Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model')
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java98
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java152
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java68
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java356
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java60
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java6
7 files changed, 378 insertions, 378 deletions
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
index 37fbc949d..338de32e8 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
@@ -45,50 +45,50 @@ public class PDADebugElement extends DebugElement {
}
/**
- * Sends a request to the PDA interpreter, waits for and returns the reply.
- *
- * @param request command
- * @return reply
- * @throws DebugException if the request fails
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASuspendCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAResumeCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStepCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDADropFrameCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetBreakpointCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAClearBreakpointCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDADataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetDataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAPopDataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAPushDataCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEvalCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackDepthCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAFrameCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetVarCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVarCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAChildrenCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAGroupsCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDARegistersCommand
- *
- * @since 3.5
- */
+ * Sends a request to the PDA interpreter, waits for and returns the reply.
+ *
+ * @param request command
+ * @return reply
+ * @throws DebugException if the request fails
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASuspendCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAResumeCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAStepCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDADropFrameCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASetBreakpointCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAClearBreakpointCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDADataCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASetDataCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAPopDataCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAPushDataCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAEvalCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackDepthCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAFrameCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASetVarCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAVarCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAChildrenCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAGroupsCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDARegistersCommand
+ *
+ * @since 3.5
+ */
public PDACommandResult sendCommand(PDACommand command) throws DebugException {
- return getPDADebugTarget().sendCommand(command);
- }
+ return getPDADebugTarget().sendCommand(command);
+ }
/**
* Returns the debug target as a PDA target.
@@ -96,15 +96,15 @@ public class PDADebugElement extends DebugElement {
* @return PDA debug target
*/
protected PDADebugTarget getPDADebugTarget() {
- return (PDADebugTarget) getDebugTarget();
+ return (PDADebugTarget) getDebugTarget();
}
/**
* Returns the breakpoint manager
*
- * @return the breakpoint manager
- */
- protected IBreakpointManager getBreakpointManager() {
- return DebugPlugin.getDefault().getBreakpointManager();
- }
+ * @return the breakpoint manager
+ */
+ protected IBreakpointManager getBreakpointManager() {
+ return DebugPlugin.getDefault().getBreakpointManager();
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
index daf2a0709..9685b6f6e 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
@@ -117,15 +117,15 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
try {
message = fEventReader.readLine();
if (message != null) {
- PDAEvent event = null;
- try {
- event = PDAEvent.parseEvent(message);
- }
- catch (IllegalArgumentException e) {
- DebugCorePlugin.getDefault().getLog().log(
- new Status (IStatus.ERROR, "org.eclipse.debug.examples.core", "Error parsing PDA event", e)); //$NON-NLS-1$ //$NON-NLS-2$
- continue;
- }
+ PDAEvent event = null;
+ try {
+ event = PDAEvent.parseEvent(message);
+ }
+ catch (IllegalArgumentException e) {
+ DebugCorePlugin.getDefault().getLog().log(
+ new Status (IStatus.ERROR, "org.eclipse.debug.examples.core", "Error parsing PDA event", e)); //$NON-NLS-1$ //$NON-NLS-2$
+ continue;
+ }
Object[] listeners = fEventListeners.toArray();
for (int i = 0; i < listeners.length; i++) {
((IPDAEventListener)listeners[i]).handleEvent(event);
@@ -148,11 +148,11 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* @param listener event listener
*/
public void addEventListener(IPDAEventListener listener) {
- synchronized(fEventListeners) {
- if (!fEventListeners.contains(listener)) {
- fEventListeners.add(listener);
- }
- }
+ synchronized(fEventListeners) {
+ if (!fEventListeners.contains(listener)) {
+ fEventListeners.add(listener);
+ }
+ }
}
/**
@@ -204,12 +204,12 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
fEventDispatch = new EventDispatchJob();
fEventDispatch.schedule();
IBreakpointManager breakpointManager = getBreakpointManager();
- breakpointManager.addBreakpointListener(this);
+ breakpointManager.addBreakpointListener(this);
breakpointManager.addBreakpointManagerListener(this);
// initialize error hanlding to suspend on 'unimplemented instructions'
// and 'no such label' errors
sendCommand(new PDAEventStopCommand(PDAEventStopCommand.UNIMPINSTR, true));
- sendCommand(new PDAEventStopCommand(PDAEventStopCommand.NOSUCHLABEL, true));
+ sendCommand(new PDAEventStopCommand(PDAEventStopCommand.NOSUCHLABEL, true));
}
@Override
@@ -218,9 +218,9 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
@Override
public IThread[] getThreads() throws DebugException {
- synchronized (fThreads) {
- return fThreads.values().toArray(new IThread[fThreads.size()]);
- }
+ synchronized (fThreads) {
+ return fThreads.values().toArray(new IThread[fThreads.size()]);
+ }
}
@Override
public boolean hasThreads() throws DebugException {
@@ -282,7 +282,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
//#ifdef ex2
//# // TODO: Exercise 2 - send termination request to interpreter
//#else
- sendCommand(new PDATerminateCommand());
+ sendCommand(new PDATerminateCommand());
//#endif
}
@@ -303,12 +303,12 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
@Override
public void resume() throws DebugException {
- sendCommand(new PDAVMResumeCommand());
+ sendCommand(new PDAVMResumeCommand());
}
@Override
public void suspend() throws DebugException {
- sendCommand(new PDAVMSuspendCommand());
+ sendCommand(new PDAVMSuspendCommand());
}
@Override
@@ -317,7 +317,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
try {
if ((breakpoint.isEnabled() && getBreakpointManager().isEnabled()) || !breakpoint.isRegistered()) {
PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
- pdaBreakpoint.install(this);
+ pdaBreakpoint.install(this);
}
} catch (CoreException e) {
}
@@ -328,7 +328,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
- PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
+ PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
pdaBreakpoint.remove(this);
} catch (CoreException e) {
}
@@ -405,58 +405,58 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
setTerminated(true);
fThreads.clear();
IBreakpointManager breakpointManager = getBreakpointManager();
- breakpointManager.removeBreakpointListener(this);
+ breakpointManager.removeBreakpointListener(this);
breakpointManager.removeBreakpointManagerListener(this);
fireTerminateEvent();
removeEventListener(this);
}
private void vmResumed(PDAVMResumedEvent event) {
- setVMSuspended(false);
- fireResumeEvent(calcDetail(event.fReason));
+ setVMSuspended(false);
+ fireResumeEvent(calcDetail(event.fReason));
}
private void vmSuspended(PDAVMSuspendedEvent event) {
- setVMSuspended(true);
- fireSuspendEvent(calcDetail(event.fReason));
+ setVMSuspended(true);
+ fireSuspendEvent(calcDetail(event.fReason));
}
private int calcDetail(String reason) {
- if (reason.equals("breakpoint") || reason.equals("watch")) { //$NON-NLS-1$ //$NON-NLS-2$
- return DebugEvent.BREAKPOINT;
- } else if (reason.equals("step")) { //$NON-NLS-1$
- return DebugEvent.STEP_OVER;
- } else if (reason.equals("drop")) { //$NON-NLS-1$
- return DebugEvent.STEP_RETURN;
- } else if (reason.equals("client")) { //$NON-NLS-1$
- return DebugEvent.CLIENT_REQUEST;
- } else if (reason.equals("event")) { //$NON-NLS-1$
- return DebugEvent.BREAKPOINT;
- } else {
- return DebugEvent.UNSPECIFIED;
- }
+ if (reason.equals("breakpoint") || reason.equals("watch")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return DebugEvent.BREAKPOINT;
+ } else if (reason.equals("step")) { //$NON-NLS-1$
+ return DebugEvent.STEP_OVER;
+ } else if (reason.equals("drop")) { //$NON-NLS-1$
+ return DebugEvent.STEP_RETURN;
+ } else if (reason.equals("client")) { //$NON-NLS-1$
+ return DebugEvent.CLIENT_REQUEST;
+ } else if (reason.equals("event")) { //$NON-NLS-1$
+ return DebugEvent.BREAKPOINT;
+ } else {
+ return DebugEvent.UNSPECIFIED;
+ }
}
private void started(PDAStartedEvent event) {
- PDAThread newThread = new PDAThread(this, event.fThreadId);
- fThreads.put(Integer.valueOf(event.fThreadId), newThread);
- newThread.start();
+ PDAThread newThread = new PDAThread(this, event.fThreadId);
+ fThreads.put(Integer.valueOf(event.fThreadId), newThread);
+ newThread.start();
}
private void exited(PDAExitedEvent event) {
- PDAThread thread = fThreads.remove(Integer.valueOf(event.fThreadId));
- if (thread != null) {
- thread.exit();
- }
+ PDAThread thread = fThreads.remove(Integer.valueOf(event.fThreadId));
+ if (thread != null) {
+ thread.exit();
+ }
}
private synchronized void setVMSuspended(boolean suspended) {
- fVMSuspended = suspended;
+ fVMSuspended = suspended;
}
- private synchronized void setTerminated(boolean terminated) {
- fTerminated = terminated;
- }
+ private synchronized void setTerminated(boolean terminated) {
+ fTerminated = terminated;
+ }
private String sendRequest(String request) throws DebugException {
synchronized (fRequestSocket) {
@@ -466,7 +466,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
// wait for reply
String retVal = fRequestReader.readLine();
if (retVal == null) {
- requestFailed("Request failed: " + request + ". Debugger connection closed.", null); //$NON-NLS-1$ //$NON-NLS-2$
+ requestFailed("Request failed: " + request + ". Debugger connection closed.", null); //$NON-NLS-1$ //$NON-NLS-2$
}
return retVal;
} catch (IOException e) {
@@ -479,8 +479,8 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
@Override
public PDACommandResult sendCommand(PDACommand command) throws DebugException {
- String response = sendRequest(command.getRequest());
- return command.createResult(response);
+ String response = sendRequest(command.getRequest());
+ return command.createResult(response);
}
/**
@@ -496,7 +496,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
} else {
breakpointRemoved(breakpoints[i], null);
}
- }
+ }
}
@Override
@@ -505,15 +505,15 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
started((PDAStartedEvent)event);
} else if (event instanceof PDAExitedEvent) {
exited((PDAExitedEvent)event);
- } else if (event instanceof PDAVMStartedEvent) {
- vmStarted((PDAVMStartedEvent)event);
+ } else if (event instanceof PDAVMStartedEvent) {
+ vmStarted((PDAVMStartedEvent)event);
} else if (event instanceof PDAVMTerminatedEvent) {
- vmTerminated();
- } else if (event instanceof PDAVMSuspendedEvent) {
- vmSuspended((PDAVMSuspendedEvent)event);
- } else if (event instanceof PDAVMResumedEvent) {
- vmResumed((PDAVMResumedEvent)event);
- }
+ vmTerminated();
+ } else if (event instanceof PDAVMSuspendedEvent) {
+ vmSuspended((PDAVMSuspendedEvent)event);
+ } else if (event instanceof PDAVMResumedEvent) {
+ vmResumed((PDAVMResumedEvent)event);
+ }
}
/**
@@ -526,15 +526,15 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* if terminated
*/
public PDAThread getThread(int threadId) {
- if (threadId > 0) {
- return fThreads.get(Integer.valueOf(threadId));
- } else {
- synchronized(fThreads) {
- if (fThreads.size() > 0) {
- return fThreads.values().iterator().next();
- }
- }
- }
+ if (threadId > 0) {
+ return fThreads.get(Integer.valueOf(threadId));
+ } else {
+ synchronized(fThreads) {
+ if (fThreads.size() > 0) {
+ return fThreads.values().iterator().next();
+ }
+ }
+ }
return null;
}
@@ -544,7 +544,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* @throws DebugException
*/
public void restart() throws DebugException {
- sendCommand(new PDARestartCommand());
- }
+ sendCommand(new PDARestartCommand());
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
index fdd7cde92..761ea8211 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
@@ -221,15 +221,15 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame {
return fId;
}
- /**
- * Returns the stack frame's thread's unique identifier
- *
- * @return this stack frame's thread's unique identifier
- *
- * @since 3.5
- */
+ /**
+ * Returns the stack frame's thread's unique identifier
+ *
+ * @return this stack frame's thread's unique identifier
+ *
+ * @since 3.5
+ */
protected int getThreadIdentifier() {
- return fThread.getIdentifier();
+ return fThread.getIdentifier();
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
index 6eda5867b..007c5c25b 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
@@ -24,17 +24,17 @@ import org.eclipse.debug.core.model.IVariable;
*/
public class PDAStackValue extends PDADebugElement implements IValue {
- final private PDAThread fThread;
- final private String fValue;
- final private int fIndex;
+ final private PDAThread fThread;
+ final private String fValue;
+ final private int fIndex;
- /**
- * Constructs a value that appears on the data stack
- *
- * @param target debug target
- * @param value value on the stack
- * @param index index on the stack
- */
+ /**
+ * Constructs a value that appears on the data stack
+ *
+ * @param target debug target
+ * @param value value on the stack
+ * @param index index on the stack
+ */
public PDAStackValue(PDAThread thread, String value, int index) {
super(thread.getDebugTarget());
fThread = thread;
@@ -43,43 +43,43 @@ public class PDAStackValue extends PDADebugElement implements IValue {
}
public PDAThread getThread() {
- return fThread;
+ return fThread;
}
- @Override
+ @Override
public String getValueString() throws DebugException {
- return fValue;
- }
+ return fValue;
+ }
- @Override
+ @Override
public boolean isAllocated() throws DebugException {
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public IVariable[] getVariables() throws DebugException {
- return new IVariable[0];
- }
+ return new IVariable[0];
+ }
- @Override
+ @Override
public boolean hasVariables() throws DebugException {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public String getReferenceTypeName() throws DebugException {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof PDAStackValue &&
- ((PDAStackValue)obj).fValue.equals(fValue) &&
- ((PDAStackValue)obj).fIndex == fIndex;
- }
+ return obj instanceof PDAStackValue &&
+ ((PDAStackValue)obj).fValue.equals(fValue) &&
+ ((PDAStackValue)obj).fIndex == fIndex;
+ }
- @Override
+ @Override
public int hashCode() {
- return super.hashCode() + fIndex;
- }
+ return super.hashCode() + fIndex;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
index 19913ecf7..b72fa1b18 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
@@ -50,10 +50,10 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
*/
public class PDAThread extends PDADebugElement implements IThread, IPDAEventListener {
- /**
- * ID of this thread as reported by PDA.
- */
- private final int fThreadId;
+ /**
+ * ID of this thread as reported by PDA.
+ */
+ private final int fThreadId;
/**
* Breakpoint this thread is suspended at or <code>null</code>
@@ -97,29 +97,29 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
* @since 3.5
*/
void start() {
- fireCreationEvent();
- getPDADebugTarget().addEventListener(this);
+ fireCreationEvent();
+ getPDADebugTarget().addEventListener(this);
}
- /**
- * Called by the debug target before the thread is removed.
- *
- * @since 3.5
- */
+ /**
+ * Called by the debug target before the thread is removed.
+ *
+ * @since 3.5
+ */
void exit() {
- getPDADebugTarget().removeEventListener(this);
- fireTerminateEvent();
+ getPDADebugTarget().removeEventListener(this);
+ fireTerminateEvent();
}
@Override
public IStackFrame[] getStackFrames() throws DebugException {
if (isSuspended()) {
- PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId));
- IStackFrame[] frames = new IStackFrame[result.fFrames.length];
- for (int i = 0; i < result.fFrames.length; i++) {
- frames[frames.length - i - 1] = new PDAStackFrame(this, result.fFrames[i], i);
+ PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId));
+ IStackFrame[] frames = new IStackFrame[result.fFrames.length];
+ for (int i = 0; i < result.fFrames.length; i++) {
+ frames[frames.length - i - 1] = new PDAStackFrame(this, result.fFrames[i], i);
}
- return frames;
+ return frames;
}
return new IStackFrame[0];
}
@@ -178,15 +178,15 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
@Override
public boolean isSuspended() {
- if (getDebugTarget().isTerminated()) {
- return false;
- }
- if (getDebugTarget().isSuspended()) {
- return true;
- }
- synchronized (this) {
- return fSuspended;
- }
+ if (getDebugTarget().isTerminated()) {
+ return false;
+ }
+ if (getDebugTarget().isSuspended()) {
+ return true;
+ }
+ synchronized (this) {
+ return fSuspended;
+ }
}
@Override
@@ -203,7 +203,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
//#ifdef ex2
//# // TODO: Exercise 2 - send suspend request to interpreter
//#else
- sendCommand(new PDASuspendCommand(fThreadId));
+ sendCommand(new PDASuspendCommand(fThreadId));
//#endif
}
@@ -252,7 +252,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
@Override
public void terminate() throws DebugException {
- getDebugTarget().terminate();
+ getDebugTarget().terminate();
}
/**
@@ -296,64 +296,64 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
@Override
public void handleEvent(PDAEvent _event) {
- if (_event instanceof PDARunControlEvent && fThreadId == ((PDARunControlEvent)_event).fThreadId) {
- PDARunControlEvent event = (PDARunControlEvent)_event;
- // clear previous state
- fBreakpoint = null;
- setStepping(false);
-
- // handle events
- if (event instanceof PDAResumedEvent || event instanceof PDAVMResumedEvent) {
- setSuspended(false);
- if ("step".equals(event.fReason)) { //$NON-NLS-1$
- setStepping(true);
- resumed(DebugEvent.STEP_OVER);
- //#ifdef ex2
- //# }
- //# // TODO: Exercise 2 - handle/fire "client" resume event
- //#else
- } else if ("client".equals(event.fReason)) { //$NON-NLS-1$
- resumed(DebugEvent.CLIENT_REQUEST);
- }
- //#endif
- //#ifdef ex5
- //# // TODO: Exercise 5 - handle start of drop event
- //#else
- else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
- resumed(DebugEvent.STEP_RETURN);
- }
- //#endif
- } else if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- setSuspended(true);
- //#ifdef ex2
- //# // TODO: Exercise 2 - handle/fire "client" suspend event
- //# if (event.endsWith("step")) {
- //# suspended(DebugEvent.STEP_END);
- //# } else if (event.startsWith("suspended event") && getError() != null) {
- //# exceptionHit();
- //# }
- //#else
- if ("client".equals(event.fReason)) { //$NON-NLS-1$
- suspended(DebugEvent.CLIENT_REQUEST);
- } else if ("step".equals(event.fReason)) { //$NON-NLS-1$
- suspended(DebugEvent.STEP_END);
- } else if ("event".equals(event.fReason) && getError() != null) { //$NON-NLS-1$
- exceptionHit();
- }
- //#endif
- //#ifdef ex5
- //# // TODO: Exercise 5 - handle end of drop event
- //#else
- else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
- suspended(DebugEvent.STEP_END);
- }
- //#endif
- } else if (_event instanceof PDANoSuchLabelEvent ||
- _event instanceof PDAUnimplementedInstructionEvent)
- {
- setError(event.fMessage);
- }
- }
+ if (_event instanceof PDARunControlEvent && fThreadId == ((PDARunControlEvent)_event).fThreadId) {
+ PDARunControlEvent event = (PDARunControlEvent)_event;
+ // clear previous state
+ fBreakpoint = null;
+ setStepping(false);
+
+ // handle events
+ if (event instanceof PDAResumedEvent || event instanceof PDAVMResumedEvent) {
+ setSuspended(false);
+ if ("step".equals(event.fReason)) { //$NON-NLS-1$
+ setStepping(true);
+ resumed(DebugEvent.STEP_OVER);
+ //#ifdef ex2
+ //# }
+ //# // TODO: Exercise 2 - handle/fire "client" resume event
+ //#else
+ } else if ("client".equals(event.fReason)) { //$NON-NLS-1$
+ resumed(DebugEvent.CLIENT_REQUEST);
+ }
+ //#endif
+ //#ifdef ex5
+ //# // TODO: Exercise 5 - handle start of drop event
+ //#else
+ else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
+ resumed(DebugEvent.STEP_RETURN);
+ }
+ //#endif
+ } else if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
+ setSuspended(true);
+ //#ifdef ex2
+ //# // TODO: Exercise 2 - handle/fire "client" suspend event
+ //# if (event.endsWith("step")) {
+ //# suspended(DebugEvent.STEP_END);
+ //# } else if (event.startsWith("suspended event") && getError() != null) {
+ //# exceptionHit();
+ //# }
+ //#else
+ if ("client".equals(event.fReason)) { //$NON-NLS-1$
+ suspended(DebugEvent.CLIENT_REQUEST);
+ } else if ("step".equals(event.fReason)) { //$NON-NLS-1$
+ suspended(DebugEvent.STEP_END);
+ } else if ("event".equals(event.fReason) && getError() != null) { //$NON-NLS-1$
+ exceptionHit();
+ }
+ //#endif
+ //#ifdef ex5
+ //# // TODO: Exercise 5 - handle end of drop event
+ //#else
+ else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
+ suspended(DebugEvent.STEP_END);
+ }
+ //#endif
+ } else if (_event instanceof PDANoSuchLabelEvent ||
+ _event instanceof PDAUnimplementedInstructionEvent)
+ {
+ setError(event.fMessage);
+ }
+ }
}
/**
@@ -380,12 +380,12 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
}
/**
- * Notification an error was encountered. Fires a breakpoint
- * suspend event.
- */
- private void exceptionHit() {
- suspended(DebugEvent.BREAKPOINT);
- }
+ * Notification an error was encountered. Fires a breakpoint
+ * suspend event.
+ */
+ private void exceptionHit() {
+ suspended(DebugEvent.BREAKPOINT);
+ }
/**
* Sets the current variables for the given stack frame. Called
@@ -421,8 +421,8 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
* Pops the top frame off the callstack.
*
* @throws DebugException
- *
- * @since 3.5
+ *
+ * @since 3.5
*/
public void popFrame() throws DebugException {
//#ifdef ex5
@@ -451,89 +451,89 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
return false;
}
- /**
- * Returns the values on the data stack (top down)
- *
- * @return the values on the data stack (top down)
- *
- * @since 3.5
- */
- public IValue[] getDataStack() throws DebugException {
- PDAListResult result = (PDAListResult)sendCommand(new PDADataCommand(fThreadId));
- if (result.fValues.length > 0) {
- IValue[] values = new IValue[result.fValues.length];
- for (int i = 0; i < result.fValues.length; i++) {
- values[values.length - i - 1] = new PDAStackValue(this, result.fValues[i], i);
- }
- return values;
- }
- return new IValue[0];
- }
-
- /**
- * Returns whether popping the data stack is currently permitted
- *
- * @return whether popping the data stack is currently permitted
- *
- * @since 3.5
- */
- public boolean canPopData() {
- try {
- return !isTerminated() && isSuspended() && getDataStack().length > 0;
- } catch (DebugException e) {
- }
- return false;
- }
-
- /**
- * Pops and returns the top of the data stack
- *
- * @return the top value on the stack
- * @throws DebugException if the stack is empty or the request fails
- *
- * @since 3.5
- */
- public IValue popData() throws DebugException {
- IValue[] dataStack = getDataStack();
- if (dataStack.length > 0) {
- sendCommand(new PDAPopDataCommand(fThreadId));
- return dataStack[0];
- }
- requestFailed("Empty stack", null); //$NON-NLS-1$
- return null;
- }
-
- /**
- * Returns whether pushing a value is currently supported.
- *
- * @return whether pushing a value is currently supported
- *
- * @since 3.5
- */
- public boolean canPushData() {
- return !isTerminated() && isSuspended();
- }
-
- /**
- * Pushes a value onto the stack.
- *
- * @param value value to push
- * @throws DebugException on failure
- *
- * @since 3.5
- */
- public void pushData(String value) throws DebugException {
- sendCommand(new PDAPushDataCommand(fThreadId, value));
- }
-
- /**
- * Returns this thread's unique identifier
- *
- * @return this thread's unique identifier
- *
- * @since 3.5
- */
+ /**
+ * Returns the values on the data stack (top down)
+ *
+ * @return the values on the data stack (top down)
+ *
+ * @since 3.5
+ */
+ public IValue[] getDataStack() throws DebugException {
+ PDAListResult result = (PDAListResult)sendCommand(new PDADataCommand(fThreadId));
+ if (result.fValues.length > 0) {
+ IValue[] values = new IValue[result.fValues.length];
+ for (int i = 0; i < result.fValues.length; i++) {
+ values[values.length - i - 1] = new PDAStackValue(this, result.fValues[i], i);
+ }
+ return values;
+ }
+ return new IValue[0];
+ }
+
+ /**
+ * Returns whether popping the data stack is currently permitted
+ *
+ * @return whether popping the data stack is currently permitted
+ *
+ * @since 3.5
+ */
+ public boolean canPopData() {
+ try {
+ return !isTerminated() && isSuspended() && getDataStack().length > 0;
+ } catch (DebugException e) {
+ }
+ return false;
+ }
+
+ /**
+ * Pops and returns the top of the data stack
+ *
+ * @return the top value on the stack
+ * @throws DebugException if the stack is empty or the request fails
+ *
+ * @since 3.5
+ */
+ public IValue popData() throws DebugException {
+ IValue[] dataStack = getDataStack();
+ if (dataStack.length > 0) {
+ sendCommand(new PDAPopDataCommand(fThreadId));
+ return dataStack[0];
+ }
+ requestFailed("Empty stack", null); //$NON-NLS-1$
+ return null;
+ }
+
+ /**
+ * Returns whether pushing a value is currently supported.
+ *
+ * @return whether pushing a value is currently supported
+ *
+ * @since 3.5
+ */
+ public boolean canPushData() {
+ return !isTerminated() && isSuspended();
+ }
+
+ /**
+ * Pushes a value onto the stack.
+ *
+ * @param value value to push
+ * @throws DebugException on failure
+ *
+ * @since 3.5
+ */
+ public void pushData(String value) throws DebugException {
+ sendCommand(new PDAPushDataCommand(fThreadId, value));
+ }
+
+ /**
+ * Returns this thread's unique identifier
+ *
+ * @return this thread's unique identifier
+ *
+ * @since 3.5
+ */
public int getIdentifier() {
- return fThreadId;
+ return fThreadId;
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
index 24a8ef402..fe1452c4c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
@@ -26,7 +26,7 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAListResult;
*/
public class PDAValue extends PDADebugElement implements IValue {
- final private PDAVariable fVariable;
+ final private PDAVariable fVariable;
final private String fValue;
public PDAValue(PDAVariable variable, String value) {
@@ -57,46 +57,46 @@ public class PDAValue extends PDADebugElement implements IValue {
@Override
public IVariable[] getVariables() throws DebugException {
- PDAStackFrame frame = fVariable.getStackFrame();
- PDAListResult result = (PDAListResult) sendCommand(
- new PDAChildrenCommand(frame.getThreadIdentifier(), frame.getIdentifier(), fVariable.getName()) );
+ PDAStackFrame frame = fVariable.getStackFrame();
+ PDAListResult result = (PDAListResult) sendCommand(
+ new PDAChildrenCommand(frame.getThreadIdentifier(), frame.getIdentifier(), fVariable.getName()) );
- IVariable[] children = new IVariable[result.fValues.length];
- for(int i = 0; i < result.fValues.length; i++) {
- children[i] = new PDAVariable(frame, result.fValues[i]);
- }
+ IVariable[] children = new IVariable[result.fValues.length];
+ for(int i = 0; i < result.fValues.length; i++) {
+ children[i] = new PDAVariable(frame, result.fValues[i]);
+ }
return children;
}
@Override
public boolean hasVariables() throws DebugException {
- if (getVariables().length != 0) {
- return true;
- }
- // Value with multiple words can be show as an array using logical
- // structures. If the value has multiple words, it needs to indicate
- // that it has children even if logical structures are not turned on.
+ if (getVariables().length != 0) {
+ return true;
+ }
+ // Value with multiple words can be show as an array using logical
+ // structures. If the value has multiple words, it needs to indicate
+ // that it has children even if logical structures are not turned on.
return fValue.split("\\W+").length > 1; //$NON-NLS-1$
}
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue);
- }
+ return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue);
+ }
- @Override
+ @Override
public int hashCode() {
- return fValue.hashCode();
- }
+ return fValue.hashCode();
+ }
- /**
- * Returns the variable that this value was created for.
- *
- * @return The variable that this value was created for.
- *
- * @since 3.5
- */
- public PDAVariable getVariable() {
- return fVariable;
- }
+ /**
+ * Returns the variable that this value was created for.
+ *
+ * @return The variable that this value was created for.
+ *
+ * @since 3.5
+ */
+ public PDAVariable getVariable() {
+ return fVariable;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
index afe1d7f9c..4db49c209 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
@@ -49,7 +49,7 @@ public class PDAVariable extends PDADebugElement implements IVariable {
@Override
public IValue getValue() throws DebugException {
PDACommandResult result = sendCommand(new PDAVarCommand(
- fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName()));
+ fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName()));
return new PDAValue(this, result.fResponseText);
}
@@ -70,8 +70,8 @@ public class PDAVariable extends PDADebugElement implements IVariable {
@Override
public void setValue(String expression) throws DebugException {
- sendCommand(new PDASetVarCommand(
- fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression));
+ sendCommand(new PDASetVarCommand(
+ fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression));
fireChangeEvent(DebugEvent.CONTENT);
}

Back to the top