2 * Copyright 2008-2010 Novell, Inc.
3 * Copyright 2011 Xamarin Inc.
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6 #ifndef __MONO_MONO_STACK_UNWINDING_H__
7 #define __MONO_MONO_STACK_UNWINDING_H__
9 #include <mono/metadata/appdomain.h>
10 #include <mono/metadata/metadata.h>
11 #include <mono/utils/mono-context.h>
14 * Possible frame types returned by the stack walker.
17 /* Normal managed frames */
18 FRAME_TYPE_MANAGED = 0,
19 /* Pseudo frame marking the start of a method invocation done by the soft debugger */
20 FRAME_TYPE_DEBUGGER_INVOKE = 1,
21 /* Frame for transitioning to native code */
22 FRAME_TYPE_MANAGED_TO_NATIVE = 2,
23 FRAME_TYPE_TRAMPOLINE = 3,
28 MONO_UNWIND_NONE = 0x0,
29 MONO_UNWIND_LOOKUP_IL_OFFSET = 0x1,
31 MONO_UNWIND_LOOKUP_ACTUAL_METHOD = 0x2,
33 * Store the locations where caller-saved registers are saved on the stack in
34 * frame->reg_locations. The pointer is only valid during the call to the unwind
37 MONO_UNWIND_REG_LOCATIONS = 0x4,
38 MONO_UNWIND_DEFAULT = MONO_UNWIND_LOOKUP_ACTUAL_METHOD,
39 MONO_UNWIND_SIGNAL_SAFE = MONO_UNWIND_NONE,
40 MONO_UNWIND_LOOKUP_ALL = MONO_UNWIND_LOOKUP_IL_OFFSET | MONO_UNWIND_LOOKUP_ACTUAL_METHOD,
44 MonoStackFrameType type;
46 * For FRAME_TYPE_MANAGED, otherwise NULL.
51 * Not valid if ASYNC_CONTEXT is true.
55 * If ji->method is a gshared method, this is the actual method instance.
56 * This is only filled if lookup for actual method was requested (MONO_UNWIND_LOOKUP_ACTUAL_METHOD)
57 * Not valid if ASYNC_CONTEXT is true.
59 MonoMethod *actual_method;
60 /* The domain containing the code executed by this frame */
62 /* Whenever method is a user level method */
65 * Whenever this frame was loaded in async context.
67 gboolean async_context;
70 * IL offset of this frame.
71 * Only available if the runtime have debugging enabled (--debug switch) and
72 * il offset resultion was requested (MONO_UNWIND_LOOKUP_IL_OFFSET)
76 /* The next fields are only useful for the jit */
78 guint32 unwind_info_len;
81 mgreg_t **reg_locations;
84 /*Index into MonoThreadState::unwind_data. */
86 MONO_UNWIND_DATA_DOMAIN,
88 MONO_UNWIND_DATA_JIT_TLS,
92 * This structs holds all information needed to unwind the stack
97 gpointer unwind_data [3]; /*right now: domain, lmf and jit_tls*/
100 int gc_stackdata_size;
101 } MonoThreadUnwindState;