com.pvx.ooadide.launchers.debug.model
Class PVXDebugTarget

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.debug.core.model.DebugElement
          extended by com.pvx.ooadide.launchers.debug.model.PVXDebugElement
              extended by com.pvx.ooadide.launchers.debug.model.PVXDebugTarget
All Implemented Interfaces:
IPVXEventListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.debug.core.IBreakpointListener, org.eclipse.debug.core.IBreakpointManagerListener, org.eclipse.debug.core.model.IDebugElement, org.eclipse.debug.core.model.IDebugTarget, org.eclipse.debug.core.model.IDisconnect, org.eclipse.debug.core.model.IMemoryBlockRetrieval, org.eclipse.debug.core.model.ISuspendResume, org.eclipse.debug.core.model.ITerminate

public class PVXDebugTarget
extends PVXDebugElement
implements org.eclipse.debug.core.model.IDebugTarget, org.eclipse.debug.core.IBreakpointManagerListener, IPVXEventListener

PVX Debug Target


Field Summary
static java.lang.String CHARSET
           
 
Constructor Summary
PVXDebugTarget(org.eclipse.debug.core.ILaunch launch, org.eclipse.debug.core.model.IProcess process)
          Constructs a new debug target in the given launch for the associated PVX VM process.
PVXDebugTarget(org.eclipse.debug.core.ILaunch launch, org.eclipse.debug.core.model.IProcess process, int requestPort, int eventPort)
          Constructs a new debug target in the given launch for the associated PVX VM process.
PVXDebugTarget(org.eclipse.debug.core.ILaunch launch, org.eclipse.debug.core.model.IProcess p, java.lang.String iName)
           
 
Method Summary
 void addEventListener(IPVXEventListener listener)
          Registers the given event listener.
 void breakpointAdded(org.eclipse.debug.core.model.IBreakpoint breakpoint)
           
 void breakpointChanged(org.eclipse.debug.core.model.IBreakpoint breakpoint, org.eclipse.core.resources.IMarkerDelta delta)
           
 void breakpointManagerEnablementChanged(boolean enabled)
          When the breakpoint manager disables, remove all registered breakpoints requests from the VM.
 void breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint breakpoint, org.eclipse.core.resources.IMarkerDelta delta)
           
 boolean canDisconnect()
           
 boolean canPop()
          Returns whether popping the data stack is currently permitted
 boolean canPush()
          Returns whether pushing a value is currently supported.
 boolean canResume()
           
 boolean canSuspend()
           
 boolean canTerminate()
           
 boolean connectToInterpreter(int requestPort, int eventPort)
           
 void disconnect()
           
 org.eclipse.debug.core.model.IValue[] getDataStack()
          Returns the values on the data stack (top down)
 org.eclipse.debug.core.model.IDebugTarget getDebugTarget()
           
 org.eclipse.debug.core.ILaunch getLaunch()
           
 org.eclipse.debug.core.model.IMemoryBlock getMemoryBlock(long startAddress, long length)
           
 java.lang.String getName()
           
 org.eclipse.debug.core.model.IProcess getProcess()
           
 org.eclipse.debug.core.model.IThread[] getThreads()
           
 void handleEvent(java.lang.String event)
          Notification the given event occurred in the target program being interpretted.
 boolean hasThreads()
           
 boolean isDisconnected()
           
 boolean isSuspended()
           
 boolean isTerminated()
           
 void logAvailableData()
           
 void pauseExecution(int milliS)
           
 org.eclipse.debug.core.model.IValue pop()
          Pops and returns the top of the data stack
 void push(java.lang.String value)
          Pushes a value onto the stack.
 void removeEventListener(IPVXEventListener listener)
          Deregisters the given event listener.
 void resume()
           
 java.lang.String sendRequest(java.lang.String request)
          Sends a request to the PDA interprettor, waits for and returns the reply.
 void startDebugSession(java.net.Socket requestSocket, java.net.Socket eventSocket)
           
 boolean supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint breakpoint)
           
 boolean supportsStorageRetrieval()
           
 void suspend()
           
 void terminate()
           
 
Methods inherited from class com.pvx.ooadide.launchers.debug.model.PVXDebugElement
getModelIdentifier
 
Methods inherited from class org.eclipse.debug.core.model.DebugElement
fireChangeEvent, fireCreationEvent, fireEvent, fireResumeEvent, fireSuspendEvent, fireTerminateEvent, getAdapter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.debug.core.model.IDebugElement
getModelIdentifier
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

CHARSET

public static final java.lang.String CHARSET
See Also:
Constant Field Values
Constructor Detail

PVXDebugTarget

public PVXDebugTarget(org.eclipse.debug.core.ILaunch launch,
                      org.eclipse.debug.core.model.IProcess process,
                      int requestPort,
                      int eventPort)
               throws org.eclipse.core.runtime.CoreException
Constructs a new debug target in the given launch for the associated PVX VM process. This constructor creates an instance that creates client sockets that open a connection to the pvx interpreter which is opening server sockets

Parameters:
launch - containing launch
process - PVX VM
requestPort - port to send requests to the VM
eventPort - port to read events from
Throws:
org.eclipse.core.runtime.CoreException - if unable to connect to host

PVXDebugTarget

public PVXDebugTarget(org.eclipse.debug.core.ILaunch launch,
                      org.eclipse.debug.core.model.IProcess process)
               throws org.eclipse.core.runtime.CoreException
Constructs a new debug target in the given launch for the associated PVX VM process. This constructor creates an instance that creates server sockets sockets that open a connection to the pvx interpreter which is opening server sockets

Parameters:
launch - containing launch
process - PVX VM
requestPort - port to send requests to the VM
eventPort - port to read events from
Throws:
org.eclipse.core.runtime.CoreException - if unable to connect to host

PVXDebugTarget

public PVXDebugTarget(org.eclipse.debug.core.ILaunch launch,
                      org.eclipse.debug.core.model.IProcess p,
                      java.lang.String iName)
               throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException
Method Detail

addEventListener

public void addEventListener(IPVXEventListener listener)
Registers the given event listener. The listener will be notified of events in the program being interpretted. Has no effect if the listener is already registered.

Parameters:
listener - event listener

removeEventListener

public void removeEventListener(IPVXEventListener listener)
Deregisters the given event listener. Has no effect if the listener is not currently registered.

Parameters:
listener - event listener

startDebugSession

public void startDebugSession(java.net.Socket requestSocket,
                              java.net.Socket eventSocket)

pauseExecution

public void pauseExecution(int milliS)

connectToInterpreter

public boolean connectToInterpreter(int requestPort,
                                    int eventPort)
                             throws org.eclipse.debug.core.DebugException
Throws:
org.eclipse.debug.core.DebugException

getProcess

public org.eclipse.debug.core.model.IProcess getProcess()
Specified by:
getProcess in interface org.eclipse.debug.core.model.IDebugTarget

getThreads

public org.eclipse.debug.core.model.IThread[] getThreads()
                                                  throws org.eclipse.debug.core.DebugException
Specified by:
getThreads in interface org.eclipse.debug.core.model.IDebugTarget
Throws:
org.eclipse.debug.core.DebugException

hasThreads

public boolean hasThreads()
                   throws org.eclipse.debug.core.DebugException
Specified by:
hasThreads in interface org.eclipse.debug.core.model.IDebugTarget
Throws:
org.eclipse.debug.core.DebugException

getName

public java.lang.String getName()
                         throws org.eclipse.debug.core.DebugException
Specified by:
getName in interface org.eclipse.debug.core.model.IDebugTarget
Throws:
org.eclipse.debug.core.DebugException

supportsBreakpoint

public boolean supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint breakpoint)
Specified by:
supportsBreakpoint in interface org.eclipse.debug.core.model.IDebugTarget

getDebugTarget

public org.eclipse.debug.core.model.IDebugTarget getDebugTarget()
Specified by:
getDebugTarget in interface org.eclipse.debug.core.model.IDebugElement
Overrides:
getDebugTarget in class org.eclipse.debug.core.model.DebugElement

getLaunch

public org.eclipse.debug.core.ILaunch getLaunch()
Specified by:
getLaunch in interface org.eclipse.debug.core.model.IDebugElement
Overrides:
getLaunch in class org.eclipse.debug.core.model.DebugElement

canTerminate

public boolean canTerminate()
Specified by:
canTerminate in interface org.eclipse.debug.core.model.ITerminate

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface org.eclipse.debug.core.model.ITerminate

terminate

public void terminate()
               throws org.eclipse.debug.core.DebugException
Specified by:
terminate in interface org.eclipse.debug.core.model.ITerminate
Throws:
org.eclipse.debug.core.DebugException

canResume

public boolean canResume()
Specified by:
canResume in interface org.eclipse.debug.core.model.ISuspendResume

canSuspend

