public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?)
@ 2020-12-29  1:46 yangyibiao at outlook dot com
  2020-12-29  2:12 ` [Bug breakpoints/27126] " yangyibiao at outlook dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: yangyibiao at outlook dot com @ 2020-12-29  1:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27126

            Bug ID: 27126
           Summary: Step will skip prior statements for statements with
                    omp atomic directive at -O1 (bug or feature?)
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: yangyibiao at outlook dot com
                CC: vries at gcc dot gnu.org
  Target Milestone: ---

Created attachment 13083
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13083&action=edit
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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/27126] Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?)
  2020-12-29  1:46 [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) yangyibiao at outlook dot com
@ 2020-12-29  2:12 ` yangyibiao at outlook dot com
  2021-01-04  8:25 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at outlook dot com @ 2020-12-29  2:12 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27126

Yibiao Yang <yangyibiao at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yangyibiao at outlook dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/27126] Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?)
  2020-12-29  1:46 [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) yangyibiao at outlook dot com
  2020-12-29  2:12 ` [Bug breakpoints/27126] " yangyibiao at outlook dot com
@ 2021-01-04  8:25 ` vries at gcc dot gnu.org
  2021-01-05  1:49 ` yangyibiao at outlook dot com
  2021-01-05  8:00 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-04  8:25 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27126

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
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 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/27126] Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?)
  2020-12-29  1:46 [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) yangyibiao at outlook dot com
  2020-12-29  2:12 ` [Bug breakpoints/27126] " yangyibiao at outlook dot com
  2021-01-04  8:25 ` vries at gcc dot gnu.org
@ 2021-01-05  1:49 ` yangyibiao at outlook dot com
  2021-01-05  8:00 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at outlook dot com @ 2021-01-05  1:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27126

Yibiao Yang <yangyibiao at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |NOTABUG

--- Comment #2 from Yibiao Yang <yangyibiao at outlook dot com> ---
(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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug breakpoints/27126] Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?)
  2020-12-29  1:46 [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) yangyibiao at outlook dot com
                   ` (2 preceding siblings ...)
  2021-01-05  1:49 ` yangyibiao at outlook dot com
@ 2021-01-05  8:00 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-05  8:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27126

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|NOTABUG                     |DUPLICATE

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Changing back to correct resolution.

*** This bug has been marked as a duplicate of bug 25507 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-05  8:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29  1:46 [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) yangyibiao at outlook dot com
2020-12-29  2:12 ` [Bug breakpoints/27126] " yangyibiao at outlook dot com
2021-01-04  8:25 ` vries at gcc dot gnu.org
2021-01-05  1:49 ` yangyibiao at outlook dot com
2021-01-05  8:00 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).