mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Search debugger first in selected CBS toolchain. (#1033)
For Core Build System local debug target. If there is no absolute path set in the Debugger tab of the launch configuration, try to find the debugger first in the selected toolchain. If the debugger is not found in the toolchain, let GdbLaunch search in PATH. If an absolute path is set, GdbLaunch will use that. Fixes #1008
This commit is contained in:
parent
2efeaae713
commit
c4f22cd1e7
1 changed files with 16 additions and 0 deletions
|
@ -10,18 +10,22 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.launching;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||
import org.eclipse.cdt.core.build.IToolChain;
|
||||
import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
|
||||
import org.eclipse.cdt.dsf.concurrent.Sequence;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.Messages;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||
|
@ -78,6 +82,18 @@ public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDele
|
|||
envProps.putAll(buildEnv);
|
||||
gdbLaunch.setInitialEnvironment(envProps);
|
||||
|
||||
String debugger = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
|
||||
Path debuggerPath = Paths.get(debugger);
|
||||
// Try to find the debugger in the toolchain if the name is not absolute.
|
||||
if (!debuggerPath.isAbsolute()) {
|
||||
IToolChain toolChain = buildConfig.getToolChain();
|
||||
Path gdbPath = toolChain.getCommandPath(debuggerPath);
|
||||
if (gdbPath != null) {
|
||||
gdbLaunch.setGDBPath(gdbPath.toString());
|
||||
}
|
||||
// When not found, GdbLaunch will search the debugger in PATH.
|
||||
}
|
||||
String gdbVersion = gdbLaunch.getGDBVersion();
|
||||
|
||||
gdbLaunch.setProgramPath(getProgramPath(configuration, buildConfig));
|
||||
|
|
Loading…
Add table
Reference in a new issue