1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

[302597] Handle the missing *stopped event after CLI commands from GDBs older than 7.0. Also add support for 'return' in the console. We can now use next, continue et al in the console.

This commit is contained in:
Marc Khouzam 2010-02-11 19:10:27 +00:00
parent 73f10c6e73
commit 9fa4237bc5
3 changed files with 30 additions and 6 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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());
}
}
}
}
}
}
}