Using gdb stop the program when it is using any function from file X

前端 未结 6 1940
广开言路
广开言路 2020-12-03 04:57

and I would like to know if there is any way to stop a program when is using a function from a certain file. Ideally what I am looking for is something like:



        
6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 05:49

    rbreak regex

    Set breakpoints on all functions matching the regular expression regex. This command sets an unconditional breakpoint on all matches, printing a list of all breakpoints it set. Once these breakpoints are set, they are treated just like the breakpoints set with the break command. You can delete them, disable them, or make them conditional the same way as any other breakpoint.

    The syntax of the regular expression is the standard one used with tools like `grep'. Note that this is different from the syntax used by shells, so for instance foo* matches all functions that include an fo followed by zero or more os. There is an implicit .* leading and trailing the regular expression you supply, so to match only functions that begin with foo, use ^foo.

    When debugging C++ programs, rbreak is useful for setting breakpoints on overloaded functions that are not members of any special classes.

提交回复
热议问题