Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2007-04-16 19:02:30 +0000
committerDoug Schaefer2007-04-16 19:02:30 +0000
commitaa17ffe74ca5e6b58e2dce9fbe0f4aaa22e239b0 (patch)
treeebbac7ec020ac3b8f20db6d6270714f85aac95b6 /jtag/org.eclipse.cdt.debug.gdbjtag.core
parent12de1eb9a0d17c4e6c9f22eaf28ada3406533d77 (diff)
downloadorg.eclipse.cdt-aa17ffe74ca5e6b58e2dce9fbe0f4aaa22e239b0.tar.gz
org.eclipse.cdt-aa17ffe74ca5e6b58e2dce9fbe0f4aaa22e239b0.tar.xz
org.eclipse.cdt-aa17ffe74ca5e6b58e2dce9fbe0f4aaa22e239b0.zip
Initial code for supporting hardware debugging with GDB, mainly with JTAG.
Diffstat (limited to 'jtag/org.eclipse.cdt.debug.gdbjtag.core')
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/.classpath7
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/.project28
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF15
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/build.properties5
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties1
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml16
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java50
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java37
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagConstants.java24
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java50
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java114
11 files changed, 347 insertions, 0 deletions
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.classpath b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.classpath
new file mode 100644
index 00000000000..751c8f2e504
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.project b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.project
new file mode 100644
index 00000000000..db3493df07a
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.debug.gdbjtag.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..808a611d52b
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CDT GDB JTAG Core Plug-in
+Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.debug.core,
+ org.eclipse.cdt.launch,
+ org.eclipse.cdt.debug.core,
+ org.eclipse.cdt.debug.mi.core,
+ org.eclipse.cdt.core
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.cdt.debug.gdbjtag.core
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/build.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.core/build.properties
new file mode 100644
index 00000000000..e9863e281ea
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties
new file mode 100644
index 00000000000..562aaf708eb
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties
@@ -0,0 +1 @@
+launchConfig.name=GDB Hardware Debugging
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml
new file mode 100644
index 00000000000..a26dd638b1c
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.eclipse.cdt.debug.gdbjtag.core.GDBJtagLaunchConfigurationDelegate"
+ id="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"
+ modes="debug"
+ name="%launchConfig.name"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"/>
+ </extension>
+
+</plugin>
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java
new file mode 100644
index 00000000000..2369b21f7ae
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.cdt.debug.gdbjtag.core;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbremote.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java
new file mode 100644
index 00000000000..ff68b705570
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagCommandFactory.java
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * Copyright (c) 2007 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.cdt.debug.gdbjtag.core;
+
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+
+/**
+ * @author Doug Schaefer
+ *
+ */
+public class GDBJtagCommandFactory extends CommandFactory {
+
+ /**
+ *
+ */
+ public GDBJtagCommandFactory() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param miVersion
+ */
+ public GDBJtagCommandFactory(String miVersion) {
+ super(miVersion);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagConstants.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagConstants.java
new file mode 100644
index 00000000000..1a9bb8de8b0
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagConstants.java
@@ -0,0 +1,24 @@
+/**********************************************************************
+ * Copyright (c) 2006 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.cdt.debug.gdbjtag.core;
+
+/**
+ * @author Doug Schaefer
+ *
+ */
+public class GDBJtagConstants {
+
+ public static final String DEBUGGER_ID = "org.eclipse.cdt.debug.mi.core.CDebuggerNew"; //$NON-NLS-1$
+
+ public static final String LAUNCH_ATTR_INIT_COMMANDS = Activator.PLUGIN_ID + ".initCommands"; //$NON-NLS-1$
+ public static final String LAUNCH_ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java
new file mode 100644
index 00000000000..01d756e49ff
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * Copyright (c) 2007 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.cdt.debug.gdbjtag.core;
+
+import java.io.File;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger;
+import org.eclipse.cdt.debug.mi.core.MIPlugin;
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * @author Doug Schaefer
+ *
+ */
+public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
+
+ public ICDISession createSession(ILaunch launch, File executable,
+ IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ICDISession createDebuggerSession(ILaunch launch, IBinaryObject exe,
+ IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ protected CommandFactory getCommandFactory(ILaunchConfiguration config)
+ throws CoreException {
+ String miVersion = MIPlugin.getMIVersion(config);
+ return new GDBJtagCommandFactory(miVersion);
+ }
+
+}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java
new file mode 100644
index 00000000000..ec19f429dd2
--- /dev/null
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java
@@ -0,0 +1,114 @@
+/**********************************************************************
+ * Copyright (c) 2006 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.debug.gdbjtag.core;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+
+/**
+ * @author Doug Schaefer
+ *
+ */
+public class GDBJtagLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
+
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ };
+
+ public void launch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ try {
+ // set the default source locator if required
+ setDefaultSourceLocator(launch, configuration);
+
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ ICDebugConfiguration debugConfig = getDebugConfig(configuration);
+ ICDISession dsession = null;
+ String debugMode = configuration
+ .getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+
+ if (debugMode
+ .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
+// dsession = ((EmbeddedGDBCDIDebugger) debugConfig
+// .createDebugger()).createDebuggerSession(this,
+// launch, exeFileInfo, new SubProgressMonitor(
+// monitor, 8));
+//
+// ICDITarget[] dtargets = dsession.getTargets();
+// // setFactory(dtargets);
+// try {
+//
+// monitor.worked(1);
+//
+// executeGDBScript(
+// configuration,
+// LaunchConfigurationConstants.ATTR_DEBUGGER_COMMANDS_INIT,
+// dtargets);
+// monitor.worked(2);
+//
+// queryTargetState(dtargets);
+//
+// // create the Launch targets/processes for eclipse.
+// for (int i = 0; i < dtargets.length; i++) {
+// Target target = (Target) dtargets[i];
+// target.setConfiguration(new Configuration(target));
+// Process process = target.getProcess();
+// IProcess iprocess = null;
+// if (process != null) {
+// iprocess = DebugPlugin.newProcess(launch,
+// process, renderProcessLabel(exePath
+// .toOSString()));
+// }
+// CDIDebugModel.newDebugTarget(launch, projectInfo,
+// dtargets[i],
+// renderTargetLabel(debugConfig), iprocess,
+// exeFileInfo, true, true, false);
+// /* FIX!!!! put up a console view for */
+// // if (process != null) {
+// // iprocess = DebugPlugin.newProcess(launch,
+// // process,
+// // renderProcessLabel(exePath.toOSString()));
+// // }
+// }
+// executeGDBScript(
+// configuration,
+// LaunchConfigurationConstants.ATTR_DEBUGGER_COMMANDS_RUN,
+// dtargets);
+//
+// } catch (CoreException e) {
+// try {
+// dsession.terminate();
+// } catch (CDIException e1) {
+// // ignore
+// }
+// throw e;
+// }
+ }
+ } else {
+ cancel("TargetConfiguration not supported",
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ } finally {
+ monitor.done();
+ }
+
+ }
+
+}

Back to the top