Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2010-05-03 18:56:21 +0000
committerJohn Cortell2010-05-03 18:56:21 +0000
commit99dd5a34ae60056d1b684c986ba4975c3fb04782 (patch)
tree5cc95828d402b9c9dd383b140e6ad90a0e64113b /dsf-gdb
parent4b0c9bd6cef05da8c6b39375fcfd182f03b461ef (diff)
downloadorg.eclipse.cdt-99dd5a34ae60056d1b684c986ba4975c3fb04782.tar.gz
org.eclipse.cdt-99dd5a34ae60056d1b684c986ba4975c3fb04782.tar.xz
org.eclipse.cdt-99dd5a34ae60056d1b684c986ba4975c3fb04782.zip
Bug 311380: Interrupting target can leave Debug view in awkward state
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java47
1 files changed, 44 insertions, 3 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
index ac72a824096..10063701ca9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
@@ -363,7 +363,7 @@ public class MIStack extends AbstractDsfService
final MIFrameDMC miFrameDmc = (MIFrameDMC)frameDmc;
- IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(frameDmc, IMIExecutionDMContext.class);
+ final IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(frameDmc, IMIExecutionDMContext.class);
if (execDmc == null) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "No execution context found in " + frameDmc, null)); //$NON-NLS-1$
rm.done();
@@ -453,6 +453,36 @@ public class MIStack extends AbstractDsfService
rm.setData(new FrameDataFromMIStackFrameListInfo(getData(), idx));
rm.done();
}
+
+ @Override
+ protected void handleError() {
+ // We're seeing gdb in some cases fail when it's
+ // being asked for the stack depth or stack
+ // frames, but the same command succeeds if
+ // the request is limited to one frame. So try
+ // again with a limit of 1. It's better to show
+ // just one frame than none at all
+ if (miFrameDmc.fLevel == 0) {
+ fMICommandCache.execute(
+ fCommandFactory.createMIStackListFrames(execDmc, 0, 0),
+ new DataRequestMonitor<MIStackListFramesInfo>(getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ // Find the index to the correct MI frame object.
+ int idx = findFrameIndex(getData().getMIFrames(), miFrameDmc.fLevel);
+ if (idx == -1) {
+ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid frame " + frameDmc, null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // Create the data object.
+ rm.setData(new FrameDataFromMIStackFrameListInfo(getData(), idx));
+ rm.done();
+ }
+ });
+ }
+ }
});
}
@@ -857,7 +887,7 @@ public class MIStack extends AbstractDsfService
});
}
- public void getStackDepth(IDMContext dmc, final int maxDepth, final DataRequestMonitor<Integer> rm) {
+ public void getStackDepth(final IDMContext dmc, final int maxDepth, final DataRequestMonitor<Integer> rm) {
final IMIExecutionDMContext execDmc = DMContexts.getAncestorOfType(dmc, IMIExecutionDMContext.class);
if (execDmc != null) {
// Make sure the thread is stopped
@@ -909,7 +939,18 @@ public class MIStack extends AbstractDsfService
rm.setData(1);
rm.done();
} else {
- super.handleError();
+ // We're seeing gdb in some cases fail when it's
+ // being asked for the stack depth or stack
+ // frames, but the same command succeeds if
+ // the request is limited to one frame. So try
+ // again with a limit of 1. It's better to show
+ // just one frame than none at all
+ if (maxDepth != 1) {
+ getStackDepth(dmc, 1, rm);
+ }
+ else {
+ super.handleError();
+ }
}
}
});

Back to the top