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

[261753] protects us against sending MI Stopped events with a null context if GDB generates an empty *stopped event

This commit is contained in:
Marc Khouzam 2009-01-21 04:10:51 +00:00
parent f21a1cd7f7
commit 55244050c6

View file

@ -119,7 +119,7 @@ public class MIRunControlEventProcessor_7_0
MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr; MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr;
// Change of state. // Change of state.
String state = exec.getAsyncClass(); String state = exec.getAsyncClass();
if ("stopped".equals(state)) { //$NON-NLS-1$ if (STOPPED_REASON.equals(state)) {
// Re-set the thread and stack level to -1 when stopped event is recvd. // Re-set the thread and stack level to -1 when stopped event is recvd.
// This is to synchronize the state between GDB back-end and AbstractMIControl. // This is to synchronize the state between GDB back-end and AbstractMIControl.
fCommandControl.resetCurrentThreadLevel(); fCommandControl.resetCurrentThreadLevel();
@ -154,7 +154,7 @@ public class MIRunControlEventProcessor_7_0
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
} }
} }
else if ("running".equals(state)) { //$NON-NLS-1$ else if (RUNNING_REASON.equals(state)) {
MIEvent<?> event = createEvent(RUNNING_REASON, exec); MIEvent<?> event = createEvent(RUNNING_REASON, exec);
if (event != null) { if (event != null) {
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
@ -286,6 +286,11 @@ public class MIRunControlEventProcessor_7_0
execDmc = procService.createExecutionContext(containerDmc, threadDmc, threadId); execDmc = procService.createExecutionContext(containerDmc, threadDmc, threadId);
} }
if (execDmc == null) {
// Badly formatted event
return null;
}
MIEvent<?> event = null; MIEvent<?> event = null;
if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$ if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$
event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults()); event = MIBreakpointHitEvent.parse(execDmc, exec.getToken(), exec.getMIResults());
@ -342,7 +347,7 @@ public class MIRunControlEventProcessor_7_0
if (rr != null) { if (rr != null) {
// Check if the state changed. // Check if the state changed.
String state = rr.getResultClass(); String state = rr.getResultClass();
if ("running".equals(state)) { //$NON-NLS-1$ if (RUNNING_REASON.equals(state)) {
// Store the type of command that is the trigger for the coming // Store the type of command that is the trigger for the coming
// *running event // *running event
if (cmd instanceof MIExecNext) { fLastRunningCmdType = MIRunningEvent.NEXT; } if (cmd instanceof MIExecNext) { fLastRunningCmdType = MIRunningEvent.NEXT; }