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;
20 typedef struct _MonoDebugHandle MonoDebugHandle;
22 typedef struct _MonoDebugLineNumberEntry MonoDebugLineNumberEntry;
24 typedef struct _MonoDebugVarInfo MonoDebugVarInfo;
25 typedef struct _MonoDebugMethodJitInfo MonoDebugMethodJitInfo;
26 typedef struct _MonoDebugMethodAddress MonoDebugMethodAddress;
27 typedef struct _MonoDebugMethodAddressList MonoDebugMethodAddressList;
28 typedef struct _MonoDebugClassEntry MonoDebugClassEntry;
30 typedef struct _MonoDebugMethodInfo MonoDebugMethodInfo;
31 typedef struct _MonoDebugLocalsInfo MonoDebugLocalsInfo;
32 typedef struct _MonoDebugSourceLocation MonoDebugSourceLocation;
34 typedef struct _MonoDebugList MonoDebugList;
37 MONO_DEBUG_FORMAT_NONE,
38 MONO_DEBUG_FORMAT_MONO,
39 MONO_DEBUG_FORMAT_DEBUGGER
44 * We intentionally do not use GList here since the debugger needs to know about
45 * the layout of the fields.
47 struct _MonoDebugList {
52 struct _MonoSymbolTable {
58 * Corlib and metadata info.
60 MonoDebugHandle *corlib;
61 MonoDebugDataTable *global_data_table;
62 MonoDebugList *data_tables;
67 MonoDebugList *symbol_files;
70 struct _MonoDebugHandle {
74 MonoDebugDataTable *type_table;
75 MonoSymbolFile *symfile;
78 struct _MonoDebugMethodJitInfo {
79 const mono_byte *code_start;
81 uint32_t prologue_end;
82 uint32_t epilogue_begin;
83 const mono_byte *wrapper_addr;
84 uint32_t num_line_numbers;
85 MonoDebugLineNumberEntry *line_numbers;
87 MonoDebugVarInfo *this_var;
88 MonoDebugVarInfo *params;
90 MonoDebugVarInfo *locals;
93 struct _MonoDebugMethodAddressList {
96 mono_byte data [MONO_ZERO_LEN_ARRAY];
99 struct _MonoDebugSourceLocation {
101 uint32_t row, column;
106 * These bits of the MonoDebugLocalInfo's "index" field are flags specifying
107 * where the variable is actually stored.
109 * See relocate_variable() in debug-symfile.c for more info.
111 #define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS 0xf0000000
113 /* The variable is in register "index". */
114 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER 0
116 /* The variable is at offset "offset" from register "index". */
117 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET 0x10000000
119 /* The variable is in the two registers "offset" and "index". */
120 #define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS 0x20000000
122 /* The variable is dead. */
123 #define MONO_DEBUG_VAR_ADDRESS_MODE_DEAD 0x30000000
125 struct _MonoDebugVarInfo {
129 uint32_t begin_scope;
134 #define MONO_DEBUGGER_MAJOR_VERSION 81
135 #define MONO_DEBUGGER_MINOR_VERSION 6
136 #define MONO_DEBUGGER_MAGIC 0x7aff65af4253d427ULL
138 extern MonoSymbolTable *mono_symbol_table;
139 extern MonoDebugFormat mono_debug_format;
140 extern int32_t mono_debug_debugger_version;
141 extern int32_t _mono_debug_using_mono_debugger;
143 void mono_debug_list_add (MonoDebugList **list, const void* data);
144 void mono_debug_list_remove (MonoDebugList **list, const void* data);
146 void mono_debug_init (MonoDebugFormat format);
147 void mono_debug_open_image_from_memory (MonoImage *image, const mono_byte *raw_contents, int size);
148 void mono_debug_cleanup (void);
150 void mono_debug_close_image (MonoImage *image);
152 void mono_debug_domain_unload (MonoDomain *domain);
153 void mono_debug_domain_create (MonoDomain *domain);
155 mono_bool mono_debug_using_mono_debugger (void);
157 MonoDebugMethodAddress *
158 mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDomain *domain);
160 MonoDebugMethodInfo *
161 mono_debug_lookup_method (MonoMethod *method);
163 MonoDebugMethodAddressList *
164 mono_debug_lookup_method_addresses (MonoMethod *method);
166 MonoDebugMethodJitInfo*
167 mono_debug_find_method (MonoMethod *method, MonoDomain *domain);
170 mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);
174 mono_debug_add_delegate_trampoline (void* code, int size);
177 mono_debug_lookup_locals (MonoMethod *method);
180 * Line number support.
183 MonoDebugSourceLocation *
184 mono_debug_lookup_source_location (MonoMethod *method, uint32_t address, MonoDomain *domain);
187 mono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, uint32_t native_offset);
190 mono_debug_free_source_location (MonoDebugSourceLocation *location);
193 mono_debug_print_stack_frame (MonoMethod *method, uint32_t native_offset, MonoDomain *domain);
196 * Mono Debugger support functions
198 * These methods are used by the JIT while running inside the Mono Debugger.
201 int mono_debugger_method_has_breakpoint (MonoMethod *method);
202 int mono_debugger_insert_breakpoint (const char *method_name, mono_bool include_namespace);
204 void mono_set_is_debugger_attached (mono_bool attached);
205 mono_bool mono_is_debugger_attached (void);
209 #endif /* __MONO_DEBUG_H__ */