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

PR 41476 Support for variable in shared libs paths for debugger

Debugger in launch config stores absolute lib paths which
totally not convinient for storing shared launch configs.
This will allow to store variable and resolve the just before
passing paths to debugger

Change-Id: I368407783606c5a5697067afc235dba5dc03ae52
This commit is contained in:
elaskavaia 2013-03-27 16:25:42 -04:00 committed by Elena Laskavaia
parent 40b08ac68c
commit 6ba8df52b2

View file

@ -11,6 +11,9 @@
package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
/**
*
* -gdb-set
@ -25,13 +28,22 @@ public class MIGDBSetSolibSearchPath extends MIGDBSet {
String sep = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < paths.length; i++) {
if (buffer.length() == 0) {
buffer.append(paths[i]);
} else {
buffer.append(sep).append(paths[i]);
if (buffer.length() > 0) {
buffer.append(sep);
}
buffer.append(resolve(paths[i]));
}
String[] p = new String [] {"solib-search-path", buffer.toString()}; //$NON-NLS-1$
setParameters(p);
}
protected String resolve(String path) {
try {
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
path = manager.performStringSubstitution(path, false);
} catch (Exception e) {
// if anything happens here just use the non-resolved one
}
return path;
}
}