mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
[265483] Allow the interruption of the inferior for MacOS
This commit is contained in:
parent
5a1293b690
commit
d4c2688d6c
2 changed files with 71 additions and 0 deletions
|
@ -0,0 +1,64 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Marc-Andre Laperle - Mac OS version, fix for bug 265483
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.dsf.gdb.service.macos;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.GDBRunControl;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecInterrupt;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
public class MacOSGDBRunControl extends GDBRunControl {
|
||||||
|
|
||||||
|
public MacOSGDBRunControl(DsfSession session) {
|
||||||
|
super(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We use the MIControl code since -exec-interrupt works with Apple gdb
|
||||||
|
// but SIGINT does not; it seems it runs in async mode by default
|
||||||
|
@Override
|
||||||
|
public void suspend(final IExecutionDMContext context, final RequestMonitor rm){
|
||||||
|
assert context != null;
|
||||||
|
|
||||||
|
canSuspend(
|
||||||
|
context,
|
||||||
|
new DataRequestMonitor<Boolean>(getExecutor(), rm) {
|
||||||
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
if (getData()) {
|
||||||
|
MIExecInterrupt cmd = null;
|
||||||
|
if (context instanceof IContainerDMContext) {
|
||||||
|
cmd = new MIExecInterrupt(context);
|
||||||
|
} else {
|
||||||
|
IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
|
||||||
|
if (dmc == null) {
|
||||||
|
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Given context: " + context + " is not an execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
rm.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmd = new MIExecInterrupt(dmc);
|
||||||
|
}
|
||||||
|
getConnection().queueCommand(cmd, new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||||
|
} else {
|
||||||
|
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Context cannot be suspended.", null)); //$NON-NLS-1$
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,11 +7,13 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Marc-Andre Laperle - Added support for Mac OS (separate factory)
|
* Marc-Andre Laperle - Added support for Mac OS (separate factory)
|
||||||
|
* - fix for bug 265483
|
||||||
* Ericsson - Added a field for the specific Mac OS version scheme
|
* Ericsson - Added a field for the specific Mac OS version scheme
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service.macos;
|
package org.eclipse.cdt.dsf.gdb.service.macos;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IExpressions;
|
import org.eclipse.cdt.dsf.debug.service.IExpressions;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
|
||||||
|
@ -33,4 +35,9 @@ public class MacOSGdbDebugServicesFactory extends GdbDebugServicesFactory {
|
||||||
protected IExpressions createExpressionService(DsfSession session) {
|
protected IExpressions createExpressionService(DsfSession session) {
|
||||||
return new MacOSGDBExpressions(session);
|
return new MacOSGDBExpressions(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IRunControl createRunControlService(DsfSession session) {
|
||||||
|
return new MacOSGDBRunControl(session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue