Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2009-09-09 19:27:00 +0000
committereutarass2009-09-09 19:27:00 +0000
commit71c37b63bb3a26a87491dc1f4de4985caeee76aa (patch)
treea86a494a68d46a7ce956192f27ba70fd1cf6bc66 /plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions
parent7ab7f9d65f26dba4930d0f3279e8c45fdfc5d89f (diff)
downloadorg.eclipse.tcf-71c37b63bb3a26a87491dc1f4de4985caeee76aa.tar.gz
org.eclipse.tcf-71c37b63bb3a26a87491dc1f4de4985caeee76aa.tar.xz
org.eclipse.tcf-71c37b63bb3a26a87491dc1f4de4985caeee76aa.zip
TCF Debugger: multiple changed in debug model in order to improve design, performance and usability
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java34
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java32
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java38
3 files changed, 22 insertions, 82 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java
index 40735ad34..26e48c26d 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepInto.java
@@ -16,8 +16,6 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
public abstract class TCFActionStepInto extends TCFAction implements IRunControl.RunControlListener {
- private static final long TIMEOUT = 10000;
-
private final boolean src_step;
private final IRunControl rc = launch.getService(IRunControl.class);
@@ -52,18 +50,8 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl
exit(new Exception("Invalid context ID"));
return;
}
- if (!ctx.canResume(src_step ? IRunControl.RM_STEP_INTO_LINE : IRunControl.RM_STEP_INTO)) {
- Protocol.invokeLater(TIMEOUT, new Runnable() {
- public void run() {
- exit(new Exception("Time out"));
- }
- });
- }
- }
- if (!state.validate()) {
- state.wait(this);
- return;
}
+ if (!state.validate(this)) return;
if (!state.getData().is_suspended) {
exit(new Exception("Context is not suspended"));
return;
@@ -83,16 +71,14 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl
return;
}
TCFDataCache<?> stack_trace = getStackTrace();
- if (!stack_trace.validate()) {
- stack_trace.wait(this);
+ if (!stack_trace.validate(this)) return;
+ if (stack_trace.getData() == null) {
+ exit(stack_trace.getError());
return;
}
if (source_ref == null) {
line_info = getLineInfo();
- if (!line_info.validate()) {
- line_info.wait(this);
- return;
- }
+ if (!line_info.validate(this)) return;
source_ref = line_info.getData();
if (source_ref == null) {
exit(new Exception("Line info not available"));
@@ -117,10 +103,7 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl
}
if (step_cnt > 0) {
TCFDataCache<IStackTrace.StackTraceContext> frame = getStackFrame();
- if (!frame.validate()) {
- frame.wait(this);
- return;
- }
+ if (!frame.validate(this)) return;
Number addr = frame.getData().getInstructionAddress();
BigInteger pc = addr instanceof BigInteger ? (BigInteger)addr : new BigInteger(addr.toString());
if (pc == null || pc0 == null || pc1 == null) {
@@ -128,10 +111,7 @@ public abstract class TCFActionStepInto extends TCFAction implements IRunControl
return;
}
if (pc.compareTo(pc0) < 0 || pc.compareTo(pc1) >= 0) {
- if (!line_info.validate()) {
- line_info.wait(this);
- return;
- }
+ if (!line_info.validate(this)) return;
TCFSourceRef ref = line_info.getData();
if (ref != null && ref.area != null) {
if (isSameLine(source_ref.area, ref.area)) {
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java
index d4c598c7f..962d913ea 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOut.java
@@ -6,7 +6,6 @@ import java.util.Map;
import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.Protocol;
import org.eclipse.tm.tcf.services.IBreakpoints;
import org.eclipse.tm.tcf.services.IRunControl;
import org.eclipse.tm.tcf.services.IStackTrace;
@@ -15,8 +14,6 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
public abstract class TCFActionStepOut extends TCFAction implements IRunControl.RunControlListener {
- private static final long TIMEOUT = 10000;
-
private final IRunControl rc = launch.getService(IRunControl.class);
private final IBreakpoints bps = launch.getService(IBreakpoints.class);
@@ -46,18 +43,8 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl.
exit(new Exception("Invalid context ID"));
return;
}
- if (!ctx.canResume(IRunControl.RM_STEP_OUT)) {
- Protocol.invokeLater(TIMEOUT, new Runnable() {
- public void run() {
- exit(new Exception("Time out"));
- }
- });
- }
- }
- if (!state.validate()) {
- state.wait(this);
- return;
}
+ if (!state.validate(this)) return;
if (!state.getData().is_suspended) {
exit(new Exception("Context is not suspended"));
return;
@@ -73,10 +60,7 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl.
return;
}
TCFDataCache<?> stack_trace = getStackTrace();
- if (!stack_trace.validate()) {
- stack_trace.wait(this);
- return;
- }
+ if (!stack_trace.validate(this)) return;
if (getStackFrameIndex() < 0) {
// Stepped out of selected function
exit(null);
@@ -84,17 +68,16 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl.
else if (bps != null && ctx.canResume(IRunControl.RM_RESUME)) {
if (bp == null) {
TCFDataCache<IStackTrace.StackTraceContext> frame = getStackFrame();
- if (!frame.validate()) {
- frame.wait(this);
- return;
- }
+ if (!frame.validate(this)) return;
Number addr = frame.getData().getReturnAddress();
if (addr == null) {
exit(new Exception("Unknown stack frame return address"));
return;
}
+ String id = "Step." + ctx.getID();
+ launch.addContextActionBreakpoint(id, "Step");
bp = new HashMap<String,Object>();
- bp.put(IBreakpoints.PROP_ID, "Step" + System.currentTimeMillis());
+ bp.put(IBreakpoints.PROP_ID, id);
bp.put(IBreakpoints.PROP_LOCATION, addr.toString());
bp.put(IBreakpoints.PROP_CONDITION, "$thread==\"" + ctx.getID() + "\"");
bp.put(IBreakpoints.PROP_ENABLED, Boolean.TRUE);
@@ -162,8 +145,7 @@ public abstract class TCFActionStepOut extends TCFAction implements IRunControl.
public void contextResumed(String context) {
}
- public void contextSuspended(String context, String pc, String reason,
- Map<String, Object> params) {
+ public void contextSuspended(String context, String pc, String reason, Map<String,Object> params) {
if (!context.equals(ctx.getID())) return;
exit(null);
}
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java
index 0d4a28ff0..d66383cd1 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/actions/TCFActionStepOver.java
@@ -18,8 +18,6 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
public abstract class TCFActionStepOver extends TCFAction implements IRunControl.RunControlListener {
- private static final long TIMEOUT = 10000;
-
private final boolean src_step;
private final IRunControl rc = launch.getService(IRunControl.class);
private final IBreakpoints bps = launch.getService(IBreakpoints.class);
@@ -56,18 +54,8 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl
exit(new Exception("Invalid context ID"));
return;
}
- if (!ctx.canResume(src_step ? IRunControl.RM_STEP_OVER_LINE : IRunControl.RM_STEP_OVER)) {
- Protocol.invokeLater(TIMEOUT, new Runnable() {
- public void run() {
- exit(new Exception("Time out"));
- }
- });
- }
- }
- if (!state.validate()) {
- state.wait(this);
- return;
}
+ if (!state.validate(this)) return;
if (!state.getData().is_suspended) {
exit(new Exception("Context is not suspended"));
return;
@@ -83,16 +71,10 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl
return;
}
TCFDataCache<?> stack_trace = getStackTrace();
- if (!stack_trace.validate()) {
- stack_trace.wait(this);
- return;
- }
+ if (!stack_trace.validate(this)) return;
if (src_step && source_ref == null) {
line_info = getLineInfo();
- if (!line_info.validate()) {
- line_info.wait(this);
- return;
- }
+ if (!line_info.validate(this)) return;
source_ref = line_info.getData();
if (source_ref == null) {
exit(new Exception("Line info not available"));
@@ -125,17 +107,16 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl
else if (bps != null && ctx.canResume(IRunControl.RM_RESUME)) {
if (bp == null) {
TCFDataCache<IStackTrace.StackTraceContext> frame = getStackFrame();
- if (!frame.validate()) {
- frame.wait(this);
- return;
- }
+ if (!frame.validate(this)) return;
Number addr = frame.getData().getInstructionAddress();
if (addr == null) {
exit(new Exception("Unknown PC address"));
return;
}
+ String id = "Step." + ctx.getID();
+ launch.addContextActionBreakpoint(id, "Step");
bp = new HashMap<String,Object>();
- bp.put(IBreakpoints.PROP_ID, "Step" + System.currentTimeMillis());
+ bp.put(IBreakpoints.PROP_ID, id);
bp.put(IBreakpoints.PROP_LOCATION, addr.toString());
bp.put(IBreakpoints.PROP_CONDITION, "$thread==\"" + ctx.getID() + "\"");
bp.put(IBreakpoints.PROP_ENABLED, Boolean.TRUE);
@@ -172,10 +153,7 @@ public abstract class TCFActionStepOver extends TCFAction implements IRunControl
assert src_step;
BigInteger pc = new BigInteger(state.getData().suspend_pc);
if (pc.compareTo(pc0) < 0 || pc.compareTo(pc1) >= 0) {
- if (!line_info.validate()) {
- line_info.wait(this);
- return;
- }
+ if (!line_info.validate(this)) return;
TCFSourceRef ref = line_info.getData();
if (ref != null && ref.area != null) {
if (isSameLine(source_ref.area, ref.area)) {

Back to the top