Ltrace: Could not find .dynsym or .dynstr in "library.so"

I tried using ltrace. I tried using the following command to profile the library.so file used by sampleapp , ltrace -c -T --library=library.so --output=out.txt ./SampleApp . But this shows the error above. But library.so is a debug build. So the character table should be there. I tried to check it with objdump --source library.so | grep CreateSocket() objdump --source library.so | grep CreateSocket() . It returns codes that use this CreateSocket () function. This means that it contains a character table. What causes this error?

Associated Record: Measures processor consumption per second of a dynamically linked library

+6
source share
1 answer

It depends on how the SampleApp executable was created. You will see this error if it was statically linked. ltrace only works for dynamically related applications.

You can run ldd SampleApp to display dependencies of shared objects. It is dynamically linked and has a dependency on libc, ldd output will contain the following line:

 libc.so.6 => /usr/lib/libc.so.6 (0x00007fb24ac53000) 

In this case, you can use the ltrace --library=libc.so.6 option, and it should work. However --library=libc.so will not match (you will not get an error, but the library call will not be consistent).

With a static ldd SampleApp instead display this result:

  not a dynamic executable 

My guess is that this is due to static linking, which might be wrong. It is important, however, that if ltrace shows this error, you need to run the diagnosis in the executable file (binary) and how it was created (linker options), and not in the shared library.

Question How does ltrace (library trace tool) work? has some good links to learn more about the internal elements of ltrace.

0
source

Source: https://habr.com/ru/post/977166/


All Articles