mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
Bug 295808, fix NPE.
This commit is contained in:
parent
107a6a6cf4
commit
3c6f76e9e1
1 changed files with 12 additions and 9 deletions
|
@ -38,20 +38,23 @@ public class MinGWDebuggerPage extends StandardGDBDebuggerPage {
|
||||||
protected String defaultGdbCommand(ILaunchConfiguration configuration) {
|
protected String defaultGdbCommand(ILaunchConfiguration configuration) {
|
||||||
// Lets look it up in the project
|
// Lets look it up in the project
|
||||||
try {
|
try {
|
||||||
String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
|
String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
|
||||||
if (projectName.length() > 0) {
|
if (projectName.length() > 0) {
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
|
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
|
||||||
ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
|
ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
|
||||||
IEnvironmentVariableManager envVarMgr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
IEnvironmentVariableManager envVarMgr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
IEnvironmentVariable pathvar = envVarMgr.getVariable("PATH", configDesc, true);
|
IEnvironmentVariable pathvar = envVarMgr.getVariable("PATH", configDesc, true); //$NON-NLS-1$
|
||||||
String path = pathvar.getValue();
|
if(pathvar != null)
|
||||||
String[] dirs = path.split(pathvar.getDelimiter());
|
{
|
||||||
for (int i = 0; i < dirs.length; ++i) {
|
String path = pathvar.getValue();
|
||||||
IPath gdbPath = new Path(dirs[i]).append("gdb.exe"); //$NON-NLS-1$
|
String[] dirs = path.split(pathvar.getDelimiter());
|
||||||
File gdbFile = gdbPath.toFile();
|
for (int i = 0; i < dirs.length; ++i) {
|
||||||
if (gdbFile.exists())
|
IPath gdbPath = new Path(dirs[i]).append("gdb.exe"); //$NON-NLS-1$
|
||||||
return gdbPath.toOSString();
|
File gdbFile = gdbPath.toFile();
|
||||||
|
if (gdbFile.exists())
|
||||||
|
return gdbPath.toOSString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue