Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-10-03 20:13:17 -0400
committerEugene Tarassov2011-10-03 20:13:17 -0400
commitfc3085f934a7be7148174d2f55cfa3b19945cdb1 (patch)
tree1fe4dbb2d3cdc2c721abd077b1e6affc5d26e3fd /plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse
parent2ae0643ac198fb5ee9b9b09c3aae600d69a52aff (diff)
downloadorg.eclipse.tcf-fc3085f934a7be7148174d2f55cfa3b19945cdb1.tar.gz
org.eclipse.tcf-fc3085f934a7be7148174d2f55cfa3b19945cdb1.tar.xz
org.eclipse.tcf-fc3085f934a7be7148174d2f55cfa3b19945cdb1.zip
TCF Debugger: added "Watch In Expressions" command in the Registers view.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java34
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java2
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java12
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java38
4 files changed, 66 insertions, 20 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 5bf8edcb7..bef9d1c30 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
@@ -61,20 +61,30 @@ public class WatchInExpressionsCommand extends AbstractActionDelegate {
}
private TCFNode[] getNodes() {
- TCFNode[] arr = getSelectedNodes();
- for (TCFNode n : arr) {
- if (n instanceof IWatchInExpressions) {
- String script = ((IWatchInExpressions)n).getScript();
- if (script != null) {
- IExpressionManager m = DebugPlugin.getDefault().getExpressionManager();
- for (final IExpression e : m.getExpressions()) {
- if (script.equals(e.getExpressionText())) return new TCFNode[0];
+ 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;
}
- continue;
+ done(arr);
}
- return new TCFNode[0];
- }
- return arr;
+ }.getE();
}
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
index a512c749f..9fee2ceb9 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
@@ -14,7 +14,5 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
public interface IWatchInExpressions {
- String getScript();
-
TCFDataCache<String> getExpressionText();
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
index 1d85b6b14..fa3d0dd98 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
@@ -674,6 +674,14 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return type;
}
+ /**
+ * Get human readable expression script,
+ * including type cast, and using variable names instead of IDs.
+ */
+ public TCFDataCache<String> getExpressionText() {
+ return expression_text;
+ }
+
private Boolean usePrevValue(Runnable done) {
// Check if view should show old value.
// Old value is shown if context is running or
@@ -1576,8 +1584,4 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
return super.getAdapter(adapter);
}
-
- public TCFDataCache<String> getExpressionText() {
- return expression_text;
- }
}
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 864646268..57ae61eb3 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
@@ -34,11 +34,11 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
-//TODO: hierarchical registers
-public class TCFNodeRegister extends TCFNode implements IElementEditor {
+public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchInExpressions {
private final TCFChildrenRegisters children;
private final TCFData<IRegisters.RegistersContext> context;
+ private final TCFData<String> expression_text;
private final TCFData<byte[]> value;
private final boolean is_stack_frame_register;
@@ -69,6 +69,35 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor {
return false;
}
};
+ expression_text = new TCFData<String>(channel) {
+ @Override
+ protected boolean startDataRetrieval() {
+ String nm = null;
+ Throwable err = null;
+ TCFNodeRegister n = TCFNodeRegister.this;
+ 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;
+ }
+ }
+ if (nm != null) nm = "$" + nm;
+ set(null, err, nm);
+ return true;
+ }
+ };
value = new TCFData<byte[]>(channel) {
@Override
protected boolean startDataRetrieval() {
@@ -113,6 +142,10 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor {
return children;
}
+ public TCFDataCache<String> getExpressionText() {
+ return expression_text;
+ }
+
void setIndex(int index) {
this.index = index;
}
@@ -430,6 +463,7 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor {
void onRegistersChanged() {
children.onRegistersChanged();
+ expression_text.reset();
context.reset();
value.reset();
// No need to post delta: parent posted CONTENT

Back to the top