Typo
[mono.git] / mono / metadata / mono-debug.h
index b87f7184ebbcc0fc2b83c282f303ebc3a6e3fc99..d4ff5b9a0241bbdd19bdf8e25a66150e6c5e89fe 100644 (file)
 #ifndef __MONO_DEBUG_H__
 #define __MONO_DEBUG_H__
 
-#include <glib.h>
+#include <mono/utils/mono-publib.h>
 #include <mono/metadata/image.h>
 #include <mono/metadata/appdomain.h>
 
+MONO_BEGIN_DECLS
+
 typedef struct _MonoSymbolTable                        MonoSymbolTable;
+typedef struct _MonoDebugDataTable             MonoDebugDataTable;
 
 typedef struct _MonoSymbolFile                 MonoSymbolFile;
-typedef struct _MonoSymbolFilePriv             MonoSymbolFilePriv;
 
 typedef struct _MonoDebugHandle                        MonoDebugHandle;
-typedef struct _MonoDebugHandlePriv            MonoDebugHandlePriv;
 
 typedef struct _MonoDebugLineNumberEntry       MonoDebugLineNumberEntry;
-typedef struct _MonoDebugLexicalBlockEntry     MonoDebugLexicalBlockEntry;
 
 typedef struct _MonoDebugVarInfo               MonoDebugVarInfo;
 typedef struct _MonoDebugMethodJitInfo         MonoDebugMethodJitInfo;
 typedef struct _MonoDebugMethodAddress         MonoDebugMethodAddress;
-typedef struct _MonoDebugWrapperData           MonoDebugWrapperData;
+typedef struct _MonoDebugMethodAddressList     MonoDebugMethodAddressList;
 typedef struct _MonoDebugClassEntry            MonoDebugClassEntry;
 
 typedef struct _MonoDebugMethodInfo            MonoDebugMethodInfo;
+typedef struct _MonoDebugLocalsInfo            MonoDebugLocalsInfo;
 typedef struct _MonoDebugSourceLocation                MonoDebugSourceLocation;
 
+typedef struct _MonoDebugList                  MonoDebugList;
+
 typedef enum {
        MONO_DEBUG_FORMAT_NONE,
        MONO_DEBUG_FORMAT_MONO,
        MONO_DEBUG_FORMAT_DEBUGGER
 } MonoDebugFormat;
 
-typedef enum {
-       MONO_DEBUGGER_TYPE_KIND_UNKNOWN = 1,
-       MONO_DEBUGGER_TYPE_KIND_FUNDAMENTAL,
-       MONO_DEBUGGER_TYPE_KIND_STRING,
-       MONO_DEBUGGER_TYPE_KIND_SZARRAY,
-       MONO_DEBUGGER_TYPE_KIND_ARRAY,
-       MONO_DEBUGGER_TYPE_KIND_POINTER,
-       MONO_DEBUGGER_TYPE_KIND_ENUM,
-       MONO_DEBUGGER_TYPE_KIND_OBJECT,
-       MONO_DEBUGGER_TYPE_KIND_STRUCT,
-       MONO_DEBUGGER_TYPE_KIND_CLASS,
-       MONO_DEBUGGER_TYPE_KIND_CLASS_INFO,
-       MONO_DEBUGGER_TYPE_KIND_REFERENCE
-} MonoDebuggerTypeKind;
+/*
+ * NOTE:
+ * We intentionally do not use GList here since the debugger needs to know about
+ * the layout of the fields.
+*/
+struct _MonoDebugList {
+       MonoDebugList *next;
+       const void* data;
+};
 
 struct _MonoSymbolTable {
-       guint64 magic;
-       guint32 version;
-       guint32 total_size;
+       uint64_t magic;
+       uint32_t version;
+       uint32_t total_size;
 
        /*
         * Corlib and metadata info.
         */
        MonoDebugHandle *corlib;
+       MonoDebugDataTable *global_data_table;
+       MonoDebugList *data_tables;
 
        /*
         * The symbol files.
         */
-       MonoDebugHandle **symbol_files;
-       guint32 num_symbol_files;
-
-       /*
-        * Data table.
-        * This is intentionally not a GPtrArray to make it more easy to
-        * read for the debugger.  The `data_tables' field contains
-        * `num_data_tables' pointers to continuous memory areas.
-        *
-        * The data table is basically a big continuous blob, but we need
-        * to split it up into pieces because we don't know the total size
-        * in advance and using g_realloc() doesn't work because that may
-        * reallocate the block to a different address.
-        */
-       guint32 num_data_tables;
-       gpointer *data_tables;
-       /*
-        * Current data table.
-        * The `current_data_table' points to a blob of `current_data_table_size'
-        * bytes.
-        */
-       gpointer current_data_table;
-       guint32 current_data_table_size;
-       /*
-        * The offset in the `current_data_table'.
-        */
-       guint32 current_data_table_offset;
+       MonoDebugList *symbol_files;
 };
 
