Gdb: apply "next" to the selected frame instead of the innermost frame

In gdb , when you run the next command. It applies to the innermost frame, not the selected frame. How to ask gdb to break the next line of the selected frame?

For instance:

Set a breakpoint in a subfunction:

 (gdb) b subfunc Breakpoint 1 at 0x400f09: file prog.c, line 94. (gdb) c Continuing. Breakpoint 1 at 0x400f09: file prog.c, line 94. 94 void subfunc() { 

Change the selected frame:

 (gdb) up #1 0x0000000000400f7e in main (argc=1, argv=0x7fffffffe468) at prog.c:70 70 subfunc(); 

I want to stop at line 71 prog.c :

 (gdb) n 95 i = 0; 

... but he stops the line 95 prog.c

+8
source share
3 answers

I finally found what I want. advance allow you to continue to a specific line. Thus, advance +1 does the job. It can be abbreviated adv +1 .

+7
source

You can do this with a temporary breakpoint offset from the current line in the selected frame :

 tbreak +1 continue 

Abbreviated:

 tb +1 c 
+1
source

I think down , then finish will work.

0
source

Source: https://habr.com/ru/post/1238522/


All Articles