Created attachment 12573 [details] a.out $ gdb --version GNU gdb (GDB) 10.0.50.20200517-git Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Consider test-case: ... $ cat small.c char *pa; void access (volatile char *ptr) { *ptr = 'x'; } int main () { char a; pa = &a; access (pa); return 0; } ... When stepping through the program by using "stepi" ... $ gcc -O1 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401106: file small.c, line 9. (gdb) r Starting program: /home/yibiao/Debugger/a.out Breakpoint 1, main () at small.c:9 9 pa = &a; (gdb) stepi 0x000000000040110b 9 pa = &a; (gdb) access (ptr=0x7fffffffdf07 "") at small.c:4 4 *ptr = 'x'; (gdb) main () at small.c:11 11 return 0; (gdb) ... /********************************************** As showed, when stepping with stepi, Line 10 is skipping over. While using step, Line 10 is hit by gdb as follow: ***********************************************/ When stepping through the program by using step: ... $ gcc -O1 -g small.c $ gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401106: file small.c, line 9. (gdb) r Starting program: /home/yibiao/Debugger/a.out Breakpoint 1, main () at small.c:9 9 pa = &a; (gdb) step 10 access (pa); (gdb) access (ptr=0x7fffffffdf07 "") at small.c:4 4 *ptr = 'x'; (gdb) main () at small.c:11 11 return 0; (gdb)
(gdb) maint info line-table objfile: /home/yibiao/DeVIL/a.out ((struct objfile *) 0x55ce857d6f60) compunit_symtab: ((struct compunit_symtab *) 0x55ce857ce7c0) symtab: /home/yibiao/DeVIL/small.c ((struct symtab *) 0x55ce857ce840) linetable: ((struct linetable *) 0x55ce85816fe0): INDEX LINE ADDRESS IS-STMT 0 3 0x0000555555555149 Y 1 3 0x0000555555555149 2 4 0x000055555555514d Y 3 4 0x000055555555514d 4 5 0x0000555555555150 5 7 0x0000555555555151 Y 6 7 0x0000555555555159 7 8 0x0000555555555169 Y 8 9 0x0000555555555169 Y 9 9 0x0000555555555169 10 10 0x0000555555555175 Y 11 3 0x0000555555555175 Y 12 4 0x0000555555555175 Y 13 4 0x0000555555555175 14 4 0x000055555555517a 15 11 0x000055555555517a Y 16 12 0x000055555555517a 17 END 0x0000555555555199 Y 0x0000555555555175 mapping to Line 10 and Line 3 and 4. gdb doesn't support locations views yet, so after collapsing entries with the same address, we left: INDEX LINE ADDRESS IS-STMT 0 3 0x0000555555555149 Y 2 4 0x000055555555514d Y 5 7 0x0000555555555151 Y 8 9 0x0000555555555169 Y 12 4 0x0000555555555175 Y 15 11 0x000055555555517a Y 17 END 0x0000555555555199 Y Thus, it is all known behaviour. *** This bug has been marked as a duplicate of bug 25507 ***