-typedef enum {
-       MONO_DEBUG_DATA_ITEM_UNKNOWN            = 0,
-       MONO_DEBUG_DATA_ITEM_METHOD,
-       MONO_DEBUG_DATA_ITEM_CLASS,
-       MONO_DEBUG_DATA_ITEM_WRAPPER
-} MonoDebugDataItemType;
-
 struct _MonoDebugHandle {
-       guint32 index;
-       const char *image_file;
+       uint32_t index;
+       char *image_file;
        MonoImage *image;
+       MonoDebugDataTable *type_table;
        MonoSymbolFile *symfile;
-       MonoDebugHandlePriv *_priv;
 };
 
 struct _MonoDebugMethodJitInfo {
-       MonoDebugMethodAddress *address;
-       const guint8 *code_start;
-       guint32 code_size;
-       guint32 prologue_end;
-       guint32 epilogue_begin;
-       const guint8 *wrapper_addr;
-       guint32 num_line_numbers;
+       const mono_byte *code_start;
+       uint32_t code_size;
+       uint32_t prologue_end;
+       uint32_t epilogue_begin;
+       const mono_byte *wrapper_addr;
+       uint32_t num_line_numbers;
        MonoDebugLineNumberEntry *line_numbers;
-       guint32 num_lexical_blocks;
-       MonoDebugLexicalBlockEntry *lexical_blocks;
-       guint32 num_params;
+       uint32_t num_params;
        MonoDebugVarInfo *this_var;
        MonoDebugVarInfo *params;
-       guint32 num_locals;
+       uint32_t num_locals;
        MonoDebugVarInfo *locals;
 };
 
-struct _MonoDebugMethodAddress {
-       guint32 size;
-       guint32 symfile_id;
-       guint32 domain_id;
-       guint32 method_id;
-       guint32 code_size;
-       guint32 dummy;
-       const guint8 *code_start;
-       const guint8 *wrapper_addr;
-       MonoDebugMethodJitInfo *jit;
-       guint8 data [MONO_ZERO_LEN_ARRAY];
-};
-
-struct _MonoDebugWrapperData {
-       guint32 size;
-       guint32 code_size;
-       MonoMethod *method;
-       const guint8 *code_start;
-       const gchar *name;
-       const gchar *cil_code;
-       guint8 data [MONO_ZERO_LEN_ARRAY];
-};
-
-struct _MonoDebugClassEntry {
-       guint32 size;
-       guint32 symfile_id;
-       guint8 data [MONO_ZERO_LEN_ARRAY];
+struct _MonoDebugMethodAddressList {
+       uint32_t size;
+       uint32_t count;
+       mono_byte data [MONO_ZERO_LEN_ARRAY];
 };
 
 struct _MonoDebugSourceLocation {
-       gchar *source_file;
-       guint32 row, column;
-       guint32 il_offset;
+       char *source_file;
+       uint32_t row, column;
+       uint32_t il_offset;
 };
 
 /*
@@ -178,51 +119,78 @@ struct _MonoDebugSourceLocation {
 /* The variable is in the two registers "offset" and "index". */
 #define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS      0x20000000
 
+/* The variable is dead. */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_DEAD               0x30000000
+
 struct _MonoDebugVarInfo {
-       guint32 index;
-       guint32 offset;
-       guint32 size;
-       guint32 begin_scope;
-       guint32 end_scope;
+       uint32_t index;
+       uint32_t offset;
+       uint32_t size;
+       uint32_t begin_scope;
+       uint32_t end_scope;
+       MonoType *type;
 };
 
-#define MONO_DEBUGGER_VERSION                          57
+#define MONO_DEBUGGER_MAJOR_VERSION                    81
+#define MONO_DEBUGGER_MINOR_VERSION                    6
 #define MONO_DEBUGGER_MAGIC                            0x7aff65af4253d427ULL
 
 extern MonoSymbolTable *mono_symbol_table;
 extern MonoDebugFormat mono_debug_format;
-extern GHashTable *mono_debug_handles;
+extern int32_t mono_debug_debugger_version;
+extern int32_t _mono_debug_using_mono_debugger;
+
+void mono_debug_list_add (MonoDebugList **list, const void* data);
+void mono_debug_list_remove (MonoDebugList **list, const void* data);
 
 void mono_debug_init (MonoDebugFormat format);
-void mono_debug_init_1 (MonoDomain *domain);
-void mono_debug_init_2 (MonoAssembly *assembly);
-void mono_debug_init_2_memory (MonoImage *image, const guint8 *raw_contents, int size);
+void mono_debug_open_image_from_memory (MonoImage *image, const mono_byte *raw_contents, int size);
 void mono_debug_cleanup (void);
 
-gboolean mono_debug_using_mono_debugger (void);
+void mono_debug_close_image (MonoImage *image);
 
-MonoDebugMethodAddress *mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit,
-                                              MonoDomain *domain);
-MonoDebugMethodJitInfo *mono_debug_read_method (MonoDebugMethodAddress *address);
-void mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);
+void mono_debug_domain_unload (MonoDomain *domain);
+void mono_debug_domain_create (MonoDomain *domain);
 
