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 breakpoints/27423] Watchpoint could be hw but is sw
Date: Mon, 15 Feb 2021 18:51:01 +0000	[thread overview]
Message-ID: <bug-27423-4717-rVOGLrOREV@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27423-4717@http.sourceware.org/bugzilla/>

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
WORKAROUND: Flip the watch expression to "0 == *(int *)0x602260", and you have
a hw watchpoint instead:
...
$ gdb -iex "set trace-commands on" -batch a.out -ex "b 18" -ex run -ex "watch 0
== *(int *)0x602260" -ex cont -ex "info break"     
+b 18
Breakpoint 1 at 0x4005ad: file test.c, line 18.
+run

Breakpoint 1, main () at test.c:18
18        int *ap = malloc (sizeof(int));
+watch 0 == *(int *)0x602260
Hardware watchpoint 2: 0 == *(int *)0x602260
+cont

Hardware watchpoint 2: 0 == *(int *)0x602260

Old value = <unreadable>
New value = 0
main () at test.c:20
20        printf ("%p\n", ap);
+info break
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00000000004005ad in main at test.c:18
        breakpoint already hit 1 time
2       hw watchpoint  keep y                      0 == *(int *)0x602260
        breakpoint already hit 1 time
...

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

  parent reply	other threads:[~2021-02-15 18:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 15:36 [Bug breakpoints/27423] New: " vries at gcc dot gnu.org
2021-02-15 16:19 ` [Bug breakpoints/27423] " vries at gcc dot gnu.org
2021-02-15 18:48 ` vries at gcc dot gnu.org
2021-02-15 18:51 ` vries at gcc dot gnu.org [this message]
2021-02-15 20:09 ` vries at gcc dot gnu.org

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-27423-4717-rVOGLrOREV@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).