[Bug debug/95360] inconsistent behaviors at -O0

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 27 12:35:49 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95360

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Yibiao Yang from comment #0)
> Breakpoint 1, main () at small.c:5
> 5	  for (; d<1; d++)
> (gdb) stepi
> 0x0000000000401154	5	  for (; d<1; d++)
> (gdb) stepi
> 0x000000000040115a	5	  for (; d<1; d++)
> (gdb) stepi
> 0x000000000040115c	5	  for (; d<1; d++)
> (gdb) stepi
> 0x000000000040113b	6	    for (; b<1; b++)
> (gdb) stepi
> 0x0000000000401141	6	    for (; b<1; b++)
> (gdb) stepi
> 0x0000000000401143	6	    for (; b<1; b++)
> (gdb) stepi
> 7	      c[b][d+1] = 0;
> (gdb)
> 
> 
> /*****************************************************
> As showed, Line 6 is hit first and then hit Line 7 with stepi.
> However, when using step, gdb is first hit Line 7 and then hit Line 6.
> This is an inconsistent behaviors between stepi and step
> *****************************************************/

Gdb is behaving consistently in the following sense:
- when gdb is at a "recommended breakpoint location" it shows the source line
  only with line number prefix.
- otherwise, it shows the source line with both address and line number prefix.

So, what the stepi sequence shows it that the next "recommended breakpoint
location" after line 5 is line 7, which is consistent with a step from line 5
to line 7.


More information about the Gcc-bugs mailing list