-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/syscall_shim: Extend prsyscall (print structs, ...) #836
lib/syscall_shim: Extend prsyscall (print structs, ...) #836
Conversation
Previously, we are printing buffers and output strings also when the call fails. However, in that case it will usually contain no meaningful value so we reduce trace output by just printing the buffer's target address. Checkpatch-Ignore: COMPLEX_MACRO Checkpatch-Ignore: TRAILING_SEMICOLON Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Checkpatch-Ignore: MULTISTATEMENT_MACRO_USE_DO_WHILE Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
There are already types for decimal and hexadecimal printing. This commit adds a type for octals. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Currently, it is hard to know if a value is a hexadecimal or decimal number if there are no letters in the output. This commit adds the hex prefix 0x to avoid the confusion. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
This commit adds macros for printing selected members of struct types in the prsyscall output just like strace. The PT_STRUCT macro takes the struct's name to form a new parameter type name. The PR_STRUCT macro prints the fields specified in the var args. Nested printing of struct fields members is supported for structs pointers as well as for embedded structs. Whenever fields that are usually pointers (e.g., PT_CHARP or PT_STRUCT) are embedded, the `PT_SVAL` flag must be specified. Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
This commit adds a definition of the timespec struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @marcrittinghaus. I tested it and it works. Please use Add
instead of add
in one of the commit message you created. Then it's all go.
e4d35c4
to
579af35
Compare
thanks for pointing that out. Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @marcrittinghaus.
Reviewed-by: Razvan Deaconescu razvand@unikraft.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good here. Thanks!
Reviewed-by: Cezar Craciunoiu cezar.craciunoiu@unikraft.io
This commit adds a definition of the stat struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
579af35
to
b235c35
Compare
Thanks for mentioning the dependency on |
oh so you actually fixed it here, whoops, I thought it would be done in another PR |
Currently, it is hard to know if a value is a hexadecimal or decimal number if there are no letters in the output. This commit adds the hex prefix 0x to avoid the confusion. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
This commit adds macros for printing selected members of struct types in the prsyscall output just like strace. The PT_STRUCT macro takes the struct's name to form a new parameter type name. The PR_STRUCT macro prints the fields specified in the var args. Nested printing of struct fields members is supported for structs pointers as well as for embedded structs. Whenever fields that are usually pointers (e.g., PT_CHARP or PT_STRUCT) are embedded, the `PT_SVAL` flag must be specified. Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
This commit adds a definition of the timespec struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
This commit adds a definition of the stat struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
This commit adds a definition of the utsname struct and the uname syscall to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
This commit adds a definition of the pread64 syscall to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
This commit adds a definition of the (F|R|W|X)_OK flags and the access syscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #836
Previously, we are printing buffers and output strings also when the call fails. However, in that case it will usually contain no meaningful value so we reduce trace output by just printing the buffer's target address. Checkpatch-Ignore: COMPLEX_MACRO Checkpatch-Ignore: TRAILING_SEMICOLON Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Checkpatch-Ignore: MULTISTATEMENT_MACRO_USE_DO_WHILE Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
There are already types for decimal and hexadecimal printing. This commit adds a type for octals. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
Currently, it is hard to know if a value is a hexadecimal or decimal number if there are no letters in the output. This commit adds the hex prefix 0x to avoid the confusion. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds macros for printing selected members of struct types in the prsyscall output just like strace. The PT_STRUCT macro takes the struct's name to form a new parameter type name. The PR_STRUCT macro prints the fields specified in the var args. Nested printing of struct fields members is supported for structs pointers as well as for embedded structs. Whenever fields that are usually pointers (e.g., PT_CHARP or PT_STRUCT) are embedded, the `PT_SVAL` flag must be specified. Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the timespec struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the stat struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the utsname struct and the uname syscall to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the pread64 syscall to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the (F|R|W|X)_OK flags and the access syscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
Previously, we are printing buffers and output strings also when the call fails. However, in that case it will usually contain no meaningful value so we reduce trace output by just printing the buffer's target address. Checkpatch-Ignore: COMPLEX_MACRO Checkpatch-Ignore: TRAILING_SEMICOLON Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Checkpatch-Ignore: MULTISTATEMENT_MACRO_USE_DO_WHILE Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
There are already types for decimal and hexadecimal printing. This commit adds a type for octals. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
Currently, it is hard to know if a value is a hexadecimal or decimal number if there are no letters in the output. This commit adds the hex prefix 0x to avoid the confusion. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds macros for printing selected members of struct types in the prsyscall output just like strace. The PT_STRUCT macro takes the struct's name to form a new parameter type name. The PR_STRUCT macro prints the fields specified in the var args. Nested printing of struct fields members is supported for structs pointers as well as for embedded structs. Whenever fields that are usually pointers (e.g., PT_CHARP or PT_STRUCT) are embedded, the `PT_SVAL` flag must be specified. Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the timespec struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the stat struct to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the utsname struct and the uname syscall to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the pread64 syscall to prsyscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
This commit adds a definition of the (F|R|W|X)_OK flags and the access syscall Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#836
Prerequisite checklist
checkpatch.pl
on your commit series before opening this PR;Base target
Additional configuration
Description of changes
This PR adds a number of features to the strace-like printing in
lib/syscall_shim
(prsyscall
). New features are:Structs can also be nested. The number and selection of fields that should be printed is specified per struct definition.
PT_OUT
-values only on successEspecially, if structs are printed, it can become confusing (and also cause crashes) if a syscall fails and the uninitialized target struct is printed. The PR changes behavior so that values are only printed on success. On failure, only the type and virtual address are printed.
PT_OCTAL
0x
prefix forPT_HEX
to avoid confusion with decimal valuesHave fun!