From 55244050c6380f01bf8f7f2084ebae3ec46ca602 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 21 Jan 2009 04:10:51 +0000 Subject: [261753] protects us against sending MI Stopped events with a null context if GDB generates an empty *stopped event --- .../mi/service/command/MIRunControlEventProcessor_7_0.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'dsf-gdb') diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java index 578c8a5ec12..0045d085787 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java @@ -119,7 +119,7 @@ public class MIRunControlEventProcessor_7_0 MIExecAsyncOutput exec = (MIExecAsyncOutput) oobr; // Change of state. 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. // This is to synchronize the state between GDB back-end and AbstractMIControl. fCommandControl.resetCurrentThreadLevel(); @@ -154,7 +154,7 @@ public class MIRunControlEventProcessor_7_0 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); if (event != null) { fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); @@ -285,6 +285,11 @@ public class MIRunControlEventProcessor_7_0 IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId); execDmc = procService.createExecutionContext(containerDmc, threadDmc, threadId); } + + if (execDmc == null) { + // Badly formatted event + return null; + } MIEvent event = null; if ("breakpoint-hit".equals(reason)) { //$NON-NLS-1$ @@ -342,7 +347,7 @@ public class MIRunControlEventProcessor_7_0 if (rr != null) { // Check if the state changed. 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 // *running event if (cmd instanceof MIExecNext) { fLastRunningCmdType = MIRunningEvent.NEXT; } -- cgit v1.2.1