2004-12-03 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / metadata / mono-debug.c
index 5e24015f28853a7778fc53012134b35ffbe87456..717fb997e141e49f22d313776ea49f3ed9f34b87 100644 (file)
@@ -67,7 +67,6 @@ mono_debug_init (MonoDebugFormat format)
        mono_debugger_start_class_init_func = mono_debug_start_add_type;
        mono_debugger_class_init_func = mono_debug_add_type;
        mono_install_assembly_load_hook (mono_debug_add_assembly, NULL);
-       mono_debugger_unlock ();
 }
 
 void
@@ -337,10 +336,16 @@ il_offset_from_address (MonoDebugMethodJitInfo *jit, guint32 address)
        return -1;
 }
 
-/*
+/**
+ * mono_debug_source_location_from_address:
+ * @method:
+ * @address:
+ * @line_number:
+ * @domain:
+ *
  * Used by the exception code to get a source location from a machine address.
  *
- * Returns a textual representation of the specified address which is suitable to be displayed to
+ * Returns: a textual representation of the specified address which is suitable to be displayed to
  * the user (for instance "/home/martin/monocvs/debugger/test/Y.cs:8").
  *
  * If the optional @line_number argument is not NULL, the line number is stored there and just the
@@ -351,21 +356,20 @@ gchar *
 mono_debug_source_location_from_address (MonoMethod *method, guint32 address, guint32 *line_number,
                                         MonoDomain *domain)
 {
-       char *res;
        MonoDebugMethodInfo *minfo;
        MonoDebugDomainData *domain_data;
 
-       mono_debugger_lock ();
+       mono_loader_lock ();
        minfo = _mono_debug_lookup_method (method);
        if (!minfo || !minfo->handle || !minfo->handle->symfile ||
            !minfo->handle->symfile->offset_table) {
-               mono_debugger_unlock ();
+               mono_loader_unlock ();
                return NULL;
        }
 
        domain_data = mono_debug_get_domain_data (minfo->handle, domain);
        if (!domain_data->jit [minfo->index]) {
-               mono_debugger_unlock ();
+               mono_loader_unlock ();
                return NULL;
        }
 
@@ -375,15 +379,20 @@ mono_debug_source_location_from_address (MonoMethod *method, guint32 address, gu
                
                if (offset >= 0)
                        res = mono_debug_find_source_location (minfo->handle->symfile, method, offset, line_number);
-               mono_debugger_unlock ();
+               mono_loader_unlock ();
                return res;
        }
 
-       mono_debugger_unlock ();
+       mono_loader_unlock ();
        return NULL;
 }
 
-/*
+/**
+ * mono_debug_source_location_from_il_offset:
+ * @method:
+ * @offset:
+ * @line_number:
+ *
  * Used by the exception code to get a source location from an IL offset.
  *
  * Returns a textual representation of the specified address which is suitable to be displayed to
@@ -399,20 +408,25 @@ mono_debug_source_location_from_il_offset (MonoMethod *method, guint32 offset, g
        char *res;
        MonoDebugMethodInfo *minfo;
 
-       mono_debugger_lock ();
+       mono_loader_lock ();
        minfo = _mono_debug_lookup_method (method);
        if (!minfo || !minfo->handle || !minfo->handle->symfile) {
-               mono_debugger_unlock ();
+               mono_loader_unlock ();
                return NULL;
        }
 
        res = mono_debug_find_source_location (minfo->handle->symfile, method, offset, line_number);
-       mono_debugger_unlock ();
+       mono_loader_unlock ();
        return res;
 }
 
-/*
- * Returns the IL offset corresponding to machine address @address which is an offset
+/**
+ * mono_debug_il_offset_from_address:
+ * @method:
+ * @address:
+ * @domain:
+ *
+ * Returns: the IL offset corresponding to machine address @address which is an offset
  * relative to the beginning of the method @method.
  */
 gint32
@@ -425,23 +439,28 @@ mono_debug_il_offset_from_address (MonoMethod *method, gint32 address, MonoDomai
        if (address < 0)
                return -1;
 
-       mono_debugger_lock ();
+       mono_loader_lock ();
        minfo = _mono_debug_lookup_method (method);
        if (!minfo || !minfo->il_offsets || !minfo->handle || !minfo->handle->symfile ||
            !minfo->handle->symfile->offset_table) {
-               mono_debugger_unlock ();
+               mono_loader_unlock ();
                return -1;
        }
 
        domain_data = mono_debug_get_domain_data (minfo->handle, domain);
 
        res = il_offset_from_address (domain_data->jit [minfo->index], address);
-       mono_debugger_unlock ();
+       mono_loader_unlock ();
        return res;
 }
 
-/*
- * Returns the machine address corresponding to IL offset @il_offset.
+/**
+ * mono_debug_address_from_il_offset:
+ * @method:
+ * @il_offset:
+ * @domain:
+ *
+ * Returns: the machine address corresponding to IL offset @il_offset.
  * The returned value is an offset relative to the beginning of the method @method.
  */
 gint32
@@ -454,18 +473,18 @@ mono_debug_address_from_il_offset (MonoMethod *method, gint32 il_offset, MonoDom
        if (il_offset < 0)
                return -1;
 
-       mono_debugger_lock ();
+       mono_loader_lock ();
        minfo = _mono_debug_lookup_method (method);
        if (!minfo || !minfo->il_offsets || !minfo->handle || !minfo->handle->symfile ||
            !minfo->handle->symfile->offset_table) {
-               mono_debugger_unlock ();
+               mono_loader_unlock ();
                return -1;
        }
 
        domain_data = mono_debug_get_domain_data (minfo->handle, domain);
 
        res = _mono_debug_address_from_il_offset (domain_data->jit [minfo->index], il_offset);
-       mono_debugger_unlock ();
+       mono_loader_unlock ();
        return res;
 }