diff options
author | John Dallaway | 2018-08-26 17:06:35 +0000 |
---|---|---|
committer | John Dallaway | 2018-08-27 15:22:10 +0000 |
commit | dd17366239e57976879c40e7c3408ebf8bc5ff8e (patch) | |
tree | 4dc612f5bcaf0b16c2fe53a5ee261aebd8a2b987 | |
parent | c4ec66adf4cdd554d58f928f655b524148086fc0 (diff) | |
download | org.eclipse.cdt-dd17366239e57976879c40e7c3408ebf8bc5ff8e.tar.gz org.eclipse.cdt-dd17366239e57976879c40e7c3408ebf8bc5ff8e.tar.xz org.eclipse.cdt-dd17366239e57976879c40e7c3408ebf8bc5ff8e.zip |
Bug 538282: Add GDB Hardware Debugging launch test
Change-Id: I308a6a8d128704f83a5fc220c7c168f56e4fc040
Signed-off-by: John Dallaway <john@dallaway.org.uk>
25 files changed, 516 insertions, 66 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF index f31e5541cc1..f7e04c440f6 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GDB/MI reference application tests Bundle-SymbolicName: org.eclipse.cdt.tests.dsf.gdb;singleton:=true -Bundle-Version: 2.2.0.qualifier +Bundle-Version: 2.3.0.qualifier Bundle-Activator: org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin Bundle-Vendor: Ericsson Require-Bundle: org.eclipse.core.runtime, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml index a23d4c87b80..2e28d0f8543 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml @@ -11,7 +11,7 @@ <relativePath>../../pom.xml</relativePath> </parent> - <version>2.2.0-SNAPSHOT</version> + <version>2.3.0-SNAPSHOT</version> <artifactId>org.eclipse.cdt.tests.dsf.gdb</artifactId> <packaging>eclipse-test-plugin</packaging> diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java index 52ed37d645a..74de154290d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 Ericsson and others. + * Copyright (c) 2007, 2018 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 @@ -8,6 +8,7 @@ * Contributors: * Ericsson - Initial Implementation * Simon Marchi (Ericsson) - Add and use runningOnWindows(). + * John Dallaway - Generalize for launch config type (bug 538282) *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.framework; @@ -106,6 +107,7 @@ public class BaseTestCase { public static final String ATTR_DEBUG_SERVER_NAME = TestsPlugin.PLUGIN_ID + ".DEBUG_SERVER_NAME"; private static final String DEFAULT_EXEC_NAME = "GDBMIGenericTestApp.exe"; + private static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.cdt.tests.dsf.gdb.TestLaunch"; private static GdbLaunch fLaunch; @@ -480,7 +482,8 @@ public class BaseTestCase { launchGdbServer(); ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType lcType = launchMgr.getLaunchConfigurationType("org.eclipse.cdt.tests.dsf.gdb.TestLaunch"); + String lcTypeId = getLaunchConfigurationTypeId(); + ILaunchConfigurationType lcType = launchMgr.getLaunchConfigurationType(lcTypeId); assert lcType != null; ILaunchConfigurationWorkingCopy lcWorkingCopy = lcType.newInstance( @@ -732,6 +735,10 @@ public class BaseTestCase { } } + protected String getLaunchConfigurationTypeId() { + return LAUNCH_CONFIGURATION_TYPE_ID; + } + protected static String doReadGdbVersion(String gdb) throws IOException { Process process = ProcessFactory.getFactory().exec(gdb + " --version"); try { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.classpath b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.classpath new file mode 100644 index 00000000000..3e5654f17eb --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.classpath @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"> + <attributes> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.externalToolBuilders/GDBJtagTestAppBuilder.launch b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.externalToolBuilders/GDBJtagTestAppBuilder.launch new file mode 100644 index 00000000000..57743ca713d --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.externalToolBuilders/GDBJtagTestAppBuilder.launch @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> +<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/> +<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/org.eclipse.cdt.debug.gdbjtag.core.tests/data" type="2"/> </resources>}"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.cdt.tests.dsf.gdb"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.cdt.tests.dsf.gdb/TestAppBuilder.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,clean"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.cdt.debug.gdbjtag.core.tests}"/> +<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> +</launchConfiguration> diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.project b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.project new file mode 100644 index 00000000000..c1db0b68853 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.project @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.cdt.debug.gdbjtag.core.tests</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/GDBJtagTestAppBuilder.launch</value> + </dictionary> + </arguments> + </buildCommand> + <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.tests/.settings/org.eclipse.jdt.core.prefs b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..8fa66374273 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: GDB Hardware Debugging Tests +Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core.tests;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.tests.Activator +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.cdt.tests.dsf.gdb;bundle-version="2.3.0", + org.junit, + org.eclipse.cdt.debug.core, + org.eclipse.cdt.dsf.gdb, + org.eclipse.cdt.debug.gdbjtag.core;bundle-version="9.2.1", + org.eclipse.cdt.dsf, + org.eclipse.cdt.launch, + org.eclipse.debug.core +Bundle-ActivationPolicy: lazy +Bundle-Vendor: Eclipse CDT +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/about.html b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/about.html new file mode 100644 index 00000000000..04492dd7e1b --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/about.html @@ -0,0 +1,24 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><head> + + +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head><body lang="EN-US"> +<h2>About This Content</h2> + +<p>May 14, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body></html>
\ No newline at end of file diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/build.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/build.properties new file mode 100644 index 00000000000..da79d937315 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + data/,\ + about.html diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/.gitignore b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/.gitignore new file mode 100644 index 00000000000..5e56e040ec0 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/Makefile b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/Makefile new file mode 100644 index 00000000000..cae207a41a5 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/Makefile @@ -0,0 +1,43 @@ +BINDIR = ../bin +BUILDDIR = ../build +SRC_C = $(wildcard *.c) +SRC_CXX = $(wildcard *.cc) + +# We rebuild everything whenever one of the headers change +HEADERS = $(wildcard *.h) + +# Use .exe extension so that files are named the same way in Linux and Windows. +BINS = $(patsubst %.c,$(BINDIR)/%.exe,$(SRC_C)) $(patsubst %.cc,$(BINDIR)/%.exe,$(SRC_CXX)) + +CC = gcc +CXX = g++ + +CFLAGS = -g3 -O0 +CXXFLAGS = -g3 -O0 + +# Don't try to use pthread on Windows +# The OS environment variable exists on Windows +ifneq ($(OS),Windows_NT) + CFLAGS += -pthread + CXXFLAGS += -pthread +endif + +MKDIR = mkdir -p +RM = rm -f +RMDIR = rmdir + +.PHONY: all clean + +all: $(BINS) + +$(BINDIR): + $(MKDIR) $@ + +$(BINDIR)/%.exe: %.c $(HEADERS) Makefile | $(BINDIR) + $(CC) $(CFLAGS) -o $@ $< + +$(BINDIR)/%.exe: %.cc $(HEADERS) Makefile | $(BINDIR) + $(CXX) $(CXXFLAGS) -o $@ $< + +clean: + $(RM) -r $(BINDIR) $(BUILDDIR) diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/Minimal.cc b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/Minimal.cc new file mode 100644 index 00000000000..c8b5d7732df --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/Minimal.cc @@ -0,0 +1,5 @@ +/* A minimal C++ file with a main() function */ + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/pom.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/pom.xml new file mode 100644 index 00000000000..a83734e5eb0 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/pom.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.cdt</groupId> + <artifactId>cdt-parent</artifactId> + <version>9.6.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + + <version>1.0.0-SNAPSHOT</version> + <artifactId>org.eclipse.cdt.debug.gdbjtag.core.tests</artifactId> + <packaging>eclipse-test-plugin</packaging> + + <properties> + <dsf.gdb.tests.gdbPath>/shared/common/gdb/gdb-all/bin</dsf.gdb.tests.gdbPath> + <dsf.gdb.tests.gdbTestSuite>AutomatedSuite.java</dsf.gdb.tests.gdbTestSuite> + <dsf.gdb.tests.timeout.multiplier>1</dsf.gdb.tests.timeout.multiplier> + <cdt.tests.dsf.gdb.versions>gdb.8.1</cdt.tests.dsf.gdb.versions> + <skipTests>${dsf-gdb.skip.tests}</skipTests> + </properties> + <build> + <plugins> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>clean</id> + <phase>clean</phase> + <configuration> + <tasks> + <ant antfile="../../dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/TestAppBuilder.xml" target="clean"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>prepare</id> + <phase>pre-integration-test</phase> + <configuration> + <tasks> + <ant antfile="../../dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/TestAppBuilder.xml" target="makeTestApps"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <useUIHarness>false</useUIHarness> + <argLine>${tycho.testArgLine} ${base.ui.test.vmargs} -ea -Xms256m -Xmx512m -XX:MaxPermSize=256M -Dcdt.tests.dsf.gdb.path=${dsf.gdb.tests.gdbPath} -Ddsf.gdb.tests.timeout.multiplier=${dsf.gdb.tests.timeout.multiplier} -Dcdt.tests.dsf.gdb.versions=${cdt.tests.dsf.gdb.versions}</argLine> + <appArgLine>-debug ./dsf.debug.options</appArgLine> + <includes> + <include>**/${dsf.gdb.tests.gdbTestSuite}</include> + </includes> + <testFailureIgnore>true</testFailureIgnore> + </configuration> + </plugin> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>target-platform-configuration</artifactId> + <configuration> + <dependency-resolution> + <extraRequirements> + <requirement> + <type>eclipse-feature</type> + <id>org.eclipse.platform</id> + <versionRange>0.0.0</versionRange> + </requirement> + <requirement> + <type>eclipse-feature</type> + <id>org.eclipse.cdt</id> + <versionRange>0.0.0</versionRange> + </requirement> + </extraRequirements> + </dependency-resolution> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/Activator.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/Activator.java new file mode 100644 index 00000000000..2abc8ebff2b --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/Activator.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2007, 2018 Wind River 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: + * Wind River Systems - initial API and implementation + * John Dallaway - GDB JTAG implementation (bug 538282) + *******************************************************************************/ +package org.eclipse.cdt.debug.gdbjtag.core.tests; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/AutomatedSuite.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/AutomatedSuite.java new file mode 100644 index 00000000000..45cda1e0238 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/AutomatedSuite.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2012, 2018 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) - Base Implementation + * John Dallaway - GDB JTAG Implementation (bug 538282) + *******************************************************************************/ +package org.eclipse.cdt.debug.gdbjtag.core.tests.launch; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + SuiteGDBJtag.class, +}) + +public class AutomatedSuite { + // do nothing +} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/GDBJtagLaunchTest.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/GDBJtagLaunchTest.java new file mode 100644 index 00000000000..18e354ef2ab --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/GDBJtagLaunchTest.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2016, 2018 Kichwa Coders 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: + * Jonah Graham (Kichwa Coders) - base API and implementation + * John Dallaway - GDB JTAG implementation (bug 538282) + *******************************************************************************/ +package org.eclipse.cdt.debug.gdbjtag.core.tests.launch; + +import static org.junit.Assert.assertFalse; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; +import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +@SuppressWarnings("restriction") +public class GDBJtagLaunchTest extends BaseParametrizedTestCase { + + private static final String TEST_LAUNCH_CONFIGURATION_TYPE_ID = + "org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"; //$NON-NLS-1$ + private static final String TEST_JTAG_DEVICE_ID = + "org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"; //$NON-NLS-1$ + private static final String TEST_PROGRAM_NAME = EXEC_PATH + "Minimal.exe"; //$NON-NLS-1$ + + @Test + public void testGdbJtagLaunch() { + assertFalse("Launch should be running", getGDBLaunch().isTerminated()); + } + + @Override + protected String getLaunchConfigurationTypeId() { + return TEST_LAUNCH_CONFIGURATION_TYPE_ID; + } + + @Override + protected void setLaunchAttributes() { + super.setLaunchAttributes(); + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, TEST_PROGRAM_NAME); + setLaunchAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, remote); + setLaunchAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE_ID, TEST_JTAG_DEVICE_ID); + setLaunchAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, false); + setLaunchAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, remote); + setLaunchAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, true); + setLaunchAttribute(IGDBJtagConstants.ATTR_STOP_AT, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); + setLaunchAttribute(IGDBJtagConstants.ATTR_SET_RESUME, remote); + if (remote) { + setLaunchAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, true); + } else { + setLaunchAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "file " + TEST_PROGRAM_NAME); //$NON-NLS-1$ + setLaunchAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, "run"); //$NON-NLS-1$ + } + } + + @Override + protected GdbLaunch doLaunchInner() throws Exception { + if (remote) { + final ILaunchConfigurationWorkingCopy wc = getLaunchConfiguration().getWorkingCopy(); + // copy host from IGDBLaunchConfigurationConstants.ATTR_HOST to IGDBJtagConstants.ATTR_IP_ADDRESS + final Object host = getLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST); + wc.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, host); + // copy port from IGDBLaunchConfigurationConstants.ATTR_PORT to IGDBJtagConstants.ATTR_PORT_NUMBER + final Object port = getLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT); + if (port instanceof String) { + wc.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, Integer.valueOf((String) port)); + } + wc.doSave(); + } + return super.doLaunchInner(); + } + +} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/SuiteGDBJtag.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/SuiteGDBJtag.java new file mode 100644 index 00000000000..e9711af48a2 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/src/org/eclipse/cdt/debug/gdbjtag/core/tests/launch/SuiteGDBJtag.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2016, 2018 QNX Software System 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: + * Elena Laskavaia (QNX Software System) - Base API and implementation + * John Dallaway - GDB JTAG implementation (bug 538282) + *******************************************************************************/ +package org.eclipse.cdt.debug.gdbjtag.core.tests.launch; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@SuppressWarnings("restriction") +@RunWith(Suite.class) +@Suite.SuiteClasses({ + GDBJtagLaunchTest.class +}) + +public class SuiteGDBJtag { + + @BeforeClass + public static void before() { + BaseParametrizedTestCase.resetGlobalState(); + } + +} 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 index 32004182441..6b5fff74a21 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF @@ -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.2.0.qualifier +Bundle-Version: 9.2.1.qualifier Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties index 992882878fd..33e149394ce 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2007, 2010 QNX Software Systems and others +# Copyright (c) 2007, 2018 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 @@ -8,6 +8,7 @@ # Contributors: # QNX Software Systems - initial API and implementation # IBM Corporation +# John Dallaway - migrate device extensions to core plugin, bug 538282 ############################################################################### launchConfig.name=GDB Hardware Debugging pluginName=Eclipse GDB Hardware Debug Core Plug-in @@ -15,6 +16,13 @@ providerName=Eclipse CDT JTagDevice.name=JTAG Device +AbatronBDI2000.name=Abatron BDI2000 +MacraigorUsb2Demon.name=Macraigor USB2Demon +GenericSerial.name=Generic Serial +OpenOCDPipe.name=OpenOCD (via pipe) +OpenOCDSocket.name=OpenOCD (via socket) +Generic.name=Generic TCP/IP + launchDelegate.jtag.name=Legacy GDB Hardware Debugging launchDelegate.jtag.description=Jtag hardware debugging using the legacy debugger Framework (CDI). launchDelegate.jtagDsf.name=GDB (DSF) Hardware Debugging diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml index 457da8191e5..7bbff7dba69 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml @@ -23,5 +23,54 @@ type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"> </launchDelegate> </extension> - + <extension + point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> + <device + class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericDevice" + id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice" + name="%Generic.name"> + </device> + </extension> + <extension + point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> + <device + class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000" + id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000" + name="%AbatronBDI2000.name"> + </device> + </extension> + <extension + point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> + <device + class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon" + id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon" + name="%MacraigorUsb2Demon.name"> + </device> + </extension> + <extension + point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> + <device + class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl" + default_connection="/dev/com1" + id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericSerial" + name="%GenericSerial.name"> + </device> + </extension> + <extension + point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> + <device + class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDPipe" + default_connection="| openocd --pipe" + id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCD" + name="%OpenOCDPipe.name"> + </device> + </extension> + <extension + point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> + <device + class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket" + id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket" + name="%OpenOCDSocket.name"> + </device> + </extension> </plugin> diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF index 89a04d336d2..a8097a2c9e1 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.ui;singleton:=true -Bundle-Version: 8.1.0.qualifier +Bundle-Version: 8.1.1.qualifier Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.ui.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.debug.ui, org.eclipse.cdt.launch, - org.eclipse.cdt.debug.gdbjtag.core, + org.eclipse.cdt.debug.gdbjtag.core;bundle-version="9.2.1", org.eclipse.core.variables, org.eclipse.ui.ide, org.eclipse.cdt.debug.core, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties index e28b8d518b2..71b6e37cfc0 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties @@ -13,17 +13,11 @@ # - API generalization to become transport-independent (e.g. to # allow connections via serial ports and pipes). # John Dallaway - OpenOCD extensions, bug 494059 +# John Dallaway - Migrate device extensions to core plugin, bug 538282 ############################################################################### pluginName=Eclipse GDB Hardware Debug UI Plug-in providerName=Eclipse CDT -AbatronBDI2000.name=Abatron BDI2000 -MacraigorUsb2Demon.name=Macraigor USB2Demon -GenericSerial.name=Generic Serial -OpenOCDPipe.name=OpenOCD (via pipe) -OpenOCDSocket.name=OpenOCD (via socket) -Generic.name=Generic TCP/IP - launchtab.cmaintab.name=Main launchtab.debuggertab.name=Debugger launchtab.startuptab.name=Startup diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml index 5509aec0c19..0aeb647d171 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml @@ -17,56 +17,6 @@ type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"/> </extension> <extension - point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> - <device - class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericDevice" - id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice" - name="%Generic.name"> - </device> - </extension> - <extension - point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> - <device - class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000" - id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000" - name="%AbatronBDI2000.name"> - </device> - </extension> - <extension - point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> - <device - class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon" - id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon" - name="%MacraigorUsb2Demon.name"> - </device> - </extension> - <extension - point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> - <device - class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl" - default_connection="/dev/com1" - id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericSerial" - name="%GenericSerial.name"> - </device> - </extension> - <extension - point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> - <device - class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDPipe" - default_connection="| openocd --pipe" - id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCD" - name="%OpenOCDPipe.name"> - </device> - </extension> - <extension - point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> - <device - class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket" - id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket" - name="%OpenOCDSocket.name"> - </device> - </extension> - <extension point="org.eclipse.debug.ui.launchConfigurationTabs"> <tab class="org.eclipse.cdt.debug.gdbjtag.internal.ui.GDBJtagDSFCMainTab" @@ -240,6 +240,7 @@ <module>dsf-gdb/org.eclipse.cdt.dsf.gdb.tests</module> <module>dsf-gdb/org.eclipse.cdt.tests.dsf.gdb</module> <module>dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui.tests</module> + <module>jtag/org.eclipse.cdt.debug.gdbjtag.core.tests</module> <module>lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests</module> <module>qt/org.eclipse.cdt.qt.ui.tests</module> <module>testsrunner/org.eclipse.cdt.testsrunner.tests</module> |