Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2015-03-17 15:02:22 -0400
committerEugene Tarassov2015-03-17 15:02:22 -0400
commit3e63e55614073f5fec1e4449957031b58e16fa8f (patch)
tree725d5f32f1d30d27e3feeb7a12867cefaa840564 /plugins
parent81c39c23c064a2d2ee83a2af958e858d6db1fd11 (diff)
downloadorg.eclipse.tcf-3e63e55614073f5fec1e4449957031b58e16fa8f.tar.gz
org.eclipse.tcf-3e63e55614073f5fec1e4449957031b58e16fa8f.tar.xz
org.eclipse.tcf-3e63e55614073f5fec1e4449957031b58e16fa8f.zip
TCF Core: StackTrace service: new stack frame properties: CodeArea and FuncID
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LineNumbersProxy.java33
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/StackTraceProxy.java15
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILineNumbers.java33
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IStackTrace.java28
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java108
6 files changed, 158 insertions, 63 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LineNumbersProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LineNumbersProxy.java
index 749de5339..c60613f23 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LineNumbersProxy.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/LineNumbersProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -65,42 +65,15 @@ public class LineNumbersProxy implements ILineNumbers {
}.token;
}
- private static int getInteger(Map<String,Object> map, String name, int def) {
- Number n = (Number)map.get(name);
- if (n == null) return def;
- return n.intValue();
- }
-
- private static String getString(Map<String,Object> map, String name, String def) {
- String s = (String)map.get(name);
- if (s == null) return def;
- return s;
- }
-
- private static boolean getBoolean(Map<String,Object> map, String name) {
- Boolean b = (Boolean)map.get(name);
- if (b == null) return false;
- return b.booleanValue();
- }
-
@SuppressWarnings("unchecked")
private CodeArea[] toTextAreaArray(Object o) {
if (o == null) return null;
Collection<Map<String,Object>> c = (Collection<Map<String,Object>>)o;
int n = 0;
CodeArea[] arr = new CodeArea[c.size()];
- String directory = null;
- String file = null;
for (Map<String,Object> area : c) {
- directory = getString(area, "Dir", directory);
- file = getString(area, "File", file);
- arr[n++] = new CodeArea(directory, file,
- getInteger(area, "SLine", 0), getInteger(area, "SCol", 0),
- getInteger(area, "ELine", 0), getInteger(area, "ECol", 0),
- (Number)area.get("SAddr"), (Number)area.get("EAddr"),
- getInteger(area, "ISA", 0),
- getBoolean(area, "IsStmt"), getBoolean(area, "BasicBlock"),
- getBoolean(area, "PrologueEnd"), getBoolean(area, "EpilogueBegin"));
+ arr[n] = new CodeArea(area, n > 0 ? arr[n - 1] : null);
+ n++;
}
return arr;
}
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/StackTraceProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/StackTraceProxy.java
index 243ad4034..95286d4ec 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/StackTraceProxy.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/StackTraceProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,8 @@ import java.util.Map;
import org.eclipse.tcf.core.Command;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.ILineNumbers.CodeArea;
+import org.eclipse.tcf.services.ILineNumbers;
import org.eclipse.tcf.services.IStackTrace;
@@ -67,6 +69,17 @@ public class StackTraceProxy implements IStackTrace {
return (Number)props.get(PROP_INSTRUCTION_ADDRESS);
}
+ public CodeArea getCodeArea() {
+ @SuppressWarnings("unchecked")
+ Map<String,Object> area = (Map<String,Object>)props.get(PROP_CODE_AREA);
+ if (area == null) return null;
+ return new ILineNumbers.CodeArea(area, null);
+ }
+
+ public String getFuncID() {
+ return (String)props.get(PROP_FUNC_ID);
+ }
+
public Map<String, Object> getProperties() {
return props;
}
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILineNumbers.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILineNumbers.java
index 1f5fdebe1..d2bc8e09e 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILineNumbers.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/ILineNumbers.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.tcf.services;
+import java.util.Map;
+
import org.eclipse.tcf.protocol.IService;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.JSON;
@@ -67,6 +69,35 @@ public interface ILineNumbers extends IService {
this.epilogue_begin = epilogue_begin;
}
+ public CodeArea(Map<String,Object> area, CodeArea prev) {
+ this(getString(area, "Dir", prev != null ? prev.directory : null),
+ getString(area, "File", prev != null ? prev.file : null),
+ getInteger(area, "SLine", 0), getInteger(area, "SCol", 0),
+ getInteger(area, "ELine", 0), getInteger(area, "ECol", 0),
+ (Number)area.get("SAddr"), (Number)area.get("EAddr"),
+ getInteger(area, "ISA", 0),
+ getBoolean(area, "IsStmt"), getBoolean(area, "BasicBlock"),
+ getBoolean(area, "PrologueEnd"), getBoolean(area, "EpilogueBegin"));
+ }
+
+ private static int getInteger(Map<String,Object> map, String name, int def) {
+ Number n = (Number)map.get(name);
+ if (n == null) return def;
+ return n.intValue();
+ }
+
+ private static String getString(Map<String,Object> map, String name, String def) {
+ String s = (String)map.get(name);
+ if (s == null) return def;
+ return s;
+ }
+
+ private static boolean getBoolean(Map<String,Object> map, String name) {
+ Boolean b = (Boolean)map.get(name);
+ if (b == null) return false;
+ return b.booleanValue();
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IStackTrace.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IStackTrace.java
index 41231b4f2..30e309cdc 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IStackTrace.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IStackTrace.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -101,6 +101,18 @@ public interface IStackTrace extends IService {
/**
* Stack frame property:
+ * ILineNumbers.CodeArea - call site code area.
+ */
+ static final String PROP_CODE_AREA = "CodeArea";
+
+ /**
+ * Stack frame property:
+ * String - function symbol ID.
+ */
+ static final String PROP_FUNC_ID = "FuncID";
+
+ /**
+ * Stack frame property:
* Integer, stack frame level, starting from stack bottom
* @deprecated, use "Index" property.
* Note: "Index" is counted from the top of the stack, while "Level" is counted from the bottom.
@@ -236,6 +248,20 @@ public interface IStackTrace extends IService {
Number getArgumentsAddress();
/**
+ * Get code area that describes source code location of the frame.
+ * If null, client should use LineNumbers service to find frame source location.
+ * @return code area or null.
+ */
+ ILineNumbers.CodeArea getCodeArea();
+
+ /**
+ * Get function symbol ID.
+ * If null, client should use Symbols service to find function symbol ID.
+ * @return function symbol ID or null.
+ */
+ String getFuncID();
+
+ /**
* Get complete map of context properties.
* @return map of context properties.
*/
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
index a0c13ac78..2e9c12641 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2014 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -698,9 +698,9 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe
ref_data.context_id = mem_data.getID();
ref_data.address_size = mem_data.getAddressSize();
}
+ ref_data.address = addr;
command = syms.findByAddr(id, addr, new ISymbols.DoneFind() {
public void doneFind(IToken token, Exception error, String symbol_id) {
- ref_data.address = addr;
ref_data.error = error;
ref_data.symbol_id = symbol_id;
set(token, null, ref_data);
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
index 1906ed23e..ba22967c0 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2014 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,6 +30,8 @@ import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IExpressions;
+import org.eclipse.tcf.services.ILineNumbers;
+import org.eclipse.tcf.services.IMemory;
import org.eclipse.tcf.services.IStackTrace;
import org.eclipse.tcf.services.ISymbols;
import org.eclipse.tcf.util.TCFDataCache;
@@ -96,27 +98,51 @@ public class TCFNodeStackFrame extends TCFNode implements ITCFStackFrame {
@Override
protected boolean startDataRetrieval() {
if (!stack_trace_context.validate(this)) return false;
- if (!address.validate(this)) return false;
- BigInteger n = address.getData();
- if (n == null) {
- set(null, address.getError(), null);
+ IStackTrace.StackTraceContext ctx = stack_trace_context.getData();
+ if (ctx == null) {
+ set(null, stack_trace_context.getError(), null);
return true;
}
- assert parent.getStackTrace().isValid();
- if (frame_no > 0) n = n.subtract(BigInteger.valueOf(1));
- TCFDataCache<TCFNodeExecContext> mem_cache = ((TCFNodeExecContext)parent).getMemoryNode();
- if (!mem_cache.validate(this)) return false;
- if (mem_cache.getError() != null || mem_cache.getData() == null) {
- set(null, mem_cache.getError(), null);
+ TCFDataCache<TCFNodeExecContext> mem_node_cache = ((TCFNodeExecContext)parent).getMemoryNode();
+ if (!mem_node_cache.validate(this)) return false;
+ if (mem_node_cache.getError() != null || mem_node_cache.getData() == null) {
+ set(null, mem_node_cache.getError(), null);
return true;
}
- TCFDataCache<TCFSourceRef> info_cache = mem_cache.getData().getLineInfo(n);
- if (info_cache == null) {
- set(null, null, null);
- return true;
+ TCFNodeExecContext mem_node = mem_node_cache.getData();
+ ILineNumbers.CodeArea area = ctx.getCodeArea();
+ if (area != null) {
+ IMemory.MemoryContext mem_ctx_data = null;
+ if (mem_node != null) {
+ TCFDataCache<IMemory.MemoryContext> mem_ctx_cache = mem_node.getMemoryContext();
+ if (!mem_ctx_cache.validate(this)) return false;
+ mem_ctx_data = mem_ctx_cache.getData();
+ }
+ final TCFSourceRef ref_data = new TCFSourceRef();
+ if (mem_ctx_data != null) {
+ ref_data.context_id = mem_ctx_data.getID();
+ ref_data.address_size = mem_ctx_data.getAddressSize();
+ }
+ ref_data.area = area;
+ set(null, null, ref_data);
+ }
+ else {
+ if (!address.validate(this)) return false;
+ BigInteger n = address.getData();
+ if (n == null) {
+ set(null, address.getError(), null);
+ return true;
+ }
+ assert parent.getStackTrace().isValid();
+ if (frame_no > 0) n = n.subtract(BigInteger.valueOf(1));
+ TCFDataCache<TCFSourceRef> info_cache = mem_node.getLineInfo(n);
+ if (info_cache == null) {
+ set(null, null, null);
+ return true;
+ }
+ if (!info_cache.validate(this)) return false;
+ set(null, info_cache.getError(), info_cache.getData());
}
- if (!info_cache.validate(this)) return false;
- set(null, info_cache.getError(), info_cache.getData());
return true;
}
};
@@ -129,21 +155,47 @@ public class TCFNodeStackFrame extends TCFNode implements ITCFStackFrame {
set(null, address.getError(), null);
return true;
}
- assert parent.getStackTrace().isValid();
- if (frame_no > 0) n = n.subtract(BigInteger.valueOf(1));
- TCFDataCache<TCFNodeExecContext> mem_cache = ((TCFNodeExecContext)parent).getMemoryNode();
- if (!mem_cache.validate(this)) return false;
- if (mem_cache.getError() != null || mem_cache.getData() == null) {
- set(null, mem_cache.getError(), null);
+ if (!stack_trace_context.validate(this)) return false;
+ IStackTrace.StackTraceContext ctx = stack_trace_context.getData();
+ if (ctx == null) {
+ set(null, stack_trace_context.getError(), null);
return true;
}
- TCFDataCache<TCFFunctionRef> info_cache = mem_cache.getData().getFuncInfo(n);
- if (info_cache == null) {
- set(null, null, null);
+ TCFDataCache<TCFNodeExecContext> mem_node_cache = ((TCFNodeExecContext)parent).getMemoryNode();
+ if (!mem_node_cache.validate(this)) return false;
+ if (mem_node_cache.getError() != null || mem_node_cache.getData() == null) {
+ set(null, mem_node_cache.getError(), null);
return true;
}
- if (!info_cache.validate(this)) return false;
- set(null, info_cache.getError(), info_cache.getData());
+ TCFNodeExecContext mem_node = mem_node_cache.getData();
+ String func_id = ctx.getFuncID();
+ if (func_id != null) {
+ IMemory.MemoryContext mem_ctx_data = null;
+ if (mem_node != null) {
+ TCFDataCache<IMemory.MemoryContext> mem_ctx_cache = mem_node.getMemoryContext();
+ if (!mem_ctx_cache.validate(this)) return false;
+ mem_ctx_data = mem_ctx_cache.getData();
+ }
+ TCFFunctionRef ref = new TCFFunctionRef();
+ if (mem_ctx_data != null) {
+ ref.context_id = mem_ctx_data.getID();
+ ref.address_size = mem_ctx_data.getAddressSize();
+ }
+ ref.address = n;
+ ref.symbol_id = func_id;
+ set(null, null, ref);
+ }
+ else {
+ assert parent.getStackTrace().isValid();
+ if (frame_no > 0) n = n.subtract(BigInteger.valueOf(1));
+ TCFDataCache<TCFFunctionRef> info_cache = mem_node.getFuncInfo(n);
+ if (info_cache == null) {
+ set(null, null, null);
+ return true;
+ }
+ if (!info_cache.validate(this)) return false;
+ set(null, info_cache.getError(), info_cache.getData());
+ }
return true;
}
};

Back to the top