frysk.proc.live
Class Watchpoint

java.lang.Object
  extended by frysk.proc.live.Watchpoint
All Implemented Interfaces:
Comparable

public class Watchpoint
extends Object
implements Comparable

Internal proc class that represents a Breakpoint at a certain address in a Proc. Some attempts are made to have synchronize different Breakpoint instances at the same address in the same Proc, but currently this isn't a full singleton.


Field Summary
private  long address
           
private static HashMap installedWatchpoints
           
private  int length
           
private  Task task
           
private  boolean writeOnly
           
 
Constructor Summary
private Watchpoint(long address, int length, boolean writeOnly, Task task)
          Private constructor called by create to record address and proc.
 
Method Summary
 int compareTo(Object o)
          Uses natural ordering on address.
static Watchpoint create(long address, int length, boolean writeOnly, Task task)
          Creates a Breakpoint for the Proc at the given Address but does not set it yet.
 boolean equals(Object o)
           
 long getAddress()
           
 int getLength()
           
 Task getTask()
          Returns the Proc to which this breakpoint belongs.
 int hashCode()
           
 void install(Task task)
          Installs breakpoint.
 boolean isInstalled()
          Returns true if break point is installed and not yet removed.
 boolean isWriteOnly()
           
 void remove(Task task)
          Removes the breakpoint.
private  void reset(Task task)
          Actually removes the breakpoint.
private  void set(Task task)
          Actually sets the breakpoint.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

address

private final long address

length

private final int length

writeOnly

private final boolean writeOnly

task

private final Task task

installedWatchpoints

private static HashMap installedWatchpoints
Constructor Detail

Watchpoint

private Watchpoint(long address,
                   int length,
                   boolean writeOnly,
                   Task task)
Private constructor called by create to record address and proc.

Method Detail

create

public static Watchpoint create(long address,
                                int length,
                                boolean writeOnly,
                                Task task)
Creates a Breakpoint for the Proc at the given Address but does not set it yet. Returns the appropriate Breakpoint depending on host type. If a Breakpoint for this address and proc is already installed that Breakpoint will be returned.


getAddress

public long getAddress()

getLength

public int getLength()

isWriteOnly

public boolean isWriteOnly()

install

public void install(Task task)
Installs breakpoint. Caller must make sure there is no breakpoint set at that address yet and that install() is not called again till remove() is called on it.


set

private void set(Task task)
Actually sets the breakpoint.


remove

public void remove(Task task)
Removes the breakpoint. Caller must make sure it is called only when it is installed and not in the middle of a step.


reset

private void reset(Task task)
Actually removes the breakpoint.


getTask

public Task getTask()
Returns the Proc to which this breakpoint belongs.


isInstalled

public boolean isInstalled()
Returns true if break point is installed and not yet removed.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(Object o)
Uses natural ordering on address.

Specified by:
compareTo in interface Comparable

toString

public String toString()
Overrides:
toString in class Object