Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <bauerman@br.ibm.com>,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	Joel Brobecker <brobecker@adacore.com>,
	Eli Zaretskii <eliz@gnu.org>
Subject: Re: [patch 2/3] Implement support for PowerPC BookE ranged watchpoints
Date: Sat, 27 Nov 2010 18:01:00 -0000	[thread overview]
Message-ID: <201011271801.11710.pedro@codesourcery.com> (raw)
In-Reply-To: <201011271747.39053.pedro@codesourcery.com>

On Saturday 27 November 2010 17:47:38, Pedro Alves wrote:
> On Friday 26 November 2010 21:15:22, Thiago Jung Bauermann wrote:
> 
> > So in your opinion, the watch command should always use two watchpoint
> > registers to set up a ranged watchpoint in BookE ppc? I'm a bit
> > reluctant to use all the watchpoint registers to set up one
> > watchpoint...
> 
> Blame the hardware designers, not me.  :-)
> 
> > Then comes the question of how to support the PPC_BREAKPOINT_MODE_EXACT
> > behaviour... A new flag or command to let the user "opt in" to a less
> > capable watchpoint, but one which uses less hardware resources?
> 
> Yes, that's what I think we should do.  I can help you code this,
> but I'm going computer-less real soon now until the 3rd December,
> and I'll only be able to help/review changes then onwards.
> 
> Here's what I think we should do in more detail:
> 
>  1 - make ppc-linux-nat.c insert ranged watchpoints for len > 1.
> 
>  2 - make ppc-linux-nat.c insert exact watchpoints when len == 1.

BTW, optional, but something that the ppc watchpoint support is
lacking.  Step 2.5, ppc-linux-nat.c should be taught to keep a list
of watchpoint requests, and merge watch requests for the same
addresses.  See <http://sourceware.org/ml/gdb-patches/2010-09/msg00470.html>
for an example of what that would fix.

> 
> with the above, watchpoints will behave as core gdb wants,
> while we will still use only one register in the case that
> is possible.
> 
>  3 - add a new command to let the user select that gdb should
>      trust that primitive types are always accessed through their
>      address (== exact).
>      My opinion is that it should be off by default, on the
>      grounds that most users aren't and shouldn't be that
>      familiar with the debug support of the chip or target
>      they're using.  Users want things to Just Work.
>      Every case that gdb doesn't behave the way it is
>      supposed to by default, and there's diverging behavior
>      in different target, is a case for frustration, bug
>      reports, and support requests.  Another argument is that
>      simulators/emulators (think qemu, for example) may not
>      have this limitation, and can implement the RSP
>      watchpoint packets as gdb expects (always ranged).
> 
>  4 - implementation wise, when the option added in #3 is
>      enabled, gdb (breakpoint.c) checks if the memory being watched
>      corresponds to a scalar type.  (or, going a step
>      further, if wrapped in a structure or union or array,
>      that only contains a single scalar, recursively).  If
>      true, then the "struct value" gdb used to record the
>      expression's current value (for comparison with the
>      new value whenever the low level watchpoint triggers) is
>      the same as usual, but, the watchpoint location that is associated
>      with the watchpoint is set to have length == 1, instead of
>      the whole width of the watched memory range.
>      This way, the target is requested to watch a single
>      byte at the scalar's address.  Note how due to the
>      change done in #2, ppc-linux-nat.c will insert an 
>      PPC_BREAKPOINT_MODE_EXACT in this case.
> 
>      This means that no changes to the target_insert_watchpoint
>      interface are required.  This also means that no 
>      changes to the remote protocol are required.  If
>      the new option is on, and the user wants to watch
>      an "int i", whose address is 0xD3ADB33F, the target
>      will see a "Z2,D3ADB33F,1" request.  That is, watch
>      writes to the 1 byte long range starting at D3ADB33F.
>      That is the same as saying trap only on writes to
>      D3ADB33F.
> 
>      This also means that no new breakpoint_ops type
>      is required either.  A new flag in the breakpoint will do
>      (so that the "exact" property of watchpoints already
>      created is preserved if the user flips the switch).
> 
> WDYT?  Sounds reasonable?  I'd prefer doing these changes
> as first step.  I haven't looked yet at what kind of masks
> masked watchpoints support, but if they only support masks in the form
> of (binary) 11110000, 1111111100, etc. (no alternating 1s and 0s),
> then no target_insert_watchpoint or remote protocol change is
> required either for those.

-- 
Pedro Alves


  reply	other threads:[~2010-11-27 18:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 21:52 Thiago Jung Bauermann
2010-11-23 23:17 ` Pedro Alves
2010-11-24 21:06   ` Thiago Jung Bauermann
2010-11-25 17:32     ` Pedro Alves
2010-11-26 11:09       ` Eli Zaretskii
2010-11-27 13:25         ` Thiago Jung Bauermann
2010-11-27 15:28           ` Eli Zaretskii
2010-11-26 21:15       ` Thiago Jung Bauermann
2010-11-27 17:47         ` Pedro Alves
2010-11-27 18:01           ` Pedro Alves [this message]
2010-12-09  1:44           ` Thiago Jung Bauermann
2010-12-23 19:07           ` Thiago Jung Bauermann
2010-12-23 19:13             ` Eli Zaretskii
2010-12-23 20:17               ` Thiago Jung Bauermann
2010-12-23 22:18             ` Pedro Alves
2010-12-24  5:10               ` Joel Brobecker
2010-12-25 14:13               ` Eli Zaretskii
2010-12-27 20:18                 ` Thiago Jung Bauermann
2010-12-28  2:30               ` Thiago Jung Bauermann
2010-12-28  5:47                 ` Joel Brobecker
2010-12-28 16:42                   ` Pedro Alves
2010-12-28 16:10                 ` Pedro Alves
2010-12-29  1:00                   ` Thiago Jung Bauermann
2010-11-26 10:59 ` Eli Zaretskii

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=201011271801.11710.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=bauerman@br.ibm.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.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