This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimizing watchpoints


Hi Phil,

On Fri, 2007-09-28 at 22:20 +0100, Phil Muldoon wrote:
> Given that debug registers are very scarce, and that typically there 
> might be a scenario where we could better optimize watching similar 
> addresses and ranges, is there an established protocol for this?
> 
> I thought about checking addresses and ranges as a simple "we are 
> already watching this address in another register and scope". But as 
> usual things get hairy in C when you add in pointers (that pointer to 
> pointers in structures and so on).

We are already doing a simple version of this for low level breakpoints.
For each Code observer added at the proc level there is a simple map,
BreakpointAddresses, that keeps track of whether or not an actual
breakpoint instruction is already there. So whenever a Code observer is
added or removed at a particular address the BreakpointAddresses map is
consulted to see whether an existing one can be reused, or should be
kept, because other Code observers are monitoring the address.

For watchpoints you don't just have simple addresses, but also a range.
That makes your 'overlapping' detection a little less straightforward
than in the Code observer case. But BreakpointAddresses does already
give a simple version that can find breakpoint addressses given a range
of memory, public Iterator getBreakpoints(long from, long till).
Something like this, based on a TreeSet of addresses plus ranges can
probably be used to implement your watchpoint address range overlapping
detection.

I wouldn't worry too much about the particulars of hairy C structures.
That should be handled at a higher language level by installing multiple
proc watchpoint observers.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]