Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Wu Zhou <woodzltc@cn.ibm.com>
Cc: gdb-patches@sources.redhat.com, mark.kettenis@xs4all.nl,
		bje@au1.ibm.com, anton@au1.ibm.com
Subject: Re: [RFC] GDB patches for hw watchpoints - revised
Date: Wed, 14 Dec 2005 18:13:00 -0000	[thread overview]
Message-ID: <20051213203546.GA11674@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0512131318090.30718@linux.site>

On Tue, Dec 13, 2005 at 02:10:03PM +0800, Wu Zhou wrote:
> 2. The second one need Anton's patch, which changed three lines in 
> arch/ppc64/mm/fault.c:

> With this patch, I can use PTRACE_GETSIGINFO to get the stopped data 
> address (it is in siginfo.si_addr).  But one problem is that 
> to_stopped_by_watchpoint will call PTRACE_GETSIGINFO first to determine if 
> the stop is caused by watchpoint.  And another problem is that gdb need to 
> single step the process to execute current instruction when a watchpoint 
> is hit.  This will again drop into bpstat_stop_status, which will call 
> stopped_by_watchpoint and thus call PTRACE_GETSIGINFO again.  
> 
> I take a look at IA64's code, it set the dd bit of IA64_PSR_REGNUM, which
> will disable the watchpoint for the next instruction.  But it seems that 
> ppc don't have such a way.  Do we have any workaround for this?  

Could you cache the stopped data address when we are stopped by a
watchpoint, and then return the cached one if we aren't stopped by a
watchpoint any more but were the previous instruction?

I realize this is gross; the entire "step, then check the stopped data
address" is a bad idea, in my opinion.

> 3. The third one is a little tricky.  Now that ppc has at most 1 DABR. So 
> I can set the stopped_data_address to the data address when we set the 
> watchpoint (in ppc_linux_insert_watchpoint).  Everytime 
> target_stopped_data_address is called, the breakpoint is either read or 
> access, so it is already clear that it is stopped by watchpoint.  Then 
> this trick seems to make sense, right?

Weren't there other PPCs with more than one though?

> I had tested the above three methods.  The first one works ok when the 
> data breakpoint is aligned by 8 bytes.  The third one works ok for both 
> aligned and non-aligned data breakpoint.  For the second one, I don't know 
> how to work around the extra PTRACE_GETSIGINFO call caused by the single 
> step yet.  But if I reserver the stopped_data_address when we first 
> hit watchpoint, and store it back when I call ppc_linux_stopped_data_address. 
> I can make rwatch and awatch to work as expected.

... right, I guess I should have read your whole message first!  That's
my preferred option if we can find a clean way to do it.  I thought
there was a target with an example of this, but I can't find it.  I'm
not sure I understand why ia64 needs to disable the watchpoint, though.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  parent reply	other threads:[~2005-12-13 20:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06 19:54 Wu Zhou
2005-12-06 22:46 ` Ulrich Weigand
2005-12-09 12:00   ` Wu Zhou
2005-12-09 14:34     ` Ulrich Weigand
2005-12-06 23:05 ` Eli Zaretskii
2005-12-06 23:31   ` Daniel Jacobowitz
2005-12-09 12:04     ` Wu Zhou
2005-12-09 14:22       ` Daniel Jacobowitz
2005-12-09 18:58         ` Eli Zaretskii
2005-12-10 22:23         ` Wu Zhou
2005-12-11 11:12           ` Daniel Jacobowitz
2005-12-11 14:39             ` Wu Zhou
2005-12-13 22:47             ` Wu Zhou
2005-12-14 18:12               ` Eli Zaretskii
2005-12-14 18:13               ` Daniel Jacobowitz [this message]
2005-12-15 20:06                 ` Wu Zhou
2005-12-16  0:10                   ` Anton Blanchard
2005-12-22 15:26 Wu Zhou
2005-12-22 15:38 ` Wu Zhou
2005-12-22 15:57   ` Eli Zaretskii
2005-12-22 15:57     ` Wu Zhou
2005-12-23 20:52       ` Eli Zaretskii
2006-01-22 20:56       ` Daniel Jacobowitz
2006-01-24  3:40         ` Wu Zhou
2006-01-24  3:43           ` Daniel Jacobowitz
2006-01-24  4:33             ` Wu Zhou
2006-01-24 11:00               ` Wu Zhou
2006-01-24 21:20                 ` Daniel Jacobowitz
2006-01-25  3:19                   ` Wu Zhou
2006-01-25  8:34                     ` Replace to_region_size_ok_for_hw_watchpoint references with to_region_ok_for_hw_watchpoint ones Wu Zhou
2006-02-02  1:43                       ` [RFC] GDB patches for hw watchpoints - revised Daniel Jacobowitz
2006-02-08  5:35                         ` Wu Zhou
2006-02-09  5:44                           ` Wu Zhou
2006-02-09  7:44                             ` Eli Zaretskii
2006-02-13  9:53                               ` Wu Zhou

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=20051213203546.GA11674@nevyn.them.org \
    --to=drow@false.org \
    --cc=anton@au1.ibm.com \
    --cc=bje@au1.ibm.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    --cc=woodzltc@cn.ibm.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