-
Notifications
You must be signed in to change notification settings - Fork 479
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
auto-args with filter module #171
Closed
honggyukim
wants to merge
18
commits into
namhyung:master
from
honggyukim:review/auto-args-with-filter-module
Closed
auto-args with filter module #171
honggyukim
wants to merge
18
commits into
namhyung:master
from
honggyukim:review/auto-args-with-filter-module
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIGSEGV (and SIGABRT) will be handled by segv_handler. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
When it writes the /proc/self/maps to the map file, it also creates a sinle linked list of struct ftrace_proc_maps. But the list contains duplicated entries and it confuses symbol loading code. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
It used fixed size (64) buffer for printing a string argument. So its length is longer than that, it would have undefined behavior. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
s/ftrace/uftrace/ Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Later change would require that each session has valid maps at least for one. This patch fixes crash during unit test due to that change. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
With --nest-libcall uftrace can trace (library) functions from any modules. To make user easier to setup filters or triggers, it needs to apply them to all available modules. But it's tricky to determine which one is available. Since symbol data is not big (compared to trace data), it'd rather save all symbols unconditionally. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Change to trigger action (including filter, trigger, argument and return value) to be applied to all modules unless specified explicitly. If module name is given (e.g. -F open@myprog), it would be applied to the module only (like before). Signed-off-by: Namhyung Kim <namhyung@gmail.com>
The symbol files intended to save relative addresses so that they can be recalculated to the real address using map info in a session. But it was found that it failed to do so. The SYMTAB_FL_ADJ_OFFSET flag was to adjust current load address with ELF load address to calcuate real symbol address with the offset (especially for main executables and prelink-ed libraries). Signed-off-by: Namhyung Kim <namhyung@gmail.com>
It failed to save relative addresses for dlopen-ed libraries. So it makes the dlopen test case failed - fix it. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
It now applies argument setting to PLT functions in modules too. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
This adds *.sw[opn], *.patch and .orig rules to .gitignore. Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
This is a preparation for adding a new option --auto-args, which displays arguments / return values for known library functions such as libc functions. Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
Since some of strings are too long to store inside buffer, it sometimes exceeds ARGBUF_SIZE and fails. This patch limits the maximum string size is to 48 with NULL to prevent such problems. Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
This adds a list prototypes of well-known library functions in "prototypes.h" and its parser that generates uftrace format argspec. The usage is as follows: $ ./misc/gen-autoargs.py -i ./misc/prototypes.h Then it generates "autoargs.h" that can be directly included by uftrace for --auto-args option support. In the below example, "simple_prototypes.h" has only 5 functions. It can be passed to "gen-autoargs.py" and the output is as follows: $ cat simple_prototypes.h void *malloc(size_t size); void free(void* ptr); const char* strcpy(char* dest, const char* src); int open(const char* pathname, int flags); int pthread_mutex_lock(pthread_mutex_t *mutex); $ ./gen-autoargs.py simple_prototypes.h GEN autoargs.h $ cat autoargs.h ... static char *auto_args_list = "malloc@arg1/u;" "free@arg1/x;" "strcpy@arg1/s,arg2/s;" "open@arg1/s,arg2;" "pthread_mutex_lock@arg1/x;" ; static char *auto_retvals_list = "malloc@retval/x;" "strcpy@retval/s;" "open@retval;" "pthread_mutex_lock@retval;" ; Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
Since gen-autoargs.py generates a very long list of args/retval list, uftrace fails to store the entire list into the current buffer. It needs a huge buffer to store the list to properly support --auto-args option. This patch expands the size 8 times bigger. Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
"utils/prototypes.h" contains the prototypes of well-known library functions, especially libc functions. uftrace understandable argspec format is generated by "gen-autoargs.py" based on "utils/prototypes.h" file. Then the generated "autoargs.h" file is directly included by uftrace for --auto-args support. This patch adds automatic args/retval rules directly to uftrace when --auto-args is enabled. It allows uftrace to display args/retval even for distributed binaries without -pg or -finstrument-functions build. Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
$ uftrace --auto-args tests/t-autoargs hello hello # DURATION TID FUNCTION [11503] | main() { 2.044 us [11503] | strlen("autoargs test") = 13; 1.583 us [11503] | calloc(1, 14) = 0x1b28a80; 1.193 us [11503] | free(0x1b28a80); 1.344 us [11503] | strcmp("hello", "hello") = 0; 4.056 us [11503] | puts("hello") = 6; 18.513 us [11503] | } /* main */ Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
gen-autoargs.py generates autoargs.h for --auto-args option support. So this patch adds a build rule to generate it. Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
I just found that filter-module branch and check/auto-args branch have conflicts so I resolved and created another PR. And I also removed the library name add logic in |
This is not necessary any more so close it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes review/filter-module branch of namhyung then modified check/auto-args based on it.