1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 509812 - Unable to interrupt arm remote target, Neon and GDB 7.12

Adding a GDBJtagDSFFinalLaunchSequence_7_12 class to be used when
interfacing with GDB 7.12 or higher.
A new step is added to the sequence in order to enable async mode,
which will allow us to use the new GDBFullCLIConsole

Change-Id: I08c382550c6dd8a8567a66169495a9e490c35397
This commit is contained in:
Alvaro Sanchez-Leon 2017-01-09 11:42:22 -05:00
parent 028eb67a17
commit 2e780a54f1
8 changed files with 140 additions and 8 deletions

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.debug.gdbjtag.core" version="2">
<resource path="src/org/eclipse/cdt/debug/gdbjtag/core/dsf/gdb/service/extensions/GDBJtagControl_HEAD.java" type="org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.extensions.GDBJtagControl_HEAD">
<filter comment="This change is understood and will not break the API" id="338849923">
<message_arguments>
<message_argument value="org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.extensions.GDBJtagControl_HEAD"/>
</message_arguments>
</filter>
</resource>
</component>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true
Bundle-Version: 9.0.0.qualifier
Bundle-Version: 9.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>9.0.0-SNAPSHOT</version>
<version>9.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.gdbjtag.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,77 @@
/*******************************************************************************
* Copyright (c) 2017 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
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Subclass for GDB >= 7.12.
*
* @since 9.1
*/
public class GDBJtagDSFFinalLaunchSequence_7_12 extends GDBJtagDSFFinalLaunchSequence_7_7 {
public GDBJtagDSFFinalLaunchSequence_7_12(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 steps from the base class
List<String> orderList = new ArrayList<String>(
Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
// Add the new step after we source the gdbinit file to make sure the user
// cannot change this behavior
orderList.add(orderList.indexOf("stepSourceGDBInitFile") + 1, //$NON-NLS-1$
"stepSetTargetAsync"); //$NON-NLS-1$
return orderList.toArray(new String[orderList.size()]);
}
return super.getExecutionOrder(group);
}
@Execute
public void stepSetTargetAsync(RequestMonitor rm) {
DsfServicesTracker tracker = new DsfServicesTracker(Activator.getBundleContext(),
getSession().getId());
IMICommandControl commandControl = tracker.getService(IMICommandControl.class);
tracker.dispose();
if (commandControl != null) {
// Use target async when interfacing with GDB 7.12 or higher
// this will allow us to use the new enhanced GDB Full CLI console
commandControl.queueCommand(
commandControl.getCommandFactory().createMIGDBSetTargetAsync(commandControl.getContext(), true),
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
@Override
protected void handleError() {
// We should only be calling this for GDB >= 7.12,
// but just in case, accept errors for older GDBs
rm.done();
}
});
} else {
// Should never happen but accept errors in this case
rm.done();
}
}
}

View file

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2017 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
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service;
import java.util.Map;
import org.eclipse.cdt.debug.gdbjtag.core.GDBJtagDSFFinalLaunchSequence_7_12;
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
import org.eclipse.cdt.dsf.concurrent.Sequence;
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_12;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.debug.core.ILaunchConfiguration;
/**
* Jtag control service which selects the Jtag CompleteInitializationSequence. Used for GDB >= 7.12
*
* @since 9.1
*/
public class GDBJtagControl_7_12 extends GDBControl_7_12 {
public GDBJtagControl_7_12(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
super(session, config, factory);
}
@Override
protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes,
RequestMonitorWithProgress rm) {
return new GDBJtagDSFFinalLaunchSequence_7_12(getSession(), attributes, rm);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2016 Ericsson and others.
* Copyright (c) 2011, 2017 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
@ -30,6 +30,9 @@ public class GdbJtagDebugServicesFactory extends GdbDebugServicesFactory {
@Override
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
if (compareVersionWith(GDB_7_12_VERSION) >= 0) {
return new GDBJtagControl_7_12(session, config, new CommandFactory_6_8());
}
if (compareVersionWith(GDB_7_7_VERSION) >= 0) {
return new GDBJtagControl_7_7(session, config, new CommandFactory_6_8());
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015 Ericsson and others.
* Copyright (c) 2015, 2017 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
@ -7,7 +7,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.extensions;
import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.GDBJtagControl_7_7;
import org.eclipse.cdt.debug.gdbjtag.core.dsf.gdb.service.GDBJtagControl_7_12;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
@ -38,14 +38,14 @@ import org.eclipse.debug.core.ILaunchConfiguration;
*
* @since 8.5
*/
public class GDBJtagControl_HEAD extends GDBJtagControl_7_7 {
public class GDBJtagControl_HEAD extends GDBJtagControl_7_12 {
public GDBJtagControl_HEAD(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
super(session, config, factory);
validateGdbVersion(session);
}
protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_7_VERSION; }
protected String getMinGDBVersionSupported() { return GdbDebugServicesFactory.GDB_7_12_VERSION; }
protected void validateGdbVersion(DsfSession session) {
GdbDebugServicesFactory.validateGdbVersion(session, getMinGDBVersionSupported(), this);

View file

@ -79,7 +79,13 @@ public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice {
*/
@Override
public void doContinue(Collection<String> commands) {
String cmd = "continue"; //$NON-NLS-1$
// The CLI version "continue" causes GDB to block and would not be
// able to respond other MI commands, this is a problem
// when running in async mode as it depends on the processing
// of MI commands e.g. to suspend the program.
// Therefore we need to use the MI command version "-exec-continue"
// which does not block GDB.
String cmd = "-exec-continue"; //$NON-NLS-1$
addCmd(commands, cmd);
}