frysk.proc.live
Class WatchpointAddresses

java.lang.Object
  extended by frysk.proc.live.WatchpointAddresses

public class WatchpointAddresses
extends Object

Keeps track of address watchppoints for a Proc (all Tasks of a Proc share the same breakpoints). Watchpoints absolute addresses with a length Proc text/data area. This class is used to construct higher level watchpoint observers. The class keeps track of the number of observers interested in an address/length for the Proc. It adds or deletes the actual watchpoints depending on the number of active observers.


Constructor Summary
WatchpointAddresses(Proc proc)
          Package private constructor used by the Proc when created.
 
Method Summary
 boolean addWatchpoint(TaskObserver.Watch observer, Task task, long address, int length, boolean writeOnly)
          Adds a watchpoint observer to an address.
 Collection getWatchObservers(Task task, long address, int length, boolean writeOnly)
          Called by the Proc when it has trapped a watchpoint.
 Watchpoint getWatchpoint(Task task, long address, int length, boolean writeOnly)
           
 void removeAllWatchObservers()
          Called from TaskState when the Task gets an execed event which clears the whole address space.
 boolean removeWatchpoint(TaskObserver.Watch observer, Task task, long address, int length, boolean writeOnly)
          Removes an observer from a watchpoint.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WatchpointAddresses

public WatchpointAddresses(Proc proc)
Package private constructor used by the Proc when created.

Method Detail

addWatchpoint

public boolean addWatchpoint(TaskObserver.Watch observer,
                             Task task,
                             long address,
                             int length,
                             boolean writeOnly)
Adds a watchpoint observer to an address. If there is not yet a watchpoint at the given address the given Task is asked to add one (the method will return true). Otherwise the observer is added to the list of objects to notify when the watchpoint is hit (and the method returns false).


removeWatchpoint

public boolean removeWatchpoint(TaskObserver.Watch observer,
                                Task task,
                                long address,
                                int length,
                                boolean writeOnly)
Removes an observer from a watchpoint. If this is the last observer interested in this particular address then the watchpoint is really removed by requestion the given task to do so (the method will return true). Otherwise just this observer will be removed from the list of observers for the watchpoint address (and the method will return false).

Throws:
IllegalArgumentException - if the observer was never added.

getWatchObservers

public Collection getWatchObservers(Task task,
                                    long address,
                                    int length,
                                    boolean writeOnly)
Called by the Proc when it has trapped a watchpoint. Returns a Collection of TaskObserver.Watch observers interested in the given address or null when no Watch observer was installed on this address.


getWatchpoint

public Watchpoint getWatchpoint(Task task,
                                long address,
                                int length,
                                boolean writeOnly)

removeAllWatchObservers

public void removeAllWatchObservers()
Called from TaskState when the Task gets an execed event which clears the whole address space. XXX: Should not be public.