From 6870f55fbb436f47f3b7353baf53f77f9f5c2f54 Mon Sep 17 00:00:00 2001 From: John Dallaway Date: Fri, 7 Sep 2018 16:47:19 +0100 Subject: Bug 538282: Set architecture for remote GDBJtag tests Change-Id: I0e4e8a345bd5c63116efff2a6b140500f0b77328 Signed-off-by: John Dallaway --- .../data/launch/src/x86_64.init | 1 + .../cdt/debug/gdbjtag/core/tests/launch/GDBJtagLaunchTest.java | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/x86_64.init (limited to 'jtag') diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/x86_64.init b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/x86_64.init new file mode 100644 index 00000000000..c0f4fa2ddfb --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core.tests/data/launch/src/x86_64.init @@ -0,0 +1 @@ +set architecture i386:x86-64 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 index 18e354ef2ab..991b72f169d 100644 --- 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 @@ -17,6 +17,8 @@ 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.dsf.gdb.launching.LaunchUtils; +import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.junit.Test; @@ -32,6 +34,7 @@ public class GDBJtagLaunchTest extends BaseParametrizedTestCase { 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$ + private static final String X86_64_INIT = SOURCE_PATH + "x86_64.init"; //$NON-NLS-1$ @Test public void testGdbJtagLaunch() { @@ -56,6 +59,11 @@ public class GDBJtagLaunchTest extends BaseParametrizedTestCase { setLaunchAttribute(IGDBJtagConstants.ATTR_SET_RESUME, remote); if (remote) { setLaunchAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, true); + if (0 > LaunchUtils.compareVersions(getGdbVersion(), GdbDebugServicesFactory.GDB_7_10_VERSION)) { + // Use a GDB initialization file to set x86_64 architecture for remote sessions with older GDB. + // This much precede connection to the gdbserver so we cannot use IGDBJtagConstants.ATTR_INIT_COMMANDS. + setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, X86_64_INIT); + } } else { setLaunchAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "file " + TEST_PROGRAM_NAME); //$NON-NLS-1$ setLaunchAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, "run"); //$NON-NLS-1$ -- cgit v1.2.3