public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
@ 2023-06-18  9:38 vries at gcc dot gnu.org
  2023-06-21  7:00 ` [Bug gdb/30562] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-06-18  9:38 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30562
           Summary: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On a pinebook (debian 9, arm 64-bit kernel, arm 32-bit userland), I ran into:
...
FAIL: gdb.threads/watchthreads2.exp: watch x
FAIL: gdb.threads/watchthreads2.exp: x watch loop
...

First in more detail:
...
(gdb) watch x^M
Watchpoint 3: x^M
(gdb) FAIL: gdb.threads/watchthreads2.exp: watch x
...

Basically, the problem is that we get a software rather than hardware
watchpoint.

We can "fix" this by setting the watchpoint earlier, at the main breakpoint.

Alternatively, we can "fix" this in the test-case by allowing the watchpoint to
be a software watchpoint.  This makes the test-case rather slow (30 sec), but
OTOH after commenting out the printf it speeds up significantly (5 sec).

I looked into what the different is between setting the watchpoint earlier and
later, and the difference is in arm_linux_get_hwbp_cap, where we do:
...
      if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0)
        available = 0;
...
and this call returns something < 0 in the case where we set a hw breakpoint.

I'd like to investigate this further using ptrace, but I'm not able to install
packages.  My plan is to install a new OS on the laptop, so I also may lose the
ability to reproduce this.

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

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

* [Bug gdb/30562] [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
  2023-06-18  9:38 [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x vries at gcc dot gnu.org
@ 2023-06-21  7:00 ` vries at gcc dot gnu.org
  2023-06-21  7:00 ` [Bug tdep/30562] " vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-06-21  7:00 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by:
...
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index ef3fa008adf..5f0cafdae50 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -608,6 +608,8 @@ arm_linux_get_hwbp_cap (void)
       int tid;
       unsigned int val;

+      if (inferior_ptid == null_ptid)
+       return nullptr;
       tid = inferior_ptid.lwp ();
       if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0)
        available = 0;
...

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

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

* [Bug tdep/30562] [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
  2023-06-18  9:38 [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x vries at gcc dot gnu.org
  2023-06-21  7:00 ` [Bug gdb/30562] " vries at gcc dot gnu.org
@ 2023-06-21  7:00 ` vries at gcc dot gnu.org
  2023-06-23  9:46 ` luis.machado at arm dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-06-21  7:00 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luis.machado at arm dot com
          Component|gdb                         |tdep

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

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

* [Bug tdep/30562] [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
  2023-06-18  9:38 [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x vries at gcc dot gnu.org
  2023-06-21  7:00 ` [Bug gdb/30562] " vries at gcc dot gnu.org
  2023-06-21  7:00 ` [Bug tdep/30562] " vries at gcc dot gnu.org
@ 2023-06-23  9:46 ` luis.machado at arm dot com
  2023-06-23  9:47 ` luis.machado at arm dot com
  2023-06-23  9:48 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: luis.machado at arm dot com @ 2023-06-23  9:46 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Luis Machado <luis.machado at arm dot com> ---
Interesting. Has it always been possible to have inferior_ptid == null_ptid in
the native layers?

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

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

* [Bug tdep/30562] [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
  2023-06-18  9:38 [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-06-23  9:46 ` luis.machado at arm dot com
@ 2023-06-23  9:47 ` luis.machado at arm dot com
  2023-06-23  9:48 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: luis.machado at arm dot com @ 2023-06-23  9:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Luis Machado <luis.machado at arm dot com> ---
It feels like this is something that should be handled earlier in the upper
layers, as opposed to going down all the way to the native layer to invoke
ptrace.

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

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

* [Bug tdep/30562] [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x
  2023-06-18  9:38 [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-06-23  9:47 ` luis.machado at arm dot com
@ 2023-06-23  9:48 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-06-23  9:48 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Luis Machado from comment #2)
> Interesting. Has it always been possible to have inferior_ptid == null_ptid
> in the native layers?

Sorry, no idea.

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

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-18  9:38 [Bug gdb/30562] New: [gdb] FAIL: gdb.threads/watchthreads2.exp: watch x vries at gcc dot gnu.org
2023-06-21  7:00 ` [Bug gdb/30562] " vries at gcc dot gnu.org
2023-06-21  7:00 ` [Bug tdep/30562] " vries at gcc dot gnu.org
2023-06-23  9:46 ` luis.machado at arm dot com
2023-06-23  9:47 ` luis.machado at arm dot com
2023-06-23  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).