0

Is it possible to print a list of all functions used during a program run? The program and the library used by the program is compiled with GCC without optimization.

The reason for this list is that I'd like to optimize a library which has a lot of unused functions (the library is really huge and I need only a few functions).

0

3 Answers 3

3

If you can compile them again you could use a profiler such as gprof or valgrind (with its callgrind tool). I think you wouldn't need a new compiling if you use valgrind.

Sign up to request clarification or add additional context in comments.

Comments

1

If its dynamic library (*.so) try ltrace. For example to see how ls uses libc:

ltrace --library /lib64/libc.so.6 ls

gprof can be an option too.

Comments

0

gcov (compile with gcc -ftest-coverage -fprofile-arcs) will say this too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.