summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorelaskavaia2013-03-27 16:25:42 (EDT)
committerElena Laskavaia2013-04-02 16:48:45 (EDT)
commit6ba8df52b256914544ba5cc78a661fa88c2f57f3 (patch)
treeaf462e3e7b855e04a66605f81b0cc66512b8518e
parent40b08ac68c8d2e9bd88661f7dc6c2b43d2601ce2 (diff)
downloadorg.eclipse.cdt-6ba8df52b256914544ba5cc78a661fa88c2f57f3.zip
org.eclipse.cdt-6ba8df52b256914544ba5cc78a661fa88c2f57f3.tar.gz
org.eclipse.cdt-6ba8df52b256914544ba5cc78a661fa88c2f57f3.tar.bz2
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
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java
index f47fdab..aaee7b3 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetSolibSearchPath.java
@@ -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;
+ }
}