From: Kevin Buettner <kevinb@redhat.com>
To: Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] procfs.c: TARGET_CAN_USE_HARDWARE_WATCHPOINT via target vector
Date: Mon, 12 Aug 2002 18:11:00 -0000 [thread overview]
Message-ID: <1020813011119.ZM2267@localhost.localdomain> (raw)
In-Reply-To: Michael Snyder <msnyder@redhat.com> "Re: [RFA] procfs.c: TARGET_CAN_USE_HARDWARE_WATCHPOINT via target vector" (Aug 12, 5:21pm)
On Aug 12, 5:21pm, Michael Snyder wrote:
> Kevin Buettner wrote:
> >
> > On Irix, it's possible to debug processes using the o32, n32, and n64
> > ABIs from a single gdb. Unfortunately, due to some limitations with
> > the watchpoint support in procfs.c, it is not possible to use hardware
> > watchpoints in all cases. (See patch comments for details.)
> >
> > My first cut at a patch simply changed the macro in
> > config/mips/nm-irix5.h. However, since this same solution will be
> > required for each platform requiring procfs.c, I decided to use the
> > newly added hardware breakpoint facilities in the target vector.
> >
> > Okay to commit?
>
> Sure -- but don't you think it should default to zero?
> Or is being able to do it the norm? (I don't remember).
Here's the part of the patch to look at:
> > +/* Return non-zero if we can set a hardware watchpoint of type TYPE. TYPE
> > + is one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint,
> > + or bp_hardware_watchpoint. CNT is the number of watchpoints used so
> > + far.
> > +
> > + Note: procfs_can_use_hw_breakpoint() is not yet used by all
> > + procfs.c targets due to the fact that some of them still define
> > + TARGET_CAN_USE_HARDWARE_WATCHPOINT. */
> > +
> > +static int
> > +procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
> > +{
> > +#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
> > + return 0;
> > +#else
> > + /* Due to the way that proc_set_watchpoint() is implemented, host
> > + and target pointers must be of the same size. If they are not,
> > + we can't use hardware watchpoints. This limitation is due to the
> > + fact that proc_set_watchpoint() calls address_to_host_pointer();
> > + a close inspection of address_to_host_pointer will reveal that
> > + an internal error will be generated when the host and target
> > + pointer sizes are different. */
> > + if (sizeof (void *) != TYPE_LENGTH (builtin_type_void_data_ptr))
> > + return 0;
> > +
> > + /* Other tests here??? */
> > +
> > + return 1;
> > +#endif
> > }
So...
It returns zero for targets without hardware watchpoint support.
It returns 1 for targets with hardware watchpoint support,...
UNLESS the host and target pointer sizes don't match, in which case it
returns 0.
I think the above is what procfs.c targets do for
TARGET_CAN_USE_HARDWARE_WATCHPOINT with the exception of the "UNLESS"
clause which is new.
BTW, it seems to me that we should have some other tests (for type,
size, number of existing hardware watchpoints, etc) in the "Other
tests here???" section, but I don't really know what these tests
should be yet. Also, none of the other procfs.c targets currently
seem to care about this, so the functionality will be the same as
what we currently have (right or wrong).
Thanks for the quick reply.
Kevin
next prev parent reply other threads:[~2002-08-13 1:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-12 14:38 Kevin Buettner
2002-08-12 17:40 ` Michael Snyder
2002-08-12 18:11 ` Kevin Buettner [this message]
2002-08-12 19:40 ` Michael Snyder
2002-08-13 14:11 ` Andrew Cagney
2002-08-13 14:39 ` Kevin Buettner
2002-08-13 17:21 ` Andrew Cagney
2002-08-26 18:31 ` Michael Snyder
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=1020813011119.ZM2267@localhost.localdomain \
--to=kevinb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=msnyder@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