public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
@ 2022-05-28  7:55 vries at gcc dot gnu.org
  2022-05-28  8:04 ` [Bug gdb/29196] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-05-28  7:55 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29196
           Summary: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp:
                    watchpoint variable triggers at next
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On openSUSE Tumbleweed with gcc-12, and with test-case gdb.base/gdb11531.exp
and target board unix/-m32/-fPIE/-pie I run into:
...
(gdb) PASS: gdb.base/gdb11531.exp: set watchpoint
next^M
34        myrec.x = 5;^M
(gdb) FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
...

The problem is that normally runto main lands us at:
...
Breakpoint 1, main () at
/data/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/gdb11531.c:34^M
34        myrec.x = 5;^M
(gdb) 
...
after which the next executes line 34.

In this case however, runto main lands us at:
...
Breakpoint 1, main () at
/data/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/gdb11531.c:33^M
33      {^M
(gdb) 
...
so the next executes line 33, and the watchpoint won't trigger.

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

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

* [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
  2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
@ 2022-05-28  8:04 ` vries at gcc dot gnu.org
  2022-05-28  8:08 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-05-28  8:04 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I guess this is due to this difference.

With -m32, the entry at line 34 has the view bit set:
...
gdb11531.c:
File name                            Line number    Starting address    View   
Stmt
gdb11531.c                                    33           0x804915d           
   x
gdb11531.c                                    34           0x804915d       1   
   x
gdb11531.c                                    35           0x8049167           
   x
...
and with -m32 -pie, we have instead:
...
gdb11531.c:
File name                            Line number    Starting address    View   
Stmt
gdb11531.c                                    33              0x117d           
   x
gdb11531.c                                    34              0x1187           
   x
gdb11531.c                                    35              0x1191           
   x
gdb11531.c                                    36              0x119d           
   x
...

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

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

* [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
  2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
  2022-05-28  8:04 ` [Bug gdb/29196] " vries at gcc dot gnu.org
@ 2022-05-28  8:08 ` vries at gcc dot gnu.org
  2022-05-28  8:26 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-05-28  8:08 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Using:
...
$ gdb -q -batch outputs/gdb.base/gdb11531/gdb11531 -ex start -ex "maint info
line-tab"
...
we get the info how gdb parses the line tab.

And for -m32 we have:
...
INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END 
0      33     0x0804915d         Y                    
1      34     0x0804915d         Y                    
2      35     0x08049167         Y                    
3      36     0x08049173         Y                    
4      37     0x0804917d         Y                    
5      38     0x08049187         Y                    
6      39     0x0804918c         Y                    
7      END    0x0804918d         Y                    
...
and for -m32 -pie:
...
INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END 
0      33     0x5655617d         Y                    
1      34     0x56556187         Y                    
2      35     0x56556191         Y                    
3      36     0x5655619d         Y                    
4      37     0x565561a7         Y                    
5      38     0x565561b1         Y                    
6      39     0x565561b7         Y                    
7      END    0x565561b8         Y                    
...

So I guess from gdb point of view the difference is that for -m32, line 33 and
34 fall at the same insn, and for -m32 -pie not.

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

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

* [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
  2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
  2022-05-28  8:04 ` [Bug gdb/29196] " vries at gcc dot gnu.org
  2022-05-28  8:08 ` vries at gcc dot gnu.org
@ 2022-05-28  8:26 ` vries at gcc dot gnu.org
  2022-06-04 11:59 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-05-28  8:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, but with -m64, both with and without -pie, we also have different
addresses for lines 33 and 34:
...
INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END 
0      33     0x0000000000401116 Y                    
1      34     0x000000000040111a Y                    
2      35     0x0000000000401124 Y                    
3      36     0x0000000000401134 Y                    
4      37     0x000000000040113e Y                    
5      38     0x0000000000401148 Y                    
6      39     0x000000000040114e Y                    
7      END    0x0000000000401150 Y                    
...
and we don't see the fail here, so maybe we can learn something from comparing
against this scenario as well.

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

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

* [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
  2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-05-28  8:26 ` vries at gcc dot gnu.org
@ 2022-06-04 11:59 ` vries at gcc dot gnu.org
  2022-06-08  9:17 ` vries at gcc dot gnu.org
  2022-06-08  9:48 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-06-04 11:59 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-May/189563.html

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

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

* [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
  2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-06-04 11:59 ` vries at gcc dot gnu.org
@ 2022-06-08  9:17 ` vries at gcc dot gnu.org
  2022-06-08  9:48 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-06-08  9:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
As mentioned here (
https://sourceware.org/pipermail/gdb-patches/2022-June/189907.html ) we still
need to handle get_pc_thunk for more register, and deal with resulting
regressions.

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

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

* [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
  2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-06-08  9:17 ` vries at gcc dot gnu.org
@ 2022-06-08  9:48 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-06-08  9:48 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
I played around a bit with the test-case and created break2.c:
...
struct some_struct
{
  int a_field;
  int b_field;
  union { int z_field; };
};

struct some_struct values[50];

void marker4 (long d)
{
  int volatile i = 1;
  values[0].a_field = d;
}
...
which I compiled with gcc-12:
...
$ gcc-12 -B ./build/gcc break2.c -c -O2 -g -m32 -pie -fPIE
...
and found:
...
00000000 <marker4>:
   0:   e8 fc ff ff ff          call   1 <marker4+0x1>
   5:   05 01 00 00 00          add    $0x1,%eax
   a:   83 ec 10                sub    $0x10,%esp
   d:   8b 54 24 14             mov    0x14(%esp),%edx
  11:   c7 44 24 0c 01 00 00    movl   $0x1,0xc(%esp)
  18:   00 
  19:   89 90 00 00 00 00       mov    %edx,0x0(%eax)
  1f:   83 c4 10                add    $0x10,%esp
  22:   c3                      ret    
...

So, in this case the get_pc_thunk call ends up _before_ the usual prologue
part, which is something the current code doesn't take into account:
...
@@ -1821,7 +1934,9 @@ i386_analyze_prologue (struct gdbarch *gdbarch,
   pc = i386_skip_probe (pc);
   pc = i386_analyze_stack_align (pc, current_pc, cache);
   pc = i386_analyze_frame_setup (gdbarch, pc, current_pc, cache);
-  return i386_analyze_register_saves (pc, current_pc, cache);
+  pc = i386_analyze_register_saves (pc, current_pc, cache);
+  pc = i386_skip_call_pc_thunk (gdbarch, pc, cache);
+  return pc;
 }

 /* Return PC of first real instruction.  */
...

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

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

end of thread, other threads:[~2022-06-08  9:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28  7:55 [Bug gdb/29196] New: [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next vries at gcc dot gnu.org
2022-05-28  8:04 ` [Bug gdb/29196] " vries at gcc dot gnu.org
2022-05-28  8:08 ` vries at gcc dot gnu.org
2022-05-28  8:26 ` vries at gcc dot gnu.org
2022-06-04 11:59 ` vries at gcc dot gnu.org
2022-06-08  9:17 ` vries at gcc dot gnu.org
2022-06-08  9:48 ` 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).