1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 21:35:40 +02:00

2004-11-24 Alain Magloire

Make the terminate() more responsive when gdb is shuting down.
	See long discussion part of the 77435 fixes and 40087.

	* cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
	* mi/org/eclipse/cdt/debug/core/MIInferior.java
This commit is contained in:
Alain Magloire 2004-11-24 22:01:05 +00:00
parent 317776f413
commit c4a7c7ac9d
3 changed files with 40 additions and 15 deletions

View file

@ -1,3 +1,10 @@
2004-11-24 Alain Magloire
Make the terminate() more responsive when gdb is shuting down.
See long discussion part of the 77435 fixes and 40087.
* cdi/org/eclipse/cdt/debug/mi/core/cdi/ExpressionManager.java
* mi/org/eclipse/cdt/debug/core/MIInferior.java
2004-11-23 Alain Magloire 2004-11-23 Alain Magloire
Tentative fix for 77435 Tentative fix for 77435
* cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java

View file

@ -120,15 +120,24 @@ public class ExpressionManager extends Manager {
String varName = variable.getMIVar().getVarName(); String varName = variable.getMIVar().getVarName();
MIVarChange[] changes = noChanges; MIVarChange[] changes = noChanges;
MIVarUpdate update = factory.createMIVarUpdate(varName); MIVarUpdate update = factory.createMIVarUpdate(varName);
MIVarUpdateInfo info = null;
try { try {
mi.postCommand(update); mi.postCommand(update);
MIVarUpdateInfo info = update.getMIVarUpdateInfo(); } catch (MIException e) {
throw new MI2CDIException(e);
}
boolean timedout = false;
try {
info = update.getMIVarUpdateInfo();
if (info == null) { if (info == null) {
timedout = true;
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
} }
changes = info.getMIVarChanges(); changes = info.getMIVarChanges();
} catch (MIException e) { } catch (MIException e) {
//throw new MI2CDIException(e); if (timedout) {
throw new MI2CDIException(e);
}
eventList.add(new MIVarDeletedEvent(mi, varName)); eventList.add(new MIVarDeletedEvent(mi, varName));
} }
for (int j = 0; j < changes.length; j++) { for (int j = 0; j < changes.length; j++) {

View file

@ -35,6 +35,7 @@ public class MIInferior extends Process {
boolean connected = false; boolean connected = false;
boolean exitCodeKnown = false;
int exitCode = 0; int exitCode = 0;
int state = 0; int state = 0;
@ -132,6 +133,7 @@ public class MIInferior extends Process {
public int exitValue() { public int exitValue() {
if (isTerminated()) { if (isTerminated()) {
if (!session.isTerminated()) { if (!session.isTerminated()) {
if (!exitCodeKnown) {
CommandFactory factory = session.getCommandFactory(); CommandFactory factory = session.getCommandFactory();
MIGDBShowExitCode code = factory.createMIGDBShowExitCode(); MIGDBShowExitCode code = factory.createMIGDBShowExitCode();
try { try {
@ -141,6 +143,8 @@ public class MIInferior extends Process {
} catch (MIException e) { } catch (MIException e) {
// no rethrown. // no rethrown.
} }
exitCodeKnown = true;
}
} }
return exitCode; return exitCode;
} }
@ -174,11 +178,16 @@ public class MIInferior extends Process {
} }
int token = 0; int token = 0;
if (isSuspended()) { if (isSuspended()) {
try {
CommandFactory factory = session.getCommandFactory(); CommandFactory factory = session.getCommandFactory();
MIExecAbort abort = factory.createMIExecAbort(); MIExecAbort abort = factory.createMIExecAbort();
session.postCommand0(abort, session.getCommandTimeout()); session.postCommand0(abort, -1);
abort.getMIInfo(); // do not wait for the answer.
//abort.getMIInfo();
token = abort.getToken(); token = abort.getToken();
} catch (MIException e) {
// ignore the error
}
} }
setTerminated(token, true); setTerminated(token, true);
} else if (session.isCoreSession() && !isTerminated()){ } else if (session.isCoreSession() && !isTerminated()){