http://sourceware.org/gdb/current/onlinedocs/gdb/
Set a breakpoint
gdb breakpoint Category:
To set a breakpoint commands Category:
breakpoint
Breakpoints may be generated in accordance with the line number, function, conditions.
watchpoint
Generating a breakpoint value monitored variables or expression changes.
catchpoint
Generating a signal monitoring. For example c ++'s throw, or when loading libraries.
gdb variables numerals starting from 1, different breakpoints using the same reference variables management, can enable, disable and other management commands, the breakpoint range while supporting the operation, for example, some breakpoint command accepts as a parameter range.
For example: disable 5-8
1, break and break variants explain:
Related commands have break, tbreak, rbreak, hbreak, thbreak, the latter two are hardware-based, not first introduced.
>>break 与 tbeak
break, tbreak breakpoint may be generated in accordance with the line number, function, conditions. tbreak setting method and break the same, but tbreak stopped only once breakpoint after breakpoint is automatically deleted, break need to manually delete breakpoints and control enabled.
may break with the following parameters:
linenum local line number, that list of command line numbers visible
filename: linenum develop a file line number
function function, the function can also be custom library functions, such as open
filename: function developed function file
condtion conditions
* Address address, but the address of the function, variable, this address can be obtained by info add command.
E.g:
break 10
break test.c:10
break main
break test.c:main
break system
break open
If you want to set a breakpoint at the specified address, the main function of such an address breakpoint.
Available main address info add main obtained as 0x80484624, and then break * 0x80484624.
Conditional breakpoint is specified condition while entering the breakpoint breakpoint as specified above.
For example, if there :( variable of type int index)
break 10 if index == 3
tbreak 12 if index == 5
>>rbreak
rbreak can with a regular expression. rbreak + usage of the expression and grep + similar expressions. I.e., all are provided with a breakpoint in a function expression matching entry.
rbreak list_ * That all functions are set breakpoints in place to list_ as the first character.
rbreak ^ list_ function and the same.
>> See breakpoint information
info break [break num ]
info break lists all breakpoints information, info break after break can also be set to be viewed as num:
info break 1 lists the breakpoint breakpoint information number is 1
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
stop only if i==1
breakpoint already hit 1 time
1.1 y 0x080486a2 in void foo<int>() at t.cc:8
1.2 y 0x080486ca in void foo<double>() at t.cc:8