GDB-Lists all function calls

Source: Internet
Author: User
Tags egrep

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.