Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: K via Gdb <gdb@sourceware.org>
To: gdb <gdb@sourceware.org>
Subject: Re: gdb behaviour change under software watchpoints?
Date: Fri, 25 Apr 2025 18:04:26 +0200	[thread overview]
Message-ID: <CACTzTFD_VqGNHPiZwBg--E75g9qE3MUYEoOWdM6U+XHn=+U4fg@mail.gmail.com> (raw)
In-Reply-To: <8b81ad7c-0866-40c9-a81a-db9a51326fef@arm.com>

trying to set a hw watchpoint I get this:
```
(gdb) watch *0x550195e010
Hardware watchpoint 1: *0x550195e010
(gdb) c
Continuing.
Warning:
Could not insert hardware watchpoint 1.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Command aborted.
```

so I switched to s/w watchpoint:  set can-use-hw-watchpoints 0

here's the output when I don't use an expression to look for a specific
value (which didn't show up)
but self examine the value at an address and just continue on until the
abort():
```
gdb-multiarch -q -x gdbinit  ../_build/cross/bin/ocamljitlinker
Reading symbols from ../_build/cross/bin/ocamljitlinker...
The target architecture is set to "aarch64".
warning: remote target does not support file transfer, attempting to access
files from local filesystem.
0x0000005504303300 in ?? () from
/usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1
Watchpoint 1: *0x550195e010
c

Watchpoint 1: *0x550195e010

Old value = <unreadable>
New value = 0x0
0x0000005504519a40 in brk () from /usr/aarch64-linux-gnu/lib/libc.so.6
(gdb) Continuing.

Watchpoint 1: *0x550195e010

Old value = 0x0
New value = 0x4a20001
caml_page_table_modify (page=page@entry=0x5504a20000,
toclear=toclear@entry=0x0,
toset=toset@entry=0x1) at memory.c:176
176      caml_page_table.occupancy++;
(gdb) c
Continuing.

Watchpoint 1: *0x550195e010

Old value = 0x4a20001
New value = 0x9100a021
0x00000055044d91c4 in ?? () from /usr/aarch64-linux-gnu/lib/libc.so.6
(gdb) c
Continuing.
[Inferior 1 (process 1) exited with code 02]
```

what I see at this point without any watchpoint:
```
Program received signal SIGABRT, Aborted.
0x00000055044bf5e8 in ?? () from /usr/aarch64-linux-gnu/lib/libc.so.6
```


On Fri, 25 Apr 2025 at 15:09, Luis Machado <luis.machado@arm.com> wrote:

> On 4/24/25 17:54, K via Gdb wrote:
> > A bug in my software is revealed by a debug build which eventually calls
> > abort(). gdb sees and reports this and I can do a backtrace and find a
> > memory location I need to investigate.
> > then I make a run with a watchpoint on said memory location which has to
> be
> > software since it's a non-host binary running under qemu.
> > not only does the watchpoint not get triggered despite ensuring binary is
> > being loaded to the same address, but gdb only reports that the process
> has
> > exitted with an error code - no memory to examine, no backtrace.
> >
> > the former is mysterious but the latter is annoying - is this behaviour
> > necessitated by setting watchpoints?
> > I have remote access to a machine of the target variety but I would ask
> > first whether I can expect the behaviour to return to normal when using a
> > hardware watchpoint. No point is going down a dead end...
> > Thanks.
>
> qemu should know how do do hardware breakpoints. Do you have some logging
> output
> from when the watchpoint gets set until gdb runs until the program exits?
>

  reply	other threads:[~2025-04-25 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 16:54 K via Gdb
2025-04-25 13:09 ` Luis Machado via Gdb
2025-04-25 16:04   ` K via Gdb [this message]
2025-05-30 14:14     ` Luis Machado via Gdb
2025-04-25 14:15 ` K via Gdb

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='CACTzTFD_VqGNHPiZwBg--E75g9qE3MUYEoOWdM6U+XHn=+U4fg@mail.gmail.com' \
    --to=gdb@sourceware.org \
    --cc=cq.personal@gmail.com \
    /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