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__
10 #include <mono/metadata/image.h>
11 #include <mono/metadata/appdomain.h>
13 typedef struct _MonoSymbolTable MonoSymbolTable;
15 typedef struct _MonoSymbolFile MonoSymbolFile;
16 typedef struct _MonoSymbolFilePriv MonoSymbolFilePriv;
18 typedef struct _MonoDebugHandle MonoDebugHandle;
19 typedef struct _MonoDebugHandlePriv MonoDebugHandlePriv;
21 typedef struct _MonoDebugLineNumberEntry MonoDebugLineNumberEntry;
22 typedef struct _MonoDebugLexicalBlockEntry MonoDebugLexicalBlockEntry;
24 typedef struct _MonoDebugVarInfo MonoDebugVarInfo;
25 typedef struct _MonoDebugMethodJitInfo MonoDebugMethodJitInfo;
26 typedef struct _MonoDebugMethodAddress MonoDebugMethodAddress;
27 typedef struct _MonoDebugClassEntry MonoDebugClassEntry;
29 typedef struct _MonoDebuggerMetadataInfo MonoDebuggerMetadataInfo;
32 MONO_DEBUG_FORMAT_NONE,
33 MONO_DEBUG_FORMAT_MONO,
34 MONO_DEBUG_FORMAT_DEBUGGER
38 MONO_DEBUGGER_TYPE_KIND_UNKNOWN = 1,
39 MONO_DEBUGGER_TYPE_KIND_FUNDAMENTAL,
40 MONO_DEBUGGER_TYPE_KIND_STRING,
41 MONO_DEBUGGER_TYPE_KIND_SZARRAY,
42 MONO_DEBUGGER_TYPE_KIND_ARRAY,
43 MONO_DEBUGGER_TYPE_KIND_POINTER,
44 MONO_DEBUGGER_TYPE_KIND_ENUM,
45 MONO_DEBUGGER_TYPE_KIND_OBJECT,
46 MONO_DEBUGGER_TYPE_KIND_STRUCT,
47 MONO_DEBUGGER_TYPE_KIND_CLASS,
48 MONO_DEBUGGER_TYPE_KIND_CLASS_INFO,
49 MONO_DEBUGGER_TYPE_KIND_REFERENCE
50 } MonoDebuggerTypeKind;
52 struct _MonoSymbolTable {
58 * Corlib and metadata info.
60 MonoDebugHandle *corlib;
61 MonoDebuggerMetadataInfo *metadata_info;
66 MonoDebugHandle **symbol_files;
67 guint32 num_symbol_files;
71 * This is intentionally not a GPtrArray to make it more easy to
72 * read for the debugger. The `data_tables' field contains
73 * `num_data_tables' pointers to continuous memory areas.
75 * The data table is basically a big continuous blob, but we need
76 * to split it up into pieces because we don't know the total size
77 * in advance and using g_realloc() doesn't work because that may
78 * reallocate the block to a different address.
80 guint32 num_data_tables;
81 gpointer *data_tables;
84 * The `current_data_table' points to a blob of `current_data_table_size'
87 gpointer current_data_table;
88 guint32 current_data_table_size;
90 * The offset in the `current_data_table'.
92 guint32 current_data_table_offset;
96 MONO_DEBUG_DATA_ITEM_UNKNOWN = 0,
97 MONO_DEBUG_DATA_ITEM_METHOD,
98 MONO_DEBUG_DATA_ITEM_CLASS
99 } MonoDebugDataItemType;
101 struct _MonoDebugHandle {
103 const char *image_file;
105 MonoSymbolFile *symfile;
106 MonoDebugHandlePriv *_priv;
109 struct _MonoDebugMethodJitInfo {
110 MonoDebugMethodAddress *address;
111 const guint8 *code_start;
113 guint32 prologue_end;
114 guint32 epilogue_begin;
115 const guint8 *wrapper_addr;
116 guint32 num_line_numbers;
117 MonoDebugLineNumberEntry *line_numbers;
118 guint32 num_lexical_blocks;
119 MonoDebugLexicalBlockEntry *lexical_blocks;
121 MonoDebugVarInfo *this_var;
122 MonoDebugVarInfo *params;
124 MonoDebugVarInfo *locals;
127 struct _MonoDebugMethodAddress {
134 const guint8 *code_start;
135 const guint8 *wrapper_addr;
136 MonoDebugMethodJitInfo *jit;
137 guint8 data [MONO_ZERO_LEN_ARRAY];
140 struct _MonoDebugClassEntry {
143 guint8 data [MONO_ZERO_LEN_ARRAY];
147 * These bits of the MonoDebugLocalInfo's "index" field are flags specifying
148 * where the variable is actually stored.
150 * See relocate_variable() in debug-symfile.c for more info.
152 #define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS 0xf0000000
154 /* The variable is in register "index". */
155 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER 0
157 /* The variable is at offset "offset" from register "index". */
158 #define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET 0x10000000
160 /* The variable is in the two registers "offset" and "index". */
161 #define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS 0x20000000
163 struct _MonoDebugVarInfo {
171 #define MONO_DEBUGGER_VERSION 50
172 #define MONO_DEBUGGER_MAGIC 0x7aff65af4253d427ULL
174 extern MonoSymbolTable *mono_symbol_table;
175 extern MonoDebugFormat mono_debug_format;
176 extern GHashTable *mono_debug_handles;
178 void mono_debug_init (MonoDebugFormat format);
179 void mono_debug_init_1 (MonoDomain *domain);
180 void mono_debug_init_2 (MonoAssembly *assembly);
181 void mono_debug_cleanup (void);
183 MonoDebugMethodAddress *mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit,
185 MonoDebugMethodJitInfo *mono_debug_read_method (MonoDebugMethodAddress *address);
186 void mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);
187 gchar *mono_debug_source_location_from_address (MonoMethod *method, guint32 address,
188 guint32 *line_number, MonoDomain *domain);
189 gchar *mono_debug_source_location_from_il_offset (MonoMethod *method, guint32 offset,
190 guint32 *line_number);
191 gint32 mono_debug_il_offset_from_address (MonoMethod *method, gint32 address, MonoDomain *domain);
192 gint32 mono_debug_address_from_il_offset (MonoMethod *method, gint32 il_offset, MonoDomain *domain);
194 #endif /* __MONO_DEBUG_H__ */