* Makefile: Build the make-map.exe in Mono.Unix.Native; add /nowarn:0618 to
[mono.git] / mono / metadata / mono-debug-debugger.h
1 /*
2  * This header is only installed for use by the debugger:
3  * the structures and the API declared here are not supported.
4  */
5
6 #ifndef __MONO_DEBUG_DEBUGGER_H__
7 #define __MONO_DEBUG_DEBUGGER_H__
8
9 #include <glib.h>
10 #include <mono/metadata/debug-helpers.h>
11 #include <mono/metadata/debug-mono-symfile.h>
12 #include <mono/io-layer/io-layer.h>
13
14 typedef struct _MonoDebuggerBreakpointInfo      MonoDebuggerBreakpointInfo;
15 typedef struct _MonoDebuggerIOLayer             MonoDebuggerIOLayer;
16
17 typedef enum {
18         MONO_DEBUGGER_EVENT_BREAKPOINT,
19         MONO_DEBUGGER_EVENT_ADD_MODULE,
20         MONO_DEBUGGER_EVENT_RELOAD_SYMTABS,
21         MONO_DEBUGGER_EVENT_UNHANDLED_EXCEPTION,
22         MONO_DEBUGGER_EVENT_EXCEPTION,
23         MONO_DEBUGGER_EVENT_THROW_EXCEPTION
24 } MonoDebuggerEvent;
25
26 struct _MonoDebuggerBreakpointInfo {
27         guint32 index;
28         MonoMethodDesc *desc;
29 };
30
31 /*
32  * Address of the x86 trampoline code.  This is used by the debugger to check
33  * whether a method is a trampoline.
34  */
35 extern guint8 *mono_trampoline_code [];
36
37 #ifndef PLATFORM_WIN32
38
39 /*
40  * Functions we export to the debugger.
41  */
42 struct _MonoDebuggerIOLayer
43 {
44         void (*InitializeCriticalSection) (WapiCriticalSection *section);
45         void (*DeleteCriticalSection) (WapiCriticalSection *section);
46         gboolean (*TryEnterCriticalSection) (WapiCriticalSection *section);
47         void (*EnterCriticalSection) (WapiCriticalSection *section);
48         void (*LeaveCriticalSection) (WapiCriticalSection *section);
49
50         guint32 (*WaitForSingleObject) (gpointer handle, guint32 timeout, 
51                                         gboolean alertable);
52         guint32 (*SignalObjectAndWait) (gpointer signal_handle, gpointer wait,
53                                         guint32 timeout, gboolean alertable);
54         guint32 (*WaitForMultipleObjects) (guint32 numobjects, gpointer *handles,
55                                       gboolean waitall, guint32 timeout, gboolean alertable);
56
57         gpointer (*CreateSemaphore) (WapiSecurityAttributes *security,
58                                      gint32 initial, gint32 max,
59                                      const gunichar2 *name);
60         gboolean (*ReleaseSemaphore) (gpointer handle, gint32 count, gint32 *prevcount);
61
62         gpointer (*CreateThread) (WapiSecurityAttributes *security,
63                                   guint32 stacksize, WapiThreadStart start,
64                                   gpointer param, guint32 create, guint32 *tid);
65         gsize (*GetCurrentThreadId) (void);
66 };
67
68 extern MonoDebuggerIOLayer mono_debugger_io_layer;
69
70 #endif
71
72 extern void (*mono_debugger_event_handler) (MonoDebuggerEvent event, guint64 data, guint64 arg);
73
74 void            mono_debugger_initialize                  (gboolean use_debugger);
75 void            mono_debugger_cleanup                     (void);
76
77 void            mono_debugger_lock                        (void);
78 void            mono_debugger_unlock                      (void);
79 void            mono_debugger_event                       (MonoDebuggerEvent event, guint64 data, guint64 arg);
80
81 void            mono_debugger_add_symbol_file             (MonoDebugHandle *handle);
82 void            mono_debugger_start_add_type              (MonoDebugHandle *symfile, MonoClass *klass);
83 void            mono_debugger_add_builtin_types           (MonoDebugHandle *symfile);
84
85 int             mono_debugger_insert_breakpoint_full      (MonoMethodDesc *desc);
86 int             mono_debugger_remove_breakpoint           (int breakpoint_id);
87 int             mono_debugger_insert_breakpoint           (const gchar *method_name, gboolean include_namespace);
88 int             mono_debugger_method_has_breakpoint       (MonoMethod *method);
89 void            mono_debugger_breakpoint_callback         (MonoMethod *method, guint32 idx);
90
91 gpointer        mono_debugger_create_notification_function (gpointer *notification_address);
92
93 MonoObject     *mono_debugger_runtime_invoke              (MonoMethod *method, void *obj,
94                                                            void **params, MonoObject **exc);
95
96 gboolean        mono_debugger_lookup_type                 (const gchar *type_name);
97 gint32          mono_debugger_lookup_assembly             (const gchar *name);
98 gboolean        mono_debugger_unhandled_exception         (gpointer addr, gpointer stack, MonoObject *exc);
99 void            mono_debugger_handle_exception            (gpointer addr, gpointer stack, MonoObject *exc);
100 gboolean        mono_debugger_throw_exception             (gpointer addr, gpointer stack, MonoObject *exc);
101
102
103
104 void *
105 mono_vtable_get_static_field_data (MonoVTable *vt);
106
107 gchar *
108 mono_debugger_check_runtime_version (const char *filename);
109
110 #endif /* __MONO_DEBUG_DEBUGGER_H__ */