public boolean canSuspend()
Specified by:
canSuspend in interface org.eclipse.debug.core.model.ISuspendResume

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface org.eclipse.debug.core.model.ISuspendResume

resume

public void resume()
            throws org.eclipse.debug.core.DebugException
Specified by:
resume in interface org.eclipse.debug.core.model.ISuspendResume
Throws:
org.eclipse.debug.core.DebugException

suspend

public void suspend()
             throws org.eclipse.debug.core.DebugException
Specified by:
suspend in interface org.eclipse.debug.core.model.ISuspendResume
Throws:
org.eclipse.debug.core.DebugException

breakpointAdded

public void breakpointAdded(org.eclipse.debug.core.model.IBreakpoint breakpoint)
Specified by:
breakpointAdded in interface org.eclipse.debug.core.IBreakpointListener

breakpointRemoved

public void breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint breakpoint,
                              org.eclipse.core.resources.IMarkerDelta delta)
Specified by:
breakpointRemoved in interface org.eclipse.debug.core.IBreakpointListener

breakpointChanged

public void breakpointChanged(org.eclipse.debug.core.model.IBreakpoint breakpoint,
                              org.eclipse.core.resources.IMarkerDelta delta)
Specified by:
breakpointChanged in interface org.eclipse.debug.core.IBreakpointListener

canDisconnect

public boolean canDisconnect()
Specified by:
canDisconnect in interface org.eclipse.debug.core.model.IDisconnect

disconnect

public void disconnect()
                throws org.eclipse.debug.core.DebugException
Specified by:
disconnect in interface org.eclipse.debug.core.model.IDisconnect
Throws:
org.eclipse.debug.core.DebugException

isDisconnected

public boolean isDisconnected()
Specified by:
isDisconnected in interface org.eclipse.debug.core.model.IDisconnect

supportsStorageRetrieval

public boolean supportsStorageRetrieval()
Specified by:
supportsStorageRetrieval in interface org.eclipse.debug.core.model.IMemoryBlockRetrieval

getMemoryBlock

public org.eclipse.debug.core.model.IMemoryBlock getMemoryBlock(long startAddress,
                                                                long length)
                                                         throws org.eclipse.debug.core.DebugException
Specified by:
getMemoryBlock in interface org.eclipse.debug.core.model.IMemoryBlockRetrieval
Throws:
org.eclipse.debug.core.DebugException

getDataStack

public org.eclipse.debug.core.model.IValue[] getDataStack()
                                                   throws org.eclipse.debug.core.DebugException
Returns the values on the data stack (top down)

Returns:
the values on the data stack (top down)
Throws:
org.eclipse.debug.core.DebugException

logAvailableData

public void logAvailableData()
                      throws java.io.IOException
Throws:
java.io.IOException

sendRequest

public java.lang.String sendRequest(java.lang.String request)
                             throws org.eclipse.debug.core.DebugException
Description copied from class: PVXDebugElement
Sends a request to the PDA interprettor, waits for and returns the reply.

Interprettor commands and replies are as follows:

Overrides:
sendRequest in class PVXDebugElement
Parameters:
request - command
Returns:
reply
Throws:
org.eclipse.debug.core.DebugException - if the request fails

breakpointManagerEnablementChanged

public void breakpointManagerEnablementChanged(boolean enabled)
When the breakpoint manager disables, remove all registered breakpoints requests from the VM. When it enables, reinstall them.

Specified by:
breakpointManagerEnablementChanged in interface org.eclipse.debug.core.IBreakpointManagerListener

canPop

public boolean canPop()
Returns whether popping the data stack is currently permitted

Returns:
whether popping the data stack is currently permitted

pop

public org.eclipse.debug.core.model.IValue pop()
                                        throws org.eclipse.debug.core.DebugException
Pops and returns the top of the data stack

Returns:
the top value on the stack
Throws:
org.eclipse.debug.core.DebugException - if the stack is empty or the request fails

canPush

public boolean canPush()
Returns whether pushing a value is currently supported.

Returns:
whether pushing a value is currently supported

push

public void push(java.lang.String value)
          throws org.eclipse.debug.core.DebugException
Pushes a value onto the stack.

Parameters:
value - value to push
Throws:
org.eclipse.debug.core.DebugException - on failure

handleEvent

public void handleEvent(java.lang.String event)
Description copied from interface: IPVXEventListener
Notification the given event occurred in the target program being interpretted.

Specified by:
handleEvent in interface IPVXEventListener
Parameters:
event - the event