How can I skip a line in the GDB debugger?
Asked
Active
Viewed 1.1k times
4
-
2What do you mean? **Step** to the next line, once you've hit a breakpoint? Cause the line to never be executed? – Cascabel Jan 18 '11 at 05:38
-
1https://stackoverflow.com/questions/4037308/can-i-use-gdb-to-skip-a-line-without-having-to-type-line-numbers – Ciro Santilli OurBigBook.com Aug 02 '17 at 13:54
3 Answers
15
You may find these links interesting :
In short, you can use :
next
to execute the current line and directly go to the next one (if the line is a function call, it doesn't step into the function),step
to execute the current line (if it's a function call, it enters the function and stops at its first statement),until X
to execute the code and stop on line Xb X
and thenrun
orcontinue
, to set a breakpoint on line X and execute the code until line X is reached.
If you really want to skip a line, thus stepping to the next one but NOT executing it, you can use jump X
(X being a line number). Be careful and use breakpoints, because using jump
will make the debugger resume code execution from line X.

fulguroblastor
- 606
- 5
- 11
4
several ways
next
to step a line
until 1234
to continue until the line 1234.

hhafez
- 38,949
- 39
- 113
- 143
0
If you want to skip execution of some lines, you can manually alter program counter and continue execution

Neera
- 1,577
- 8
- 10