1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Patch for Elena bug 166660. Cover up some wholes in the MI inferior handling that could cause multi-threading issues.

This commit is contained in:
Doug Schaefer 2008-01-25 21:04:27 +00:00
parent c0b97bbe1c
commit 10534b5968

View file

@ -147,7 +147,7 @@ public class BreakpointManager extends Manager {
// Stop the program // Stop the program
if (allowInterrupt && target.isRunning()) { if (allowInterrupt && target.isRunning()) {
// Disable events. // Disable events.
((EventManager)getSession().getEventManager()).allowProcessingEvents(false); ((EventManager) getSession().getEventManager()).allowProcessingEvents(false);
target.suspend(); target.suspend();
shouldRestart = true; shouldRestart = true;
} }
@ -155,10 +155,9 @@ public class BreakpointManager extends Manager {
} }
void resumeInferior(Target target, boolean shouldRestart) throws CDIException { void resumeInferior(Target target, boolean shouldRestart) throws CDIException {
((EventManager) getSession().getEventManager()).allowProcessingEvents(true);
if (shouldRestart) { if (shouldRestart) {
target.resume(); target.resume();
// Enable events again.
((EventManager)getSession().getEventManager()).allowProcessingEvents(true);
} }
} }
@ -239,19 +238,24 @@ public class BreakpointManager extends Manager {
if (info == null) { if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
} }
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
// Resume the program and enable events.
resumeInferior(target, restart);
}
for (int i = 0; i < miBreakpoints.length; i++) { for (int i = 0; i < miBreakpoints.length; i++) {
miBreakpoints[i].setEnabled(true); miBreakpoints[i].setEnabled(true);
} }
breakpoint.setEnabled0(true); breakpoint.setEnabled0(true);
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
// Resume the program and enable events.
resumeInferior(target, restart);
} finally {
// Fire a changed Event. // Fire a changed Event.
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0])); miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
} }
}
}
/** /**
* Call through the Breakpoint class. Breakpoint.disable * Call through the Breakpoint class. Breakpoint.disable
@ -299,18 +303,21 @@ public class BreakpointManager extends Manager {
if (info == null) { if (info == null) {
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
} }
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
resumeInferior(target, restart);
}
for (int i = 0; i < miBreakpoints.length; i++) { for (int i = 0; i < miBreakpoints.length; i++) {
miBreakpoints[i].setEnabled(false); miBreakpoints[i].setEnabled(false);
} }
breakpoint.setEnabled0(false); breakpoint.setEnabled0(false);
} catch (MIException e) {
throw new MI2CDIException(e);
} finally {
try {
resumeInferior(target, restart);
} finally {
// Fire a changed Event. // Fire a changed Event.
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0])); miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
} }
}
}
/** /**
* Use by the Breakpoint class, Breakpoint.setCondition(Condition cond) * Use by the Breakpoint class, Breakpoint.setCondition(Condition cond)