Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorAlain Magloire2003-12-02 15:20:29 -0500
committerAlain Magloire2003-12-02 15:20:29 -0500
commite8a67966ac242ee8c06f905dae333a685feab750 (patch)
tree6353c90369dba4f8b82e25a969ab81aa83b1696b /debug
parenteb0372549c29a963ca0ea3ae8030b190194787cd (diff)
downloadorg.eclipse.cdt-e8a67966ac242ee8c06f905dae333a685feab750.tar.gz
org.eclipse.cdt-e8a67966ac242ee8c06f905dae333a685feab750.tar.xz
org.eclipse.cdt-e8a67966ac242ee8c06f905dae333a685feab750.zip
Retry the stack-info-depth when failing the fisrt time.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
index ecd3ba20c18..2b063b15b16 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java
@@ -128,14 +128,29 @@ public class Thread extends CObject implements ICDIThread {
CommandFactory factory = mi.getCommandFactory();
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
mi.postCommand(depth);
- MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
- if (info == null) {
- throw new CDIException("No answer");
+ MIStackInfoDepthInfo info = null;
+ try {
+ // Catch the first exception gdb can recover the second time.
+ info = depth.getMIStackInfoDepthInfo();
+ if (info == null) {
+ throw new CDIException("No answer");
+ }
+ stackdepth = info.getDepth();
+ } catch (MIException e) {
+ // First try fails, retry. gdb patches up the corrupt frame
+ // so retry should give us a frame count that is safe.
+ mi.postCommand(depth);
+ info = depth.getMIStackInfoDepthInfo();
+ if (info == null) {
+ throw new CDIException("No answer");
+ }
+ stackdepth = info.getDepth();
+ if (stackdepth > 0) {
+ stackdepth--;
+ }
}
- stackdepth = info.getDepth();
} catch (MIException e) {
throw new MI2CDIException(e);
- //System.out.println(e);
} finally {
currentTarget.setCurrentThread(currentThread, false);
}

Back to the top