gdb: breakpoint: Command Lists: execute commands

5.1.7 Breakpoint Command Lists
can execute a series of commands when any breakpoint (or watchpoint or catchpoint) takes effect. For example: Maybe you want to print the value of a specific variable at a certain point, or open another breakpoint.
commands [range…]
… command-list …
end
The end keyword represents the end of the command set. If you want to delete the command associated with the breakpoint: type commands and follow it immediately with end.
If there is no parameter after commands, it defaults to the last breakpoint, watchpoint or catchpoint ((not to the breakpoint most recently encountered). If the most recent breakpoints were set with a single command, then the commands will apply to all the breakpoints set by that command. This applies to breakpoints set by rbreak, and also applies when a single break command creates multiple breakpoints (see Section 10.2 [Ambiguous Expressions], page 110).

example

(gdb) break main
Breakpoint 

Guess you like

Origin blog.csdn.net/qq_36428903/article/details/131298616