public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29196] [gdb, gcc-12/m32/pie] FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
Date: Wed, 08 Jun 2022 09:48:45 +0000	[thread overview]
Message-ID: <bug-29196-4717-4XQ72VenXX@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29196-4717@http.sourceware.org/bugzilla/>

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.

      parent reply	other threads:[~2022-06-08  9:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28  7:55 [Bug gdb/29196] New: " 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29196-4717-4XQ72VenXX@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).