1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 365471: Explicitly set 'target-async off'

This commit is contained in:
Marc Khouzam 2011-12-23 09:49:51 -05:00
parent c1f0069b97
commit 5c70f146df
4 changed files with 95 additions and 9 deletions

View file

@ -11,6 +11,7 @@
* IBM Corporation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - No longer call method to check non-stop for GDB < 7.0 (Bug 365471)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
@ -79,7 +80,6 @@ public class FinalLaunchSequence extends ReflectionSequence {
"stepSetBreakpointPending", //$NON-NLS-1$
"stepEnablePrettyPrinting", //$NON-NLS-1$
"stepSourceGDBInitFile", //$NON-NLS-1$
"stepSetNonStop", //$NON-NLS-1$
"stepSetAutoLoadSharedLibrarySymbols", //$NON-NLS-1$
"stepSetSharedLibraryPaths", //$NON-NLS-1$
@ -251,6 +251,9 @@ public class FinalLaunchSequence extends ReflectionSequence {
* Enable non-stop mode if requested.
* @since 4.0
*/
// Keep this method in this class for backwards-compatibility, although
// it is called only by sub-classes.
// It could be moved to FinalLaunchSequence_7_0, otherwise.
@Execute
public void stepSetNonStop(final RequestMonitor requestMonitor) {
boolean isNonStop = CDebugUtils.getAttribute(
@ -280,7 +283,17 @@ public class FinalLaunchSequence extends ReflectionSequence {
}
});
} else {
requestMonitor.done();
// Explicitly set target-async to off for all-stop mode.
fCommandControl.queueCommand(
fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), false),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleError() {
// We should only be calling this for GDB >= 7.0,
// but just in case, accept errors for older GDBs
requestMonitor.done();
}
});
}
}

View file

@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson 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 Khouzam (Ericsson) - initial API and implementation (Bug 365471)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Subclass for GDB >= 7.0.
* This class currently sets non-stop mode, or makes
* sure target-async is off for all-stop.
*
* @since 4.1
*/
public class FinalLaunchSequence_7_0 extends FinalLaunchSequence {
public FinalLaunchSequence_7_0(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
super(session, attributes, rm);
}
@Override
protected String[] getExecutionOrder(String group) {
if (GROUP_TOP_LEVEL.equals(group)) {
// Initialize the list with the base class' steps
// We need to create a list that we can modify, which is why we create our own ArrayList.
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our steps right after the initialization of the base class.
orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence") + 1, "stepInitializeFinalLaunchSequence_7_0"); //$NON-NLS-1$ //$NON-NLS-2$
// Note that stepSetNonStop is defined in the base class for backwards-compatibility
orderList.add(orderList.indexOf("stepSourceGDBInitFile") + 1, "stepSetNonStop"); //$NON-NLS-1$ //$NON-NLS-2$
return orderList.toArray(new String[orderList.size()]);
}
return null;
}
/**
* Initialize the members of the FinalLaunchSequence_7_0 class.
* This step is mandatory for the rest of the sequence to complete.
*/
@Execute
public void stepInitializeFinalLaunchSequence_7_0(RequestMonitor rm) {
rm.done();
}
}

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Ericsson - initial API and implementation
* Marc Khouzam (Ericsson) - Use new FinalLaunchSequence_7_0 as base class (Bug 365471)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
@ -34,7 +35,7 @@ import org.eclipse.core.runtime.Status;
*
* @since 4.0
*/
public class FinalLaunchSequence_7_2 extends FinalLaunchSequence {
public class FinalLaunchSequence_7_2 extends FinalLaunchSequence_7_0 {
private IGDBControl fGdbControl;
private DsfSession fSession;
@ -56,7 +57,7 @@ public class FinalLaunchSequence_7_2 extends FinalLaunchSequence {
List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Now insert our steps right after the initialization of the base class.
orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence") + 1, "stepInitializeFinalLaunchSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$
orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_0") + 1, "stepInitializeFinalLaunchSequence_7_2"); //$NON-NLS-1$ //$NON-NLS-2$
orderList.add(orderList.indexOf("stepSetBreakpointPending") + 1, "stepDetachOnFork"); //$NON-NLS-1$ //$NON-NLS-2$
return orderList.toArray(new String[orderList.size()]);

View file

@ -11,6 +11,7 @@
* Ericsson - New version for 7_0
* Vladimir Prus (CodeSourcery) - Support for -data-read-memory-bytes (bug 322658)
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Marc Khouzam (Ericsson) - Call new FinalLaunchSequence_7_0 (Bug 365471)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service.command;
@ -38,7 +39,7 @@ import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence;
import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence_7_0;
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
@ -170,6 +171,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
}
@Override
public String getId() {
return fMIBackend.getId();
}
@ -179,10 +181,12 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
return fControlDmc;
}
@Override
public ICommandControlDMContext getContext() {
return fControlDmc;
}
@Override
public void terminate(final RequestMonitor rm) {
if (fTerminated) {
rm.done();
@ -204,6 +208,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
// runnable will kill the task.
final Future<?> forceQuitTask = getExecutor().schedule(
new DsfRunnable() {
@Override
public void run() {
fMIBackend.destroy();
rm.done();
@ -246,6 +251,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
});
}
@Override
public AbstractCLIProcess getCLIProcess() {
return fCLIProcess;
}
@ -253,11 +259,13 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
/**
* @since 2.0
*/
@Override
public void setTracingStream(OutputStream tracingStream) {
setMITracingStream(tracingStream);
}
/** @since 3.0 */
@Override
public void setEnvironment(Properties props, boolean clear, RequestMonitor rm) {
int count = 0;
CountingRequestMonitor countingRm = new CountingRequestMonitor(getExecutor(), rm);
@ -285,6 +293,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
/**
* @since 4.0
*/
@Override
@SuppressWarnings("unchecked")
public void completeInitialization(final RequestMonitor rm) {
// We take the attributes from the launchConfiguration
@ -321,10 +330,11 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
* @since 4.0
*/
protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
return new FinalLaunchSequence(getSession(), attributes, rm);
return new FinalLaunchSequence_7_0(getSession(), attributes, rm);
}
/**@since 4.0 */
@Override
public List<String> getFeatures() {
return fFeatures;
}
@ -468,9 +478,8 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
/**
* @since 4.0
*/
public void enablePrettyPrintingForMIVariableObjects(
final RequestMonitor rm) {
@Override
public void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm) {
queueCommand(
getCommandFactory().createMIEnablePrettyPrinting(fControlDmc),
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
@ -479,6 +488,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
/**
* @since 4.0
*/
@Override
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
String subCommand = "set python print-stack " + (enabled ? "on" : "off"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$