Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-09-26 13:00:52 -0400
committereutarass2011-09-26 13:00:52 -0400
commit93fe91e55769eb06bb8fdfb57af81619bf614c0b (patch)
treeab7ec30c75c1ce402143222aa96e98c44baefcbd
parent43bd0e13f016c93594cfaa025cadf6e7861b97dd (diff)
downloadorg.eclipse.tcf-93fe91e55769eb06bb8fdfb57af81619bf614c0b.tar.gz
org.eclipse.tcf-93fe91e55769eb06bb8fdfb57af81619bf614c0b.tar.xz
org.eclipse.tcf-93fe91e55769eb06bb8fdfb57af81619bf614c0b.zip
TCF Debugger: symbol files and path map are now associated with SymbolsGroup instead of ProcessID.
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapCommand.java16
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapWidget.java62
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java4
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java8
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenHoverExpressions.java4
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenLogExpressions.java4
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java41
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java77
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java157
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java1
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java1
11 files changed, 234 insertions, 141 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapCommand.java
index b3f1a93a0..d953973d6 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapCommand.java
@@ -21,6 +21,7 @@ import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeLaunch;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeModule;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeStackFrame;
+import org.eclipse.tm.tcf.services.IMemory;
import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
@@ -37,12 +38,21 @@ public class MemoryMapCommand extends AbstractActionDelegate {
return;
}
if (!mem_cache.validate(this)) return;
- if (mem_cache.getError() != null) {
+ TCFNodeExecContext mem_node = mem_cache.getData();
+ if (mem_node == null) {
done(false);
return;
}
- TCFNodeExecContext node = mem_cache.getData();
- done(node != null && node.getMemoryContext().getData() != null);
+ TCFDataCache<TCFNodeExecContext> syms_cache = mem_node.getSymbolsNode();
+ if (!syms_cache.validate(this)) return;
+ TCFNodeExecContext syms_node = syms_cache.getData();
+ if (syms_node == null) {
+ done(false);
+ return;
+ }
+ TCFDataCache<IMemory.MemoryContext> ctx_cache = syms_node.getMemoryContext();
+ if (!ctx_cache.validate(this)) return;
+ done(ctx_cache.getData() != null);
}
}.getE();
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapWidget.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapWidget.java
index 37e2e88c2..7db194fde 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapWidget.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapWidget.java
@@ -483,20 +483,25 @@ public class MemoryMapWidget {
return;
}
String id = null;
- TCFNodeExecContext node = mem_cache.getData();
- if (node != null) {
- TCFDataCache<IMemory.MemoryContext> mem_ctx = node.getMemoryContext();
- if (!mem_ctx.validate(this)) return;
- if (mem_ctx.getData() != null) {
- if (node.getModel().getLaunch().isMemoryMapPreloadingSupported()) {
- TCFDataCache<String> name_cache = node.getFullName();
- if (!name_cache.validate(this)) return;
- id = name_cache.getData();
- }
- else {
- id = mem_ctx.getData().getName();
+ TCFNodeExecContext mem_node = mem_cache.getData();
+ if (mem_node != null) {
+ TCFDataCache<TCFNodeExecContext> syms_cache = mem_node.getSymbolsNode();
+ if (!syms_cache.validate(this)) return;
+ TCFNodeExecContext syms_node = syms_cache.getData();
+ if (syms_node != null) {
+ TCFDataCache<IMemory.MemoryContext> mem_ctx = syms_node.getMemoryContext();
+ if (!mem_ctx.validate(this)) return;
+ if (mem_ctx.getData() != null) {
+ if (syms_node.getModel().getLaunch().isMemoryMapPreloadingSupported()) {
+ TCFDataCache<String> name_cache = syms_node.getFullName();
+ if (!name_cache.validate(this)) return;
+ id = name_cache.getData();
+ }
+ else {
+ id = mem_ctx.getData().getName();
+ }
+ if (id == null) id = syms_node.getID();
}
- if (id == null) id = node.getID();
}
}
done(id);
@@ -528,20 +533,25 @@ public class MemoryMapWidget {
if (n instanceof TCFNodeExecContext) {
TCFNodeExecContext exe = (TCFNodeExecContext)n;
if (!collectMemoryNodes(exe.getChildren())) return false;
- TCFDataCache<IMemory.MemoryContext> mem_ctx = exe.getMemoryContext();
- if (!mem_ctx.validate(this)) return false;
- if (mem_ctx.getData() != null) {
- String s = null;
- if (exe.getModel().getLaunch().isMemoryMapPreloadingSupported()) {
- TCFDataCache<String> nm = exe.getFullName();
- if (!nm.validate(this)) return false;
- s = nm.getData();
- }
- else {
- s = mem_ctx.getData().getName();
+ TCFDataCache<TCFNodeExecContext> syms_cache = exe.getSymbolsNode();
+ if (!syms_cache.validate(this)) return false;
+ TCFNodeExecContext syms_node = syms_cache.getData();
+ if (syms_node != null) {
+ TCFDataCache<IMemory.MemoryContext> mem_ctx = syms_node.getMemoryContext();
+ if (!mem_ctx.validate(this)) return false;
+ if (mem_ctx.getData() != null) {
+ String id = null;
+ if (syms_node.getModel().getLaunch().isMemoryMapPreloadingSupported()) {
+ TCFDataCache<String> name_cache = syms_node.getFullName();
+ if (!name_cache.validate(this)) return false;
+ id = name_cache.getData();
+ }
+ else {
+ id = mem_ctx.getData().getName();
+ }
+ if (id == null) id = syms_node.getID();
+ target_map_nodes.put(id, syms_node);
}
- if (s == null) s = exe.getID();
- if (s != null) target_map_nodes.put(s, exe);
}
}
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java
index b4f54d074..f0e0b638c 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/launch/TCFPathMapTab.java
@@ -60,15 +60,13 @@ public class TCFPathMapTab extends AbstractLaunchConfigurationTab {
private static final String[] column_ids = {
IPathMap.PROP_SOURCE,
IPathMap.PROP_DESTINATION,
- IPathMap.PROP_HOST,
- IPathMap.PROP_PROTOCOL,
+ IPathMap.PROP_CONTEXT,
};
private static final int[] column_size = {
300,
300,
50,
- 50,
};
private static final String TAB_ID = "org.eclipse.tm.tcf.launch.pathMapTab";
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java
index c02cf897f..459cd16a2 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java
@@ -151,14 +151,6 @@ public class TCFChildrenExecContext extends TCFChildren {
n.setMemoryContext(context);
}
- void onMemoryMapChanged() {
- for (TCFNode n : getNodes()) ((TCFNodeExecContext)n).onMemoryMapChanged();
- }
-
- void onMemoryChanged(Number[] addr, long[] size) {
- for (TCFNode n : getNodes()) ((TCFNodeExecContext)n).onMemoryChanged(addr, size);
- }
-
void onAncestorContextChanged() {
for (TCFNode n : getNodes()) ((TCFNodeExecContext)n).onAncestorContextChanged();
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenHoverExpressions.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenHoverExpressions.java
index 23bdf9f5c..45abb553b 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenHoverExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenHoverExpressions.java
@@ -33,6 +33,10 @@ class TCFChildrenHoverExpressions extends TCFChildren {
for (TCFNode n : getNodes()) ((TCFNodeExpression)n).onMemoryChanged();
}
+ void onMemoryMapChanged() {
+ for (TCFNode n : getNodes()) ((TCFNodeExpression)n).onMemoryMapChanged();
+ }
+
private TCFNodeExpression findScript(String text) {
for (TCFNode n : getNodes()) {
TCFNodeExpression e = (TCFNodeExpression)n;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenLogExpressions.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenLogExpressions.java
index 44a468a4c..711e97c37 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenLogExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenLogExpressions.java
@@ -35,6 +35,10 @@ public class TCFChildrenLogExpressions extends TCFChildren {
for (TCFNode n : getNodes()) ((TCFNodeExpression)n).onMemoryChanged();
}
+ void onMemoryMapChanged() {
+ for (TCFNode n : getNodes()) ((TCFNodeExpression)n).onMemoryMapChanged();
+ }
+
public TCFNodeExpression findScript(String script) {
for (TCFNode n : getNodes()) {
TCFNodeExpression e = (TCFNodeExpression)n;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
index 491ba1fc7..380a8a7a4 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
@@ -307,11 +307,12 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
public void contextChanged(IMemory.MemoryContext[] contexts) {
for (IMemory.MemoryContext ctx : contexts) {
- TCFNode node = getNode(ctx.getID());
+ String id = ctx.getID();
+ TCFNode node = getNode(id);
if (node instanceof TCFNodeExecContext) {
((TCFNodeExecContext)node).onContextChanged(ctx);
}
- onMemoryChanged(ctx.getID());
+ onMemoryChanged(id, true);
}
}
@@ -319,12 +320,12 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
onContextRemoved(context_ids);
}
- public void memoryChanged(String context_id, Number[] addr, long[] size) {
- TCFNode node = getNode(context_id);
+ public void memoryChanged(String id, Number[] addr, long[] size) {
+ TCFNode node = getNode(id);
if (node instanceof TCFNodeExecContext) {
((TCFNodeExecContext)node).onMemoryChanged(addr, size);
}
- onMemoryChanged(context_id);
+ onMemoryChanged(id, true);
}
};
@@ -350,7 +351,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
if (!id.equals(context) && node instanceof TCFNodeExecContext) {
((TCFNodeExecContext)node).onContainerSuspended();
}
- onMemoryChanged(id);
+ onMemoryChanged(id, false);
}
TCFNode node = getNode(context);
if (node instanceof TCFNodeExecContext) {
@@ -389,7 +390,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
if (node instanceof TCFNodeExecContext) {
((TCFNodeExecContext)node).onContextChanged(ctx);
}
- onMemoryChanged(id);
+ onMemoryChanged(id, true);
}
launch_node.onAnyContextSuspendedOrChanged();
}
@@ -424,18 +425,19 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
setDebugViewSelection(node, reason);
annotation_manager.updateAnnotations(null, launch);
}
- onMemoryChanged(id);
+ onMemoryChanged(id, false);
}
};
private final IMemoryMap.MemoryMapListener mmap_listenr = new IMemoryMap.MemoryMapListener() {
- public void changed(String context) {
- TCFNode node = getNode(context);
+ public void changed(String id) {
+ TCFNode node = getNode(id);
if (node instanceof TCFNodeExecContext) {
TCFNodeExecContext exe = (TCFNodeExecContext)node;
exe.onMemoryMapChanged();
}
+ onMemoryChanged(id, true);
display.asyncExec(new Runnable() {
public void run() {
if (PlatformUI.isWorkbenchRunning()) {
@@ -746,8 +748,21 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
Activator.log(bf.toString(), x);
}
- void onMemoryChanged(String id) {
+ void onMemoryChanged(String id, boolean notify_references) {
if (channel == null) return;
+ if (notify_references) {
+ for (Object obj : context_map.values()) {
+ if (obj instanceof IRunControl.RunControlContext) {
+ IRunControl.RunControlContext subctx = (IRunControl.RunControlContext)obj;
+ if (id.equals(subctx.getProcessID()) && !id.equals(subctx.getID())) {
+ TCFNode subnode = getNode(subctx.getID());
+ if (subnode instanceof TCFNodeExecContext) {
+ ((TCFNodeExecContext)subnode).onMemoryChanged(null, null);
+ }
+ }
+ }
+ }
+ }
if (mem_retrieval.size() == 0) return;
if (mem_blocks_update == null) {
mem_blocks_update = new MemoryBlocksUpdate(channel);
@@ -845,6 +860,10 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
annotation_manager.updateAnnotations(null, launch);
}
+ void updateContextMap(String id, IRunControl.RunControlContext ctx) {
+ context_map.put(id, ctx);
+ }
+
private void onContextOrProcessRemoved() {
final int generation = ++auto_disconnect_generation;
Protocol.invokeLater(1000, new Runnable() {
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
index bf206f606..17491ba33 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
@@ -65,6 +65,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
private final TCFData<Collection<Map<String,Object>>> signal_list;
private final TCFData<SignalMask[]> signal_mask;
private final TCFData<TCFNodeExecContext> memory_node;
+ private final TCFData<TCFNodeExecContext> symbols_node;
private final TCFData<String> full_name;
private LinkedHashMap<BigInteger,TCFDataCache<TCFSourceRef>> line_info_lookup_cache;
@@ -253,6 +254,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
}
command = run.getContext(id, new IRunControl.DoneGetContext() {
public void doneGetContext(IToken token, Exception error, IRunControl.RunControlContext context) {
+ if (context != null) model.updateContextMap(id, context);
set(token, error, context);
}
});
@@ -392,38 +394,49 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
memory_node = new TCFData<TCFNodeExecContext>(channel) {
@Override
protected boolean startDataRetrieval() {
- TCFNode n = TCFNodeExecContext.this;
- String id = null;
- Throwable err = null;
- while (n != null && !n.isDisposed()) {
- if (n instanceof TCFNodeExecContext) {
- TCFNodeExecContext exe = (TCFNodeExecContext)n;
- TCFDataCache<IRunControl.RunControlContext> cache = exe.getRunContext();
- if (!cache.validate(this)) return false;
- err = cache.getError();
- if (err != null) break;
- IRunControl.RunControlContext ctx = cache.getData();
- if (ctx == null) break;
- String prs = ctx.getProcessID();
- id = prs != null ? prs : n.id;
- break;
- }
- n = n.parent;
+ String mem_id = null;
+ if (!run_context.validate(this)) return false;
+ Throwable err = run_context.getError();
+ if (err == null) {
+ IRunControl.RunControlContext ctx = run_context.getData();
+ if (ctx != null) mem_id = ctx.getProcessID();
}
if (err != null) {
set(null, err, null);
}
- else if (id == null) {
+ else if (mem_id == null) {
set(null, new Exception("Context does not provide memory access"), null);
}
else {
- if (!model.createNode(id, this)) return false;
- if (!isValid()) {
- TCFNodeExecContext exe = (TCFNodeExecContext)model.getNode(id);
- if (!exe.getMemoryContext().validate(this)) return false;
- set(null, null, exe);
+ if (!model.createNode(mem_id, this)) return false;
+ if (!isValid()) set(null, null, (TCFNodeExecContext)model.getNode(mem_id));
+ }
+ return true;
+ }
+ };
+ symbols_node = new TCFData<TCFNodeExecContext>(channel) {
+ @Override
+ protected boolean startDataRetrieval() {
+ String syms_id = null;
+ if (!run_context.validate(this)) return false;
+ Throwable err = run_context.getError();
+ if (err == null) {
+ IRunControl.RunControlContext ctx = run_context.getData();
+ if (ctx != null) {
+ syms_id = ctx.getSymbolsGroup();
+ if (syms_id == null) syms_id = ctx.getProcessID();
}
}
+ if (err != null) {
+ set(null, err, null);
+ }
+ else if (syms_id == null) {
+ set(null, new Exception("Context does not support symbol groups"), null);
+ }
+ else {
+ if (!model.createNode(syms_id, this)) return false;
+ if (!isValid()) set(null, null, (TCFNodeExecContext)model.getNode(syms_id));
+ }
return true;
}
};
@@ -445,7 +458,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
lst.add(res);
while (p.parent instanceof TCFNodeExecContext) {
p = (TCFNodeExecContext)p.parent;
- TCFDataCache<IRunControl.RunControlContext> run_ctx_cache = p.getRunContext();
+ TCFDataCache<IRunControl.RunControlContext> run_ctx_cache = p.run_context;
if (!run_ctx_cache.validate(this)) return false;
IRunControl.RunControlContext run_ctx_data = run_ctx_cache.getData();
String name = null;
@@ -512,6 +525,10 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
mem_context.reset(ctx);
}
+ public TCFDataCache<TCFNodeExecContext> getSymbolsNode() {
+ return symbols_node;
+ }
+
public TCFDataCache<TCFNodeExecContext> getMemoryNode() {
return memory_node;
}
@@ -550,7 +567,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
IMemory.MemoryContext mem_data = null;
TCFNodeExecContext mem = memory_node.getData();
if (mem != null) {
- TCFDataCache<IMemory.MemoryContext> mem_cache = mem.getMemoryContext();
+ TCFDataCache<IMemory.MemoryContext> mem_cache = mem.mem_context;
if (!mem_cache.validate(this)) return false;
mem_data = mem_cache.getData();
}
@@ -611,7 +628,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
IMemory.MemoryContext mem_data = null;
TCFNodeExecContext mem = memory_node.getData();
if (mem != null) {
- TCFDataCache<IMemory.MemoryContext> mem_cache = mem.getMemoryContext();
+ TCFDataCache<IMemory.MemoryContext> mem_cache = mem.mem_context;
if (!mem_cache.validate(this)) return false;
mem_data = mem_cache.getData();
}
@@ -1087,6 +1104,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
if (frame != null) result.setInputElement(frame);
}
else if (IDebugUIConstants.ID_MODULE_VIEW.equals(view_id)) {
+ // TODO: need to post view input delta when memory context changes
TCFDataCache<TCFNodeExecContext> mem = model.searchMemoryContext(this);
if (mem == null) return true;
if (!mem.validate(done)) return false;
@@ -1220,6 +1238,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
assert !isDisposed();
full_name.reset();
run_context.reset(context);
+ symbols_node.reset();
memory_node.reset();
signal_mask.reset();
if (state.isValid()) {
@@ -1363,7 +1382,6 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
void onMemoryChanged(Number[] addr, long[] size) {
assert !isDisposed();
- children_exec.onMemoryChanged(addr, size);
children_stack.onMemoryChanged();
children_exps.onMemoryChanged();
children_hover_exps.onMemoryChanged();
@@ -1374,10 +1392,11 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
void onMemoryMapChanged() {
clearLookupCaches();
memory_map.reset();
- children_exec.onMemoryMapChanged();
- children_stack.onMemoryMapChanged();
children_modules.onMemoryMapChanged();
+ children_stack.onMemoryMapChanged();
children_exps.onMemoryMapChanged();
+ children_hover_exps.onMemoryMapChanged();
+ children_log_exps.onMemoryMapChanged();
postModulesChangedDelta();
}
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 351f93f6f..39c929e5e 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
@@ -350,17 +350,32 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
protected boolean startDataRetrieval() {
if (addr != null) {
if (mem == null) {
- TCFDataCache<TCFNodeExecContext> mem_cache = model.searchMemoryContext(parent);
- if (mem_cache == null) {
+ TCFDataCache<TCFNodeExecContext> mem_node_cache = model.searchMemoryContext(parent);
+ if (mem_node_cache == null) {
set(null, new Exception("Context does not provide memory access"), null);
return true;
}
- if (!mem_cache.validate(this)) return false;
- if (mem_cache.getError() != null) {
- set(null, mem_cache.getError(), null);
+ if (!mem_node_cache.validate(this)) return false;
+ if (mem_node_cache.getError() != null) {
+ set(null, mem_node_cache.getError(), null);
+ return true;
+ }
+ TCFNodeExecContext mem_node = mem_node_cache.getData();
+ if (mem_node == null) {
+ set(null, new Exception("Context does not provide memory access"), null);
+ return true;
+ }
+ TCFDataCache<IMemory.MemoryContext> mem_ctx_cache = mem_node.getMemoryContext();
+ if (!mem_ctx_cache.validate(this)) return false;
+ if (mem_ctx_cache.getError() != null) {
+ set(null, mem_ctx_cache.getError(), null);
+ return true;
+ }
+ mem = mem_ctx_cache.getData();
+ if (mem == null) {
+ set(null, new Exception("Context does not provide memory access"), null);
return true;
}
- mem = mem_cache.getData().getMemoryContext().getData();
}
if (size == 0) {
// data is ASCII string
@@ -479,6 +494,18 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
type_name = new TCFData<String>(channel) {
@Override
protected boolean startDataRetrieval() {
+ if (!type.validate(this)) return false;
+ if (type.getData() == null) {
+ if (!value.validate(this)) return false;
+ IExpressions.Value val = value.getData();
+ if (val != null && val.getValue() != null) {
+ String s = getTypeName(val.getTypeClass(), val.getValue().length);
+ if (s != null) {
+ set(null, null, s);
+ return true;
+ }
+ }
+ }
StringBuffer bf = new StringBuffer();
if (!getTypeName(bf, type, this)) return false;
set(null, null, bf.toString());
@@ -645,6 +672,25 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return false;
}
+ private String getTypeName(ISymbols.TypeClass type_class, int size) {
+ String s = null;
+ switch (type_class) {
+ case integer:
+ if (size == 0) s = "<Void>";
+ else s = "<Integer-" + (size * 8) + ">";
+ break;
+ case cardinal:
+ if (size == 0) s = "<Void>";
+ else s = "<Unsigned-" + (size * 8) + ">";
+ break;
+ case real:
+ if (size == 0) s = "<Void>";
+ else s = "<Float-" + (size * 8) + ">";
+ break;
+ }
+ return s;
+ }
+
private boolean getTypeName(StringBuffer bf, TCFDataCache<ISymbols.Symbol> type_cache, Runnable done) {
String name = null;
for (;;) {
@@ -661,34 +707,9 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
else if ((flags & ISymbols.SYM_FLAG_INTERFACE_TYPE) != 0) s = "interface " + s;
else s = "struct " + s;
}
- if (s == null && type_symbol.getSize() == 0) s = "void";
+ if (s == null) s = getTypeName(type_symbol.getTypeClass(), type_symbol.getSize());
if (s == null) {
switch (type_symbol.getTypeClass()) {
- case integer:
- switch (type_symbol.getSize()) {
- case 1: s = "char"; break;
- case 2: s = "short"; break;
- case 4: s = "int"; break;
- case 8: s = "long long"; break;
- default: s = "<Integer>"; break;
- }
- break;
- case cardinal:
- switch (type_symbol.getSize()) {
- case 1: s = "unsigned char"; break;
- case 2: s = "unsigned short"; break;
- case 4: s = "unsigned"; break;
- case 8: s = "unsigned long long"; break;
- default: s = "<Unsigned>"; break;
- }
- break;
- case real:
- switch (type_symbol.getSize()) {
- case 4: s = "float"; break;
- case 8: s = "double"; break;
- default: s = "<Float>"; break;
- }
- break;
case pointer:
s = "*";
if ((flags & ISymbols.SYM_FLAG_REFERENCE) != 0) s = "&";
@@ -805,10 +826,10 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return new BigInteger(temp);
}
- private String toNumberString(int radix, ISymbols.Symbol t, byte[] data, int offs, int size, boolean big_endian) {
+ private String toNumberString(int radix, ISymbols.TypeClass t, byte[] data, int offs, int size, boolean big_endian) {
if (size <= 0 || size > 16) return "";
- if (radix != 16 && t != null) {
- switch (t.getTypeClass()) {
+ if (radix != 16) {
+ switch (t) {
case array:
case composite:
return "";
@@ -818,12 +839,12 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
if (data == null) s = "N/A";
if (s == null && radix == 10) {
if (t != null) {
- switch (t.getTypeClass()) {
+ switch (t) {
case integer:
s = toBigInteger(data, offs, size, big_endian, true).toString();
break;
case real:
- switch (t.getSize()) {
+ switch (size) {
case 4:
s = Float.toString(Float.intBitsToFloat(toBigInteger(
data, offs, size, big_endian, true).intValue()));
@@ -862,7 +883,11 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
IExpressions.Value val = value.getData();
if (val != null) {
byte[] data = val.getValue();
- if (data != null) s = toNumberString(radix, type.getData(), data, 0, data.length, val.isBigEndian());
+ if (data != null) {
+ ISymbols.TypeClass t = val.getTypeClass();
+ if (t == ISymbols.TypeClass.unknown && type.getData() != null) t = type.getData().getTypeClass();
+ s = toNumberString(radix, t, data, 0, data.length, val.isBigEndian());
+ }
}
if (s == null) s = "N/A";
return s;
@@ -1124,19 +1149,36 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
type_data = type_cache.getData();
}
if (type_data == null) {
+ ISymbols.TypeClass type_class = ISymbols.TypeClass.unknown;
+ if (!value.validate(done)) return false;
+ if (value.getData() != null) type_class = value.getData().getTypeClass();
if (level == 0) {
- bf.append("Type: not available\n");
+ assert offs == 0;
+ assert size == data.length;
+ String s = getTypeName(type_class, size);
+ if (s == null) s = "not available";
+ bf.append("Type: ");
+ bf.append(s);
+ bf.append('\n');
bf.append("Size: ");
- bf.append(data.length);
- bf.append(data.length == 1 ? " byte\n" : " bytes\n");
- if (data.length > 0) {
+ bf.append(size);
+ bf.append(size == 1 ? " byte\n" : " bytes\n");
+ if (size > 0) {
+ if (type_class == ISymbols.TypeClass.integer || type_class == ISymbols.TypeClass.real) {
+ bf.append("Dec: ");
+ bf.append(toNumberString(10, type_class, data, offs, size, big_endian));
+ bf.append("\n");
+ }
bf.append("Hex: ");
- bf.append(toNumberString(16, type_data, data, 0, data.length, big_endian));
+ bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
bf.append("\n");
}
}
+ else if (type_class == ISymbols.TypeClass.integer || type_class == ISymbols.TypeClass.real) {
+ bf.append(toNumberString(10, type_class, data, offs, size, big_endian));
+ }
else {
- bf.append(toNumberString(16, type_data, data, 0, data.length, big_endian));
+ bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
}
return true;
}
@@ -1154,43 +1196,44 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
}
if (type_data.getSize() > 0) {
- switch (type_data.getTypeClass()) {
+ ISymbols.TypeClass type_class = type_data.getTypeClass();
+ switch (type_class) {
case enumeration:
case integer:
case cardinal:
case real:
if (level == 0) {
bf.append("Dec: ");
- bf.append(toNumberString(10, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(10, type_class, data, offs, size, big_endian));
bf.append("\n");
bf.append("Oct: ");
- bf.append(toNumberString(8, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(8, type_class, data, offs, size, big_endian));
bf.append("\n");
bf.append("Hex: ");
- bf.append(toNumberString(16, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
bf.append("\n");
}
else if (type_data.getTypeClass() == ISymbols.TypeClass.cardinal) {
bf.append("0x");
- bf.append(toNumberString(16, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
}
else {
- bf.append(toNumberString(10, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(10, type_class, data, offs, size, big_endian));
}
break;
case pointer:
case function:
if (level == 0) {
bf.append("Oct: ");
- bf.append(toNumberString(8, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(8, type_class, data, offs, size, big_endian));
bf.append("\n");
bf.append("Hex: ");
- bf.append(toNumberString(16, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
bf.append("\n");
}
else {
bf.append("0x");
- bf.append(toNumberString(16, type_data, data, offs, size, big_endian));
+ bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
}
break;
case array:
@@ -1484,14 +1527,6 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
IExpressions exps = node.launch.getService(IExpressions.class);
exps.assign(exp.getID(), bf, new IExpressions.DoneAssign() {
public void doneAssign(IToken token, Exception error) {
- TCFNode exe = node;
- while (exe != null) {
- if (exe instanceof TCFNodeExecContext) {
- exe.model.onMemoryChanged(exe.id);
- break;
- }
- exe = exe.parent;
- }
node.getRootExpression().onValueChanged();
if (error != null) {
node.model.showMessageBox("Cannot modify element value", error);
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java
index a11cc01d7..b81f8f47a 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java
@@ -437,6 +437,7 @@ public class TCFNodeStackFrame extends TCFNode {
if (stack_trace_cache.getTopFrame() == this) result.setInputElement(exe);
}
else if (IDebugUIConstants.ID_MODULE_VIEW.equals(id)) {
+ // TODO: need to post view input delta when memory context changes
TCFDataCache<TCFNodeExecContext> mem = model.searchMemoryContext(this);
if (mem == null) return true;
if (!mem.validate(done)) return false;
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java
index eee12ab4b..211c9dc84 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestExpressions.java
@@ -109,6 +109,7 @@ class TestExpressions implements ITCFTest,
"&tcf_test_func3",
"tcf_test_array + 10",
"*(tcf_test_array + 10) | 1",
+ "&*(char *)(int *)0 == 0",
};
TestExpressions(TCFTestSuite test_suite, RunControl test_rc, IChannel channel) {

Back to the top