1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 570018: Set preferred launch delegate

Change-Id: Ie5861f630489109375ccaf352f621e00ed7cdde8
This commit is contained in:
John Dallaway 2021-01-02 13:44:48 +00:00
parent 8698d6ce9b
commit c3c5c2f3ba
3 changed files with 12 additions and 7 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core.tests;singleton:=true
Bundle-Version: 1.0.200.qualifier
Bundle-Version: 1.0.300.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",

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.200-SNAPSHOT</version>
<version>1.0.300-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.gdbjtag.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2019 Kichwa Coders Ltd and others.
* Copyright (c) 2016, 2021 Kichwa Coders Ltd and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -11,11 +11,14 @@
* Contributors:
* Jonah Graham (Kichwa Coders) - base API and implementation
* John Dallaway - GDB JTAG implementation (bug 538282)
* John Dallaway - Set preferred launch delegate (bug 570018)
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.tests.launch;
import static org.junit.Assert.assertFalse;
import java.util.Set;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
@ -24,15 +27,16 @@ 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.eclipse.debug.core.ILaunchManager;
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_LAUNCH_DELEGATE_ID = "org.eclipse.cdt.debug.gdbjtag.core.dsfLaunchDelegate"; //$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$
private static final String X86_64_INIT = SOURCE_PATH + "x86_64.init"; //$NON-NLS-1$
@ -63,7 +67,7 @@ public class GDBJtagLaunchTest extends BaseParametrizedTestCase {
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.
// This must precede connection to the gdbserver so we cannot use IGDBJtagConstants.ATTR_INIT_COMMANDS.
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, X86_64_INIT);
}
} else {
@ -75,8 +79,9 @@ public class GDBJtagLaunchTest extends BaseParametrizedTestCase {
@Override
protected GdbLaunch doLaunchInner() throws Exception {
final ILaunchConfigurationWorkingCopy wc = getLaunchConfiguration().getWorkingCopy();
wc.setPreferredLaunchDelegate(Set.of(ILaunchManager.DEBUG_MODE), TEST_LAUNCH_DELEGATE_ID);
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);
@ -85,8 +90,8 @@ public class GDBJtagLaunchTest extends BaseParametrizedTestCase {
if (port instanceof String) {
wc.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, Integer.valueOf((String) port));
}
wc.doSave();
}
wc.doSave();
return super.doLaunchInner();
}