frysk.proc.live
Class Breakpoint

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

public class Breakpoint
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 installed
           
private  long oo_address
           
private  Instruction origInstruction
           
private  Proc proc
           
private  int reset_stepping_tasks
           
 
Constructor Summary
private Breakpoint(long address, Proc proc)
          Private constructor called by create to record address and proc.
 
Method Summary
(package private)  Breakpoint cloneForProc(Proc proc)
          Makes a clone of this Breakpoint, but for a particular Proc.
 int compareTo(Object o)
          Uses natural ordering on address.
static Breakpoint create(long address, Proc proc)
          Creates a Breakpoint for the Proc at the given Address but does not set it yet.
 boolean equals(Object o)
           
 long getAddress()
           
 Instruction getInstruction()
          If this breakpoint is installed then the original instruction at the breakpoint address is returned.
 Proc getProc()
          Returns the Proc to which this breakpoint belongs.
 long getSetupAddress()
          Return the address that the original instruction has been setup if the breakpoint has been setup.
 int hashCode()
           
 void install(Task task)
          Installs breakpoint.
 boolean isInstalled()
          Returns true if break point is installed and not yet removed.
 void prepareStep(Task task)
          Prepares the given Task for a step over the breakpoint.
 void remove(Task task)
          Removes the breakpoint.
(package private)  void reset(Task task)
          Actually removes the breakpoint.
private  void set(Task task)
          Actually sets the breakpoint.
 void stepAbort(Task task)
          Aborts a breakpoint setup (interrupted while stepping).
 void stepDone(Task task)
          Notifies the breakpoint that a step has just taken place and that the task should be put into a state ready to continue (keeping the breakpoint in place).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

address

private final long address

proc

private final Proc proc

reset_stepping_tasks

private int reset_stepping_tasks

installed

private static HashMap installed

origInstruction

private Instruction origInstruction

oo_address

private long oo_address
Constructor Detail

Breakpoint

private Breakpoint(long address,
                   Proc proc)
Private constructor called by create to record address and proc.

Method Detail

create

public static Breakpoint create(long address,
                                Proc proc)
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()

getSetupAddress

public long getSetupAddress()
Return the address that the original instruction has been setup if the breakpoint has been setup. This can be an out of line address or if doing reset stepping the original address.


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

void reset(Task task)
Actually removes the breakpoint. Package private for BreakpointAddresses.clearBreakpoints(), all other callers should use remove().


prepareStep

public void prepareStep(Task task)
Prepares the given Task for a step over the breakpoint. This sets up the program counter and makes sure the next instruction is the one on which the breakpoint was placed. Should not be called again until stepDone is called. The given Task should be stopped and the intention is that the Task immediately tries to do a step and stepDone() called immediately afterwards (since this method might temporarily adjust registers for this Task that get cleaned up by stepDone() afterwards).


stepDone

public void stepDone(Task task)
Notifies the breakpoint that a step has just taken place and that the task should be put into a state ready to continue (keeping the breakpoint in place).


stepAbort

public void stepAbort(Task task)
Aborts a breakpoint setup (interrupted while stepping).


getInstruction

public Instruction getInstruction()
If this breakpoint is installed then the original instruction at the breakpoint address is returned. Otherwise null could be returned.


getProc

public Proc getProc()
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

cloneForProc

Breakpoint cloneForProc(Proc proc)
Makes a clone of this Breakpoint, but for a particular Proc. This is used by the BreakPointAddresses class to make a clone of all breakpoints set on a froked proc. First makes sure to have the canonical (installed) breakpoint. Then makes a copy and adds the original instruction. See BreakPointAddresses cloneForProc() and clearAllAddresses for more explanation.