1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Bug 166960: Set environment before loading executable to allow for dynamically loaded library to be found

This commit is contained in:
Marc Khouzam 2010-05-21 13:46:31 +00:00
parent d87f6ff74c
commit 65be0d654f

View file

@ -134,6 +134,50 @@ public class FinalLaunchSequence extends Sequence {
requestMonitor.done();
}
}},
/*
* Specify GDB's working directory
*/
new Step() { @Override
public void execute(final RequestMonitor requestMonitor) {
IPath dir = null;
try {
dir = fGDBBackend.getGDBWorkingDirectory();
} catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get working directory", e)); //$NON-NLS-1$
requestMonitor.done();
return;
}
if (dir != null) {
fCommandControl.queueCommand(
fCommandFactory.createMIEnvironmentCD(fCommandControl.getContext(), dir.toPortableString()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else {
requestMonitor.done();
}
}},
/*
* Specify environment variables if needed
*/
new Step() { @Override
public void execute(final RequestMonitor requestMonitor) {
boolean clear = false;
Properties properties = new Properties();
try {
clear = fGDBBackend.getClearEnvironment();
properties = fGDBBackend.getEnvironmentVariables();
} catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get environment information", e)); //$NON-NLS-1$
requestMonitor.done();
return;
}
if (clear == true || properties.size() > 0) {
fCommandControl.setEnvironment(properties, clear, requestMonitor);
} else {
requestMonitor.done();
}
}},
/*
* Specify the executable file to be debugged and read the symbol table.
*/
@ -179,50 +223,6 @@ public class FinalLaunchSequence extends Sequence {
requestMonitor.done();
}
}},
/*
* Specify GDB's working directory
*/
new Step() { @Override
public void execute(final RequestMonitor requestMonitor) {
IPath dir = null;
try {
dir = fGDBBackend.getGDBWorkingDirectory();
} catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get working directory", e)); //$NON-NLS-1$
requestMonitor.done();
return;
}
if (dir != null) {
fCommandControl.queueCommand(
fCommandFactory.createMIEnvironmentCD(fCommandControl.getContext(), dir.toPortableString()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else {
requestMonitor.done();
}
}},
/*
* Specify environment variables if needed
*/
new Step() { @Override
public void execute(final RequestMonitor requestMonitor) {
boolean clear = false;
Properties properties = new Properties();
try {
clear = fGDBBackend.getClearEnvironment();
properties = fGDBBackend.getEnvironmentVariables();
} catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get environment information", e)); //$NON-NLS-1$
requestMonitor.done();
return;
}
if (clear == true || properties.size() > 0) {
fCommandControl.setEnvironment(properties, clear, requestMonitor);
} else {
requestMonitor.done();
}
}},
/*
* Enable non-stop mode if necessary
*/