-MonoDebugMethodInfo *mono_debug_lookup_method (MonoMethod *method);
+mono_bool mono_debug_using_mono_debugger (void);
+
+MonoDebugMethodAddress *
+mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDomain *domain);
+
+MonoDebugMethodInfo *
+mono_debug_lookup_method (MonoMethod *method);
+
+MonoDebugMethodAddressList *
+mono_debug_lookup_method_addresses (MonoMethod *method);
 
 MonoDebugMethodJitInfo*
-mono_debug_find_method (MonoDebugMethodInfo *minfo, MonoDomain *domain);
+mono_debug_find_method (MonoMethod *method, MonoDomain *domain);
+
+void
+mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);
+
+
+void
+mono_debug_add_delegate_trampoline (void* code, int size);
+
+MonoDebugLocalsInfo*
+mono_debug_lookup_locals (MonoMethod *method);
 
 /*
  * Line number support.
  */
 
 MonoDebugSourceLocation *
-mono_debug_lookup_source_location (MonoMethod *method, guint32 address, MonoDomain *domain);
+mono_debug_lookup_source_location (MonoMethod *method, uint32_t address, MonoDomain *domain);
+
+int32_t
+mono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, uint32_t native_offset);
 
 void
 mono_debug_free_source_location (MonoDebugSourceLocation *location);
 
-gchar *
-mono_debug_print_stack_frame (MonoMethod *method, guint32 native_offset, MonoDomain *domain);
+char *
+mono_debug_print_stack_frame (MonoMethod *method, uint32_t native_offset, MonoDomain *domain);
 
 /*
  * Mono Debugger support functions
@@ -231,9 +199,11 @@ mono_debug_print_stack_frame (MonoMethod *method, guint32 native_offset, MonoDom
  */
 
 int             mono_debugger_method_has_breakpoint       (MonoMethod *method);
-int             mono_debugger_insert_breakpoint           (const gchar *method_name, gboolean include_namespace);
-gboolean        mono_debugger_unhandled_exception         (gpointer addr, gpointer stack, MonoObject *exc);
-void            mono_debugger_handle_exception            (gpointer addr, gpointer stack, MonoObject *exc);
-gboolean        mono_debugger_throw_exception             (gpointer addr, gpointer stack, MonoObject *exc);
+int             mono_debugger_insert_breakpoint           (const char *method_name, mono_bool include_namespace);
+
+void mono_set_is_debugger_attached (mono_bool attached);
+mono_bool mono_is_debugger_attached (void);
+
+MONO_END_DECLS
 
 #endif /* __MONO_DEBUG_H__ */