Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-11-01 18:52:20 +0000
committerEugene Tarassov2011-11-01 18:52:20 +0000
commit6978cec621ce8964b45513b9b4a0c64e8c400022 (patch)
tree69852f16a139aea698315c97a9c6e3add49209c3 /plugins
parent8fdb7ce7139aeda0dc3f083017772e483afdc46b (diff)
downloadorg.eclipse.tcf-6978cec621ce8964b45513b9b4a0c64e8c400022.tar.gz
org.eclipse.tcf-6978cec621ce8964b45513b9b4a0c64e8c400022.tar.xz
org.eclipse.tcf-6978cec621ce8964b45513b9b4a0c64e8c400022.zip
TCF Debugger: fixed: "Watch In Expressions" command should add quotes for register names that contain spaces and other special characters.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java42
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java42
2 files changed, 47 insertions, 37 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
index bef9d1c30..931ac3fa1 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.tm.internal.tcf.debug.ui.commands;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -43,7 +42,15 @@ public class WatchInExpressionsCommand extends AbstractActionDelegate {
TCFDataCache<String> text_cache = ((IWatchInExpressions)node).getExpressionText();
if (!text_cache.validate(this)) return;
String text_data = text_cache.getData();
- if (text_data != null) e = manager.newWatchExpression(text_data);
+ if (text_data != null) {
+ for (final IExpression x : manager.getExpressions()) {
+ if (text_data.equals(x.getExpressionText())) {
+ done(null);
+ return;
+ }
+ }
+ e = manager.newWatchExpression(text_data);
+ }
}
done(e);
}
@@ -61,30 +68,11 @@ public class WatchInExpressionsCommand extends AbstractActionDelegate {
}
private TCFNode[] getNodes() {
- final TCFNode[] arr = getSelectedNodes();
- return new TCFTask<TCFNode[]>(2000) {
- public void run() {
- for (TCFNode n : arr) {
- if (n instanceof IWatchInExpressions) {
- TCFDataCache<String> text_cache = ((IWatchInExpressions)n).getExpressionText();
- if (!text_cache.validate(this)) return;
- String text_data = text_cache.getData();
- if (text_data != null) {
- IExpressionManager m = DebugPlugin.getDefault().getExpressionManager();
- for (final IExpression e : m.getExpressions()) {
- if (text_data.equals(e.getExpressionText())) {
- done(new TCFNode[0]);
- return;
- }
- }
- }
- continue;
- }
- done(new TCFNode[0]);
- return;
- }
- done(arr);
- }
- }.getE();
+ TCFNode[] arr = getSelectedNodes();
+ for (TCFNode n : arr) {
+ if (n instanceof IWatchInExpressions) continue;
+ return new TCFNode[0];
+ }
+ return arr;
}
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
index 57ae61eb3..7c5954c55 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
@@ -11,6 +11,7 @@
package org.eclipse.tm.internal.tcf.debug.ui.model;
import java.math.BigInteger;
+import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
@@ -72,29 +73,50 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
expression_text = new TCFData<String>(channel) {
@Override
protected boolean startDataRetrieval() {
- String nm = null;
Throwable err = null;
TCFNodeRegister n = TCFNodeRegister.this;
+ ArrayList<String> names = new ArrayList<String>();
for (;;) {
if (!n.context.validate(this)) return false;
IRegisters.RegistersContext ctx = n.context.getData();
if (ctx == null) {
err = n.context.getError();
- nm = null;
break;
}
String s = ctx.getName();
if (s == null) break;
- nm = nm == null ? s : s + '.' + nm;
- if (n.parent instanceof TCFNodeRegister) {
- n = (TCFNodeRegister)n.parent;
- }
- else {
- break;
+ names.add(s);
+ if (!(n.parent instanceof TCFNodeRegister)) break;
+ n = (TCFNodeRegister)n.parent;
+ }
+ if (names.size() == 0 || err != null) {
+ set(null, err, null);
+ }
+ else {
+ StringBuffer bf = new StringBuffer();
+ boolean first = true;
+ int m = names.size();
+ while (m > 0) {
+ String s = names.get(--m);
+ boolean need_quotes = false;
+ int l = s.length();
+ for (int i = 0; i < l; i++) {
+ char ch = s.charAt(i);
+ if (ch >= 'A' && ch <= 'Z') continue;
+ if (ch >= 'a' && ch <= 'z') continue;
+ if (ch >= '0' && ch <= '9') continue;
+ need_quotes = true;
+ break;
+ }
+ if (!first) bf.append('.');
+ if (need_quotes) bf.append("$\"");
+ if (first) bf.append('$');
+ bf.append(s);
+ if (need_quotes) bf.append('"');
+ first = false;
}
+ set(null, null, bf.toString());
}
- if (nm != null) nm = "$" + nm;
- set(null, err, nm);
return true;
}
};

Back to the top