Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 41231b4f2d9693d59a13b38348ce478cfed0f5fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*******************************************************************************
 * 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
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.services;

import java.util.Map;

import org.eclipse.tcf.protocol.IService;
import org.eclipse.tcf.protocol.IToken;

/**
 * Stack Trace service implements thread stack back tracing.
 *
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IStackTrace extends IService {

    static final String NAME = "StackTrace";

    /**
     * Stack frame context property names.
     */

    static final String PROP_ID = "ID";

    /**
     * Stack frame property:
     * String, stack frame parent ID.
     */
    static final String PROP_PARENT_ID = "ParentID";

    /**
     * Stack frame property:
     * String, stack frame process ID.
     */
    static final String PROP_PROCESS_ID = "ProcessID";

    /**
     * Stack frame property:
     * String, human readable name.
     */
    static final String PROP_NAME = "Name";

    /**
     * Stack frame property:
     * Boolean, true if the frame is top frame on a stack.
     */
    static final String PROP_TOP_FRAME = "TopFrame";

    /**
     * Stack frame property:
     * Integer, stack frame index, starting from stack top (current frame).
     * @since 1.2
     */
    static final String PROP_INDEX = "Index";

    /**
     * Stack frame property:
     * Boolean, true if the frame data was computed using symbols info,
     * false or not set if the data was collected using stack crawl logic.
     * @since 1.2
     */
    static final String PROP_WALK = "Walk";

    /**
     * Stack frame property:
     * Number, stack frame memory address.
     */
    static final String PROP_FRAME_ADDRESS = "FP";

    /**
     * Stack frame property:
     * Number, return address.
     */
    static final String PROP_RETURN_ADDRESS = "RP";

    /**
     * Stack frame property:
     * Number, instruction pointer.
     */
    static final String PROP_INSTRUCTION_ADDRESS = "IP";

    /**
     * Stack frame property:
     * Integer, number of function arguments.
     */
    static final String PROP_ARGUMENTS_COUNT = "ArgsCnt";

    /**
     * Stack frame property:
     * Number, memory address of function arguments.
     */
    static final String PROP_ARGUMENTS_ADDRESS = "ArgsAddr";

    /**
     * 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.
     */
    static final String PROP_LEVEL = "Level";

    /**
     * Retrieve context info for given context IDs.
     *
     * The command will fail if parent thread is not suspended.
     * Client can use Run Control service to suspend a thread.
     *
     * @param id - array of context IDs.
     * @param done - call back interface called when operation is completed.
     */
    IToken getContext(String[] id, DoneGetContext done);

    /**
     * Client call back interface for getContext().
     */
    interface DoneGetContext {
        /**
         * Called when context data retrieval is done.
         * @param error - error description if operation failed, null if succeeded.
         * @param context - array of context data or null if error.
         */
        void doneGetContext(IToken token, Exception error, StackTraceContext[] context);
    }

    /**
     * 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.
     *
     * @param parent_context_id - parent context ID.
     * @param done - call back interface called when operation is completed.
     */
    IToken getChildren(String parent_context_id, DoneGetChildren done);

    /**
     * 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.
     * @since 1.2
     */
    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 ID list retrieval is done.
         * @param error - error description if operation failed, null if succeeded.
         * @param context_ids - array of available context IDs.
         */
        void doneGetChildren(IToken token, Exception error, String[] context_ids);
    }

    /**
     * StackTraceContext represents stack trace objects - stacks and stack frames.
     */
    interface StackTraceContext {

        /**
         * Get Context ID.
         * @return context ID.
         */
        String getID();

        /**
         * Get parent context ID.
         * @return parent context ID.
         */
        String getParentID();

        /**
         * Get context name - if context represents a stack.
         * @return context name or null.
         */
        String getName();

        /**
         * Get memory address of this frame.
         * @return address or null if not a stack frame.
         */
        Number getFrameAddress();

        /**
         * Get program counter saved in this stack frame -
         * it is address of instruction to be executed when the function returns.
         * @return return address or null if not a stack frame.
         */
        Number getReturnAddress();

        /**
         * Get address of the next instruction to be executed in this stack frame.
         * For top frame it is same as PC register value.
         * For other frames it is same as return address of the next frame.
         * @return instruction address or null if not a stack frame.
         */
        Number getInstructionAddress();

        /**
         * Get number of function arguments for this frame.
         * @return function arguments count.
         */
        int getArgumentsCount();

        /**
         * Get address of function arguments area in memory.
         * @return function arguments address or null if not available.
         */
        Number getArgumentsAddress();

        /**
         * Get complete map of context properties.
         * @return map of context properties.
         */
        Map<String,Object> getProperties();
    }
}

Back to the top