Skip to content
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

Dwarf argspec is not loaded for shared libraries #685

Open
honggyukim opened this issue Feb 27, 2019 · 0 comments
Open

Dwarf argspec is not loaded for shared libraries #685

honggyukim opened this issue Feb 27, 2019 · 0 comments
Labels

Comments

@honggyukim
Copy link
Collaborator

honggyukim commented Feb 27, 2019

It seems that dwarf argspec is not loaded for shared libraries.
1. build

$ cd uftrace/tests
$ gcc -pg -g -o libabc_test_lib.so -shared -fPIC s-lib.c
$ gcc -pg -g -o t-lib.pg s-libmain.c -L. -labc_test_lib
$ gcc     -g -o t-lib    s-libmain.c -L. -labc_test_lib

2. tracing -pg compiled t-lib.pg
In this case, all the functions are normally traced with their arguments and return values.

$ LD_LIBRARY_PATH=. uftrace --no-pager -la t-lib.pg
# DURATION     TID     FUNCTION
            [145706] | main(1, 0x7ffc05116da8) {
            [145706] |   foo() {
            [145706] |     lib_a() {
            [145706] |       lib_a(4095) {
            [145706] |         lib_b(4096) {
            [145706] |           lib_c(4095) {
   1.226 us [145706] |             getpid() = 145706;
   7.047 us [145706] |           } = 2381; /* lib_c */
  11.637 us [145706] |         } = 2382; /* lib_b */
  12.667 us [145706] |       } = 2381; /* lib_a */
  14.890 us [145706] |     } /* lib_a */
  16.233 us [145706] |   } = 2381; /* foo */
  18.994 us [145706] | } = 0; /* main */

3. tracing t-lib
But t-lib is not compiled with -pg so it can only be traced with --force option. In this case, argspec in libabc_test_lib.so is not used during tracing.

$ LD_LIBRARY_PATH=. uftrace --no-pager -la --force t-lib
# DURATION     TID     FUNCTION
            [145694] | lib_a() {
            [145694] |   lib_a() {
            [145694] |     lib_b() {
            [145694] |       lib_c() {
   0.985 us [145694] |         getpid() = 145694;
   8.358 us [145694] |       } /* lib_c */
   9.001 us [145694] |     } /* lib_b */
   9.481 us [145694] |   } /* lib_a */
  11.503 us [145694] | } /* lib_a */

I'm just wondering if this is expected result or not.

@honggyukim honggyukim added the args label May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant