frysk.rt
Class SourceBreakpoint

java.lang.Object
  extended by frysk.rt.SourceBreakpoint
All Implemented Interfaces:
Observer, BreakpointObserver, Comparable
Direct Known Subclasses:
FunctionBreakpoint, LineBreakpoint

public abstract class SourceBreakpoint
extends Object
implements Comparable, BreakpointObserver


Nested Class Summary
private  class SourceBreakpoint.ProcEntry
           
static class SourceBreakpoint.State
           
 
Field Summary
static SourceBreakpoint.State DEFERRED
          The action point is should be enabled but is not yet, perhaps because a shared library hasn't been loaded yet.
static SourceBreakpoint.State DELETED
          The action point is deleted and should not be reenabled.
static SourceBreakpoint.State DISABLED
          The action point is disabled and should have no effect in the running process.
static SourceBreakpoint.State ENABLED
          The action point is enabled and will be "fired" when hit.
(package private)  int id
           
private  ArrayList observers
           
private  HashMap procMap
           
private  HashMap taskStateMap
           
private  SourceBreakpoint.State userState
           
 
Constructor Summary
SourceBreakpoint(int id)
           
SourceBreakpoint(int id, SourceBreakpoint.State state)
           
 
Method Summary
 void addedTo(Object observable)
          Acknowledge the request to add this Observer from Object's set of observers was successful.
 void addFailed(Object observable, Throwable w)
          Notify that the attempt to add to the specified observer failed.
 void addObserver(SourceBreakpointObserver observer)
           
 boolean appliesTo(Proc proc, Task task)
           
 int compareTo(Object o)
           
 boolean containsPersistentBreakpoint(Proc proc, Breakpoint.PersistentBreakpoint bpt)
          Test if RunState breakpoint is contained in this object.
 void deletedFrom(Object observable)
          Acknowledge the request to delete this Observer from Object's set of observers was successful (or that the Observer was spontaneously deleted, e.g., due to a task exit).
 void deleteObserver(SourceBreakpointObserver observer)
           
 void disableBreakpoint(Task task, SteppingEngine steppingEngine)
          Delete the object's raw breakpoints from a process via the RunState.
 void enableBreakpoint(Task task, SteppingEngine steppingEngine)
          Add this object's raw breakpoints to the process via the RunState object.
 LinkedList getAddrs(Proc proc)
          Get the list of raw address objects for a process
abstract  LinkedList getBreakpointRawAddresses(Task task)
          Get all the machine addresses for this breakpoint using the stopped task in the process.
 int getId()
           
(package private) abstract  long getRawAddress(Object addr)
          Return the address to use as a breakpoint from the object stored in the list of breakpoints.
 SourceBreakpoint.State getState(Task task)
          Get the state of an action point.
 Map getTaskStateMap()
          Get the map from tasks to breakpoint's state in the task.
 SourceBreakpoint.State getUserState()
           
 int numberOfObservers()
           
abstract  PrintWriter output(PrintWriter writer)
           
 void removeAllObservers()
           
 void setAddrs(Proc proc, LinkedList addrs)
          Set the list of raw address objects.
 void setState(Task task, SourceBreakpoint.State state)
          Set state of a breakpoint in a task.
 void setUserState(SourceBreakpoint.State state)
           
 void updateHit(Breakpoint.PersistentBreakpoint breakpoint, Task task, long address)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

procMap

private HashMap procMap

ENABLED

public static final SourceBreakpoint.State ENABLED
The action point is enabled and will be "fired" when hit.


DISABLED

public static final SourceBreakpoint.State DISABLED
The action point is disabled and should have no effect in the running process.


DELETED

public static final SourceBreakpoint.State DELETED
The action point is deleted and should not be reenabled.


DEFERRED

public static final SourceBreakpoint.State DEFERRED
The action point is should be enabled but is not yet, perhaps because a shared library hasn't been loaded yet.


taskStateMap

private HashMap taskStateMap

userState

private SourceBreakpoint.State userState

observers

private ArrayList observers

id

final int id
Constructor Detail

SourceBreakpoint

public SourceBreakpoint(int id,
                        SourceBreakpoint.State state)

SourceBreakpoint

public SourceBreakpoint(int id)
Method Detail

getState

public SourceBreakpoint.State getState(Task task)
Get the state of an action point.

Returns:
state constant object

setState

public void setState(Task task,
                     SourceBreakpoint.State state)
Set state of a breakpoint in a task.


getTaskStateMap

public Map getTaskStateMap()
Get the map from tasks to breakpoint's state in the task. Read only!


getUserState

public SourceBreakpoint.State getUserState()

setUserState

public void setUserState(SourceBreakpoint.State state)

getAddrs

public LinkedList getAddrs(Proc proc)
Get the list of raw address objects for a process

Parameters:
The - process
Returns:
the list

setAddrs

public void setAddrs(Proc proc,
                     LinkedList addrs)
Set the list of raw address objects.

Parameters:
addrs - the address objects

getRawAddress

abstract long getRawAddress(Object addr)
Return the address to use as a breakpoint from the object stored in the list of breakpoints.

Parameters:
addr - the object stored in the addrs list
Returns:
the raw address at which a breakpoint will be set

enableBreakpoint

public void enableBreakpoint(Task task,
                             SteppingEngine steppingEngine)
Add this object's raw breakpoints to the process via the RunState object.

Parameters:
task - task to which breakpoints are added, although they are in fact added to the entire process.
steppingEngine - The SteppingEngine to notify.
runState - the RunState object

disableBreakpoint

public void disableBreakpoint(Task task,
                              SteppingEngine steppingEngine)
Delete the object's raw breakpoints from a process via the RunState.

Parameters:
task - task in the process
steppingEngine - TODO
runState - the RunState object

containsPersistentBreakpoint

public boolean containsPersistentBreakpoint(Proc proc,
                                            Breakpoint.PersistentBreakpoint bpt)
Test if RunState breakpoint is contained in this object. This is only valid if the source breakpoint has been added to (and not deleted from) the process.

Parameters:
bpt -
Returns:

updateHit

public void updateHit(Breakpoint.PersistentBreakpoint breakpoint,
                      Task task,
                      long address)
Specified by:
updateHit in interface BreakpointObserver

addedTo

public void addedTo(Object observable)
Description copied from interface: Observer
Acknowledge the request to add this Observer from Object's set of observers was successful.

Specified by:
addedTo in interface Observer

addFailed

public void addFailed(Object observable,
                      Throwable w)
Description copied from interface: Observer
Notify that the attempt to add to the specified observer failed.

Specified by:
addFailed in interface Observer

deletedFrom

public void deletedFrom(Object observable)
Description copied from interface: Observer
Acknowledge the request to delete this Observer from Object's set of observers was successful (or that the Observer was spontaneously deleted, e.g., due to a task exit).

Specified by:
deletedFrom in interface Observer

addObserver

public void addObserver(SourceBreakpointObserver observer)

deleteObserver

public void deleteObserver(SourceBreakpointObserver observer)

numberOfObservers

public int numberOfObservers()

removeAllObservers

public void removeAllObservers()

getId

public int getId()

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getBreakpointRawAddresses

public abstract LinkedList getBreakpointRawAddresses(Task task)
Get all the machine addresses for this breakpoint using the stopped task in the process.

Parameters:
task - the stopped task
Returns:
list of addresses

output

public abstract PrintWriter output(PrintWriter writer)

appliesTo

public boolean appliesTo(Proc proc,
                         Task task)