mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-22 15:53:58 +02:00
Retry the stack-info-depth when failing the fisrt time.
This commit is contained in:
parent
eb0372549c
commit
e8a67966ac
1 changed files with 20 additions and 5 deletions
|
@ -128,14 +128,29 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
||||||
mi.postCommand(depth);
|
mi.postCommand(depth);
|
||||||
MIStackInfoDepthInfo info = depth.getMIStackInfoDepthInfo();
|
MIStackInfoDepthInfo info = null;
|
||||||
if (info == null) {
|
try {
|
||||||
throw new CDIException("No answer");
|
// 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) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
//System.out.println(e);
|
|
||||||
} finally {
|
} finally {
|
||||||
currentTarget.setCurrentThread(currentThread, false);
|
currentTarget.setCurrentThread(currentThread, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue