Created attachment 13083 [details] the binary Consider the following program: --- $ cat small.c int x = 6; int main () { // L4 #pragma omp atomic x = x * 7 + 6; // L6 #pragma omp atomic x = x - 8 + 6; // L8 #pragma omp atomic x = x * 7 ^ 6; // L10 return 0; // L11 } --- If compiled with optimization enabled(-O1, -O2, -O3 et.al), gdb behaves incorrect) $ gcc -O1 -g small.c $ gdb a.out (gdb) start Temporary breakpoint 1, main () at small.c:4 4 { // L4 (gdb) s 10 x = x * 7 ^ 6; // L10 (gdb) s 11 return 0; // L11 ############################## Line L6 and Line L8 are skipped when stepping. However, LLDB behaves like my expectation: LLDB will stop at L6 and L8. $ gdb -v GNU gdb (GDB) 11.0.50.20201224-git $ gcc -v gcc version 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04)
OK, let's start with the line number program (using readline -wL): ... CU: small.c: Line number Starting address View Stmt 4 0x400496 x 6 0x400496 1 x 8 0x400496 2 x 10 0x400496 3 x 6 0x400496 4 8 0x4004a5 10 0x4004a8 10 0x4004b1 11 0x4004bc x 12 0x4004bc 1 - 0x4004c2 ... When read in by gdb, it looks like pretty much the same (using "maint info line-table"): ... INDEX LINE ADDRESS IS-STMT 0 4 0x0000000000400496 Y 1 6 0x0000000000400496 Y 2 8 0x0000000000400496 Y 3 10 0x0000000000400496 Y 4 6 0x0000000000400496 5 8 0x00000000004004a5 6 10 0x00000000004004a8 7 10 0x00000000004004b1 8 11 0x00000000004004bc Y 9 12 0x00000000004004bc 10 END 0x00000000004004c2 Y ... Now, when not instruction stepping, gdb ignores entries with IS-STMT is N. Doing that, we have left: ... 0 4 0x0000000000400496 Y 1 6 0x0000000000400496 Y 2 8 0x0000000000400496 Y 3 10 0x0000000000400496 Y 8 11 0x00000000004004bc Y 10 END 0x00000000004004c2 Y ... Then also, gdb doesn't support locations views yet, so after collapsing entries with the same address, we have left: ... 3 10 0x0000000000400496 Y 8 11 0x00000000004004bc Y 10 END 0x00000000004004c2 Y ... And, that's the behaviour you see. This is all known behaviour. I'm marking this a duplicate of PR25507 - "Add support for location views". *** This bug has been marked as a duplicate of bug 25507 ***
(In reply to Tom de Vries from comment #1) > And, that's the behaviour you see. > > This is all known behaviour. > > I'm marking this a duplicate of PR25507 - "Add support for location views". > > *** This bug has been marked as a duplicate of bug 25507 *** Thank you very much for such a detailed explanation.
Changing back to correct resolution. *** This bug has been marked as a duplicate of bug 25507 ***