diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java index 60e77d41096..7c8bbb6decd 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 QNX Software Systems and others. + * Copyright (c) 2000, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -238,7 +238,7 @@ public class CLIEventProcessor private static int getSteppingOperationKind(String operation) { int type = -1; - /* execution commands: n, next, s, step, si, stepi, u, until, finish, + /* execution commands: n, next, s, step, si, stepi, u, until, finish, return, c, continue, fg */ if (operation.equals("n") || operation.equals("next")) { //$NON-NLS-1$ //$NON-NLS-2$ type = MIRunningEvent.NEXT; @@ -253,6 +253,8 @@ public class CLIEventProcessor type = MIRunningEvent.UNTIL; } else if (operation.startsWith("fin") && "finish".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ type = MIRunningEvent.FINISH; + } else if (operation.startsWith("ret") && "return".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + type = MIRunningEvent.RETURN; } else if (operation.equals("c") || operation.equals("fg") || //$NON-NLS-1$ //$NON-NLS-2$ (operation.startsWith("cont") && "continue".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$ type = MIRunningEvent.CONTINUE; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java index 51e2167938f..85765af7b75 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor_7_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 QNX Software Systems and others. + * Copyright (c) 2008, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -183,7 +183,7 @@ public class CLIEventProcessor_7_0 private static int getSteppingOperationKind(String operation) { int type = -1; - /* execution commands: n, next, s, step, si, stepi, u, until, finish, + /* execution commands: n, next, s, step, si, stepi, u, until, finish, rerurn, c, continue, fg */ if (operation.equals("n") || operation.equals("next")) { //$NON-NLS-1$ //$NON-NLS-2$ type = MIRunningEvent.NEXT; @@ -198,6 +198,8 @@ public class CLIEventProcessor_7_0 type = MIRunningEvent.UNTIL; } else if (operation.startsWith("fin") && "finish".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ type = MIRunningEvent.FINISH; + } else if (operation.startsWith("ret") && "return".indexOf(operation) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + type = MIRunningEvent.RETURN; } else if (operation.equals("c") || operation.equals("fg") || //$NON-NLS-1$ //$NON-NLS-2$ (operation.startsWith("cont") && "continue".indexOf(operation) != -1)) { //$NON-NLS-1$ //$NON-NLS-2$ type = MIRunningEvent.CONTINUE; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java index 302913650d3..928ed6ddc4a 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Wind River Systems and others. + * Copyright (c) 2006, 2010 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,7 @@ package org.eclipse.cdt.dsf.mi.service.command; import java.util.LinkedList; import java.util.List; +import org.eclipse.cdt.dsf.debug.service.IRunControl; import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; @@ -29,6 +30,7 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand; import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecFinish; import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNext; @@ -283,7 +285,25 @@ public class MIRunControlEventProcessor } } } else if ("error".equals(state)) { //$NON-NLS-1$ - } + } else if ("done".equals(state)) { //$NON-NLS-1$ + // For GDBs older than 7.0, GDB does not trigger a *stopped event + // when it stops due to a CLI command. We have to trigger the + // MIStoppedEvent ourselves + if (cmd instanceof CLICommand) { + IRunControl runControl = fServicesTracker.getService(IRunControl.class); + IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); + if (runControl != null && procService != null) { + String groupId = MIProcesses.UNIQUE_GROUP_ID; + IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId); + IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId); + + if (runControl.isSuspended(processContainerDmc) == false) { + MIEvent event = MIStoppedEvent.parse(processContainerDmc, id, rr.getMIResults()); + fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); + } + } + } + } } } }