1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +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,18 +238,23 @@ 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$
} }
for (int i = 0; i < miBreakpoints.length; i++) {
miBreakpoints[i].setEnabled(true);
}
breakpoint.setEnabled0(true);
} catch (MIException e) { } catch (MIException e) {
throw new MI2CDIException(e); throw new MI2CDIException(e);
} finally { } finally {
// Resume the program and enable events. try {
resumeInferior(target, restart); // Resume the program and enable events.
resumeInferior(target, restart);
} finally {
// Fire a changed Event.
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
}
} }
for (int i = 0; i < miBreakpoints.length; i++) {
miBreakpoints[i].setEnabled(true);
}
breakpoint.setEnabled0(true);
// Fire a changed Event.
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
} }
/** /**
@ -299,17 +303,20 @@ 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$
} }
for (int i = 0; i < miBreakpoints.length; i++) {
miBreakpoints[i].setEnabled(false);
}
breakpoint.setEnabled0(false);
} catch (MIException e) { } catch (MIException e) {
throw new MI2CDIException(e); throw new MI2CDIException(e);
} finally { } finally {
resumeInferior(target, restart); try {
resumeInferior(target, restart);
} finally {
// Fire a changed Event.
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
}
} }
for (int i = 0; i < miBreakpoints.length; i++) {
miBreakpoints[i].setEnabled(false);
}
breakpoint.setEnabled0(false);
// Fire a changed Event.
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
} }
/** /**