frysk.isa.watchpoints
Class WatchpointFunctions

java.lang.Object
  extended by frysk.isa.watchpoints.WatchpointFunctions
Direct Known Subclasses:
IA32WatchpointFunctions, X8664WatchpointFunctions

public abstract class WatchpointFunctions
extends Object


Field Summary
protected  int noOfWatchpoints
           
protected  int watchpointMaxLength
           
protected  int watchpointMinLength
           
 
Constructor Summary
WatchpointFunctions()
           
 
Method Summary
abstract  void deleteWatchpoint(Task task, int index)
          Deletes a watchpoint.
 List getAllWatchpoints(Task task)
          Returns all the watchpoints know in the debug control registers
 int getWatchpointCount()
          Returns number of watchpoints for this architecture
 int getWatchpointMaxLength()
          Returns maximum length of a single watchpoint in a single hardware register
 int getWatchpointMinLength()
          Returns minimum length of a single watchpoint in a single hardware register
abstract  boolean hasWatchpointTriggered(Task task, int index)
          Reads the Debug Status Register and checks if the breakpoint specified has fired.
protected abstract  long readControlRegister(Task task)
          Reads the Debug control register.
protected abstract  long readStatusRegister(Task task)
          Reads the Debug status register.
abstract  Watchpoint readWatchpoint(Task task, int index)
          Reads a watchpoint.
abstract  void resetWatchpoint(Task task, int index)
          Resets the appropriate bit in the debug status register after a watchpoint has triggered, thereby reseting it.
abstract  void setWatchpoint(Task task, int index, long addr, int range, boolean writeOnly)
          Builds and sets a hardware watchpoint on a task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noOfWatchpoints

protected int noOfWatchpoints

watchpointMaxLength

protected int watchpointMaxLength

watchpointMinLength

protected int watchpointMinLength
Constructor Detail

WatchpointFunctions

public WatchpointFunctions()
Method Detail

setWatchpoint

public abstract void setWatchpoint(Task task,
                                   int index,
                                   long addr,
                                   int range,
                                   boolean writeOnly)
Builds and sets a hardware watchpoint on a task.

Parameters:
task - - task to set a watchpoint on.
index - - watchpoint number to write. Architecture dependent.
addr - - linear virtual address to watch.
range - - length of range to watch. Normally 1,2 or 4 bytes. 8 on 64 bit systems. Architecture dependent.
writeOnly - - When true, only trigger when address is written. False, trigger when address is read or written to.

readWatchpoint

public abstract Watchpoint readWatchpoint(Task task,
                                          int index)
Reads a watchpoint. Takes a task, and an index.

Parameters:
task - - task to read a watchpoint from.
index - - watchpoint number to read.
Returns:
long - value of register for watchpoint.

deleteWatchpoint

public abstract void deleteWatchpoint(Task task,
                                      int index)
Deletes a watchpoint. Takes a task, and an index.

Parameters:
task - - task on which to delete a watchpoint.
index - - watchpoint number to delete.

getAllWatchpoints

public List getAllWatchpoints(Task task)
Returns all the watchpoints know in the debug control registers

Parameters:
task - - task on which to delete a watchpoint.
Returns:
List- List of watchpoints

readControlRegister

protected abstract long readControlRegister(Task task)
Reads the Debug control register.

Parameters:
task - - task to read the debug control register from.

readStatusRegister

protected abstract long readStatusRegister(Task task)
Reads the Debug status register.

Parameters:
task - - task to read the debug status register from.

hasWatchpointTriggered

public abstract boolean hasWatchpointTriggered(Task task,
                                               int index)
Reads the Debug Status Register and checks if the breakpoint specified has fired.

Parameters:
task - - task to read the debug control register from.
index - - Debug register to check

resetWatchpoint

public abstract void resetWatchpoint(Task task,
                                     int index)
Resets the appropriate bit in the debug status register after a watchpoint has triggered, thereby reseting it.

Parameters:
task - - task to read the debug control register from.
index - - Debug register to reset.

getWatchpointCount

public final int getWatchpointCount()
Returns number of watchpoints for this architecture

Returns:
int number of usable watchpoints.

getWatchpointMaxLength

public final int getWatchpointMaxLength()
Returns maximum length of a single watchpoint in a single hardware register

Returns:
int maximum length

getWatchpointMinLength

public final int getWatchpointMinLength()
Returns minimum length of a single watchpoint in a single hardware register

Returns:
int minimum length