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_DEBUGGER_H__
7 #define __MONO_DEBUG_DEBUGGER_H__
10 #include <mono/metadata/debug-helpers.h>
11 #include <mono/metadata/debug-mono-symfile.h>
12 #include <mono/io-layer/io-layer.h>
14 typedef struct _MonoDebuggerBreakpointInfo MonoDebuggerBreakpointInfo;
15 typedef struct _MonoDebuggerBuiltinTypeInfo MonoDebuggerBuiltinTypeInfo;
16 typedef struct _MonoDebuggerBuiltinTypes MonoDebuggerBuiltinTypes;
17 typedef struct _MonoDebuggerSymbolTable MonoDebuggerSymbolTable;
18 typedef struct _MonoDebuggerSymbolFile MonoDebuggerSymbolFile;
19 typedef struct _MonoDebuggerSymbolFilePriv MonoDebuggerSymbolFilePriv;
20 typedef struct _MonoDebuggerRangeInfo MonoDebuggerRangeInfo;
21 typedef struct _MonoDebuggerClassInfo MonoDebuggerClassInfo;
22 typedef struct _MonoDebuggerIOLayer MonoDebuggerIOLayer;
25 MONO_DEBUGGER_EVENT_BREAKPOINT,
26 MONO_DEBUGGER_EVENT_RELOAD_SYMTABS,
27 MONO_DEBUGGER_EVENT_UNHANDLED_EXCEPTION
31 MONO_DEBUGGER_TYPE_KIND_UNKNOWN = 1,
32 MONO_DEBUGGER_TYPE_KIND_FUNDAMENTAL,
33 MONO_DEBUGGER_TYPE_KIND_STRING,
34 MONO_DEBUGGER_TYPE_KIND_SZARRAY,
35 MONO_DEBUGGER_TYPE_KIND_ARRAY,
36 MONO_DEBUGGER_TYPE_KIND_POINTER,
37 MONO_DEBUGGER_TYPE_KIND_ENUM,
38 MONO_DEBUGGER_TYPE_KIND_OBJECT,
39 MONO_DEBUGGER_TYPE_KIND_STRUCT,
40 MONO_DEBUGGER_TYPE_KIND_CLASS,
41 MONO_DEBUGGER_TYPE_KIND_CLASS_INFO
42 } MonoDebuggerTypeKind;
44 struct _MonoDebuggerBreakpointInfo {
49 struct _MonoDebuggerBuiltinTypeInfo
52 MonoDebuggerClassInfo *cinfo;
58 struct _MonoDebuggerBuiltinTypes {
60 guint32 type_info_size;
61 MonoDebuggerBuiltinTypeInfo *object_type;
62 MonoDebuggerBuiltinTypeInfo *byte_type;
63 MonoDebuggerBuiltinTypeInfo *void_type;
64 MonoDebuggerBuiltinTypeInfo *boolean_type;
65 MonoDebuggerBuiltinTypeInfo *sbyte_type;
66 MonoDebuggerBuiltinTypeInfo *int16_type;
67 MonoDebuggerBuiltinTypeInfo *uint16_type;
68 MonoDebuggerBuiltinTypeInfo *int32_type;
69 MonoDebuggerBuiltinTypeInfo *uint32_type;
70 MonoDebuggerBuiltinTypeInfo *int_type;
71 MonoDebuggerBuiltinTypeInfo *uint_type;
72 MonoDebuggerBuiltinTypeInfo *int64_type;
73 MonoDebuggerBuiltinTypeInfo *uint64_type;
74 MonoDebuggerBuiltinTypeInfo *single_type;
75 MonoDebuggerBuiltinTypeInfo *double_type;
76 MonoDebuggerBuiltinTypeInfo *char_type;
77 MonoDebuggerBuiltinTypeInfo *string_type;
78 MonoDebuggerBuiltinTypeInfo *enum_type;
79 MonoDebuggerBuiltinTypeInfo *array_type;
80 MonoDebuggerBuiltinTypeInfo *exception_type;
83 struct _MonoDebuggerSymbolTable {
89 * Corlib and builtin types.
92 MonoDebuggerSymbolFile *corlib;
93 MonoDebuggerBuiltinTypes *builtin_types;
98 guint32 num_symbol_files;
99 MonoDebuggerSymbolFile **symbol_files;
103 * This is intentionally not a GPtrArray to make it more easy to
104 * read for the debugger. The `type_tables' field contains
105 * `num_type_tables' pointers to continuous memory areas of
106 * `type_table_chunk_size' bytes each.
108 * The type table is basically a big continuous blob, but we need
109 * to split it up into pieces because we don't know the total size
110 * in advance and using g_realloc() doesn't work because that may
111 * reallocate the block to a different address.
113 guint32 num_type_tables;
114 guint32 type_table_chunk_size;
115 gpointer *type_tables;
117 * Current type table.
118 * The `current_type_table' points to a blob of `type_table_chunk_size'
121 gpointer current_type_table;
123 * This is the total size of the type table, including all the tables
124 * in the `type_tables' vector.
126 guint32 type_table_size;
128 * These are global offsets - the `current_type_table' starts at global
129 * offset `type_table_start' and we've already allocated stuff in it
130 * until offset `type_table_offset'.
132 guint32 type_table_offset;
133 guint32 type_table_start;
136 struct _MonoDebuggerSymbolFile {
138 MonoSymbolFile *symfile;
140 const char *image_file;
141 guint32 class_entry_size;
142 /* Pointer to the malloced range table. */
145 MonoDebuggerRangeInfo *range_table;
146 guint32 range_entry_size;
147 guint32 num_range_entries;
148 /* Pointer to the malloced class table. */
149 MonoDebuggerClassInfo *class_table;
150 guint32 num_class_entries;
152 MonoDebuggerSymbolFilePriv *_priv;
155 struct _MonoDebuggerRangeInfo {
156 const guint8 *start_address;
157 const guint8 *end_address;
159 gpointer dynamic_data;
160 guint32 dynamic_size;
163 struct _MonoDebuggerClassInfo {
170 extern MonoDebuggerSymbolTable *mono_debugger_symbol_table;
173 * Address of the x86 trampoline code. This is used by the debugger to check
174 * whether a method is a trampoline.
176 extern guint8 *mono_generic_trampoline_code;
178 #ifndef PLATFORM_WIN32
181 * Functions we export to the debugger.
183 struct _MonoDebuggerIOLayer
185 void (*InitializeCriticalSection) (WapiCriticalSection *section);
186 void (*DeleteCriticalSection) (WapiCriticalSection *section);
187 gboolean (*TryEnterCriticalSection) (WapiCriticalSection *section);
188 void (*EnterCriticalSection) (WapiCriticalSection *section);
189 void (*LeaveCriticalSection) (WapiCriticalSection *section);
191 guint32 (*WaitForSingleObject) (gpointer handle, guint32 timeout);
192 guint32 (*SignalObjectAndWait) (gpointer signal_handle, gpointer wait,
193 guint32 timeout, gboolean alertable);
194 guint32 (*WaitForMultipleObjects) (guint32 numobjects, gpointer *handles,
195 gboolean waitall, guint32 timeout);
197 gpointer (*CreateSemaphore) (WapiSecurityAttributes *security,
198 gint32 initial, gint32 max,
200 gboolean (*ReleaseSemaphore) (gpointer handle, gint32 count, gint32 *prevcount);
202 gpointer (*CreateThread) (WapiSecurityAttributes *security,
203 guint32 stacksize, WapiThreadStart start,
204 gpointer param, guint32 create, guint32 *tid);
205 guint32 (*GetCurrentThreadId) (void);
208 extern MonoDebuggerIOLayer mono_debugger_io_layer;
212 extern void (*mono_debugger_event_handler) (MonoDebuggerEvent event, gpointer data, guint32 arg);
214 void mono_debugger_initialize (MonoDomain *domain);
215 void mono_debugger_cleanup (void);
217 void mono_debugger_lock (void);
218 void mono_debugger_unlock (void);
219 void mono_debugger_event (MonoDebuggerEvent event, gpointer data, guint32 arg);
221 MonoDebuggerSymbolFile *mono_debugger_add_symbol_file (MonoDebugHandle *handle);
222 void mono_debugger_add_type (MonoDebuggerSymbolFile *symfile, MonoClass *klass);
223 MonoDebuggerBuiltinTypes *mono_debugger_add_builtin_types (MonoDebuggerSymbolFile *symfile);
225 void mono_debugger_add_method (MonoDebuggerSymbolFile *symfile,
226 MonoDebugMethodInfo *minfo,
227 MonoDebugMethodJitInfo *jit);
229 int mono_debugger_insert_breakpoint_full (MonoMethodDesc *desc);
230 int mono_debugger_remove_breakpoint (int breakpoint_id);
231 int mono_debugger_insert_breakpoint (const gchar *method_name, gboolean include_namespace);
232 int mono_debugger_method_has_breakpoint (MonoMethod *method);
233 void mono_debugger_breakpoint_callback (MonoMethod *method, guint32 idx);
235 gpointer mono_debugger_create_notification_function (gpointer *notification_address);
237 MonoObject *mono_debugger_runtime_invoke (MonoMethod *method, void *obj,
238 void **params, MonoObject **exc);
240 guint32 mono_debugger_lookup_type (const gchar *type_name);
241 gint32 mono_debugger_lookup_assembly (const gchar *name);
242 gboolean mono_debugger_unhandled_exception (gpointer addr, MonoObject *exc);
246 mono_vtable_get_static_field_data (MonoVTable *vt);
249 MonoReflectionMethod *
250 ves_icall_MonoDebugger_GetMethod (MonoReflectionAssembly *assembly, guint32 token);
253 ves_icall_MonoDebugger_GetMethodToken (MonoReflectionAssembly *assembly, MonoReflectionMethod *method);
256 ves_icall_MonoDebugger_GetLocalTypeFromSignature (MonoReflectionAssembly *assembly, MonoArray *signature);
259 ves_icall_MonoDebugger_GetType (MonoReflectionAssembly *assembly, guint32 token);
261 #endif /* __MONO_DEBUG_DEBUGGER_H__ */