2 * This header is only installed for use by the debugger:
3 * the structures and the API declared here are not supported.
6 #ifndef __MONO_DEBUG_H__
7 #define __MONO_DEBUG_H__
9 #include <mono/utils/mono-publib.h>
10 #include <mono/metadata/image.h>
11 #include <mono/metadata/appdomain.h>
15 typedef struct _MonoSymbolTable MonoSymbolTable;
16 typedef struct _MonoDebugDataTable MonoDebugDataTable;
18 typedef struct _MonoSymbolFile MonoSymbolFile;
19 typedef struct _MonoPPDBFile MonoPPDBFile;
21 typedef struct _MonoDebugHandle MonoDebugHandle;
23 typedef struct _MonoDebugLineNumberEntry MonoDebugLineNumberEntry;
25 typedef struct _MonoDebugVarInfo MonoDebugVarInfo;
26 typedef struct _MonoDebugMethodJitInfo MonoDebugMethodJitInfo;
27 typedef struct _MonoDebugMethodAddress MonoDebugMethodAddress;
28 typedef struct _MonoDebugMethodAddressList MonoDebugMethodAddressList;
29 typedef struct _MonoDebugClassEntry MonoDebugClassEntry;
31 typedef struct _MonoDebugMethodInfo MonoDebugMethodInfo;
32 typedef struct _MonoDebugLocalsInfo MonoDebugLocalsInfo;
33 typedef struct _MonoDebugSourceLocation MonoDebugSourceLocation;
35 typedef struct _MonoDebugList MonoDebugList;
38 MONO_DEBUG_FORMAT_NONE,
39 MONO_DEBUG_FORMAT_MONO,
40 /* Deprecated, the mdb debugger is not longer supported. */
41 MONO_DEBUG_FORMAT_DEBUGGER
46 * We intentionally do not use GList here since the debugger needs to know about
47 * the layout of the fields.
49 struct _MonoDebugList {
54 struct _MonoSymbolTable {
60 * Corlib and metadata info.
62 MonoDebugHandle *corlib;
63 MonoDebugDataTable *global_data_table;
64 MonoDebugList *data_tables;
69 MonoDebugList *symbol_files;
72 struct _MonoDebugHandle {
76 MonoDebugDataTable *type_table;
77 MonoSymbolFile *symfile;
81 struct _MonoDebugMethodJitInfo {
82 const mono_byte *code_start;
84 uint32_t prologue_end;
85 uint32_t epilogue_begin;
86 const mono_byte *wrapper_addr;
87 uint32_t num_line_numbers;
88 MonoDebugLineNumberEntry *line_numbers;
90 MonoDebugVarInfo *this_var;
91 MonoDebugVarInfo *params;
93 MonoDebugVarInfo *locals;
94 MonoDebugVarInfo *gsharedvt_info_var;
95 MonoDebugVarInfo *gsharedvt_locals_var;
98 struct _MonoDebugMethodAddressList {
101 mono_byte data [MONO_ZERO_LEN_ARRAY];
104 struct _MonoDebugSourceLocation {
106 uint32_t row, column;
110 MONO_API mono_bool mono_debug_enabled (void);
113 * These bits of the MonoDebugLocalInfo's "index" field are flags specifying
114 * where the variable is actually stored.
116 * See relocate_variable() in debug-symfile.c for more info.
118 #define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS 0xf0000000
120 /* The variable is in register "index". */
121 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER 0
123 /* The variable is at offset "offset" from register "index". */
124 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET 0x10000000
126 /* The variable is in the two registers "offset" and "index". */
127 #define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS 0x20000000
129 /* The variable is dead. */
130 #define MONO_DEBUG_VAR_ADDRESS_MODE_DEAD 0x30000000
132 /* Same as REGOFFSET, but do an indirection */
133 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR 0x40000000
135 /* gsharedvt local */
136 #define MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL 0x50000000
138 /* variable is a vt address */
139 #define MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR 0x60000000
141 struct _MonoDebugVarInfo {
145 uint32_t begin_scope;
150 #define MONO_DEBUGGER_MAJOR_VERSION 81
151 #define MONO_DEBUGGER_MINOR_VERSION 6
152 #define MONO_DEBUGGER_MAGIC 0x7aff65af4253d427ULL
154 MONO_API void mono_debug_init (MonoDebugFormat format);
155 MONO_API void mono_debug_open_image_from_memory (MonoImage *image, const mono_byte *raw_contents, int size);
156 MONO_API void mono_debug_cleanup (void);
158 MONO_API void mono_debug_close_image (MonoImage *image);
160 MONO_API void mono_debug_domain_unload (MonoDomain *domain);
161 MONO_API void mono_debug_domain_create (MonoDomain *domain);
163 MONO_API MonoDebugMethodAddress *
164 mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDomain *domain);
167 mono_debug_remove_method (MonoMethod *method, MonoDomain *domain);
169 MONO_API MonoDebugMethodInfo *
170 mono_debug_lookup_method (MonoMethod *method);
172 MONO_API MonoDebugMethodAddressList *
173 mono_debug_lookup_method_addresses (MonoMethod *method);
175 MONO_API MonoDebugMethodJitInfo*
176 mono_debug_find_method (MonoMethod *method, MonoDomain *domain);
179 mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);
183 mono_debug_add_delegate_trampoline (void* code, int size);
185 MONO_API MonoDebugLocalsInfo*
186 mono_debug_lookup_locals (MonoMethod *method);
188 MonoDebugSourceLocation *
189 mono_debug_method_lookup_location (MonoDebugMethodInfo *minfo, int il_offset);
192 * Line number support.
195 MONO_API MonoDebugSourceLocation *
196 mono_debug_lookup_source_location (MonoMethod *method, uint32_t address, MonoDomain *domain);
199 mono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, uint32_t native_offset);
202 mono_debug_free_source_location (MonoDebugSourceLocation *location);
205 mono_debug_print_stack_frame (MonoMethod *method, uint32_t native_offset, MonoDomain *domain);
208 * Mono Debugger support functions
210 * These methods are used by the JIT while running inside the Mono Debugger.
213 MONO_API int mono_debugger_method_has_breakpoint (MonoMethod *method);
214 MONO_API int mono_debugger_insert_breakpoint (const char *method_name, mono_bool include_namespace);
216 MONO_API void mono_set_is_debugger_attached (mono_bool attached);
217 MONO_API mono_bool mono_is_debugger_attached (void);
221 #endif /* __MONO_DEBUG_H__ */