gdb, set breakpoint on all functions in a file

╄→尐↘猪︶ㄣ 提交于 2019-11-26 13:28:39

问题


Is there a single command in gdb which can set breakpoints on all the functions in a given file ? I know about rbreak regex which sets breakpoints in matching regular expression functions, but my file doesnt have fixed patterned functions.

In another way, is there a command by which I can set a breakpoint on a filename. Which will mean, whenever control gets inside this file, it should break ?

I personally think this should not be much difficult to implement in gdb, but just wondering if somebody has already done this.


回答1:


(gdb) rbreak file:.

from http://sourceware.org/gdb/download/onlinedocs/gdb/Set-Breaks.html#Set-Breaks




回答2:


(gdb) set height 0
(gdb) rbreak file.cpp:.*

worked fine for me.

In my case it was useful to shrink the result set a little bit by specifying a template argument for the functions contained in the file:

(gdb) rbreak file.cpp:.*TemplateClass.*


来源:https://stackoverflow.com/questions/1476002/gdb-set-breakpoint-on-all-functions-in-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!