Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-07-14 02:37:35 +0000
committerEugene Tarassov2013-07-14 02:37:35 +0000
commit9742e5b1d384f4148b5f5c627b4a11f249bb912e (patch)
tree14a0b5444021fe0fe0cb65c1172d28bb9b19f69b /plugins
parentd2f1bb2edabca3e5b4b9b2e602961fffc63766a5 (diff)
downloadorg.eclipse.tcf-9742e5b1d384f4148b5f5c627b4a11f249bb912e.tar.gz
org.eclipse.tcf-9742e5b1d384f4148b5f5c627b4a11f249bb912e.tar.xz
org.eclipse.tcf-9742e5b1d384f4148b5f5c627b4a11f249bb912e.zip
Bug 411756 - [doc] Stacktrace service documentation should be updated with new properties and new command
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/StackTraceProxy.java17
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IStackTrace.java83
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestExpressions.java42
3 files changed, 125 insertions, 17 deletions
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 4fc68b6f7..243ad4034 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, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2013 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
@@ -91,6 +91,21 @@ public class StackTraceProxy implements IStackTrace {
}.token;
}
+ public IToken getChildrenRange(String parent_context_id, int range_start, int range_end, final DoneGetChildren done) {
+ return new Command(channel, this, "getChildrenRange", new Object[]{ parent_context_id, range_start, range_end }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ String[] arr = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ arr = toStringArray(args[1]);
+ }
+ done.doneGetChildren(token, error, arr);
+ }
+ }.token;
+ }
+
public IToken getContext(String[] id, final DoneGetContext done) {
return new Command(channel, this, "getContext", new Object[]{ id }) {
@Override
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 dfc9dd605..37fb284dc 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, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2013 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
@@ -24,17 +24,48 @@ public interface IStackTrace extends IService {
* Stack frame context property names.
*/
static final String
- PROP_ID = "ID", /** String, stack frame ID */
- PROP_PARENT_ID = "ParentID", /** String, stack frame parent ID */
- PROP_PROCESS_ID = "ProcessID", /** String, stack frame process ID */
- PROP_NAME = "Name", /** String, human readable name */
- PROP_TOP_FRAME = "TopFrame", /** Boolean, true if the frame is top frame on a stack */
- PROP_LEVEL = "Level", /** Integer, stack frame level, starting from stack bottom */
- PROP_FRAME_ADDRESS = "FP", /** Number, stack frame memory address */
- PROP_RETURN_ADDRESS = "RP", /** Number, return address */
- PROP_INSTRUCTION_ADDRESS = "IP", /** Number, instruction pointer */
- PROP_ARGUMENTS_COUNT = "ArgsCnt", /** Integer, number of function arguments */
- PROP_ARGUMENTS_ADDRESS = "ArgsAddr"; /** Number, memory address of function arguments */
+ /** String, stack frame ID */
+ PROP_ID = "ID",
+
+ /** String, stack frame parent ID */
+ PROP_PARENT_ID = "ParentID",
+
+ /** String, stack frame process ID */
+ PROP_PROCESS_ID = "ProcessID",
+
+ /** String, human readable name */
+ PROP_NAME = "Name",
+
+ /** Boolean, true if the frame is top frame on a stack */
+ PROP_TOP_FRAME = "TopFrame",
+
+ /** Integer, stack frame index, starting from stack top (current frame) */
+ PROP_INDEX = "Index",
+
+ /** Boolean, true if the frame data was computed using symbols info,
+ * false or not set if the data was collected using stack crawl logic. */
+ PROP_WALK = "Walk",
+
+ /** Number, stack frame memory address */
+ PROP_FRAME_ADDRESS = "FP",
+
+ /** Number, return address */
+ PROP_RETURN_ADDRESS = "RP",
+
+ /** Number, instruction pointer */
+ PROP_INSTRUCTION_ADDRESS = "IP",
+
+ /** Integer, number of function arguments */
+ PROP_ARGUMENTS_COUNT = "ArgsCnt",
+
+ /** Number, memory address of function arguments */
+ PROP_ARGUMENTS_ADDRESS = "ArgsAddr";
+
+ static final String
+ /** 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. */
+ PROP_LEVEL = "Level";
/**
* Retrieve context info for given context IDs.
@@ -60,12 +91,14 @@ public interface IStackTrace extends IService {
}
/**
- * Retrieve stack trace context list.
+ * Retrieve stack trace context ID list.
* Parent context usually corresponds to an execution thread.
* Some targets have more then one stack. In such case children of a thread
* are stacks, and stack frames are deeper in the hierarchy - they can be
* retrieved with additional getChildren commands.
*
+ * Stack frames are ordered from stack bottom to top.
+ *
* The command will fail if parent thread is not suspended.
* Client can use Run Control service to suspend a thread.
*
@@ -75,14 +108,32 @@ public interface IStackTrace extends IService {
IToken getChildren(String parent_context_id, DoneGetChildren done);
/**
- * Client call back interface for getChildren().
+ * Retrieve a range of stack trace context IDs.
+ * Parent context usually corresponds to an execution thread.
+ *
+ * Note: to allow partial and incremental stack tracing, IDs ordering in
+ * the range is reversed relative to getChildren command order.
+ * For example, range 0..1 represents last two stack frames:
+ * current frame (top of the stack) and previous one.
+ *
+ * The command will fail if parent thread is not suspended.
+ * Client can use Run Control service to suspend a thread.
+ *
+ * @param parent_context_id – parent context ID.
+ * @param range_start - start of the range (inclusive).
+ * @param range_end - end of the range (inclusive).
+ * @param done - call back interface called when operation is completed.
+ */
+ IToken getChildrenRange(String parent_context_id, int range_start, int range_end, DoneGetChildren done);
+
+ /**
+ * Client call back interface for getChildren() and getChildrenRange().
*/
interface DoneGetChildren {
/**
- * Called when context list retrieval is done.
+ * Called when context ID list retrieval is done.
* @param error – error description if operation failed, null if succeeded.
* @param context_ids – array of available context IDs.
- * Stack frames are ordered from stack bottom to top.
*/
void doneGetChildren(IToken token, Exception error, String[] context_ids);
}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestExpressions.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestExpressions.java
index f9ebee153..39999aefa 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestExpressions.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestExpressions.java
@@ -67,6 +67,7 @@ class TestExpressions implements ITCFTest,
private String suspended_pc;
private boolean waiting_suspend;
private String[] stack_trace;
+ private String[] stack_range;
private IStackTrace.StackTraceContext[] stack_frames;
private String[] local_var_expr_ids;
private final Set<IToken> cmds = new HashSet<IToken>();
@@ -422,6 +423,47 @@ class TestExpressions implements ITCFTest,
});
return;
}
+ if (stack_range == null) {
+ srv_stk.getChildrenRange(thread_id, 1, 2, new IStackTrace.DoneGetChildren() {
+ public void doneGetChildren(IToken token, Exception error, String[] context_ids) {
+ if (error instanceof IErrorReport && ((IErrorReport)error).getErrorCode() == IErrorReport.TCF_ERROR_INV_COMMAND) {
+ /* Older agent, the command not available */
+ stack_range = new String[0];
+ runTest();
+ }
+ else if (error != null) {
+ exit(error);
+ }
+ else if (context_ids == null) {
+ exit(new Exception("Invalid stack trace"));
+ }
+ else {
+ for (int i = 0; i < 2; i++) {
+ int j = stack_trace.length - i - 2;
+ if (i >= context_ids.length) {
+ if (j >= 0) {
+ exit(new Exception("Invalid result of doneGetChildren command: too short"));
+ }
+ }
+ else {
+ if (j < 0) {
+ exit(new Exception("Invalid result of doneGetChildren command: too long"));
+ }
+ if (context_ids[i]== null) {
+ exit(new Exception("Invalid result of doneGetChildren command: ID is null"));
+ }
+ if (!context_ids[i].equals(stack_trace[j])) {
+ exit(new Exception("Invalid result of doneGetChildren command: wrong ID"));
+ }
+ }
+ }
+ stack_range = context_ids;
+ runTest();
+ }
+ }
+ });
+ return;
+ }
if (stack_frames == null) {
srv_stk.getContext(stack_trace, new IStackTrace.DoneGetContext() {
public void doneGetContext(IToken token, Exception error, IStackTrace.StackTraceContext[] frames) {

Back to the top