说我在第20行,我希望程序继续并停在第40,60和80行。
是否有一些命令功能,如until 40
,until 60
和until 80
?
代码中有循环,因此n 20
不适合此处。
答案 0 :(得分:3)
除了迈克尔对断点的解释,这可能是解决问题的最佳方法,实际上还有“直到”和“前进”命令,这些命令就是你需要/建议的。
基本上你可以做“直到60”或“直到main.c:60”或“提前60”或类似的,这取决于你是否要将临时断点限制在当前帧。
答案 1 :(得分:1)
强调我的:
gdb$ help break
Set breakpoint at specified **line** or function.
break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM] [if CONDITION]
PROBE_MODIFIER shall be present if the command is to be placed in a
probe point. Accepted values are `-probe' (for a generic, automatically
guessed probe type) or `-probe-stap' (for a SystemTap probe).
**LOCATION may be a line number, function name, or "*" and an address.**
If a line number is specified, break at start of code for that line.
If a function is specified, break at start of code for that function.
If an address is specified, break at that exact address.
With no LOCATION, uses current execution address of the selected
stack frame. This is useful for breaking on return to a stack frame.
THREADNUM is the number from "info threads".
CONDITION is a boolean expression.
Multiple breakpoints at one place are permitted, and useful if their
conditions are different.
Do "help breakpoints" for info on other commands dealing with breakpoints.
此外,还可以使用until location
,但它也会在从当前堆栈帧返回时停止程序。