1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

retry stakc-info-depth a second time.

This commit is contained in:
Alain Magloire 2003-12-02 17:32:16 +00:00
parent 1ab961febb
commit 6feee575a5

View file

@ -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);
}