Created attachment 12574 [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 __attribute__((noinline)) void g(int x) { asm volatile ("" : "+r" (x)); } __attribute__((noinline)) int f(int a, int b, int d) { int r = -1; b += d; if (d == a) r = b - d; g (b); return r; } int main() { int l; asm ("" : "=r" (l) : "0" (0)); f (l + 0, l + 1, l + 4); return 0; } ... When stepping through the program by using "step", line 11 is skipping over. ... $ gcc -O2 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401020: file small.c, line 18. (gdb) r Starting program: /home/yibiao/Debugger/a.out Breakpoint 1, main () at small.c:18 18 asm ("" : "=r" (l) : "0" (0)); (gdb) step 19 f (l + 0, l + 1, l + 4); (gdb) step f (a=a@entry=0, b=b@entry=1, d=d@entry=4) at small.c:9 9 b += d; (gdb) step 10 if (d == a) (gdb) step 12 g (b); (gdb) ... When stepping through the program by using "stepi", line 11 is hit by gdb after line 9. ... $ gcc -O2 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401020: file small.c, line 18. (gdb) r Starting program: /home/yibiao/Debugger/a.out Breakpoint 1, main () at small.c:18 18 asm ("" : "=r" (l) : "0" (0)); (gdb) stepi 19 f (l + 0, l + 1, l + 4); (gdb) stepi 0x0000000000401025 19 f (l + 0, l + 1, l + 4); (gdb) stepi 0x0000000000401028 19 f (l + 0, l + 1, l + 4); (gdb) stepi f (a=a@entry=0, b=b@entry=1, d=d@entry=4) at small.c:9 9 b += d; (gdb) stepi 0x0000000000401133 11 r = b - d; (gdb)
Gdb does not support location views. This is all known behaviour. *** This bug has been marked as a duplicate of bug 25507 ***