Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip some lines in the GDB debugger?

Tags:

c

How can I skip a line in the GDB debugger?

like image 888
user556761 Avatar asked Oct 28 '25 05:10

user556761


2 Answers

You may find these links interesting :

GDB Tutorial - Main commands

Another tutorial

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 X
  • b X and then run or continue, 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.

like image 79
BlueCookie Avatar answered Oct 29 '25 21:10

BlueCookie


several ways

next

to step a line

until 1234

to continue until the line 1234.

like image 23
hhafez Avatar answered Oct 29 '25 22:10

hhafez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!