How can we list all the functions being calledinchAn application
For any realistically sized application, ThisList would has thousands of entries, which'll probably make it useless. You can find outAll functions defined (and not necessarily called)inchAn application with the NM command, e.g.nm/path/to/a. out| Egrep'[TW]‘
EG:
[Email protected] ~]# nm./test | Egrep ' [TW] '
00000000004005f0 T __libc_csu_fini
0000000000400600 T __libc_csu_init
00000000004006c8 T _fini
00000000004003c8 T _init
0000000000400420 T _start
0000000000600990 W Data_start
0000000000400504 T Main
You can also with GDB toSeta breakpoint on each function: (GDB)SetLogging on # Collect traceinchgdb.txt (GDB)SetConfirm Off # you wouldn't want to confirm every one of them(GDB) Rbreak. #Seta breakpoint on each function OnceContinue, you'll hit a breakpoint for each function called.
Use the Disable and continue commands to move forward. I Don'T believe there isAn easy- to-automate, unless you want-to-use Python scripting. Already mentioned Gprof isAnother good option.
Record function-call-history should be a great hardware accelerated possibility
ifYou are one of the few people ( -) with a CPU that supports Intel Processor tracing (Intel PT, intel_ptinch/proc/cpuinfo). GDB docs claim that it can produce output like: (GDB) List1,Ten1 voidFoo (void)2 {3 }45 voidBar (void)6 {7 ...8foo ();9 ...Ten} (GDB) record function-call-history/ILC1Bar Inst1,4At FOO.C:6,82Foo Inst5,TenAt FOO.C:2,33Bar Inst One, -At FOO.C:9,Tenbeforeusingit need to Run:startrecord Btracewhich is wherea non capable CPU fails with:target does not support branch tracing. CPU Support isFurther discussed at:how to run record instruction-history and function-call-historyinchGdb?
GDB-Lists all function calls