mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 18:55:38 +02:00
Bug 336876: Simplify GDBRunControl_7_2
This will help extend the class for the grouping patch. Change-Id: I67f392833d6391a97850b184f5c866337dff0aba
This commit is contained in:
parent
b5606e115f
commit
c7a94541e5
4 changed files with 13 additions and 58 deletions
|
@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
|
||||||
Bundle-Version: 4.8.0.qualifier
|
Bundle-Version: 4.9.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
|
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>4.8.0-SNAPSHOT</version>
|
<version>4.9.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.dsf.gdb</artifactId>
|
<artifactId>org.eclipse.cdt.dsf.gdb</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2014 Wind River Systems and others.
|
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -701,7 +701,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
||||||
rm.done(doCanResume(context));
|
rm.done(doCanResume(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean doCanResume(IExecutionDMContext context) {
|
/** @since 4.9 */
|
||||||
|
protected boolean doCanResume(IExecutionDMContext context) {
|
||||||
// Thread case
|
// Thread case
|
||||||
if (context instanceof IMIExecutionDMContext) {
|
if (context instanceof IMIExecutionDMContext) {
|
||||||
MIThreadRunState threadState = fThreadRunStates.get(context);
|
MIThreadRunState threadState = fThreadRunStates.get(context);
|
||||||
|
@ -774,7 +775,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doResume(IMIContainerDMContext context, final RequestMonitor rm) {
|
/** @since 4.9 */
|
||||||
|
protected void doResume(IMIContainerDMContext context, final RequestMonitor rm) {
|
||||||
if (!doCanResume(context)) {
|
if (!doCanResume(context)) {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
|
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
|
||||||
"Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
"Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011, 2014 Ericsson and others.
|
* Copyright (c) 2011, 2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -15,10 +15,8 @@ package org.eclipse.cdt.dsf.gdb.service;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl2;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl2;
|
||||||
|
@ -27,7 +25,6 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
|
@ -119,60 +116,16 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
|
||||||
// Now that the flag --thread-group is globally supported
|
// Now that the flag --thread-group is globally supported
|
||||||
// by GDB 7.2, we have to make sure not to use it twice.
|
// by GDB 7.2, we have to make sure not to use it twice.
|
||||||
// Bug 340262
|
// Bug 340262
|
||||||
|
/** @since 4.9 */
|
||||||
@Override
|
@Override
|
||||||
public void resume(final IExecutionDMContext context, final RequestMonitor rm) {
|
protected void doResume(IMIContainerDMContext context, final RequestMonitor rm) {
|
||||||
assert context != null;
|
if (!doCanResume(context)) {
|
||||||
|
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
|
||||||
final IMIExecutionDMContext thread = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
|
"Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
final IMIContainerDMContext container = DMContexts.getAncestorOfType(context, IMIContainerDMContext.class);
|
|
||||||
if (thread == null && container == null) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Invalid context type.", null)); //$NON-NLS-1$
|
|
||||||
rm.done();
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
canResume(context, new ImmediateDataRequestMonitor<Boolean>(rm) {
|
|
||||||
@Override
|
|
||||||
protected void handleSuccess() {
|
|
||||||
if (getData()) {
|
|
||||||
if (thread != null) {
|
|
||||||
doResume(thread, rm);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (container != null) {
|
|
||||||
doResume(container, rm);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
|
|
||||||
"Given context: " + context + ", is already running.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
rm.done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doResume(IMIExecutionDMContext context, final RequestMonitor rm) {
|
|
||||||
final MIThreadRunState threadState = fThreadRunStates.get(context);
|
|
||||||
if (threadState == null) {
|
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
|
|
||||||
"Given context: " + context + " can't be found.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
rm.done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
threadState.fResumePending = true;
|
|
||||||
fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
|
||||||
@Override
|
|
||||||
protected void handleFailure() {
|
|
||||||
threadState.fResumePending = false;
|
|
||||||
super.handleFailure();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doResume(IMIContainerDMContext context, final RequestMonitor rm) {
|
|
||||||
fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue