Wednesday, June 16, 2010

gdb: skip instructions or lines while stepping the program

Supposed you are at line 50 and you want to skip the following several lines of your source code and continue from line 60, you can input command

   jump 60

However, the command will continue your program till it meets next break point or the end of the program. So before you run the "jump" command, you should set a break point first.

   break 60
   jump 60

You can issue the command in its short form.

   b 60
   j 60

Alternatively, if the line you want to skip is a function call, you can step into it first, and return right after.


You would need to mind the return value if the function returns something.

No comments:

Get This <