This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa:breakpoint] Correctly count watchpoints
- From: "Eli Zaretskii" <eliz at is dot elta dot co dot il>
- To: ac131313 at redhat dot com
- Cc: gdb-patches at sources dot redhat dot com
- Date: Tue, 01 Oct 2002 21:23:19 +0300
- Subject: Re: [rfa:breakpoint] Correctly count watchpoints
- References: <Pine.SUN.3.91.1021001064238.7898B-100000@is> <3D9939CF.8050205@redhat.com>
- Reply-to: Eli Zaretskii <eliz at is dot elta dot co dot il>
> Date: Tue, 01 Oct 2002 01:59:43 -0400
> From: Andrew Cagney <ac131313@redhat.com>
> >
> > Why two? Some expressions might need 3 registers. If you use this
> > worst-case scenario, GDB will think it cannot watch more than a single
> > expression, and that some data types, such as double's, and complex
> > aggregates, such as struct's, cannot be watched at all. It's hardly a
> > Good Thing to refuse to set watchpoints based on inaccurate decisions
> > like this.
>
> You mentioned two :-)
That was an example.
> Under the current arangement, an architecture has two choices:
>
> - have target_can_use_hardware_watchpoints() always return true (most
> targets appear to do this) and then error while trying to insert the
> watchpoints. This is what the i386 currently does.
>
> - have target_can_use...() make use of the counts and return an
> indication based on that
The reason the first strategy is widely used is that the high-level
code of GDB makes it very hard to do anything intelligent otherwise,
especially since refusing the target_can_use_hardware_watchpoints call
means GDB won't even try to insert that watchpoint. IIRC, GDB doesn't
even promise to call that function (macro) only once for each
watchpoint.