How to go to the previous line in GDB?

前端 未结 9 813
北荒
北荒 2020-11-29 16:33

Is it possible in gdb to go to a line before the currently executing line. e.g:


void my_fun( somePtrType** arr,int start,int end)
{
 // arr is an array of p         


        
9条回答
  •  感情败类
    2020-11-29 17:36

    If your setup code for arr is just above "line a" (a very commonly scenario), you can do it like this:

    tbreak myfilename.c:123 (line 123 is the start of setup code for arr) then

    jump 123
    

    The "tbreak" prevents gdb from continuing (resuming) the program after the jump.

    then you can step through the setup code or just set a breakpoint at "line a" and continue

提交回复
热议问题