diff options
author | Eugene Tarassov | 2015-03-17 19:02:22 +0000 |
---|---|---|
committer | Eugene Tarassov | 2015-03-17 19:02:22 +0000 |
commit | 3e63e55614073f5fec1e4449957031b58e16fa8f (patch) | |
tree | 725d5f32f1d30d27e3feeb7a12867cefaa840564 /plugins/org.eclipse.tcf.core/src/org | |
parent | 81c39c23c064a2d2ee83a2af958e858d6db1fd11 (diff) | |
download | org.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/org.eclipse.tcf.core/src/org')
4 files changed, 76 insertions, 33 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. */ |