diff options
author | Alain Magloire | 2003-12-02 20:20:29 +0000 |
---|---|---|
committer | Alain Magloire | 2003-12-02 20:20:29 +0000 |
commit | e8a67966ac242ee8c06f905dae333a685feab750 (patch) | |
tree | 6353c90369dba4f8b82e25a969ab81aa83b1696b | |
parent | eb0372549c29a963ca0ea3ae8030b190194787cd (diff) | |
download | org.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.
-rw-r--r-- | debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java | 25 |
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); } |