Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2013-07-31 16:44:16 +0000
committerMike Rennie2013-07-31 16:44:16 +0000
commitd975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch)
treec7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.debug.examples.core
parent4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff)
downloadeclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz
eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz
eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.debug.examples.core')
-rw-r--r--org.eclipse.debug.examples.core/.classpath4
-rw-r--r--org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs40
-rw-r--r--org.eclipse.debug.examples.core/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java460
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java4
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java1
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java8
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java4
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java4
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java22
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java46
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java9
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java1
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java135
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java5
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java26
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java21
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java158
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java11
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java9
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java14
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java17
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java14
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java14
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java3
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java1
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java1
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java1
-rw-r--r--org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java65
66 files changed, 750 insertions, 488 deletions
diff --git a/org.eclipse.debug.examples.core/.classpath b/org.eclipse.debug.examples.core/.classpath
index 9f8cf0e63..d97c2f508 100644
--- a/org.eclipse.debug.examples.core/.classpath
+++ b/org.eclipse.debug.examples.core/.classpath
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src_ant"/>
<classpathentry kind="src" path="pdavm/src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
index 5d7a22fe3..74c3aeb02 100644
--- a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
@@ -14,17 +14,17 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -33,9 +33,9 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
@@ -53,10 +53,10 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
@@ -65,7 +65,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
@@ -78,11 +78,11 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
@@ -91,18 +91,18 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
@@ -119,9 +119,9 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
diff --git a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
index d6aa25d24..8445dae1c 100644
--- a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
@@ -6,9 +6,9 @@ Bundle-Version: 1.3.300.qualifier
Bundle-Activator: org.eclipse.debug.examples.core.pda.DebugCorePlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.core.variables,
- org.eclipse.debug.core,
- org.apache.ant;bundle-version="1.7.0";resolution:=optional
+ org.eclipse.core.variables;bundle-version="3.2.800",
+ org.eclipse.debug.core;bundle-version="3.9.0",
+ org.apache.ant;bundle-version="1.9.2";resolution:=optional
Eclipse-LazyStart: true
Export-Package: org.eclipse.debug.examples.ant.tasks;x-friends:="org.eclipse.debug.examples.ui",
org.eclipse.debug.examples.core.midi.launcher;x-friends:="org.eclipse.debug.examples.ui",
@@ -19,5 +19,5 @@ Export-Package: org.eclipse.debug.examples.ant.tasks;x-friends:="org.eclipse.deb
org.eclipse.debug.examples.core.pda.protocol;x-friends:="org.eclipse.debug.examples.ui",
org.eclipse.debug.examples.core.pda.sourcelookup;x-friends:="org.eclipse.debug.examples.ui",
org.eclipse.debug.examples.pdavm;x-friends:="org.eclipse.debug.examples.ui"
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
index 06e9d2f36..195d902bd 100644
--- a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
+++ b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bjorn Freeman-Benson - initial API and implementation
* Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.regex.Matcher;
@@ -35,46 +36,48 @@ import java.util.regex.Pattern;
/**
* Push Down Automata interpreter.
- *
+ *
* @since 3.5
*/
public class PDAVirtualMachine {
- static class Stack extends LinkedList {
+ static class Stack extends LinkedList<Object> {
private static final long serialVersionUID = 1L;
- public Object pop() {
+ @Override
+ public Object pop() {
return isEmpty() ? new Integer(0) : remove(size() - 1);
}
- public void push(Object value) {
+ @Override
+ public void push(Object value) {
add(value);
}
}
-
+
static class Register {
- Register(String name) {
- fName = name;
+ Register(String name) {
+ fName = name;
}
String fName;
String fGroup = "<no_group>"; //$NON-NLS-1$
boolean fIsWriteable = true;
- Map fBitFields = new LinkedHashMap(0);
+ Map<String, BitField> fBitFields = new LinkedHashMap<String, BitField>(0);
int fValue;
}
static class BitField {
- BitField(String name) {
- fName = name;
+ BitField(String name) {
+ fName = name;
}
String fName;
int fBitOffset;
int fBitCount;
- Map fMnemonics = new LinkedHashMap(0);
+ Map<String, Integer> fMnemonics = new LinkedHashMap<String, Integer>(0);
}
- Map fRegisters = new LinkedHashMap(0);
-
+ Map<String, Register> fRegisters = new LinkedHashMap<String, Register>(0);
+
class Args {
final String[] fArgs;
@@ -87,7 +90,7 @@ public class PDAVirtualMachine {
boolean hasNextArg() {
return fArgs.length > next;
}
-
+
String getNextStringArg() {
if (fArgs.length > next) {
return fArgs[next++];
@@ -124,7 +127,7 @@ public class PDAVirtualMachine {
PDAThread getThreadArg() {
int id = getNextIntArg();
- return (PDAThread)fThreads.get( new Integer(id) );
+ return fThreads.get( new Integer(id) );
}
}
@@ -141,10 +144,10 @@ public class PDAVirtualMachine {
String[] fThreadCode;
/** PDAThread copy of the labels. */
- Map fThreadLabels;
+ Map<String, Integer> fThreadLabels;
/** The stack of stack frames (the control stack) */
- final List fFrames = new LinkedList();
+ final List<Frame> fFrames = new LinkedList<Frame>();
/** Current stack frame (not includced in fFrames) */
Frame fCurrentFrame;
@@ -160,11 +163,11 @@ public class PDAVirtualMachine {
boolean fStep = false;
boolean fStepReturn = false;
-
+
int fSavedPC;
boolean fPerformingEval = false;
-
+
PDAThread(int id, String function, int pc) {
fID = id;
fCurrentFrame = new Frame(function, pc);
@@ -173,7 +176,7 @@ public class PDAVirtualMachine {
}
}
- final Map fThreads = new LinkedHashMap();
+ final Map<Integer, PDAThread> fThreads = new LinkedHashMap<Integer, PDAThread>();
int fNextThreadId = 1;
@@ -185,12 +188,12 @@ public class PDAVirtualMachine {
final String[] fCode;
/** A mapping of labels to indicies in the code array */
- final Map fLabels;
+ final Map<String, Integer> fLabels;
/** Each stack frame is a mapping of variable names to values. */
class Frame {
- final Map fLocalVariables = new LinkedHashMap();
-
+ final Map<String, Object> fLocalVariables = new LinkedHashMap<String, Object>();
+
/**
* The name of the function in this frame
*/
@@ -206,7 +209,7 @@ public class PDAVirtualMachine {
fFunction = function;
fPC = pc;
}
-
+
void set(String name, Object value) {
if (name.startsWith("$")) { //$NON-NLS-1$
setRegisterValue(name, value);
@@ -214,31 +217,35 @@ public class PDAVirtualMachine {
fLocalVariables.put(name, value);
}
}
-
+
Object get(String name) {
if (name.startsWith("$")) { //$NON-NLS-1$
return getRegisterValue(name);
- } else {
+ } else {
return fLocalVariables.get(name);
}
}
}
void setRegisterValue(String name, Object value) {
- Register reg = (Register)fRegisters.get(getRegisterPartOfName(name));
- if (reg == null) return;
+ Register reg = fRegisters.get(getRegisterPartOfName(name));
+ if (reg == null) {
+ return;
+ }
String bitFieldName = getBitFieldPartOfName(name);
if (bitFieldName != null) {
- BitField bitField = (BitField)reg.fBitFields.get(bitFieldName);
- if (bitField == null) return;
+ BitField bitField = reg.fBitFields.get(bitFieldName);
+ if (bitField == null) {
+ return;
+ }
Integer intValue = null;
if (value instanceof Integer) {
intValue = (Integer)value;
} else if (value instanceof String) {
- intValue = (Integer)bitField.fMnemonics.get(value);
+ intValue = bitField.fMnemonics.get(value);
}
if (intValue != null) {
- int bitFieldMask = 2^(bitField.fBitCount - 1);
+ int bitFieldMask = 2^(bitField.fBitCount - 1);
int registerMask = ~(bitFieldMask << bitField.fBitOffset);
int bitFieldValue = intValue.intValue() & bitFieldMask;
reg.fValue = (reg.fValue & registerMask) | (bitFieldValue << bitField.fBitOffset);
@@ -249,25 +256,29 @@ public class PDAVirtualMachine {
}
Object getRegisterValue(String name) {
- Register reg = (Register)fRegisters.get(getRegisterPartOfName(name));
- if (reg == null) return null;
+ Register reg = fRegisters.get(getRegisterPartOfName(name));
+ if (reg == null) {
+ return null;
+ }
String bitFieldName = getBitFieldPartOfName(name);
if (bitFieldName != null) {
- BitField bitField = (BitField)reg.fBitFields.get(bitFieldName);
- if (bitField == null) return null;
- int bitFieldMask = 2^(bitField.fBitCount - 1);
+ BitField bitField = reg.fBitFields.get(bitFieldName);
+ if (bitField == null) {
+ return null;
+ }
+ int bitFieldMask = 2^(bitField.fBitCount - 1);
int registerMask = bitFieldMask << bitField.fBitOffset;
return new Integer( (reg.fValue & registerMask) >> bitField.fBitOffset );
} else {
return new Integer(reg.fValue);
}
}
-
+
/**
* Breakpoints are stored per each each line of code. The boolean indicates
* whether the whole VM should suspend or just the triggering thread.
*/
- final Map fBreakpoints = new HashMap();
+ final Map<Integer, Boolean> fBreakpoints = new HashMap<Integer, Boolean>();
/**
* The suspend flag is true if the VM should suspend running the program and
@@ -280,7 +291,7 @@ public class PDAVirtualMachine {
/** Flag indicating whether the debugger is performing a step return */
boolean fStepReturnVM = false;
-
+
int fSteppingThread = 0;
/** Name of the pda program being debugged */
@@ -313,7 +324,7 @@ public class PDAVirtualMachine {
OutputStream fEventStream;
/** The eventstops table holds which events cause suspends and which do not. */
- final Map fEventStops = new HashMap();
+ final Map<String, Boolean> fEventStops = new HashMap<String, Boolean>();
{
fEventStops.put("unimpinstr", Boolean.FALSE); //$NON-NLS-1$
fEventStops.put("nosuchlabel", Boolean.FALSE); //$NON-NLS-1$
@@ -323,13 +334,13 @@ public class PDAVirtualMachine {
* The watchpoints table holds watchpoint information.
* <p/>
* variablename_stackframedepth => N
- * <ul>
- * <li>N = 0 is no watch</li>
+ * <ul>
+ * <li>N = 0 is no watch</li>
* <li>N = 1 is read watch</li>
* <li>N = 2 is write watch</li>
* <li>N = 3 is both, etc.</li>
*/
- final Map fWatchpoints = new HashMap();
+ final Map<String, Integer> fWatchpoints = new HashMap<String, Integer>();
public static void main(String[] args) {
String programFile = args.length >= 1 ? args[0] : null;
@@ -378,7 +389,7 @@ public class PDAVirtualMachine {
// Load all the code into memory
FileReader fileReader = new FileReader(inputFile);
StringWriter stringWriter = new StringWriter();
- List code = new LinkedList();
+ List<String> code = new LinkedList<String>();
try {
int c = fileReader.read();
while (c != -1) {
@@ -395,7 +406,7 @@ public class PDAVirtualMachine {
fileReader.close();
}
code.add(stringWriter.toString().trim());
- fCode = (String[])code.toArray(new String[code.size()]);
+ fCode = code.toArray(new String[code.size()]);
fLabels = mapLabels(fCode);
@@ -407,8 +418,8 @@ public class PDAVirtualMachine {
/**
* Initializes the labels map
*/
- Map mapLabels(String[] code) {
- Map labels = new HashMap();
+ Map<String, Integer> mapLabels(String[] code) {
+ Map<String, Integer> labels = new HashMap<String, Integer>();
for (int i = 0; i < code.length; i++) {
if (code[i].length() != 0 && code[i].charAt(0) == ':') {
labels.put(code[i].substring(1), new Integer(i));
@@ -460,7 +471,7 @@ public class PDAVirtualMachine {
fSuspendVM = "client"; //$NON-NLS-1$
}
-
+
void run() {
int id = fNextThreadId++;
sendDebugEvent("vmstarted", false); //$NON-NLS-1$
@@ -472,7 +483,7 @@ public class PDAVirtualMachine {
boolean allThreadsSuspended = false;
while (!fThreads.isEmpty()) {
checkForBreakpoint();
-
+
if (fSuspendVM != null) {
debugUI();
} else {
@@ -483,13 +494,13 @@ public class PDAVirtualMachine {
}
}
- PDAThread[] threadsCopy = (PDAThread[])fThreads.values().toArray(new PDAThread[fThreads.size()]);
+ PDAThread[] threadsCopy = fThreads.values().toArray(new PDAThread[fThreads.size()]);
allThreadsSuspended = true;
for (int i = 0; i < threadsCopy.length; i++) {
PDAThread thread = threadsCopy[i];
if (thread.fSuspend == null) {
allThreadsSuspended = false;
-
+
String instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
thread.fCurrentFrame.fPC++;
doOneInstruction(thread, instruction);
@@ -498,10 +509,10 @@ public class PDAVirtualMachine {
thread.fRun = false;
} else if (thread.fStepReturn) {
// If this thread is in a step-return operation, check
- // if we've returned from a call.
+ // if we've returned from a call.
instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
if ("return".equals(instruction)) { //$NON-NLS-1$
- // Note: this will only be triggered if the current
+ // Note: this will only be triggered if the current
// thread also has the fStepReturn flag set.
if (fStepReturnVM) {
fSuspendVM = thread.fID + " step"; //$NON-NLS-1$
@@ -517,14 +528,14 @@ public class PDAVirtualMachine {
sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false); //$NON-NLS-1$ //$NON-NLS-2$
thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
}
- }
+ }
}
-
+
// Force thread context switch to avoid starving out other
// processes in the system.
Thread.yield();
}
-
+
sendDebugEvent("vmterminated", false); //$NON-NLS-1$
if (fDebug) {
try {
@@ -543,28 +554,42 @@ public class PDAVirtualMachine {
void doOneInstruction(PDAThread thread, String instr) {
StringTokenizer tokenizer = new StringTokenizer(instr);
String op = tokenizer.nextToken();
- List tokens = new LinkedList();
+ List<String> tokens = new LinkedList<String>();
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken());
}
- Args args = new Args( (String[])tokens.toArray(new String[tokens.size()]) );
+ Args args = new Args( tokens.toArray(new String[tokens.size()]) );
boolean opValid = true;
- if (op.equals("add")) iAdd(thread, args); //$NON-NLS-1$
- else if (op.equals("branch_not_zero")) iBranchNotZero(thread, args); //$NON-NLS-1$
- else if (op.equals("call")) iCall(thread, args); //$NON-NLS-1$
- else if (op.equals("dec")) iDec(thread, args); //$NON-NLS-1$
- else if (op.equals("def")) iDef(thread, args); //$NON-NLS-1$
- else if (op.equals("dup")) iDup(thread, args); //$NON-NLS-1$
- else if (op.equals("exec")) iExec(thread, args); //$NON-NLS-1$
- else if (op.equals("halt")) iHalt(thread, args); //$NON-NLS-1$
- else if (op.equals("output")) iOutput(thread, args); //$NON-NLS-1$
- else if (op.equals("pop")) iPop(thread, args); //$NON-NLS-1$
- else if (op.equals("push")) iPush(thread, args); //$NON-NLS-1$
- else if (op.equals("return")) iReturn(thread, args); //$NON-NLS-1$
- else if (op.equals("var")) iVar(thread, args); //$NON-NLS-1$
- else if (op.equals("xyzzy")) iInternalEndEval(thread, args); //$NON-NLS-1$
- else if (op.startsWith(":")) {} // label //$NON-NLS-1$
+ if (op.equals("add")) { //$NON-NLS-1$
+ iAdd(thread, args);
+ } else if (op.equals("branch_not_zero")) { //$NON-NLS-1$
+ iBranchNotZero(thread, args);
+ } else if (op.equals("call")) { //$NON-NLS-1$
+ iCall(thread, args);
+ } else if (op.equals("dec")) { //$NON-NLS-1$
+ iDec(thread, args);
+ } else if (op.equals("def")) { //$NON-NLS-1$
+ iDef(thread, args);
+ } else if (op.equals("dup")) { //$NON-NLS-1$
+ iDup(thread, args);
+ } else if (op.equals("exec")) { //$NON-NLS-1$
+ iExec(thread, args);
+ } else if (op.equals("halt")) { //$NON-NLS-1$
+ iHalt(thread, args);
+ } else if (op.equals("output")) { //$NON-NLS-1$
+ iOutput(thread, args);
+ } else if (op.equals("pop")) { //$NON-NLS-1$
+ iPop(thread, args);
+ } else if (op.equals("push")) { //$NON-NLS-1$
+ iPush(thread, args);
+ } else if (op.equals("return")) { //$NON-NLS-1$
+ iReturn(thread, args);
+ } else if (op.equals("var")) { //$NON-NLS-1$
+ iVar(thread, args);
+ } else if (op.equals("xyzzy")) { //$NON-NLS-1$
+ iInternalEndEval(thread, args);
+ } else if (op.startsWith(":")) {} // label //$NON-NLS-1$
else if (op.startsWith("#")) {} // comment //$NON-NLS-1$
else {
opValid = false;
@@ -572,7 +597,7 @@ public class PDAVirtualMachine {
if (!opValid) {
sendDebugEvent("unimplemented instruction " + op, true); //$NON-NLS-1$
- if ( ((Boolean)fEventStops.get("unimpinstr")).booleanValue() ) { //$NON-NLS-1$
+ if ( fEventStops.get("unimpinstr").booleanValue() ) { //$NON-NLS-1$
fSuspendVM = thread.fID + " event unimpinstr"; //$NON-NLS-1$
thread.fCurrentFrame.fPC--;
}
@@ -589,18 +614,18 @@ public class PDAVirtualMachine {
void checkForBreakpoint() {
if (fDebug) {
- for (Iterator itr = fThreads.values().iterator(); itr.hasNext();) {
- PDAThread thread = (PDAThread)itr.next();
+ for (Iterator<PDAThread> itr = fThreads.values().iterator(); itr.hasNext();) {
+ PDAThread thread = itr.next();
Integer pc = new Integer(thread.fCurrentFrame.fPC);
// Suspend for breakpoint if:
// - the VM is not yet set to suspend, for e.g. as a result of step end,
// - the thread is not yet suspended and is not performing an evaluation
// - the breakpoints table contains a breakpoint for the given line.
- if (fSuspendVM == null &&
- thread.fSuspend == null && !thread.fPerformingEval &&
- fBreakpoints.containsKey(pc))
+ if (fSuspendVM == null &&
+ thread.fSuspend == null && !thread.fPerformingEval &&
+ fBreakpoints.containsKey(pc))
{
- if ( ((Boolean)fBreakpoints.get(pc)).booleanValue() ) {
+ if ( fBreakpoints.get(pc).booleanValue() ) {
fSuspendVM = thread.fID + " breakpoint " + pc; //$NON-NLS-1$
} else {
thread.fSuspend = "breakpoint " + pc; //$NON-NLS-1$
@@ -644,12 +669,12 @@ public class PDAVirtualMachine {
// Clear all stepping flags. In case the VM suspended while
// a step operation was being performed for the VM or some thread.
fStepVM = fStepReturnVM = false;
- for (Iterator itr = fThreads.values().iterator(); itr.hasNext();) {
- PDAThread thread = (PDAThread)itr.next();
+ for (Iterator<PDAThread> itr = fThreads.values().iterator(); itr.hasNext();) {
+ PDAThread thread = itr.next();
thread.fSuspend = null;
thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
}
-
+
while (fSuspendVM != null) {
String line = ""; //$NON-NLS-1$
try {
@@ -676,41 +701,69 @@ public class PDAVirtualMachine {
}
String command = tokenizer.nextToken();
- List tokens = new LinkedList();
+ List<String> tokens = new LinkedList<String>();
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken());
}
- Args args = new Args( (String[])tokens.toArray(new String[tokens.size()]));
-
- if ("children".equals(command)) debugChildren(args); //$NON-NLS-1$
- else if ("clear".equals(command)) debugClearBreakpoint(args); //$NON-NLS-1$
- else if ("data".equals(command)) debugData(args); //$NON-NLS-1$
- else if ("drop".equals(command)) debugDropFrame(args); //$NON-NLS-1$
- else if ("eval".equals(command)) debugEval(args); //$NON-NLS-1$
- else if ("eventstop".equals(command)) debugEventStop(args); //$NON-NLS-1$
- else if ("frame".equals(command)) debugFrame(args); //$NON-NLS-1$
- else if ("groups".equals(command)) debugGroups(args); //$NON-NLS-1$
- else if ("popdata".equals(command)) debugPopData(args); //$NON-NLS-1$
- else if ("pushdata".equals(command)) debugPushData(args); //$NON-NLS-1$
- else if ("registers".equals(command)) debugRegisters(args); //$NON-NLS-1$
- else if ("restart".equals(command)) debugRestart(args); //$NON-NLS-1$
- else if ("resume".equals(command)) debugResume(args); //$NON-NLS-1$
- else if ("set".equals(command)) debugSetBreakpoint(args); //$NON-NLS-1$
- else if ("setdata".equals(command)) debugSetData(args); //$NON-NLS-1$
- else if ("setvar".equals(command)) debugSetVariable(args); //$NON-NLS-1$
- else if ("stack".equals(command)) debugStack(args); //$NON-NLS-1$
- else if ("stackdepth".equals(command)) debugStackDepth(args); //$NON-NLS-1$
- else if ("state".equals(command)) debugState(args); //$NON-NLS-1$
- else if ("step".equals(command)) debugStep(args); //$NON-NLS-1$
- else if ("stepreturn".equals(command)) debugStepReturn(args); //$NON-NLS-1$
- else if ("suspend".equals(command)) debugSuspend(args); //$NON-NLS-1$
- else if ("terminate".equals(command)) debugTerminate(); //$NON-NLS-1$
- else if ("threads".equals(command)) debugThreads(); //$NON-NLS-1$
- else if ("var".equals(command)) debugVar(args); //$NON-NLS-1$
- else if ("vmresume".equals(command)) debugVMResume(); //$NON-NLS-1$
- else if ("vmsuspend".equals(command)) debugVMSuspend(); //$NON-NLS-1$
- else if ("watch".equals(command)) debugWatch(args); //$NON-NLS-1$
- else {
+ Args args = new Args( tokens.toArray(new String[tokens.size()]));
+
+ if ("children".equals(command)) { //$NON-NLS-1$
+ debugChildren(args);
+ } else if ("clear".equals(command)) { //$NON-NLS-1$
+ debugClearBreakpoint(args);
+ } else if ("data".equals(command)) { //$NON-NLS-1$
+ debugData(args);
+ } else if ("drop".equals(command)) { //$NON-NLS-1$
+ debugDropFrame(args);
+ } else if ("eval".equals(command)) { //$NON-NLS-1$
+ debugEval(args);
+ } else if ("eventstop".equals(command)) { //$NON-NLS-1$
+ debugEventStop(args);
+ } else if ("frame".equals(command)) { //$NON-NLS-1$
+ debugFrame(args);
+ } else if ("groups".equals(command)) { //$NON-NLS-1$
+ debugGroups(args);
+ } else if ("popdata".equals(command)) { //$NON-NLS-1$
+ debugPopData(args);
+ } else if ("pushdata".equals(command)) { //$NON-NLS-1$
+ debugPushData(args);
+ } else if ("registers".equals(command)) { //$NON-NLS-1$
+ debugRegisters(args);
+ } else if ("restart".equals(command)) { //$NON-NLS-1$
+ debugRestart(args);
+ } else if ("resume".equals(command)) { //$NON-NLS-1$
+ debugResume(args);
+ } else if ("set".equals(command)) { //$NON-NLS-1$
+ debugSetBreakpoint(args);
+ } else if ("setdata".equals(command)) { //$NON-NLS-1$
+ debugSetData(args);
+ } else if ("setvar".equals(command)) { //$NON-NLS-1$
+ debugSetVariable(args);
+ } else if ("stack".equals(command)) { //$NON-NLS-1$
+ debugStack(args);
+ } else if ("stackdepth".equals(command)) { //$NON-NLS-1$
+ debugStackDepth(args);
+ } else if ("state".equals(command)) { //$NON-NLS-1$
+ debugState(args);
+ } else if ("step".equals(command)) { //$NON-NLS-1$
+ debugStep(args);
+ } else if ("stepreturn".equals(command)) { //$NON-NLS-1$
+ debugStepReturn(args);
+ } else if ("suspend".equals(command)) { //$NON-NLS-1$
+ debugSuspend(args);
+ } else if ("terminate".equals(command)) { //$NON-NLS-1$
+ debugTerminate();
+ } else if ("threads".equals(command)) { //$NON-NLS-1$
+ debugThreads();
+ } else if ("var".equals(command)) { //$NON-NLS-1$
+ debugVar(args);
+ } else if ("vmresume".equals(command)) { //$NON-NLS-1$
+ debugVMResume();
+ } else if ("vmsuspend".equals(command)) { //$NON-NLS-1$
+ debugVMSuspend();
+ } else if ("watch".equals(command)) { //$NON-NLS-1$
+ debugWatch(args);
+ } else {
sendCommandResponse("error: invalid command\n"); //$NON-NLS-1$
}
}
@@ -724,21 +777,21 @@ public class PDAVirtualMachine {
int sfnumber = args.getNextIntArg();
String var = args.getNextStringArg();
-
- Frame frame = sfnumber >= thread.fFrames.size()
+
+ Frame frame = sfnumber >= thread.fFrames.size()
? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
String varDot = var + "."; //$NON-NLS-1$
- List children = new ArrayList();
- for (Iterator itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
- String localVar = (String)itr.next();
+ List<String> children = new ArrayList<String>();
+ for (Iterator<String> itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
+ String localVar = itr.next();
if (localVar.startsWith(varDot) && localVar.indexOf('.', varDot.length() + 1) == -1) {
children.add(localVar);
}
}
StringBuffer result = new StringBuffer();
- for (Iterator itr = children.iterator(); itr.hasNext();) {
+ for (Iterator<String> itr = children.iterator(); itr.hasNext();) {
result.append(itr.next());
result.append('|');
}
@@ -746,7 +799,7 @@ public class PDAVirtualMachine {
sendCommandResponse(result.toString());
}
-
+
void debugClearBreakpoint(Args args) {
int line = args.getNextIntArg();
@@ -764,7 +817,7 @@ public class PDAVirtualMachine {
}
StringBuffer result = new StringBuffer();
- for (Iterator itr = thread.fStack.iterator(); itr.hasNext();) {
+ for (Iterator<?> itr = thread.fStack.iterator(); itr.hasNext();) {
result.append(itr.next());
result.append('|');
}
@@ -780,7 +833,7 @@ public class PDAVirtualMachine {
}
if (!thread.fFrames.isEmpty()) {
- thread.fCurrentFrame = (Frame)thread.fFrames.remove(thread.fFrames.size() - 1);
+ thread.fCurrentFrame = thread.fFrames.remove(thread.fFrames.size() - 1);
}
thread.fCurrentFrame.fPC--;
sendCommandResponse("ok\n"); //$NON-NLS-1$
@@ -798,18 +851,18 @@ public class PDAVirtualMachine {
sendCommandResponse("error: cannot evaluate while vm is suspended\n"); //$NON-NLS-1$
return;
}
-
+
PDAThread thread = args.getThreadArg();
if (thread == null) {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
}
-
+
if (thread.fSuspend == null) {
sendCommandResponse("error: thread running\n"); //$NON-NLS-1$
return;
}
-
+
StringTokenizer tokenizer = new StringTokenizer(args.getNextStringArg(), "|"); //$NON-NLS-1$
tokenizer.countTokens();
@@ -841,9 +894,9 @@ public class PDAVirtualMachine {
thread.fSavedPC = thread.fCurrentFrame.fPC;
thread.fCurrentFrame.fPC = fCode.length;
thread.fPerformingEval = true;
-
+
thread.fSuspend = null;
-
+
sendCommandResponse("ok\n"); //$NON-NLS-1$
sendDebugEvent("resumed " + thread.fID + " eval", false); //$NON-NLS-1$ //$NON-NLS-2$
@@ -874,7 +927,7 @@ public class PDAVirtualMachine {
if (sfnumber >= thread.fFrames.size()) {
frame = thread.fCurrentFrame;
} else {
- frame = (Frame)thread.fFrames.get(sfnumber);
+ frame = thread.fFrames.get(sfnumber);
}
sendCommandResponse(printFrame(frame) + "\n"); //$NON-NLS-1$
}
@@ -883,13 +936,13 @@ public class PDAVirtualMachine {
* @param args
*/
void debugGroups(Args args) {
- TreeSet groups = new TreeSet();
- for (Iterator itr = fRegisters.values().iterator(); itr.hasNext();) {
- Register reg = (Register)itr.next();
+ TreeSet<String> groups = new TreeSet<String>();
+ for (Iterator<Register> itr = fRegisters.values().iterator(); itr.hasNext();) {
+ Register reg = itr.next();
groups.add(reg.fGroup);
}
StringBuffer response = new StringBuffer();
- for (Iterator itr = groups.iterator(); itr.hasNext();) {
+ for (Iterator<String> itr = groups.iterator(); itr.hasNext();) {
response.append(itr.next());
response.append('|');
}
@@ -914,7 +967,7 @@ public class PDAVirtualMachine {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
}
-
+
Object val = args.getNextIntOrStringArg();
thread.fStack.push(val);
sendCommandResponse("ok\n"); //$NON-NLS-1$
@@ -922,16 +975,16 @@ public class PDAVirtualMachine {
void debugRegisters(Args args) {
String group = args.getNextStringArg();
-
+
StringBuffer response = new StringBuffer();
- for (Iterator itr = fRegisters.values().iterator(); itr.hasNext();) {
- Register reg = (Register)itr.next();
+ for (Iterator<Register> itr = fRegisters.values().iterator(); itr.hasNext();) {
+ Register reg = itr.next();
if (group.equals(reg.fGroup)) {
response.append(reg.fName);
response.append(' ');
response.append(reg.fIsWriteable);
- for (Iterator itr2 = reg.fBitFields.values().iterator(); itr2.hasNext();) {
- BitField bitField = (BitField)itr2.next();
+ for (Iterator<BitField> itr2 = reg.fBitFields.values().iterator(); itr2.hasNext();) {
+ BitField bitField = itr2.next();
response.append('|');
response.append(bitField.fName);
response.append(' ');
@@ -939,15 +992,15 @@ public class PDAVirtualMachine {
response.append(' ');
response.append(bitField.fBitCount);
response.append(' ');
- for (Iterator itr3 = bitField.fMnemonics.entrySet().iterator(); itr3.hasNext();) {
- Map.Entry mnemonicEntry = (Map.Entry)itr3.next();
+ for (Iterator<Entry<String, Integer>> itr3 = bitField.fMnemonics.entrySet().iterator(); itr3.hasNext();) {
+ Entry<String, Integer> mnemonicEntry = itr3.next();
response.append(mnemonicEntry.getKey());
response.append(' ');
response.append(mnemonicEntry.getValue());
response.append(' ');
}
}
-
+
response.append('#');
}
}
@@ -961,8 +1014,8 @@ public class PDAVirtualMachine {
void debugRestart(Args args) {
fSuspendVM = "restart"; //$NON-NLS-1$
- for (Iterator itr = fThreads.keySet().iterator(); itr.hasNext();) {
- Integer id = (Integer)itr.next();
+ for (Iterator<Integer> itr = fThreads.keySet().iterator(); itr.hasNext();) {
+ Integer id = itr.next();
sendDebugEvent("exited " + id, false); //$NON-NLS-1$
}
fThreads.clear();
@@ -970,9 +1023,9 @@ public class PDAVirtualMachine {
int id = fNextThreadId++;
fThreads.put(new Integer(id), new PDAThread(id, "main", 0)); //$NON-NLS-1$
sendDebugEvent("started " + id, false); //$NON-NLS-1$
-
+
fRegisters.clear();
-
+
sendCommandResponse("ok\n"); //$NON-NLS-1$
}
@@ -981,26 +1034,26 @@ public class PDAVirtualMachine {
if (thread == null) {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
- }
+ }
if (fSuspendVM != null) {
sendCommandResponse("error: cannot resume thread when vm is suspended\n"); //$NON-NLS-1$
return;
- }
+ }
if (thread.fSuspend == null) {
sendCommandResponse("error: thread already running\n"); //$NON-NLS-1$
return;
- }
-
+ }
+
thread.fSuspend = null;
sendDebugEvent("resumed " + thread.fID + " client", false); //$NON-NLS-1$ //$NON-NLS-2$
-
+
sendCommandResponse("ok\n"); //$NON-NLS-1$
}
void debugSetBreakpoint(Args args) {
int line = args.getNextIntArg();
int stopVM = args.getNextIntArg();
-
+
fBreakpoints.put(new Integer(line), new Boolean(stopVM != 0));
sendCommandResponse("ok\n"); //$NON-NLS-1$
}
@@ -1011,7 +1064,7 @@ public class PDAVirtualMachine {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
}
-
+
int offset = args.getNextIntArg();
Object val = args.getNextIntOrStringArg();
@@ -1036,11 +1089,11 @@ public class PDAVirtualMachine {
while (args.hasNextArg()) {
val = val.toString() + " " + args.getNextStringArg(); //$NON-NLS-1$
}
-
+
if (sfnumber >= thread.fFrames.size()) {
thread.fCurrentFrame.set(var, val);
} else {
- ((Frame)thread.fFrames.get(sfnumber)).set(var, val);
+ thread.fFrames.get(sfnumber).set(var, val);
}
sendCommandResponse("ok\n"); //$NON-NLS-1$
}
@@ -1053,9 +1106,9 @@ public class PDAVirtualMachine {
}
StringBuffer result = new StringBuffer();
-
- for (Iterator itr = thread.fFrames.iterator(); itr.hasNext();) {
- Frame frame = (Frame)itr.next();
+
+ for (Iterator<Frame> itr = thread.fFrames.iterator(); itr.hasNext();) {
+ Frame frame = itr.next();
result.append(printFrame(frame));
result.append('#');
}
@@ -1085,8 +1138,8 @@ public class PDAVirtualMachine {
buf.append(frame.fPC);
buf.append('|');
buf.append(frame.fFunction);
- for (Iterator itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
- String var = (String)itr.next();
+ for (Iterator<String> itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
+ String var = itr.next();
if (var.indexOf('.') == -1) {
buf.append('|');
buf.append(var);
@@ -1107,21 +1160,21 @@ public class PDAVirtualMachine {
}
sendCommandResponse(response + "\n"); //$NON-NLS-1$
}
-
+
void debugStep(Args args) {
PDAThread thread = args.getThreadArg();
if (thread == null) {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
- }
+ }
- // Set suspend to null to allow the debug loop to exit back to the
- // instruction loop and thus run an instruction. However, we want to
- // come back to the debug loop right away, so the step flag is set to
- // true which will cause the suspend flag to get set to true when we
+ // Set suspend to null to allow the debug loop to exit back to the
+ // instruction loop and thus run an instruction. However, we want to
+ // come back to the debug loop right away, so the step flag is set to
+ // true which will cause the suspend flag to get set to true when we
// get to the next instruction.
if (fSuspendVM != null) {
- // All threads are suspended, so suspend all threads again when
+ // All threads are suspended, so suspend all threads again when
// step completes.
fSuspendVM = null;
fStepVM = true;
@@ -1145,8 +1198,8 @@ public class PDAVirtualMachine {
if (thread == null) {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
- }
-
+ }
+
if (fSuspendVM != null) {
fSuspendVM = null;
fStepReturnVM = true;
@@ -1168,7 +1221,7 @@ public class PDAVirtualMachine {
if (thread == null) {
sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
return;
- }
+ }
if (fSuspendVM != null) {
sendCommandResponse("error: vm already suspended\n"); //$NON-NLS-1$
return;
@@ -1176,8 +1229,8 @@ public class PDAVirtualMachine {
if (thread.fSuspend != null) {
sendCommandResponse("error: thread already suspended\n"); //$NON-NLS-1$
return;
- }
-
+ }
+
thread.fSuspend = "client"; //$NON-NLS-1$
sendDebugEvent("suspended " + thread.fID + " client", false); //$NON-NLS-1$ //$NON-NLS-2$
sendCommandResponse("ok\n"); //$NON-NLS-1$
@@ -1185,7 +1238,7 @@ public class PDAVirtualMachine {
void debugThreads() {
StringBuffer response = new StringBuffer();
- for (Iterator itr = fThreads.keySet().iterator(); itr.hasNext();) {
+ for (Iterator<Integer> itr = fThreads.keySet().iterator(); itr.hasNext();) {
response.append(itr.next());
response.append(' ');
}
@@ -1202,9 +1255,9 @@ public class PDAVirtualMachine {
int sfnumber = args.getNextIntArg();
String var = args.getNextStringArg();
- Frame frame = sfnumber >= thread.fFrames.size()
+ Frame frame = sfnumber >= thread.fFrames.size()
? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
-
+
Object val = frame.get(var);
if (val == null) {
sendCommandResponse("error: variable undefined\n"); //$NON-NLS-1$
@@ -1217,7 +1270,7 @@ public class PDAVirtualMachine {
if (fSuspendVM == null) {
sendCommandResponse("error: vm already running\n"); //$NON-NLS-1$
return;
- }
+ }
fSuspendVM = null;
sendCommandResponse("ok\n"); //$NON-NLS-1$
@@ -1261,10 +1314,10 @@ public class PDAVirtualMachine {
if (val instanceof Integer && ((Integer) val).intValue() != 0) {
String label = args.getNextStringArg();
if (thread.fThreadLabels.containsKey(label)) {
- thread.fCurrentFrame.fPC = ((Integer)thread.fThreadLabels.get(label)).intValue();
+ thread.fCurrentFrame.fPC = thread.fThreadLabels.get(label).intValue();
} else {
sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
- if ( ((Boolean)fEventStops.get("nosuchlabel")).booleanValue() ) { //$NON-NLS-1$
+ if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
fSuspendVM = thread.fID + " event nosuchlabel"; //$NON-NLS-1$
thread.fStack.push(val);
thread.fCurrentFrame.fPC--;
@@ -1277,10 +1330,10 @@ public class PDAVirtualMachine {
String label = args.getNextStringArg();
if (thread.fThreadLabels.containsKey(label)) {
thread.fFrames.add(thread.fCurrentFrame);
- thread.fCurrentFrame = new Frame(label, ((Integer)thread.fThreadLabels.get(label)).intValue());
+ thread.fCurrentFrame = new Frame(label, thread.fThreadLabels.get(label).intValue());
} else {
sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
- if ( ((Boolean)fEventStops.get("nosuchlabel")).booleanValue() ) { //$NON-NLS-1$
+ if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
fSuspendVM = thread.fID + " event nosuchlabel"; //$NON-NLS-1$
thread.fCurrentFrame.fPC--;
}
@@ -1311,22 +1364,28 @@ public class PDAVirtualMachine {
String bitFieldName = getBitFieldPartOfName(name);
if ("register".equals(type)) { //$NON-NLS-1$
- Register reg = new Register(regName);
+ Register reg = new Register(regName);
reg.fGroup = args.getNextStringArg();
fRegisters.put(regName, reg);
reg.fIsWriteable = args.getNextBooleanArg();
} else if ("bitfield".equals(type)) { //$NON-NLS-1$
- Register reg = (Register)fRegisters.get(regName);
- if (reg == null) return;
+ Register reg = fRegisters.get(regName);
+ if (reg == null) {
+ return;
+ }
BitField bitField = new BitField(bitFieldName);
bitField.fBitOffset = args.getNextIntArg();
bitField.fBitCount = args.getNextIntArg();
reg.fBitFields.put(bitFieldName, bitField);
} else if ("mnemonic".equals(type)) { //$NON-NLS-1$
- Register reg = (Register)fRegisters.get(regName);
- if (reg == null) return;
- BitField bitField = (BitField)reg.fBitFields.get(bitFieldName);
- if (bitField == null) return;
+ Register reg = fRegisters.get(regName);
+ if (reg == null) {
+ return;
+ }
+ BitField bitField = reg.fBitFields.get(bitFieldName);
+ if (bitField == null) {
+ return;
+ }
bitField.fMnemonics.put(args.getNextStringArg(), new Integer(args.getNextIntArg()));
}
sendDebugEvent("registers", false); //$NON-NLS-1$
@@ -1346,7 +1405,7 @@ public class PDAVirtualMachine {
if (name.startsWith("$") && start != -1) { //$NON-NLS-1$
return name.substring(start + 1, name.length());
}
- return null;
+ return null;
}
/**
@@ -1358,16 +1417,16 @@ public class PDAVirtualMachine {
thread.fStack.push(val);
thread.fStack.push(val);
}
-
+
void iExec(PDAThread thread, Args args) {
String label = args.getNextStringArg();
if (fLabels.containsKey(label)) {
int id = fNextThreadId++;
- fThreads.put( new Integer(id), new PDAThread(id, label, ((Integer)fLabels.get(label)).intValue()) );
+ fThreads.put( new Integer(id), new PDAThread(id, label, fLabels.get(label).intValue()) );
sendDebugEvent("started " + id, false); //$NON-NLS-1$
} else {
sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
- if ( ((Boolean)fEventStops.get("nosuchlabel")).booleanValue() ) { //$NON-NLS-1$
+ if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
thread.fSuspend = "event nosuchlabel"; //$NON-NLS-1$
thread.fCurrentFrame.fPC--;
}
@@ -1396,7 +1455,7 @@ public class PDAVirtualMachine {
String var = arg.substring(1);
thread.fCurrentFrame.set(var, thread.fStack.pop());
String key = thread.fCurrentFrame.fFunction + "::" + var; //$NON-NLS-1$
- if ( fWatchpoints.containsKey(key) && (((Integer)fWatchpoints.get(key)).intValue() & 2) != 0 ) {
+ if ( fWatchpoints.containsKey(key) && (fWatchpoints.get(key).intValue() & 2) != 0 ) {
fSuspendVM = thread.fID + " watch write " + key; //$NON-NLS-1$
}
} else {
@@ -1410,10 +1469,13 @@ public class PDAVirtualMachine {
if (arg.startsWith("$")) { //$NON-NLS-1$
String var = arg.substring(1);
Object val = thread.fCurrentFrame.get(var);
- if (val == null) val = "<undefined>"; //$NON-NLS-1$
+ if (val == null)
+ {
+ val = "<undefined>"; //$NON-NLS-1$
+ }
thread.fStack.push(val);
String key = thread.fCurrentFrame.fFunction + "::" + var; //$NON-NLS-1$
- if (fWatchpoints.containsKey(key) && (((Integer)fWatchpoints.get(key)).intValue() & 1) != 0) {
+ if (fWatchpoints.containsKey(key) && (fWatchpoints.get(key).intValue() & 1) != 0) {
fSuspendVM = thread.fID + " watch read " + key; //$NON-NLS-1$
}
} else {
@@ -1430,7 +1492,7 @@ public class PDAVirtualMachine {
}
thread.fStack.push(val);
}
-
+
arg = args.getNextStringArg();
}
}
@@ -1441,7 +1503,7 @@ public class PDAVirtualMachine {
*/
void iReturn(PDAThread thread, Args args) {
if (!thread.fFrames.isEmpty()) {
- thread.fCurrentFrame = (Frame)thread.fFrames.remove(thread.fFrames.size() - 1);
+ thread.fCurrentFrame = thread.fFrames.remove(thread.fFrames.size() - 1);
} else {
// Execution returned from the top frame, which means this thread
// should exit.
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java
index f972867d8..242236705 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java
@@ -33,6 +33,7 @@ public class ClockControl extends TimeControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.TimeControl#getTimeValue()
*/
+ @Override
protected long getTimeValue() {
return getSequencer().getMicrosecondPosition();
}
@@ -40,6 +41,7 @@ public class ClockControl extends TimeControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable()
*/
+ @Override
public boolean isEditable() {
return true;
}
@@ -47,6 +49,7 @@ public class ClockControl extends TimeControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String)
*/
+ @Override
public IStatus setValue(String newValue) {
try {
long value = getLong(newValue);
@@ -61,6 +64,7 @@ public class ClockControl extends TimeControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String)
*/
+ @Override
public IStatus validateValue(String value) {
try {
getLong(value);
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java
index 01e63a6b9..3ab8d18c4 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java
@@ -28,6 +28,7 @@ public class LengthControl extends TimeControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.TimeControl#getTimeValue()
*/
+ @Override
protected long getTimeValue() {
return getSequencer().getMicrosecondLength();
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
index 75801ecea..674e2fc49 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
@@ -85,6 +85,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.Launch#canTerminate()
*/
+ @Override
public boolean canTerminate() {
return getSequencer().isOpen();
}
@@ -92,6 +93,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.Launch#isTerminated()
*/
+ @Override
public boolean isTerminated() {
if (fSequencer != null) {
return !fSequencer.isOpen();
@@ -102,6 +104,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.Launch#terminate()
*/
+ @Override
public void terminate() throws DebugException {
getSequencer().stop();
getSequencer().close();
@@ -112,6 +115,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
+ @Override
public boolean canResume() {
return isSuspended();
}
@@ -119,6 +123,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
+ @Override
public boolean canSuspend() {
if (fSequencer != null) {
return fSequencer.isRunning();
@@ -129,6 +134,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
+ @Override
public boolean isSuspended() {
if (fSequencer != null) {
return fSequencer.isOpen() & !fSequencer.isRunning();
@@ -139,6 +145,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
+ @Override
public void resume() throws DebugException {
getSequencer().start();
fireChanged();
@@ -148,6 +155,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
+ @Override
public void suspend() throws DebugException {
getSequencer().stop();
fireChanged();
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java
index fbd531236..65123a55c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java
@@ -67,6 +67,7 @@ public class MidiLaunchDelegate extends LaunchConfigurationDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
String excep = configuration.getAttribute(ATTR_THROW_EXCEPTION, (String)null);
if (excep != null) {
@@ -135,6 +136,7 @@ public class MidiLaunchDelegate extends LaunchConfigurationDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
*/
+ @Override
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
return new MidiLaunch(configuration, mode);
}
@@ -142,6 +144,7 @@ public class MidiLaunchDelegate extends LaunchConfigurationDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
return false;
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
index 3274582cc..c5b51ea6a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
@@ -113,6 +113,7 @@ public abstract class SequencerControl {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
if (obj != null) {
if (getClass().equals(obj.getClass())) {
@@ -126,6 +127,7 @@ public abstract class SequencerControl {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getSequencer().hashCode() + getClass().hashCode();
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
index 28def4594..2980adc83 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
@@ -33,6 +33,7 @@ public class TempoControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#getValue()
*/
+ @Override
public String getValue() {
float bpm = getSequencer().getTempoInBPM();
return Float.toString(bpm);
@@ -41,6 +42,7 @@ public class TempoControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable()
*/
+ @Override
public boolean isEditable() {
return getSequencer().isOpen();
}
@@ -48,6 +50,7 @@ public class TempoControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String)
*/
+ @Override
public IStatus setValue(String newValue) {
try {
float value = getFloat(newValue);
@@ -62,6 +65,7 @@ public class TempoControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String)
*/
+ @Override
public IStatus validateValue(String value) {
try {
getFloat(value);
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
index 93aa54df4..4bcb85ac6 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
@@ -33,6 +33,7 @@ public abstract class TimeControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#getValue()
*/
+ @Override
public String getValue() {
long position = getTimeValue();
int milli = (int) (position & 0x3F);
@@ -67,6 +68,7 @@ public abstract class TimeControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable()
*/
+ @Override
public boolean isEditable() {
return false;
}
@@ -74,6 +76,7 @@ public abstract class TimeControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String)
*/
+ @Override
public IStatus setValue(String newValue) {
return null;
}
@@ -81,6 +84,7 @@ public abstract class TimeControl extends SequencerControl {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String)
*/
+ @Override
public IStatus validateValue(String value) {
return null;
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java
index dbdb1fc85..759f1088a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java
@@ -71,6 +71,7 @@ public class DebugCorePlugin extends Plugin {
/**
* This method is called upon plug-in activation
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
@@ -78,6 +79,7 @@ public class DebugCorePlugin extends Plugin {
/**
* This method is called when the plug-in is stopped
*/
+ @Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
index 41d3a9074..325402c7f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
@@ -60,6 +60,7 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen
*/
public PDALineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$
setMarker(marker);
@@ -75,6 +76,7 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
*/
+ @Override
public String getModelIdentifier() {
return DebugCorePlugin.ID_PDA_DEBUG_MODEL;
}
@@ -174,6 +176,7 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen
*
* @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
*/
+ @Override
public void handleEvent(PDAEvent event) {
if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
PDARunControlEvent rcEvent = (PDARunControlEvent)event;
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
index 42705dd62..2d406d9d2 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
@@ -36,6 +36,7 @@ public class PDARunToLineBreakpoint extends PDALineBreakpoint {
*/
public PDARunToLineBreakpoint(final IFile resource, final int lineNumber) throws DebugException {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
// associate with workspace root to avoid drawing in editor ruler
IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$
@@ -55,6 +56,7 @@ public class PDARunToLineBreakpoint extends PDALineBreakpoint {
*
* @return whether this breakpoint is a run-to-line breakpoint
*/
+ @Override
public boolean isRunToLineBreakpoint() {
return true;
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
index d3f7dc593..ce7c15226 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
@@ -65,6 +65,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
*/
public PDAWatchpoint(final IResource resource, final int lineNumber, final String functionName, final String varName, final boolean access, final boolean modification) throws CoreException {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.watchpoint"); //$NON-NLS-1$
setMarker(marker);
@@ -83,42 +84,48 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IWatchpoint#isAccess()
*/
- public boolean isAccess() throws CoreException {
+ @Override
+ public boolean isAccess() throws CoreException {
return getMarker().getAttribute(ACCESS, true);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IWatchpoint#setAccess(boolean)
*/
- public void setAccess(boolean access) throws CoreException {
+ @Override
+ public void setAccess(boolean access) throws CoreException {
setAttribute(ACCESS, access);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IWatchpoint#isModification()
*/
- public boolean isModification() throws CoreException {
+ @Override
+ public boolean isModification() throws CoreException {
return getMarker().getAttribute(MODIFICATION, true);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IWatchpoint#setModification(boolean)
*/
- public void setModification(boolean modification) throws CoreException {
+ @Override
+ public void setModification(boolean modification) throws CoreException {
setAttribute(MODIFICATION, modification);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IWatchpoint#supportsAccess()
*/
- public boolean supportsAccess() {
+ @Override
+ public boolean supportsAccess() {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IWatchpoint#supportsModification()
*/
- public boolean supportsModification() {
+ @Override
+ public boolean supportsModification() {
return true;
}
@@ -175,6 +182,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint#createRequest(org.eclipse.debug.examples.core.pda.model.PDADebugTarget)
*/
+ @Override
protected void createRequest(PDADebugTarget target) throws CoreException {
int flag = 0;
if (isAccess()) {
@@ -189,6 +197,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint#clearRequest(org.eclipse.debug.examples.core.pda.model.PDADebugTarget)
*/
+ @Override
protected void clearRequest(PDADebugTarget target) throws CoreException {
target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), 0));
}
@@ -196,6 +205,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
*/
+ @Override
public void handleEvent(PDAEvent event) {
if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
PDARunControlEvent rcEvent = (PDARunControlEvent)event;
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
index 95c4c34d6..b4a2ecf73 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
@@ -44,22 +44,23 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
//#ifdef ex1
//# // TODO: Exercise 1 - Launch a command shell as a system process to echo "foo"
//#elseif ex1_answer
//# Process process = DebugPlugin.exec(new String[]{"cmd", "/C", "\"echo foo\""}, null);
//# new RuntimeProcess(launch, process, "Hello", null);
- //#else
-
- List commandList = new ArrayList();
-
+ //#else
+
+ List<String> commandList = new ArrayList<String>();
+
// Get Java VM path
String javaVMHome = System.getProperty("java.home"); //$NON-NLS-1$
String javaVMExec = javaVMHome + File.separatorChar + "bin" + File.separatorChar + "java"; //$NON-NLS-1$ //$NON-NLS-2$
if (File.separatorChar == '\\') {
javaVMExec += ".exe"; //$NON-NLS-1$
- }
+ }
File exe = new File(javaVMExec);
if (!exe.exists()) {
abort(MessageFormat.format("Specified java VM executable {0} does not exist.", new Object[]{javaVMExec}), null); //$NON-NLS-1$
@@ -68,7 +69,7 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
commandList.add("-cp"); //$NON-NLS-1$
commandList.add(File.pathSeparator + DebugCorePlugin.getFileInPlugin(new Path("bin"))); //$NON-NLS-1$
-
+
commandList.add("org.eclipse.debug.examples.pdavm.PDAVirtualMachine"); //$NON-NLS-1$
// program name
@@ -76,14 +77,14 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
if (program == null) {
abort("Perl program unspecified.", null); //$NON-NLS-1$
}
-
+
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program));
if (!file.exists()) {
- abort(MessageFormat.format("Perl program {0} does not exist.", new String[] {file.getFullPath().toString()}), null); //$NON-NLS-1$
+ abort(MessageFormat.format("Perl program {0} does not exist.", new Object[] { file.getFullPath().toString() }), null); //$NON-NLS-1$
}
-
+
commandList.add(file.getLocation().toOSString());
-
+
// if in debug mode, add debug arguments - i.e. '-debug requestPort eventPort'
int requestPort = -1;
int eventPort = -1;
@@ -97,22 +98,22 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
commandList.add("" + requestPort); //$NON-NLS-1$
commandList.add("" + eventPort); //$NON-NLS-1$
}
-
- String[] commandLine = (String[]) commandList.toArray(new String[commandList.size()]);
+
+ String[] commandLine = commandList.toArray(new String[commandList.size()]);
Process process = DebugPlugin.exec(commandLine, null);
IProcess p = DebugPlugin.newProcess(launch, process, javaVMExec);
- // if in debug mode, create a debug target
+ // if in debug mode, create a debug target
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
IDebugTarget target = new PDADebugTarget(launch, p, requestPort, eventPort);
launch.addDebugTarget(target);
}
//#endif
}
-
+
/**
* Throws an exception with a new status containing the given
* message and optional exception.
- *
+ *
* @param message error message
* @param e underlying exception
* @throws CoreException
@@ -120,10 +121,10 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
private void abort(String message, Throwable e) throws CoreException {
throw new CoreException(new Status(IStatus.ERROR, DebugCorePlugin.PLUGIN_ID, 0, message, e));
}
-
+
/**
* Returns a free port number on localhost, or -1 if unable to find a free port.
- *
+ *
* @return a free port number on localhost, or -1 if unable to find a free port
*/
public static int findFreePort() {
@@ -131,7 +132,7 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
try {
socket= new ServerSocket(0);
return socket.getLocalPort();
- } catch (IOException e) {
+ } catch (IOException e) {
} finally {
if (socket != null) {
try {
@@ -140,13 +141,14 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
}
}
}
- return -1;
- }
-
+ return -1;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
return false;
- }
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java
index 5107b2695..effe377c2 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java
@@ -30,6 +30,7 @@ public class PDAArray extends PDAValue {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#hasVariables()
*/
+ @Override
public boolean hasVariables() throws DebugException {
return true;
}
@@ -37,6 +38,7 @@ public class PDAArray extends PDAValue {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getVariables()
*/
+ @Override
public IVariable[] getVariables() throws DebugException {
String string = getValueString();
String[] words = string.split("\\W+"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java
index 834198ebe..2c9dd55cb 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java
@@ -37,6 +37,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getValue()
*/
+ @Override
public IValue getValue() throws DebugException {
return fValue;
}
@@ -44,6 +45,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getName()
*/
+ @Override
public String getName() throws DebugException {
return "[" + fIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -51,6 +53,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
*/
+ @Override
public String getReferenceTypeName() throws DebugException {
return "String"; //$NON-NLS-1$
}
@@ -58,6 +61,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
*/
+ @Override
public boolean hasValueChanged() throws DebugException {
return false;
}
@@ -65,18 +69,21 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
*/
+ @Override
public void setValue(String expression) throws DebugException {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
*/
+ @Override
public void setValue(IValue value) throws DebugException {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
+ @Override
public boolean supportsValueModification() {
return false;
}
@@ -84,6 +91,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
*/
+ @Override
public boolean verifyValue(String expression) throws DebugException {
return false;
}
@@ -91,6 +99,7 @@ public class PDAArrayEntry extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
*/
+ @Override
public boolean verifyValue(IValue value) throws DebugException {
return false;
}
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 fb854ba15..f07fac187 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
@@ -39,6 +39,7 @@ public class PDADebugElement extends DebugElement {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/
+ @Override
public String getModelIdentifier() {
return DebugCorePlugin.ID_PDA_DEBUG_MODEL;
}
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 b5e4a0607..e024badf6 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
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2005, 2013 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -67,41 +67,41 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAVMTerminatedEvent;
* PDA Debug Target
*/
public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBreakpointManagerListener, IPDAEventListener {
-
+
// associated system process (VM)
private IProcess fProcess;
-
+
// containing launch object
private ILaunch fLaunch;
-
+
// sockets to communicate with VM
private Socket fRequestSocket;
private PrintWriter fRequestWriter;
private BufferedReader fRequestReader;
private Socket fEventSocket;
private BufferedReader fEventReader;
-
+
// suspended state
private boolean fVMSuspended = false;
-
+
// terminated state
private boolean fTerminated = false;
-
+
// threads
- private Map fThreads = Collections.synchronizedMap(new LinkedHashMap());
-
+ private Map<Integer, PDAThread> fThreads = Collections.synchronizedMap(new LinkedHashMap<Integer, PDAThread>());
+
// event dispatch job
private EventDispatchJob fEventDispatch;
-
+
// event listeners
- private List fEventListeners = Collections.synchronizedList(new ArrayList());
-
+ private List<IPDAEventListener> fEventListeners = Collections.synchronizedList(new ArrayList<IPDAEventListener>());
+
/**
- * Listens to events from the PDA VM and fires corresponding
+ * Listens to events from the PDA VM and fires corresponding
* debug events.
*/
class EventDispatchJob extends Job {
-
+
public EventDispatchJob() {
super("PDA Event Dispatch"); //$NON-NLS-1$
setSystem(true);
@@ -110,6 +110,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected IStatus run(IProgressMonitor monitor) {
String message = ""; //$NON-NLS-1$
while (!isTerminated() && message != null) {
@@ -127,7 +128,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
Object[] listeners = fEventListeners.toArray();
for (int i = 0; i < listeners.length; i++) {
- ((IPDAEventListener)listeners[i]).handleEvent(event);
+ ((IPDAEventListener)listeners[i]).handleEvent(event);
}
}
} catch (IOException e) {
@@ -136,14 +137,14 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
return Status.OK_STATUS;
}
-
+
}
-
+
/**
* 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.
- *
+ *
* @param listener event listener
*/
public void addEventListener(IPDAEventListener listener) {
@@ -153,21 +154,21 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
}
}
-
+
/**
* Deregisters the given event listener. Has no effect if the listener is
* not currently registered.
- *
+ *
* @param listener event listener
*/
public void removeEventListener(IPDAEventListener listener) {
fEventListeners.remove(listener);
}
-
+
/**
- * Constructs a new debug target in the given launch for the
+ * Constructs a new debug target in the given launch for the
* associated PDA VM process.
- *
+ *
* @param launch containing launch
* @param process PDA VM
* @param requestPort port to send requests to the VM
@@ -214,32 +215,37 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#getProcess()
*/
+ @Override
public IProcess getProcess() {
return fProcess;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
*/
+ @Override
public IThread[] getThreads() throws DebugException {
synchronized (fThreads) {
- return (IThread[])fThreads.values().toArray(new IThread[fThreads.size()]);
+ return fThreads.values().toArray(new IThread[fThreads.size()]);
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#hasThreads()
*/
+ @Override
public boolean hasThreads() throws DebugException {
return fThreads.size() > 0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#getName()
*/
+ @Override
public String getName() throws DebugException {
return "PDA"; //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint)
*/
+ @Override
public boolean supportsBreakpoint(IBreakpoint breakpoint) {
if (!isTerminated() && breakpoint.getModelIdentifier().equals(getModelIdentifier())) {
try {
@@ -261,40 +267,45 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
}
} catch (CoreException e) {
- }
+ }
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
*/
+ @Override
public IDebugTarget getDebugTarget() {
return this;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
*/
+ @Override
public ILaunch getLaunch() {
return fLaunch;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
+ @Override
public boolean canTerminate() {
return getProcess().canTerminate();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
+ @Override
public synchronized boolean isTerminated() {
return fTerminated || getProcess().isTerminated();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
+ @Override
public void terminate() throws DebugException {
//#ifdef ex2
-//# // TODO: Exercise 2 - send termination request to interpreter
+//# // TODO: Exercise 2 - send termination request to interpreter
//#else
sendCommand(new PDATerminateCommand());
//#endif
@@ -302,39 +313,45 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
+ @Override
public boolean canResume() {
return !isTerminated() && isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
+ @Override
public boolean canSuspend() {
return !isTerminated() && !isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
+ @Override
public synchronized boolean isSuspended() {
return !isTerminated() && fVMSuspended;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
+ @Override
public void resume() throws DebugException {
sendCommand(new PDAVMResumeCommand());
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
+ @Override
public void suspend() throws DebugException {
sendCommand(new PDAVMSuspendCommand());
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)
*/
+ @Override
public void breakpointAdded(IBreakpoint breakpoint) {
if (supportsBreakpoint(breakpoint)) {
try {
@@ -349,6 +366,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
+ @Override
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
@@ -361,6 +379,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
+ @Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
@@ -376,29 +395,34 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
*/
+ @Override
public boolean canDisconnect() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDisconnect#disconnect()
*/
+ @Override
public void disconnect() throws DebugException {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
*/
+ @Override
public boolean isDisconnected() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval()
*/
+ @Override
public boolean supportsStorageRetrieval() {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
*/
+ @Override
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
return new PDAMemoryBlock(this, startAddress, length);
}
@@ -416,7 +440,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
} catch (DebugException e) {
}
}
-
+
/**
* Install breakpoints that are already registered with the breakpoint
* manager.
@@ -427,7 +451,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
breakpointAdded(breakpoints[i]);
}
}
-
+
/**
* Called when this debug target terminates.
*/
@@ -440,17 +464,17 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
fireTerminateEvent();
removeEventListener(this);
}
-
+
private void vmResumed(PDAVMResumedEvent event) {
setVMSuspended(false);
fireResumeEvent(calcDetail(event.fReason));
}
-
+
private void vmSuspended(PDAVMSuspendedEvent event) {
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;
@@ -464,30 +488,30 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
return DebugEvent.BREAKPOINT;
} else {
return DebugEvent.UNSPECIFIED;
- }
+ }
}
-
+
private void started(PDAStartedEvent event) {
PDAThread newThread = new PDAThread(this, event.fThreadId);
fThreads.put(new Integer(event.fThreadId), newThread);
newThread.start();
}
-
+
private void exited(PDAExitedEvent event) {
- PDAThread thread = (PDAThread)fThreads.remove(new Integer(event.fThreadId));
+ PDAThread thread = fThreads.remove(new Integer(event.fThreadId));
if (thread != null) {
thread.exit();
}
}
-
+
private synchronized void setVMSuspended(boolean suspended) {
fVMSuspended = suspended;
}
-
+
private synchronized void setTerminated(boolean terminated) {
fTerminated = terminated;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.pda.model.PDADebugElement#sendRequest(java.lang.String)
*/
@@ -508,8 +532,9 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
// Should never reach this satement.
return null;
- }
-
+ }
+
+ @Override
public PDACommandResult sendCommand(PDACommand command) throws DebugException {
String response = sendRequest(command.getRequest());
return command.createResult(response);
@@ -519,6 +544,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* When the breakpoint manager disables, remove all registered breakpoints
* requests from the VM. When it enables, reinstall them.
*/
+ @Override
public void breakpointManagerEnablementChanged(boolean enabled) {
IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier());
for (int i = 0; i < breakpoints.length; i++) {
@@ -528,11 +554,12 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
breakpointRemoved(breakpoints[i], null);
}
}
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
*/
+ @Override
public void handleEvent(PDAEvent event) {
if (event instanceof PDAStartedEvent) {
started((PDAStartedEvent)event);
@@ -546,13 +573,13 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
vmSuspended((PDAVMSuspendedEvent)event);
} else if (event instanceof PDAVMResumedEvent) {
vmResumed((PDAVMResumedEvent)event);
- }
+ }
}
-
+
/**
* Returns this debug target's single thread, or <code>null</code>
* if terminated.
- *
+ *
* @param threadId ID of the thread to return, or <code>0</code>
* to return the first available thread
* @return this debug target's single thread, or <code>null</code>
@@ -560,24 +587,24 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
*/
public PDAThread getThread(int threadId) {
if (threadId > 0) {
- return (PDAThread)fThreads.get(new Integer(threadId));
+ return fThreads.get(new Integer(threadId));
} else {
synchronized(fThreads) {
if (fThreads.size() > 0) {
- return (PDAThread)fThreads.values().iterator().next();
+ return fThreads.values().iterator().next();
}
}
}
return null;
}
-
+
/**
* Restarts the current debug session
- *
+ *
* @throws DebugException
*/
public void restart() throws DebugException {
sendCommand(new PDARestartCommand());
- }
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java
index 616578131..394c7c1da 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java
@@ -42,6 +42,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress()
*/
+ @Override
public long getStartAddress() {
return fStart;
}
@@ -49,6 +50,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
*/
+ @Override
public long getLength() {
return fLength;
}
@@ -56,6 +58,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getBytes()
*/
+ @Override
public byte[] getBytes() throws DebugException {
return fBytes;
}
@@ -63,6 +66,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#supportsValueModification()
*/
+ @Override
public boolean supportsValueModification() {
return true;
}
@@ -70,6 +74,7 @@ public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#setValue(long, byte[])
*/
+ @Override
public void setValue(long offset, byte[] bytes) throws DebugException {
int i = 0;
long off = offset;
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 b235690f3..24dfefcd2 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
@@ -65,30 +65,35 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getThread()
*/
+ @Override
public IThread getThread() {
return fThread;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getVariables()
*/
+ @Override
public IVariable[] getVariables() throws DebugException {
return fThread.getVariables(this);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#hasVariables()
*/
+ @Override
public boolean hasVariables() throws DebugException {
return getVariables().length > 0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getLineNumber()
*/
+ @Override
public int getLineNumber() throws DebugException {
return fPC;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getCharStart()
*/
+ @Override
public int getCharStart() throws DebugException {
return -1;
}
@@ -96,114 +101,133 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getCharEnd()
*/
+ @Override
public int getCharEnd() throws DebugException {
return -1;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getName()
*/
+ @Override
public String getName() throws DebugException {
return fName;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups()
*/
+ @Override
public IRegisterGroup[] getRegisterGroups() throws DebugException {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups()
*/
+ @Override
public boolean hasRegisterGroups() throws DebugException {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepInto()
*/
+ @Override
public boolean canStepInto() {
return getThread().canStepInto();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepOver()
*/
+ @Override
public boolean canStepOver() {
return getThread().canStepOver();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepReturn()
*/
+ @Override
public boolean canStepReturn() {
return getThread().canStepReturn();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#isStepping()
*/
+ @Override
public boolean isStepping() {
return getThread().isStepping();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepInto()
*/
+ @Override
public void stepInto() throws DebugException {
getThread().stepInto();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepOver()
*/
+ @Override
public void stepOver() throws DebugException {
getThread().stepOver();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepReturn()
*/
+ @Override
public void stepReturn() throws DebugException {
getThread().stepReturn();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
+ @Override
public boolean canResume() {
return getThread().canResume();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
+ @Override
public boolean canSuspend() {
return getThread().canSuspend();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
+ @Override
public boolean isSuspended() {
return getThread().isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
+ @Override
public void resume() throws DebugException {
getThread().resume();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
+ @Override
public void suspend() throws DebugException {
getThread().suspend();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
+ @Override
public boolean canTerminate() {
return getThread().canTerminate();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
+ @Override
public boolean isTerminated() {
return getThread().isTerminated();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
+ @Override
public void terminate() throws DebugException {
getThread().terminate();
}
@@ -221,6 +245,7 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
if (obj instanceof PDAStackFrame) {
PDAStackFrame sf = (PDAStackFrame)obj;
@@ -233,6 +258,7 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getSourceName().hashCode() + fId;
}
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 a7909d485..4fc8e5289 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
@@ -46,38 +46,44 @@ public class PDAStackValue extends PDADebugElement implements IValue {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getValueString()
*/
- public String getValueString() throws DebugException {
+ @Override
+ public String getValueString() throws DebugException {
return fValue;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#isAllocated()
*/
- public boolean isAllocated() throws DebugException {
+ @Override
+ public boolean isAllocated() throws DebugException {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getVariables()
*/
- public IVariable[] getVariables() throws DebugException {
+ @Override
+ public IVariable[] getVariables() throws DebugException {
return new IVariable[0];
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#hasVariables()
*/
- public boolean hasVariables() throws DebugException {
+ @Override
+ public boolean hasVariables() throws DebugException {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
*/
- public String getReferenceTypeName() throws DebugException {
+ @Override
+ public String getReferenceTypeName() throws DebugException {
return null;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
- public boolean equals(Object obj) {
+ @Override
+ public boolean equals(Object obj) {
return obj instanceof PDAStackValue &&
((PDAStackValue)obj).fValue.equals(fValue) &&
((PDAStackValue)obj).fIndex == fIndex;
@@ -86,7 +92,8 @@ public class PDAStackValue extends PDADebugElement implements IValue {
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
- public int hashCode() {
+ @Override
+ public int hashCode() {
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 409746bc3..c0798215d 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
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2005, 2013 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -46,23 +46,23 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
* A PDA thread. A PDA VM is single threaded.
*/
public class PDAThread extends PDADebugElement implements IThread, IPDAEventListener {
-
+
/**
* ID of this thread as reported by PDA.
*/
private final int fThreadId;
-
+
/**
* Breakpoint this thread is suspended at or <code>null</code>
* if none.
*/
private IBreakpoint fBreakpoint;
-
+
/**
* Whether this thread is stepping
*/
private boolean fStepping = false;
-
+
/**
* Whether this thread is suspended
*/
@@ -72,45 +72,46 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
* Most recent error event or <code>null</code>
*/
private String fErrorEvent;
-
+
/**
* Table mapping stack frames to current variables
*/
- private Map fVariables = Collections.synchronizedMap(new HashMap());
-
+ private Map<IStackFrame, IVariable[]> fVariables = Collections.synchronizedMap(new HashMap<IStackFrame, IVariable[]>());
+
/**
* Constructs a new thread for the given target
- *
+ *
* @param target VM
*/
public PDAThread(PDADebugTarget target, int threadId) {
super(target);
fThreadId = threadId;
}
-
+
/**
* Called by the debug target after the thread is created.
- *
+ *
* @since 3.5
*/
void start() {
fireCreationEvent();
getPDADebugTarget().addEventListener(this);
}
-
+
/**
* Called by the debug target before the thread is removed.
- *
+ *
* @since 3.5
*/
void exit() {
getPDADebugTarget().removeEventListener(this);
fireTerminateEvent();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IThread#getStackFrames()
*/
+ @Override
public IStackFrame[] getStackFrames() throws DebugException {
if (isSuspended()) {
PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId));
@@ -122,22 +123,25 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
}
return new IStackFrame[0];
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IThread#hasStackFrames()
*/
+ @Override
public boolean hasStackFrames() throws DebugException {
return isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IThread#getPriority()
*/
+ @Override
public int getPriority() throws DebugException {
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
*/
+ @Override
public IStackFrame getTopStackFrame() throws DebugException {
IStackFrame[] frames = getStackFrames();
if (frames.length > 0) {
@@ -148,45 +152,50 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IThread#getName()
*/
+ @Override
public String getName() {
return "Main thread"; //$NON-NLS-1$
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IThread#getBreakpoints()
*/
+ @Override
public synchronized IBreakpoint[] getBreakpoints() {
if (fBreakpoint == null) {
return new IBreakpoint[0];
}
return new IBreakpoint[]{fBreakpoint};
}
-
+
/**
* Notifies this thread it has been suspended by the given breakpoint.
- *
+ *
* @param breakpoint breakpoint
*/
public synchronized void suspendedBy(IBreakpoint breakpoint) {
fBreakpoint = breakpoint;
suspended(DebugEvent.BREAKPOINT);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
+ @Override
public boolean canResume() {
return isSuspended() && !getDebugTarget().isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
+ @Override
public boolean canSuspend() {
return !isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
+ @Override
public boolean isSuspended() {
if (getDebugTarget().isTerminated()) {
return false;
@@ -201,9 +210,10 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
+ @Override
public void resume() throws DebugException {
//#ifdef ex2
-//# // TODO: Exercise 2 - send resume request to interpreter
+//# // TODO: Exercise 2 - send resume request to interpreter
//#else
sendCommand(new PDAResumeCommand(fThreadId));
//#endif
@@ -211,9 +221,10 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
+ @Override
public void suspend() throws DebugException {
//#ifdef ex2
-//# // TODO: Exercise 2 - send suspend request to interpreter
+//# // TODO: Exercise 2 - send suspend request to interpreter
//#else
sendCommand(new PDASuspendCommand(fThreadId));
//#endif
@@ -221,74 +232,84 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepInto()
*/
+ @Override
public boolean canStepInto() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepOver()
*/
+ @Override
public boolean canStepOver() {
return isSuspended();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepReturn()
*/
+ @Override
public boolean canStepReturn() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#isStepping()
*/
+ @Override
public boolean isStepping() {
return fStepping;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepInto()
*/
+ @Override
public void stepInto() throws DebugException {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepOver()
*/
+ @Override
public void stepOver() throws DebugException {
sendCommand(new PDAStepCommand(fThreadId));
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepReturn()
*/
+ @Override
public void stepReturn() throws DebugException {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
+ @Override
public boolean canTerminate() {
return !isTerminated();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
+ @Override
public boolean isTerminated() {
return getDebugTarget().isTerminated();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
+ @Override
public void terminate() throws DebugException {
getDebugTarget().terminate();
}
-
+
/**
* Sets whether this thread is stepping
- *
+ *
* @param stepping whether stepping
*/
private synchronized void setStepping(boolean stepping) {
fStepping = stepping;
}
-
+
/**
* Sets whether this thread is suspended
- *
+ *
* @param suspended whether suspended
*/
private synchronized void setSuspended(boolean suspended) {
@@ -298,7 +319,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/**
* Sets the most recent error event encountered, or <code>null</code>
* to clear the most recent error
- *
+ *
* @param event one of 'unimpinstr' or 'nosuchlabel' or <code>null</code>
*/
private synchronized void setError(String event) {
@@ -308,7 +329,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/**
* Returns the most recent error event encountered since the last
* suspend, or <code>null</code> if none.
- *
+ *
* @return the most recent error event encountered since the last
* suspend, or <code>null</code> if none
*/
@@ -319,13 +340,14 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/* (non-Javadoc)
* @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
*/
+ @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);
@@ -335,7 +357,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
//#ifdef ex2
//# }
//# // TODO: Exercise 2 - handle/fire "client" resume event
- //#else
+ //#else
} else if ("client".equals(event.fReason)) { //$NON-NLS-1$
resumed(DebugEvent.CLIENT_REQUEST);
}
@@ -363,7 +385,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
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
@@ -373,19 +395,19 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
}
//#endif
} else if (_event instanceof PDANoSuchLabelEvent ||
- _event instanceof PDAUnimplementedInstructionEvent)
+ _event instanceof PDAUnimplementedInstructionEvent)
{
setError(event.fMessage);
}
- }
+ }
}
-
+
/**
* Notification the target has resumed for the given reason.
* Clears any error condition that was last encountered and
* fires a resume event, and clears all cached variables
* for stack frames.
- *
+ *
* @param detail reason for the resume
*/
private void resumed(int detail) {
@@ -393,10 +415,10 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
fVariables.clear();
fireResumeEvent(detail);
}
-
+
/**
* Notification the target has suspended for the given reason
- *
+ *
* @param detail reason for the suspend
*/
private void suspended(int detail) {
@@ -409,12 +431,12 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
*/
private void exceptionHit() {
suspended(DebugEvent.BREAKPOINT);
- }
-
+ }
+
/**
* Sets the current variables for the given stack frame. Called
* by PDA stack frame when it is created.
- *
+ *
* @param frame
* @param variables
*/
@@ -423,49 +445,49 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
fVariables.put(frame, variables);
}
}
-
+
/**
* Returns the current variables for the given stack frame, or
* <code>null</code> if none.
- *
+ *
* @param frame stack frame
* @return variables or <code>null</code>
*/
protected IVariable[] getVariables(IStackFrame frame) {
synchronized (fVariables) {
- IVariable[] variables = (IVariable[]) fVariables.get(frame);
+ IVariable[] variables = fVariables.get(frame);
if (variables == null) {
return new IVariable[0];
}
return variables;
}
}
-
+
/**
* Pops the top frame off the callstack.
*
* @throws DebugException
- *
+ *
* @since 3.5
*/
public void popFrame() throws DebugException {
//#ifdef ex5
-//# // TODO: Exercise 5 - send drop request
+//# // TODO: Exercise 5 - send drop request
//#else
sendCommand(new PDADropFrameCommand(fThreadId));
//#endif
}
-
+
/**
* Returns whether this thread can pop the top stack frame.
*
* @return whether this thread can pop the top stack frame
- *
+ *
* @since 3.5
*/
public boolean canPopFrame() {
//#ifdef ex5
-//# // TODO: Exercise 5 - allow pop if there is more than 1 frame on the stack
+//# // TODO: Exercise 5 - allow pop if there is more than 1 frame on the stack
//#else
try {
return getStackFrames().length > 1;
@@ -474,12 +496,12 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
//#endif
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 {
@@ -491,14 +513,14 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
}
return values;
}
- return new IValue[0];
+ 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() {
@@ -508,13 +530,13 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
}
return false;
}
-
+
/**
* Pops and returns the top of the data stack
- *
- * @return the top value on the 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 {
@@ -526,24 +548,24 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
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 {
@@ -552,9 +574,9 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
/**
* Returns this thread's unique identifier
- *
+ *
* @return this thread's unique identifier
- *
+ *
* @since 3.5
*/
public int getIdentifier() {
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 81a92db29..620f7ac83 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
@@ -35,6 +35,7 @@ public class PDAValue extends PDADebugElement implements IValue {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
*/
+ @Override
public String getReferenceTypeName() throws DebugException {
try {
Integer.parseInt(fValue);
@@ -46,18 +47,21 @@ public class PDAValue extends PDADebugElement implements IValue {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getValueString()
*/
+ @Override
public String getValueString() throws DebugException {
return fValue;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#isAllocated()
*/
+ @Override
public boolean isAllocated() throws DebugException {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getVariables()
*/
+ @Override
public IVariable[] getVariables() throws DebugException {
PDAStackFrame frame = fVariable.getStackFrame();
PDAListResult result = (PDAListResult) sendCommand(
@@ -72,6 +76,7 @@ public class PDAValue extends PDADebugElement implements IValue {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#hasVariables()
*/
+ @Override
public boolean hasVariables() throws DebugException {
if (getVariables().length != 0) {
return true;
@@ -85,14 +90,16 @@ public class PDAValue extends PDADebugElement implements IValue {
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
- public boolean equals(Object obj) {
+ @Override
+ public boolean equals(Object obj) {
return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue);
}
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
- public int hashCode() {
+ @Override
+ public int hashCode() {
return fValue.hashCode();
}
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 08ca276be..3745028e1 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
@@ -46,6 +46,7 @@ public class PDAVariable extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getValue()
*/
+ @Override
public IValue getValue() throws DebugException {
PDACommandResult result = sendCommand(new PDAVarCommand(
fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName()));
@@ -55,24 +56,28 @@ public class PDAVariable extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getName()
*/
+ @Override
public String getName() throws DebugException {
return fName;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
*/
+ @Override
public String getReferenceTypeName() throws DebugException {
return "Thing"; //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
*/
+ @Override
public boolean hasValueChanged() throws DebugException {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
*/
+ @Override
public void setValue(String expression) throws DebugException {
sendCommand(new PDASetVarCommand(
fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression));
@@ -81,23 +86,27 @@ public class PDAVariable extends PDADebugElement implements IVariable {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
*/
+ @Override
public void setValue(IValue value) throws DebugException {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
+ @Override
public boolean supportsValueModification() {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
*/
+ @Override
public boolean verifyValue(String expression) throws DebugException {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
*/
+ @Override
public boolean verifyValue(IValue value) throws DebugException {
return false;
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java
index ccc6b2647..2d218e08f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java
@@ -24,6 +24,7 @@ public class WordStructureDelegate implements ILogicalStructureTypeDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate#providesLogicalStructure(org.eclipse.debug.core.model.IValue)
*/
+ @Override
public boolean providesLogicalStructure(IValue value) {
//#ifdef ex6
//# // TODO: Exercise 6 - provide logical structures if the value has multiple words
@@ -41,6 +42,7 @@ public class WordStructureDelegate implements ILogicalStructureTypeDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate#getLogicalStructure(org.eclipse.debug.core.model.IValue)
*/
+ @Override
public IValue getLogicalStructure(IValue value) throws CoreException {
//#ifdef ex6
//# // TODO: Exercise 6 - create an array from the given value
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
index 6a8caaa19..b36e3dbcf 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - bug fixing
@@ -17,24 +17,24 @@ import java.util.StringTokenizer;
/**
* Object representing a bit field in the stack command results.
- *
- * @see PDARegistersCommand
+ *
+ * @see PDARegistersCommand
*/
public class PDABitFieldData {
final public String fName;
final public int fOffset;
final public int fCount;
- final public Map fMnemonics;
-
+ final public Map<String, String> fMnemonics;
+
PDABitFieldData(String bitFieldString) {
StringTokenizer st = new StringTokenizer(bitFieldString, " "); //$NON-NLS-1$
-
+
fName = st.nextToken();
fOffset = Integer.parseInt(st.nextToken());
fCount = Integer.parseInt(st.nextToken());
-
- fMnemonics = new LinkedHashMap(0);
+
+ fMnemonics = new LinkedHashMap<String, String>(0);
while (st.hasMoreTokens()) {
fMnemonics.put(st.nextToken(), st.nextToken());
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
index 9886a920a..9d9339b75 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
@@ -29,7 +29,8 @@ public class PDAChildrenCommand extends PDACommand {
super("children " + threadId + " " + frameId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDAListResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
index 76f688bf4..20eba643f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
@@ -26,7 +26,8 @@ public class PDAClearBreakpointCommand extends PDACommand {
super("clear " + line); //$NON-NLS-1$
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
index 61cc412e1..e82630f1a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
@@ -30,7 +30,8 @@ public class PDADataCommand extends PDACommand {
super("data " + threadId); //$NON-NLS-1$
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDAListResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
index 1d77bbe79..9777ff94c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
@@ -39,7 +39,8 @@ public class PDADropFrameCommand extends PDACommand {
super("drop " + threadId); //$NON-NLS-1$
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
index 50f79cf26..499a9dd0a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
@@ -38,7 +38,8 @@ public class PDAEvalCommand extends PDACommand {
super("eval " + threadId + " " + operation); //$NON-NLS-1$ //$NON-NLS-2$
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
index 713723eea..b96060fda 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
@@ -43,7 +43,8 @@ public class PDAEventStopCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
index 3c30b3bfb..92fb11de8 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
@@ -31,7 +31,8 @@ public class PDAFrameCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDAFrameCommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
index 01cfbf4cd..d3c5ab8d7 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - bug fixing
@@ -20,8 +20,8 @@ import org.eclipse.core.runtime.Path;
/**
* Object representing a frame in the stack command results.
- *
- * @see PDAStackCommand
+ *
+ * @see PDAStackCommand
*/
public class PDAFrameData {
@@ -30,18 +30,18 @@ public class PDAFrameData {
final public int fPC;
final public String fFunction;
final public String[] fVariables;
-
+
PDAFrameData(String frameString) {
StringTokenizer st = new StringTokenizer(frameString, "|"); //$NON-NLS-1$
-
+
fFilePath = new Path(st.nextToken());
fPC = Integer.parseInt(st.nextToken());
fFunction = st.nextToken();
-
- List variablesList = new ArrayList();
+
+ List<String> variablesList = new ArrayList<String>();
while (st.hasMoreTokens()) {
variablesList.add(st.nextToken());
}
- fVariables = (String[])variablesList.toArray(new String[variablesList.size()]);
+ fVariables = variablesList.toArray(new String[variablesList.size()]);
}
} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
index bf503d461..fb405b32c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
@@ -28,7 +28,8 @@ public class PDAGroupsCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDAListResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
index 99199a5e9..e2b9a38ae 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - bug fixing
@@ -21,24 +21,24 @@ import java.util.StringTokenizer;
*/
public class PDAListResult extends PDACommandResult {
-
+
final public String[] fValues;
-
+
PDAListResult(String response) {
super(response);
StringTokenizer st = new StringTokenizer(response, "|"); //$NON-NLS-1$
- List valuesList = new ArrayList();
-
+ List<String> valuesList = new ArrayList<String>();
+
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (token.length() != 0) {
valuesList.add(token);
}
}
-
+
fValues = new String[valuesList.size()];
for (int i = 0; i < valuesList.size(); i++) {
- fValues[i] = (String)valuesList.get(i);
+ fValues[i] = valuesList.get(i);
}
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
index c90b0b600..d96681c5a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
@@ -32,7 +32,8 @@ public class PDANoSuchLabelEvent extends PDAEvent {
return message.startsWith("no such label"); //$NON-NLS-1$
}
- protected String getName(String message) {
+ @Override
+ protected String getName(String message) {
if (isEventMessage(message)) {
return "no such label"; //$NON-NLS-1$
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
index c181a2971..1e3726c25 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
@@ -29,7 +29,8 @@ public class PDAPopDataCommand extends PDACommand {
super("popdata " + threadId); //$NON-NLS-1$
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
index c6ff895c6..fd3ccd8d1 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
@@ -31,7 +31,8 @@ public class PDAPushDataCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
index 05a12cd5e..27c1874d2 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
@@ -4,9 +4,10 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipse.debug.examples.core.pda.protocol;
@@ -16,8 +17,8 @@ import java.util.StringTokenizer;
/**
* Object representing a register in the registers command results.
- *
- * @see PDARCommand
+ *
+ * @see PDARCommand
*/
public class PDARegisterData {
@@ -25,19 +26,19 @@ public class PDARegisterData {
final public String fName;
final public boolean fWritable;
final public PDABitFieldData[] fBitFields;
-
+
PDARegisterData(String regString) {
StringTokenizer st = new StringTokenizer(regString, "|"); //$NON-NLS-1$
-
+
String regInfo = st.nextToken();
StringTokenizer regSt = new StringTokenizer(regInfo, " "); //$NON-NLS-1$
fName = regSt.nextToken();
fWritable = Boolean.getBoolean(regSt.nextToken());
-
- List bitFieldsList = new ArrayList();
+
+ List<PDABitFieldData> bitFieldsList = new ArrayList<PDABitFieldData>();
while (st.hasMoreTokens()) {
bitFieldsList.add(new PDABitFieldData(st.nextToken()));
}
- fBitFields = (PDABitFieldData[])bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]);
+ fBitFields = bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]);
}
} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
index 0592d6b56..045df225d 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
@@ -28,7 +28,8 @@ public class PDARegistersCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDARegistersCommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
index a53bac5e2..7eabe8af4 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - bug fixing
@@ -21,20 +21,20 @@ import java.util.StringTokenizer;
*/
public class PDARegistersCommandResult extends PDACommandResult {
-
+
/**
- * Array of registers returned by the registers commands.
+ * Array of registers returned by the registers commands.
*/
final public PDARegisterData[] fRegisters;
-
+
PDARegistersCommandResult(String response) {
super(response);
StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$
- List regList = new ArrayList();
-
+ List<PDARegisterData> regList = new ArrayList<PDARegisterData>();
+
while (st.hasMoreTokens()) {
regList.add(new PDARegisterData(st.nextToken()));
}
- fRegisters = (PDARegisterData[])regList.toArray(new PDARegisterData[regList.size()]);
+ fRegisters = regList.toArray(new PDARegisterData[regList.size()]);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
index 6f518e9fe..29bfc78f3 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
@@ -30,7 +30,8 @@ public class PDARestartCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
index 657860137..64bac76a2 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
@@ -35,7 +35,8 @@ public class PDAResumeCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
index 3f507d1e4..c9e10a762 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
@@ -58,7 +58,8 @@ public class PDARunControlEvent extends PDAEvent {
return message.substring(idx, endIdx);
}
- protected String getName(String message) {
+ @Override
+ protected String getName(String message) {
int nameEnd = message.indexOf(' ');
nameEnd = nameEnd == -1 ? message.length() : nameEnd;
return message.substring(0, nameEnd);
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
index a5223a916..4459ebc2f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
@@ -41,7 +41,8 @@ public class PDASetBreakpointCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
index 85ed35ae4..c6f5278bc 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
@@ -31,7 +31,8 @@ public class PDASetDataCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
index ac7dde342..c32570a6a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
@@ -33,7 +33,8 @@ public class PDASetVarCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
index 92cd55bbc..836f5d6a9 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
@@ -34,7 +34,8 @@ public class PDAStackCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDAStackCommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
index b98bcba70..dfc583266 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - bug fixing
@@ -21,21 +21,21 @@ import java.util.StringTokenizer;
*/
public class PDAStackCommandResult extends PDACommandResult {
-
+
/**
- * Array of frames return by the stack commands. The frames are ordered
+ * Array of frames return by the stack commands. The frames are ordered
* with the highest-level frame first.
*/
final public PDAFrameData[] fFrames;
-
+
PDAStackCommandResult(String response) {
super(response);
StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$
- List framesList = new ArrayList();
-
+ List<PDAFrameData> framesList = new ArrayList<PDAFrameData>();
+
while (st.hasMoreTokens()) {
framesList.add(new PDAFrameData(st.nextToken()));
}
- fFrames = (PDAFrameData[])framesList.toArray(new PDAFrameData[framesList.size()]);
+ fFrames = framesList.toArray(new PDAFrameData[framesList.size()]);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
index 3b6abfa82..f30db3c68 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
@@ -31,7 +31,8 @@ public class PDAStackDepthCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDAStackDepthCommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
index 5a5124ef1..f767ba746 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
@@ -40,7 +40,8 @@ public class PDAStepCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
index 973c93e53..443513878 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
@@ -41,7 +41,8 @@ public class PDAStepReturnCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
index cba45439d..2100c4b11 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
@@ -35,7 +35,8 @@ public class PDASuspendCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
index 55db441ec..4f4ad3932 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
@@ -29,7 +29,8 @@ public class PDATerminateCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
index c6a593322..90e0103e9 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
@@ -33,7 +33,8 @@ public class PDAUnimplementedInstructionEvent extends PDAEvent {
return message.startsWith("unimplemented instruction"); //$NON-NLS-1$
}
- protected String getName(String message) {
+ @Override
+ protected String getName(String message) {
if (isEventMessage(message)) {
return "unimplemented instruction"; //$NON-NLS-1$
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
index 83bb95d6e..43c726ed0 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
@@ -32,7 +32,8 @@ public class PDAVMResumeCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
index 88f7d5dd8..d65d07dd0 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
@@ -32,7 +32,8 @@ public class PDAVMSuspendCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
index b81302b79..cab160251 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
@@ -34,7 +34,8 @@ public class PDAVarCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
index c3b88cf64..1440049ff 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
@@ -38,7 +38,8 @@ public class PDAWatchCommand extends PDACommand {
}
- public PDACommandResult createResult(String resultText) {
+ @Override
+ public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java
index f975cf7c3..83b1bc57a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java
@@ -22,6 +22,7 @@ public class PDASourceLookupDirector extends AbstractSourceLookupDirector {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
*/
+ @Override
public void initializeParticipants() {
//#ifdef ex4
//# // TODO: Exercise 4 - add our participant to this director
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java
index 0d07ce78d..7326ad37c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java
@@ -24,6 +24,7 @@ public class PDASourceLookupParticipant extends AbstractSourceLookupParticipant
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object)
*/
+ @Override
public String getSourceName(Object object) throws CoreException {
//#ifdef ex4
//# // TODO: Exercise 4 - return the name of the source file for the given stack frame
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java
index d91b3f245..208a5a4b4 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java
@@ -39,6 +39,7 @@ public class PDASourcePathComputerDelegate implements ISourcePathComputerDelegat
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourcePathComputerDelegate#computeSourceContainers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
String path = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
ISourceContainer sourceContainer = null;
diff --git a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
index dc19387ac..d51bba239 100644
--- a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
+++ b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2005, 2013 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -17,7 +17,6 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
import java.util.regex.Matcher;
@@ -31,7 +30,7 @@ import org.apache.tools.ant.util.FileUtils;
/**
* Java preprocessor for code examples. Used to export source code for
- * example plug-ins with parts of code missing/inserted etc., for
+ * example plug-ins with parts of code missing/inserted etc., for
* various exercises.
* <p>
* The preprocessor looks for #ifdef statements in java comments, and is
@@ -46,52 +45,52 @@ import org.apache.tools.ant.util.FileUtils;
* </p>
*/
public class PreProcessor extends Task {
-
- private Vector fFileSets = new Vector();
+
+ private Vector<FileSet> fFileSets = new Vector<FileSet>();
private File fDestDir = null;
- private Set fSymbols = new HashSet();
+ private Set<String> fSymbols = new HashSet<String>();
private FileUtils fUtils = FileUtils.getFileUtils();
-
+
// possible states
private static final int STATE_OUTSIDE_CONDITION = 0;
private static final int STATE_TRUE_CONDITION = 1;
private static final int STATE_FALSE_CONDITION = 2;
private static final int STATE_POST_TRUE_CONDITION = 3;
-
+
// matchers
private Matcher IF_DEF_MATCHER = Pattern.compile("#ifdef\\s+\\w+").matcher(""); //$NON-NLS-1$ //$NON-NLS-2$
private Matcher ELSE_IF_MATCHER = Pattern.compile("#elseif\\s+\\w+").matcher(""); //$NON-NLS-1$ //$NON-NLS-2$
private Matcher ELSE_MATCHER = Pattern.compile("#else$|#else\\W+").matcher(""); //$NON-NLS-1$ //$NON-NLS-2$
private Matcher END_MATCHER = Pattern.compile("#endif").matcher(""); //$NON-NLS-1$ //$NON-NLS-2$
-
+
/**
* Constructs a new preprocessor task
*/
public PreProcessor() {
}
-
+
/**
* Adds a set of files to process.
- *
+ *
* @param set a set of files to process
*/
public void addFileset(FileSet set) {
fFileSets.addElement(set);
}
-
+
/**
* Sets the destination directory for processed files.
- *
+ *
* @param destDir destination directory for processed files
*/
public void setDestdir(File destDir) {
fDestDir = destDir;
}
-
+
/**
* Sets the symbols that are "on" for the preprocessing.
- *
+ *
* @param symbols symbols that are "on" for the preprocessing
*/
public void setSymbols(String symbols) {
@@ -104,6 +103,7 @@ public class PreProcessor extends Task {
}
}
+ @Override
public void execute() throws BuildException {
if (fSymbols.size() == 0) {
throw new BuildException("No symbols specified for preprocessor"); //$NON-NLS-1$
@@ -115,7 +115,7 @@ public class PreProcessor extends Task {
throw new BuildException("destdir does not exist: " + fDestDir.getAbsolutePath()); //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer("Symbols: "); //$NON-NLS-1$
- String[] symbols = (String[]) fSymbols.toArray(new String[fSymbols.size()]);
+ String[] symbols = fSymbols.toArray(new String[fSymbols.size()]);
for (int i = 0; i < symbols.length; i++) {
String symbol = symbols[i];
buf.append(symbol);
@@ -124,10 +124,8 @@ public class PreProcessor extends Task {
}
}
log(buf.toString());
-
- Iterator fileSets = fFileSets.iterator();
- while (fileSets.hasNext()) {
- FileSet fileSet = (FileSet) fileSets.next();
+
+ for (FileSet fileSet : fFileSets) {
DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
String[] includedFiles = scanner.getIncludedFiles();
File baseDir = fileSet.getDir(getProject());
@@ -136,14 +134,13 @@ public class PreProcessor extends Task {
processFile(baseDir, fileName, fDestDir);
}
}
-
}
/**
* Process the file
* @param baseDir base directory source file is relative to
* @param fileName source file name
- * @param destDir root destination directory
+ * @param destDir root destination directory
*/
private void processFile(File baseDir, String fileName, File destDir) throws BuildException {
File destFile = new File(destDir, fileName);
@@ -167,21 +164,27 @@ public class PreProcessor extends Task {
}
} else {
// write new file
- FileWriter writer;
+ FileWriter writer = null;
try {
writer = new FileWriter(destFile);
writer.write(contents);
- writer.close();
} catch (IOException e) {
throw new BuildException(e);
+ } finally {
+ try {
+ if (writer != null) {
+ writer.close();
+ }
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
}
-
}
}
/**
* Pre-processes a file
- *
+ *
* @param srcFile the file to process
* @param strip chars to strip off lines in a true condition, or <code>null</code>
* @return
@@ -213,7 +216,7 @@ public class PreProcessor extends Task {
state = STATE_TRUE_CONDITION;
} else {
state = STATE_FALSE_CONDITION;
- }
+ }
} else if (elseif) {
throw new BuildException("#elseif encountered without corresponding #ifdef"); //$NON-NLS-1$
} else if (elze) {
@@ -261,6 +264,8 @@ public class PreProcessor extends Task {
throw new BuildException("illegal nested #ifdef"); //$NON-NLS-1$
}
break;
+ default:
+ break;
}
if (!commandLine) {
if (state == STATE_OUTSIDE_CONDITION || state == STATE_TRUE_CONDITION) {
@@ -273,8 +278,8 @@ public class PreProcessor extends Task {
buffer.append("\n"); //$NON-NLS-1$
written = true;
}
- }
- changed = changed || !written;
+ }
+ changed = changed || !written;
line = reader.readLine();
}
}

Back to the top