Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break on every method of a class in GDB?

Tags:

I have a class with a regrettable number of methods. I would like gdb to break whenever I enter the class, so through any of the methods. Is there a way to do this without setting break points individually for each method?

like image 956
pythonic metaphor Avatar asked Nov 08 '10 15:11

pythonic metaphor


People also ask

How do I break in gdb?

To do this, just type "break [functionname]". gdb will stop your program just before that function is called. Breakpoints stay set when your program ends, so you do not have to reset them unless you quit gdb and restart it.

Does gdb use hardware breakpoints?

This applies to breakpoints set with the break command as well as to internal breakpoints set by commands like next and finish . For breakpoints set with hbreak , GDB will always use hardware breakpoints. You can control this automatic behaviour with the following commands: set breakpoint auto-hw on.

What is a break point in gdb?

A breakpoint makes your program stop whenever a certain point in the program is reached. For each breakpoint, you can add conditions to control in finer detail whether your program stops.

How do I skip a breakpoint in gdb?

To skip a breakpoint a certain number of times, we use the ignore command. The ignore command takes two arguments: the breakpoint number to skip, and the number of times to skip it. (gdb) ignore 2 5 Will ignore next 5 crossings of breakpoint 2.


1 Answers

I never tried it myself, but it seems you can try the rbreak command :

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.

like image 112
icecrime Avatar answered Oct 14 '22 13:10

icecrime