* s390x.md: correct int_xor_imm length
[mono.git] / mono / mini / debug-mini.c
index a04953383770ce50d2e3132ac45ac38011edca28..4e4bc41334bb108233ff2b4e63532fcf36ff6e12 100644 (file)
@@ -9,12 +9,11 @@
 
 #include "mini.h"
 #include "jit.h"
+#include "config.h"
 #include <mono/metadata/verify.h>
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/appdomain.h>
-/* mono-debug-debugger.h needs config.h to work... */
-#include "config.h"
 #include <mono/metadata/mono-debug-debugger.h>
 
 #ifdef HAVE_VALGRIND_H
@@ -43,21 +42,11 @@ record_line_number (MiniDebugMethodInfo *info, guint32 address, guint32 offset)
 void
 mono_debug_init_method (MonoCompile *cfg, MonoBasicBlock *start_block, guint32 breakpoint_id)
 {
-       MonoMethod *method = cfg->method;
        MiniDebugMethodInfo *info;
 
        if (mono_debug_format == MONO_DEBUG_FORMAT_NONE)
                return;
 
-       if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
-           (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
-           (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
-           (method->flags & METHOD_ATTRIBUTE_ABSTRACT))
-               return;
-       if ((method->wrapper_type != MONO_WRAPPER_NONE) &&
-           (method->wrapper_type != MONO_WRAPPER_MANAGED_TO_NATIVE))
-               return;
-
        info = g_new0 (MiniDebugMethodInfo, 1);
        info->breakpoint_id = breakpoint_id;
 
@@ -189,16 +178,6 @@ mono_debug_add_vg_method (MonoMethod *method, MonoDebugMethodJitInfo *jit)
 #endif /* VALGRIND_ADD_LINE_INFO */
 }
 
-static void
-free_jit_debug_info (MonoDebugMethodJitInfo *jit)
-{
-       g_free (jit->line_numbers);
-       g_free (jit->this_var);
-       g_free (jit->params);
-       g_free (jit->locals);
-       g_free (jit);
-}
-
 void
 mono_debug_close_method (MonoCompile *cfg)
 {
@@ -254,7 +233,7 @@ mono_debug_close_method (MonoCompile *cfg)
        if (info->breakpoint_id)
                mono_debugger_breakpoint_callback (method, info->breakpoint_id);
 
-       free_jit_debug_info (jit);
+       mono_debug_free_method_jit_info (jit);
        g_array_free (info->line_numbers, TRUE);
        g_free (info);
 }
@@ -287,9 +266,9 @@ mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address)
 }
 
 static inline void
-encode_value (gint32 value, char *buf, char **endbuf)
+encode_value (gint32 value, guint8 *buf, guint8 **endbuf)
 {
-       char *p = buf;
+       guint8 *p = buf;
 
        //printf ("ENCODE: %d 0x%x.\n", value, value);
 
@@ -323,10 +302,9 @@ encode_value (gint32 value, char *buf, char **endbuf)
 }
 
 static inline gint32
-decode_value (char *_ptr, char **rptr)
+decode_value (guint8 *ptr, guint8 **rptr)
 {
-       unsigned char *ptr = (unsigned char *) _ptr;
-       unsigned char b = *ptr;
+       guint8 b = *ptr;
        gint32 len;
        
        if ((b & 0x80) == 0){
@@ -354,7 +332,7 @@ decode_value (char *_ptr, char **rptr)
 }
 
 static void
-serialize_variable (MonoDebugVarInfo *var, char *p, char **endbuf)
+serialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf)
 {
        guint32 flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
 
@@ -378,8 +356,7 @@ mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *bu
        MiniDebugMethodInfo *info;
        MonoDebugMethodJitInfo *jit;
        guint32 size, prev_offset, prev_native_offset;
-       char *buf;
-       char *p;
+       guint8 *buf, *p;
        int i;
 
        info = (MiniDebugMethodInfo *) cfg->debug_info;
@@ -424,7 +401,7 @@ mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *bu
 }
 
 static void
-deserialize_variable (MonoDebugVarInfo *var, char *p, char **endbuf)
+deserialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf)
 {
        guint32 flags;
 
@@ -450,7 +427,7 @@ deserialize_debug_info (MonoMethod *method, guint8 *code_start, guint8 *buf, gui
        MonoMethodHeader *header;
        gint32 offset, native_offset, prev_offset, prev_native_offset;
        MonoDebugMethodJitInfo *jit;
-       char *p;
+       guint8 *p;
        int i;
 
        header = mono_method_get_header (method);
@@ -531,35 +508,7 @@ mono_debug_add_aot_method (MonoDomain *domain, MonoMethod *method, guint8 *code_
 
        mono_debug_add_vg_method (method, jit);
 
-       free_jit_debug_info (jit);
-}
-
-MonoDomain *
-mono_init_debugger (const char *file, const char *opt_flags)
-{
-       MonoDomain *domain;
-       const guchar *error;
-       int opt;
-
-       g_set_prgname (file);
-
-       opt = mono_parse_default_optimizations (opt_flags);
-       opt |= MONO_OPT_SHARED;
-
-       mono_set_defaults (0, opt);
-
-       domain = mono_jit_init (file);
-
-       mono_config_parse (NULL);
-
-       error = mono_check_corlib_version ();
-       if (error) {
-               fprintf (stderr, "Corlib not in sync with this runtime: %s\n", error);
-               fprintf (stderr, "Download a newer corlib or a newer runtime at http://www.go-mono.com/daily.\n");
-               exit (1);
-       }
-
-       return domain;
+       mono_debug_free_method_jit_info (jit);
 }
 
 void
@@ -568,5 +517,5 @@ mono_debug_add_icall_wrapper (MonoMethod *method, MonoJitICallInfo* callinfo)
        if (mono_debug_format == MONO_DEBUG_FORMAT_NONE)
                return;
 
-       // mono_debug_add_wrapper (method, callinfo->func, mono_get_root_domain ());
+       // mono_debug_add_wrapper (method, callinfo->wrapper, callinfo->func);
 }