From: Yao Qi <yao@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [RFA/commit] arm-tdep.c: Do not single-step after hitting a watchpoint.
Date: Tue, 16 Sep 2014 11:12:00 -0000 [thread overview]
Message-ID: <87bnqf2578.fsf@codesourcery.com> (raw)
In-Reply-To: <1410786062-19274-1-git-send-email-brobecker@adacore.com> (Joel Brobecker's message of "Mon, 15 Sep 2014 06:01:02 -0700")
Joel Brobecker <brobecker@adacore.com> writes:
> Hello!
>
> Re: question about ARM watchpoints
> https://www.sourceware.org/ml/gdb/2014-09/msg00000.html
>
> This patch fixes an issue with watchpoints on ARM targets, where
> the debugger stops 2 instructions after the instruction causing
> the watchpoint. GDB is expected to stop at the next instruction.
>
> The problem is caused by the fact that GDB does an extra single-step
> after receiving the watchpoint notification, because the
> have_nonsteppable_watchpoint gdbarch attribute is set for ARM
> targets. Our experiments indicate that this is incorrect, at
> least for the versions of ARM that we tested on (ARMv7). We tried
Joel,
Can you elaborate your experiments? Do you do experiments on qemu, arm
bare metal targets or arm linux targets?
I find Peter tries to fix the same problem we encounter in qemu side,
[Qemu-devel] [PATCH] gdbstub: Allow target CPUs to specify watchpoint STOP_BEFORE_ACCESS flag
http://lists.nongnu.org/archive/html/qemu-devel/2014-09/msg02665.html
and this patch isn't accepted yet.
Without this patch, program stops two instructions after the variable is
updated on qemu trunk,
0x000001ae <+10>: str r3, [r7, #12]
0x000001b0 <+12>: ldr r3, [r7, #4]
=> 0x000001b2 <+14>: cmp r3, #1
0x000001b4 <+16>: bne.n 0x1ba <recurse+22>
however, with Peter's patch applied, program stops one instruction after
the variable is updated,
(gdb) watch b
Hardware watchpoint 3: b
(gdb) c
Continuing.
Hardware watchpoint 3: b
Old value = 1283
New value = 0
recurse (a=10) at ../../../../git/gdb/testsuite/gdb.base/recurse.c:15
15 if (a == 1)
(gdb) disassemble recurse
Dump of assembler code for function recurse:
0x000001a4 <+0>: push {r7, lr}
0x000001a6 <+2>: sub sp, #16
0x000001a8 <+4>: add r7, sp, #0
0x000001aa <+6>: str r0, [r7, #4]
0x000001ac <+8>: movs r3, #0
0x000001ae <+10>: str r3, [r7, #12]
=> 0x000001b0 <+12>: ldr r3, [r7, #4]
0x000001b2 <+14>: cmp r3, #1
Note that with patched qemu, two fails in gdb.base/recurse.exp are
fixed. At least, gdb and qemu should be in sync on this.
--
Yao (齐尧)
next prev parent reply other threads:[~2014-09-16 11:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-15 13:01 Joel Brobecker
2014-09-16 11:12 ` Yao Qi [this message]
2014-09-16 11:59 ` Joel Brobecker
2014-09-16 12:05 ` Luis Machado
2014-09-16 12:48 ` Joel Brobecker
2014-09-16 13:09 ` Luis Machado
2014-09-16 15:21 ` Pedro Alves
2014-09-18 11:40 ` Marcus Shawcroft
2014-09-19 17:31 ` Pedro Alves
2014-09-29 17:51 ` Joel Brobecker
2014-09-29 17:57 ` Luis Machado
2014-09-29 21:04 ` Pedro Alves
2014-09-30 8:54 ` Will Deacon
2014-09-29 18:23 Peter Maydell
2014-09-29 22:15 ` Pedro Alves
2014-09-29 22:54 ` Peter Maydell
2014-09-30 9:08 ` Pedro Alves
2014-09-30 9:18 ` Will Deacon
2014-09-30 10:07 ` Pedro Alves
2014-09-30 10:18 ` Peter Maydell
2014-09-30 10:38 ` Pedro Alves
2014-09-30 10:01 ` Peter Maydell
2014-09-30 10:34 ` Pedro Alves
2014-09-30 12:54 ` Pedro Alves
2014-09-30 13:50 ` Joel Brobecker
2014-09-30 14:11 ` Pedro Alves
2014-09-30 14:26 ` Joel Brobecker
2014-09-30 14:50 ` Peter Maydell
2014-09-30 8:57 ` Will Deacon
2014-09-30 9:04 ` Will Deacon
2014-09-30 9:14 ` Pedro Alves
2014-09-30 9:24 ` Will Deacon
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=87bnqf2578.fsf@codesourcery.com \
--to=yao@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@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