Using and extending the existing uftrace_msg format looks good. I'm ok with having a new enum for agent options. I also thought about the short options but I think it'd be better to split since we don't support all options for agent and the value might be changed later.
Note that functions implemented in C don't have srcline info.
Please send a new PR.
@ggstone0523 thanks a lot for the detailed analysis!
Do you mean disasm_check_insns()
?
@ParkHanbum are you talking about #1643? I'm not sure but I don't think it would help avoiding any existing bugs. Doing the work at runtime would make thing more complicated rather than making life easier. :)
The original concern of the full dynamic tracing is the coverage of instructions that it can patch (or modify). So it might miss some functions in the outpu that failed to patch. With compiler support like -pg
or -fpatchable-function-entry
we don't worry about the loss.
So I think we have options on AArch64 like below:
-pg
: no missing functions, incorrect arg1-finstrument-functions
: no missing functions, cannot record any args,return values-fpatchable-function-entry=2
: no missing functions, no problems with arg1-P .
: can miss some functions, no problems with arg1@honggyukim maybe we can close this for now if you don't work on it anymore.
aarch64/runtest.py: Fix tests where gcc/clang emits memcpy()
On aarch64 (depending on a number of factors including size and optimisation level) gcc and clang use memcpy() to pass and return big structs to and from function calls.
For large 4k returns, gcc may emit memcpy() for all optimization levels. For smaller structs, gcc and clang may emit memcpy() only for lower optimisation levels. In additon, it may change from one compiler version to the next.
It affects all tests tracing s-arg.c:pass() / return.c:return_large()
Two test cases did already filter memcpy(), but about a dozen other test failures were caused by unexpected memcpy() in the output.
Because emitting memcpy varies by different factors and can change from compiler to compiler, pass -N memcpy to exclude it from all traces.
memcpy() is not not expected in any test output yet, so the change to suppress memcpy is limited to tests/runtest.py.
This fixes about a dozen test case failures using the s-arg.c and s-return.c files on aarch64:
On aarch64 (depending on a number of factors including size and optimisation level) gcc and clang use memcpy()
to pass and return
big structs
to and from function calls.
For large 4k returns, gcc
may emit memcpy()
for all optimization level, while for other smaller structs, gcc and clang may emit memcpy() this only for lower optimisation levels.
For smaller structs, gcc and clang may emit memcpy() only for lower optimisation levels.
In additon, it may change from one compiler version to the next.
It affects all tests tracing s-arg.c:pass() / return.c:return_large()
Two test cases did already filter memcpy(), but about a dozen other test failures were caused by unexpected memcpy() in the output.
Because emitting memcpy varies by different factors and can change from compiler to compiler, pass -N memcpy to exclude it from all traces.
memcpy() is not not expected in any test output yet, so the change to suppress memcpy is limited to tests/runtest.py.
README.md: Add links to command-specific documentation
A simple way to to make the command-specific markdown files easily accessible is to link them from README.md
misc: Add more prototypes enums for socket
The following socket() shows some incorrect enum values for now.
int socket(int domain, int type, int protocol);
The incorrect output looks like this.
socket(AF_NETLINK, SOCK_PACKET|SOCK_DCCP|SOCK_SEQPACKET|SOCK_RDM|SOCK_RAW|SOCK_DGRAM|SOCK_STREAM+0x807e4, 15) = 7;
It's because the 'type' field can accept SOCK_CLOEXEC and SOCK_NONBLOCK, but current prototypes.h doesn't have them.
So this patch adds them then the output looks correct as follows.
socket(AF_NETLINK, SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_RAW, 15) = 7;
This can be seen as follows.
$ uftrace -la -C socket lsusb ...
[ 18635] | libusb_init() {
[ 18635] | udev_monitor_new_from_netlink() {
5.682 us [ 18635] | socket(AF_NETLINK, SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_RAW, 15) = 7;
13.064 us [ 18635] | } /* udev_monitor_new_from_netlink */
6.142 ms [ 18635] | } /* libusb_init */
Signed-off-by: Honggyu Kim honggyu.kp@gmail.com
The following socket() shows some incorrect enum values for now.
int socket(int domain, int type, int protocol);
The incorrect output looks like this.
socket(AF_NETLINK, SOCK_PACKET|SOCK_DCCP|SOCK_SEQPACKET|SOCK_RDM|SOCK_RAW|SOCK_DGRAM|SOCK_STREAM+0x807e4, 15) = 7;
It's because the 'type' field can accept SOCK_CLOEXEC and SOCK_NONBLOCK, but current prototypes.h doesn't have them.
So this patch adds them then the output looks correct as follows.
socket(AF_NETLINK, SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_RAW, 15) = 7;
This can be seen as follows.
$ uftrace -la -C socket lsusb
...
# DURATION TID FUNCTION
[ 18635] | libusb_init() {
[ 18635] | udev_monitor_new_from_netlink() {
5.682 us [ 18635] | socket(AF_NETLINK, SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_RAW, 15) = 7;
13.064 us [ 18635] | } /* udev_monitor_new_from_netlink */
6.142 ms [ 18635] | } /* libusb_init */