Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorJonah Graham2019-08-03 15:17:58 +0000
committerJonah Graham2019-08-07 04:48:15 +0000
commit6c34f9bad560b48024f0dd90d643aca0ca5810f6 (patch)
treed55a50e337ee5f30737dfae2afb39f0005d6e8cc /debug
parentacbceb04ee9e472119ef3255a47986c833fcf4c2 (diff)
downloadorg.eclipse.cdt-6c34f9bad560b48024f0dd90d643aca0ca5810f6.tar.gz
org.eclipse.cdt-6c34f9bad560b48024f0dd90d643aca0ca5810f6.tar.xz
org.eclipse.cdt-6c34f9bad560b48024f0dd90d643aca0ca5810f6.zip
Bug 542488: JTAG debug support based on DAP remote debugging
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.dap-feature/feature.xml5
-rw-r--r--debug/org.eclipse.cdt.debug.dap/BuildDebugServers.xml4
-rw-r--r--debug/org.eclipse.cdt.debug.dap/META-INF/MANIFEST.MF3
-rw-r--r--debug/org.eclipse.cdt.debug.dap/build.properties5
-rw-r--r--debug/org.eclipse.cdt.debug.dap/debug-servers/yarn.lock8
-rw-r--r--debug/org.eclipse.cdt.debug.dap/plugin.xml4
-rw-r--r--debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/DapLaunchDelegate.java47
-rw-r--r--debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/tabs/CArgumentsTab.java (renamed from debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/CArgumentsTab.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/tabs/CMainTab.java (renamed from debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/CMainTab.java)2
9 files changed, 51 insertions, 29 deletions
diff --git a/debug/org.eclipse.cdt.debug.dap-feature/feature.xml b/debug/org.eclipse.cdt.debug.dap-feature/feature.xml
index 4aa5fb543d8..0f8b8624df8 100644
--- a/debug/org.eclipse.cdt.debug.dap-feature/feature.xml
+++ b/debug/org.eclipse.cdt.debug.dap-feature/feature.xml
@@ -22,12 +22,14 @@
<requires>
<import plugin="org.apache.commons.io"/>
<import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.lsp4e" version="0.11.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.genericeditor" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jface.text"/>
<import plugin="org.eclipse.cdt.ui"/>
<import plugin="org.eclipse.cdt.core"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.lsp4j" version="0.7.2" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.commands"/>
<import plugin="org.eclipse.core.expressions"/>
<import plugin="org.eclipse.core.resources"/>
@@ -43,8 +45,7 @@
<import plugin="com.google.guava"/>
<import plugin="org.eclipse.xtext.xbase.lib"/>
<import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.lsp4e" version="0.11.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.lsp4j" version="0.7.2" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.dsf.gdb" version="5.7.200" match="greaterOrEqual"/>
</requires>
<plugin
diff --git a/debug/org.eclipse.cdt.debug.dap/BuildDebugServers.xml b/debug/org.eclipse.cdt.debug.dap/BuildDebugServers.xml
index d51ea6b706d..d8472d4ae09 100644
--- a/debug/org.eclipse.cdt.debug.dap/BuildDebugServers.xml
+++ b/debug/org.eclipse.cdt.debug.dap/BuildDebugServers.xml
@@ -2,6 +2,10 @@
<project default="BuildDebugServers">
<!-- Wrap running yarn in an ant task so that we don't have to specify absolute path to yarn in external tool builder. -->
<target name="BuildDebugServers" description="Build the Node Debug Servers with yarn">
+ <exec executable="yarn" dir="./debug-servers" failifexecutionfails="true">
+ <arg value="upgrade"/>
+ <arg value="cdt-gdb-adapter"/>
+ </exec>
<exec executable="yarn" dir="./debug-servers" failifexecutionfails="true" />
</target>
</project>
diff --git a/debug/org.eclipse.cdt.debug.dap/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.dap/META-INF/MANIFEST.MF
index a122b314508..f6723d89250 100644
--- a/debug/org.eclipse.cdt.debug.dap/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.dap/META-INF/MANIFEST.MF
@@ -27,7 +27,8 @@ Require-Bundle: org.apache.commons.io,
org.eclipse.lsp4j.debug,
org.eclipse.lsp4j.jsonrpc.debug,
com.google.guava,
- org.eclipse.xtext.xbase.lib
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.cdt.dsf.gdb;bundle-version="5.7.200"
Bundle-Vendor: %Bundle-Vendor
Export-Package: org.eclipse.cdt.debug.dap
Bundle-Activator: org.eclipse.cdt.debug.dap.Activator
diff --git a/debug/org.eclipse.cdt.debug.dap/build.properties b/debug/org.eclipse.cdt.debug.dap/build.properties
index 3800a69ab1b..d2d6a0408f9 100644
--- a/debug/org.eclipse.cdt.debug.dap/build.properties
+++ b/debug/org.eclipse.cdt.debug.dap/build.properties
@@ -3,6 +3,5 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
- OSGI-INF/,\
- OSGI-INF/l10n/bundle.properties,\
- debug-servers/
+ debug-servers/,\
+ OSGI-INF/
diff --git a/debug/org.eclipse.cdt.debug.dap/debug-servers/yarn.lock b/debug/org.eclipse.cdt.debug.dap/debug-servers/yarn.lock
index 4c9813d0163..1c7b27e5510 100644
--- a/debug/org.eclipse.cdt.debug.dap/debug-servers/yarn.lock
+++ b/debug/org.eclipse.cdt.debug.dap/debug-servers/yarn.lock
@@ -4,7 +4,7 @@
"cdt-gdb-adapter@https://ci.eclipse.org/cdt/view/all/job/cdt-gdb-adapter-master/lastSuccessfulBuild/artifact/cdt-gdb-adapter-v0.0.13.tgz":
version "0.0.13"
- resolved "https://ci.eclipse.org/cdt/view/all/job/cdt-gdb-adapter-master/lastSuccessfulBuild/artifact/cdt-gdb-adapter-v0.0.13.tgz#52f40db4d926d876c89d748807dcf6032dbde88e"
+ resolved "https://ci.eclipse.org/cdt/view/all/job/cdt-gdb-adapter-master/lastSuccessfulBuild/artifact/cdt-gdb-adapter-v0.0.13.tgz#7964b9d9f01ec5488fe279369d39ec91f11d3d8e"
dependencies:
node-addon-api "^1.6.2"
vscode-debugadapter "^1.32.1"
@@ -22,9 +22,9 @@ mkdirp@^0.5.1:
minimist "0.0.8"
node-addon-api@^1.6.2:
- version "1.6.3"
- resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.6.3.tgz#3998d4593e2dca2ea82114670a4eb003386a9fe1"
- integrity sha512-FXWH6mqjWgU8ewuahp4spec8LkroFZK2NicOv6bNwZC3kcwZUI8LeZdG80UzTSLLhK4T7MsgNwlYDVRlDdfTDg==
+ version "1.7.1"
+ resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.1.tgz#cf813cd69bb8d9100f6bdca6755fc268f54ac492"
+ integrity sha512-2+DuKodWvwRTrCfKOeR24KIc5unKjOh8mz17NCzVnHWfjAdDqbfbjqh7gUT+BkXBRQM52+xCHciKWonJ3CbJMQ==
vscode-debugadapter@^1.32.1:
version "1.35.0"
diff --git a/debug/org.eclipse.cdt.debug.dap/plugin.xml b/debug/org.eclipse.cdt.debug.dap/plugin.xml
index e113cca1b25..dd2a07f4f48 100644
--- a/debug/org.eclipse.cdt.debug.dap/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.dap/plugin.xml
@@ -36,13 +36,13 @@
id="org.eclipse.cdt.debug.dap.localApplicationLaunch.mainTab"
group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
name="%launchTab.main.name"
- class="org.eclipse.cdt.debug.dap.CMainTab">
+ class="org.eclipse.cdt.debug.dap.tabs.CMainTab">
<associatedDelegate delegate="org.eclipse.cdt.debug.dap.localCLaunch"/>
</tab>
<tab id="org.eclipse.cdt.debug.dap.localApplicationLaunch.argumentsTab"
group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
name="%launchTab.arguments.name"
- class="org.eclipse.cdt.debug.dap.CArgumentsTab">
+ class="org.eclipse.cdt.debug.dap.tabs.CArgumentsTab">
<associatedDelegate delegate="org.eclipse.cdt.debug.dap.localCLaunch"/>
<placement after="org.eclipse.cdt.debug.dap.mainTab"/>
</tab>
diff --git a/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/DapLaunchDelegate.java b/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/DapLaunchDelegate.java
index 5000cecd6a9..05659f29119 100644
--- a/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/DapLaunchDelegate.java
+++ b/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/DapLaunchDelegate.java
@@ -42,13 +42,17 @@ import org.eclipse.swt.widgets.Display;
public class DapLaunchDelegate extends AbstractCLaunchDelegate2 {
- private static final String DEBUG_ADAPTER_JS = "/debug-servers/node_modules/cdt-gdb-adapter/dist/debugAdapter.js"; //$NON-NLS-1$
- // see https://github.com/eclipse-cdt/cdt-gdb-adapter/blob/73a31934d169555a338f53512b4994c017f67a1a/src/GDBDebugSession.ts#L22
- private static final String GDB = "gdb"; //$NON-NLS-1$
- private static final String PROGRAM = "program"; //$NON-NLS-1$
- private static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
- private static final String VERBOSE = "verbose"; //$NON-NLS-1$
- private static final String LOG_FILE = "logFile"; //$NON-NLS-1$
+ private static final String DEBUG_ADAPTER_ROOT = "/debug-servers/node_modules/cdt-gdb-adapter/dist/"; //$NON-NLS-1$
+ private static final String DEBUG_ADAPTER_JS = "debugAdapter.js"; //$NON-NLS-1$
+ private static final String DEBUG_TARGET_ADAPTER_JS = "debugTargetAdapter.js"; //$NON-NLS-1$
+ // https://github.com/eclipse-cdt/cdt-gdb-adapter/blob/eccf6bbb091aedd855adf0eaa1b28d341d8405d5/src/GDBDebugSession.ts#L22
+ public static final String GDB = "gdb"; //$NON-NLS-1$
+ public static final String PROGRAM = "program"; //$NON-NLS-1$
+ public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
+ public static final String VERBOSE = "verbose"; //$NON-NLS-1$
+ public static final String LOG_FILE = "logFile"; //$NON-NLS-1$
+ public static final String INIT_COMMANDS = "initCommands"; //$NON-NLS-1$
+
private InitializeLaunchConfigurations initializeLaunchConfigurations = new InitializeLaunchConfigurations(
this::warnNodeJSMissing);
@@ -64,16 +68,26 @@ public class DapLaunchDelegate extends AbstractCLaunchDelegate2 {
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
// user settings
- Map<String, Object> param = new HashMap<>();
+ Map<String, Object> params = new HashMap<>();
- param.put(PROGRAM, LaunchUtils.getProgramPath(configuration));
- param.put(ARGUMENTS, LaunchUtils.getProgramArguments(configuration));
+ // To support transitioning from DSF to DAP we support the IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME
+ // which is part of DSF but really is a generic setting
+ params.put(GDB, org.eclipse.cdt.dsf.gdb.launching.LaunchUtils.getGDBPath(configuration).toOSString());
+ params.put(PROGRAM, LaunchUtils.getProgramPath(configuration));
+ params.put(ARGUMENTS, LaunchUtils.getProgramArguments(configuration));
+ // Explicitly default to launch -- this is the default encoded in DSPDebugTarget.initialize()
+ params.put("request", "launch"); //$NON-NLS-1$//$NON-NLS-2$
+ launch(configuration, mode, launch, monitor, false, params);
+ }
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor,
+ boolean targetDebugAdapter, Map<String, Object> params) throws CoreException {
+ String debugAdapterJs = DEBUG_ADAPTER_ROOT + (targetDebugAdapter ? DEBUG_TARGET_ADAPTER_JS : DEBUG_ADAPTER_JS);
try {
- URL fileURL = FileLocator.toFileURL(getClass().getResource(DEBUG_ADAPTER_JS));
+ URL fileURL = FileLocator.toFileURL(Activator.getDefault().getClass().getResource(debugAdapterJs));
if (fileURL == null) {
- throw new IOException(Messages.DapLaunchDelegate_missing_debugAdapter_script + Activator.PLUGIN_ID
- + DEBUG_ADAPTER_JS);
+ throw new IOException(
+ Messages.DapLaunchDelegate_missing_debugAdapter_script + Activator.PLUGIN_ID + debugAdapterJs);
}
String path = fileURL.getPath();
List<String> debugCmdArgs = Collections.singletonList(path);
@@ -83,7 +97,7 @@ public class DapLaunchDelegate extends AbstractCLaunchDelegate2 {
builder.setLaunchDebugAdapter(initializeLaunchConfigurations.getNodeJsLocation()
.orElseThrow(() -> new IOException("Cannot find node runtime")), debugCmdArgs); //$NON-NLS-1$
builder.setMonitorDebugAdapter(true);
- builder.setDspParameters(param);
+ builder.setDspParameters(params);
DSPLaunchDelegate dspLaunchDelegate = new DSPLaunchDelegate() {
@Override
@@ -100,7 +114,10 @@ public class DapLaunchDelegate extends AbstractCLaunchDelegate2 {
} catch (IOException e) {
IStatus errorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
Activator.getDefault().getLog().log(errorStatus);
- ErrorDialog.openError(Display.getDefault().getActiveShell(), "Debug error", e.getMessage(), errorStatus); //$NON-NLS-1$
+ Display.getDefault().asyncExec(() -> {
+ ErrorDialog.openError(Display.getDefault().getActiveShell(), "Debug error", e.getMessage(), //$NON-NLS-1$
+ errorStatus);
+ });
}
}
diff --git a/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/CArgumentsTab.java b/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/tabs/CArgumentsTab.java
index 92fced9dd08..f6aeb10898f 100644
--- a/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/CArgumentsTab.java
+++ b/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/tabs/CArgumentsTab.java
@@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-package org.eclipse.cdt.debug.dap;
+package org.eclipse.cdt.debug.dap.tabs;
import org.eclipse.cdt.launch.ui.CAbstractArgumentsTab;
diff --git a/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/CMainTab.java b/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/tabs/CMainTab.java
index aebba92402b..8d8fe3ca75e 100644
--- a/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/CMainTab.java
+++ b/debug/org.eclipse.cdt.debug.dap/src/org/eclipse/cdt/debug/dap/tabs/CMainTab.java
@@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-package org.eclipse.cdt.debug.dap;
+package org.eclipse.cdt.debug.dap.tabs;
import org.eclipse.cdt.launch.ui.CMainTab2;

Back to the top