Gdb step of debugging C program

Consider the case where a function has 10 lines of code and you are debugging a step through GDB and you are on line 6. You realize that the function call on line 4 made a few glitches that got you on line 5.

Assuming the function call on line 4 does nothing radical (mem free, etc.), you want to make your point SP @ line 4 and jump to that function without re-running this test case.

I was able to do this by doing a registry modification.

What I wanted to know is if there are some gdb commands that can help me achieve the above without manual registration mode.

Thank,

+3


source to share


3 answers


Use the command jump

as described here .



+3


source


Just set a breakpoint on the line you want (using the break command) and jump to it (using the branch command).



0


source


If I understand correctly, you want to "back off". This is supported by GDB since version 7. See manual , tutorial or related question.

0


source







All Articles