Bug 1629

Summary: page based watchpoints
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Unassigned <frysk-bugzilla>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on: 1496    
Bug Blocks: 1582    

Description Andrew Cagney 2005-10-29 04:31:35 UTC
requires kernel support
Comment 1 Wu Zhou 2006-03-15 14:47:07 UTC
Andrew,

What is page based watchpoints mainly used for?  And how to implement that in
the kernel?  Go through some check statement at every page access attempts?  

When the number of this kind of watchpoints goes high, the performance might be
impacted.  Nevertheless, there won't be too much this kinds of watchpoints I
believe.
Comment 2 Andrew Cagney 2006-05-05 18:22:44 UTC
Whu,

The underlying problem is that a CPU's hardware watchpoint mechanism is a very
very limited resource.  Typically only 1-4 elements can be watched and that
limits things to just a few small variables.  Page based watchpoints, on the
other hand, do not have that limitation - arbitrary memory areas can be
monitored for accesses by disabling memory accesses on a page boundary.  Against
that is the need to juggle things when a page access does occure - the access
may not be to the protected variable; and that, as you note, adds additional
overhead.  However: at least the restriction of only 1-4 watchpoints is removed;
and it is more efficient than single-stepping all instructions looking for a
faulting access. 

The kernel requirement would be a mechanism for disabling|enabling access to
specific memory pages; possibly on a per thread basis.