How can we list all the functions being called in an application
For any realistically sized application, this list will have thousands of entries, which will probably make it useless. You can find out all functions defined (but not necessarily called) in an application with the nm command, e.g. nm /path/to/a.out | egrep ' [TW] '
EG:
[root@monitor ~]# 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 use GDB to set a breakpoint on each function: (gdb) set logging on # collect trace in gdb.txt
(gdb) set confirm off # you wouldn't want to confirm every one of them
(gdb) rbreak . # set a breakpoint on each function
Once you continue, you'll hit a breakpoint for each function called.
Use the disable and continue commands to move forward. I don't believe there is an easy way to automate that, unless you want to use Python scripting. Already mentioned gprof is another good option.
record function-call-history should be a great hardware accelerated possibility 

if you are one of the few people () with a CPU that supports Intel Processor Tracing (Intel PT, intel_pt in /proc/cpuinfo).

GDB docs claim that it can produce output like:

(gdb) list ,
void foo (void)
{
} void bar (void)
{
...
foo ();
...
}
(gdb) record function-call-history /ilc
bar inst , at foo.c:,
foo inst , at foo.c:,
bar inst , at foo.c:,
Before using it you need to run: start
record btrace
which is where a non capable CPU fails with: Target does not support branch tracing.
CPU support is further discussed at: How to run record instruction-history and function-call-history in GDB?

gdb - 列出所有函数调用的更多相关文章

  1. GDB教程详解

    GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在UNIX平台下做软件,你会发现GDB这个调试工具有比VC ...

  2. GDB中文手册

    用GDB调试程序GDB概述 2使用GDB 5GDB中运行UNIX的shell程序 8在GDB中运行程序 8调试已运行的程序 两种方法: 9暂停 / 恢复程序运行 9一.设置断点(BreakPoint) ...

  3. Linux高级编程--04.GDB调试程序(设置断点)

    调试已运行的程序 在UNIX下用ps查看正在运行的程序的PID(进程ID),然后用gdb PID格式挂接正在运行的程序. 先用gdb 关联上源代码,并进行gdb,在gdb中用attach命令来挂接进程 ...

  4. linux下gcc编译多个源文件、gdb的使用方法

    一. gcc常用编译命令选项 假设源程序文件名为test.c. 1. 无选项编译链接 用法:#gcc test.c 作用:将test.c预处理.汇编.编译并链接形成可执行文件.这里未指定输出文件,默认 ...

  5. GDB 使用大法

    一.GDB 我用的是 GCC+POWERSHELL+GDB,  GDB刚刚接触也有很多要记的. 二.一个调试示例 tst.c #include <stdio.h> int func(int ...

  6. linux c/c++ GDB教程详解

    学习使用了GDB一段时间后,发现它真的好强大!好用! GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在U ...

  7. 比较全面的gdb调试命令 (转载)

    转自http://blog.csdn.net/dadalan/article/details/3758025 用GDB调试程序 GDB是一个强大的命令行调试工具.大家知道命令行的强大就是在于,其可以形 ...

  8. linux下的gdb调试工具--断点调试

    到目前为止我们的调试手段只有一种: 根据程序执行时的出错现象假设错误原因,然后在代码中适当的位置插入printf,执行程序并分析打印结果,如果结果和预期的一样,就基本上证明了自己假设的错误原因,就可以 ...

  9. GDB单步调试程序

    linux下gdb单步调试 用 GDB 调试程序 GDB 概述———— GDB 是 GNU开源组织发布的一个强大的 UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像 VC. BCB等 ...

随机推荐

  1. Cinder-2 窗口的创建过程

    通过TinderBox生成的代码很简单,整个代码如下: #include "cinder/app/AppNative.h" #include "cinder/gl/gl. ...

  2. linq 多个left join 和 sql union all -> linq union 方法

     (   from s in Base_SysMenus   join r in Base_RoleRights on s.Menu_Id equals r.Menu_Id into temp   f ...

  3. ASP.NET MVC轻教程 Step By Step 12——客户端验证

    前面两节使用的两种数据验证方法都是在服务器端进行的,也就是提交了表单,数据回传给服务器才能验证.这样会带来两个问题,一是用户体验不好,用户提交了表单之后才知道存在问题:二是会给服务器带来额外的压力.我 ...

  4. iOS:等待控件

    定义: @interface ViewController () { UIActivityIndicatorView *testActivityIndicator; } 实例化,开始旋转: -(voi ...

  5. NOR FLASH与NAND FLASH

    整理自NOR FLASH 与NAND FLASH 1:NandFlash与NorFlash典型电路图 Nor Flash接原理图 从上图可以看出,该NorFlash采用并行地址和数据总线, 其中,21 ...

  6. 严重推荐一个免费开源数据库建模工具软件 --OpenSystemArchitect 4.0

    嘿嘿,对于我这样的新手,这个工具还是很令人兴奋的. 真的是术业有专攻啊.关键还是免费开源 EXCEL,VISO,PPT,PS,CD,FREEHAND不是不可以,只是.人家还是专业点,方便点.. Ope ...

  7. xmlns:android作用以及自定义布局属性

    要定制Android layout 中的 attributes关键是要明白android中命名空间定义如: xmlns:android="http://schemas.android.com ...

  8. QML学习:Rectangle,Text,TextEdit,Flickable,Flipable元素

    QML学习:Rectangle,Text,TextEdit,Flickable,Flipable元素 本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明. 参 ...

  9. mysql排序,可以对统计的数据进行排序

    sql SELECT a.*,b.name as address_name,b.tel as address_tel,b.province as address_province,b.city as ...

  10. poj3294

    首先后缀数组预处理然后二分答案len很显然,然后考虑怎么判定我们用左右指针顺着名次扫描一下,初始左右指针为1根据LCP(i,j)=min(height[rank[i]+1]~height[rank[j ...