1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Accommodate ELF executables with any file suffix (#68)

Issue #65
This commit is contained in:
John Dallaway 2022-09-08 08:43:17 +01:00 committed by GitHub
parent b51804c7ed
commit 4a8cf1c6e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 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;singleton:=true
Bundle-Version: 10.6.0.qualifier
Bundle-Version: 10.6.100.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -27,6 +27,7 @@
* John Dallaway - Set executable file (Bug 457697)
* John Dallaway - Initialize memory data before connecting to target (Bug 575934)
* John Dallaway - Support multiple remote debug protocols (Bug 535143)
* John Dallaway - Accommodate ELF executables with any file suffix (#65)
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@ -48,6 +49,7 @@ import java.util.Properties;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.executables.Executable;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
@ -80,13 +82,17 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIStatusAsyncOutput;
import org.eclipse.cdt.dsf.mi.service.command.output.MITuple;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.launch.LaunchUtils;
import org.eclipse.cdt.utils.CommandLineUtil;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
/**
* The final launch sequence for the Jtag hardware debugging using the
@ -589,7 +595,10 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
String imageOffset = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_IMAGE_OFFSET,
IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
if (imageOffset.length() > 0) {
imageOffset = (imageFileName.endsWith(".elf")) ? "" //$NON-NLS-1$//$NON-NLS-2$
ILaunchConfiguration launchConfig = ((ILaunch) getSession().getModelAdapter(ILaunch.class))
.getLaunchConfiguration();
IPath imageFilePath = new Path(LaunchUtils.resolveProgramPath(launchConfig, imageFileName));
imageOffset = Executable.isBinaryFile(imageFilePath) ? "" //$NON-NLS-1$
: "0x" + CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_IMAGE_OFFSET, //$NON-NLS-1$
IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
}