Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / mono-debug.c
index b1a40b6ae5f2eb1c21f210c680971e67d8b916b0..4230399ec10242c2c3d339e80ed8271981bb4f96 100644 (file)
@@ -793,6 +793,40 @@ mono_debug_lookup_source_location (MonoMethod *method, guint32 address, MonoDoma
        return location;
 }
 
+/**
+ * mono_debug_lookup_source_location_by_il:
+ *
+ *   Same as mono_debug_lookup_source_location but take an IL_OFFSET argument.
+ */
+MonoDebugSourceLocation *
+mono_debug_lookup_source_location_by_il (MonoMethod *method, guint32 il_offset, MonoDomain *domain)
+{
+       MonoDebugMethodInfo *minfo;
+       MonoDebugSourceLocation *location;
+
+       if (mono_debug_format == MONO_DEBUG_FORMAT_NONE)
+               return NULL;
+
+       mono_debugger_lock ();
+       minfo = mono_debug_lookup_method_internal (method);
+       if (!minfo || !minfo->handle) {
+               mono_debugger_unlock ();
+               return NULL;
+       }
+
+       if (!minfo->handle->ppdb && (!minfo->handle->symfile || !mono_debug_symfile_is_loaded (minfo->handle->symfile))) {
+               mono_debugger_unlock ();
+               return NULL;
+       }
+
+       if (minfo->handle->ppdb)
+               location = mono_ppdb_lookup_location (minfo, il_offset);
+       else
+               location = mono_debug_symfile_lookup_location (minfo, il_offset);
+       mono_debugger_unlock ();
+       return location;
+}
+
 MonoDebugSourceLocation *
 mono_debug_method_lookup_location (MonoDebugMethodInfo *minfo, int il_offset)
 {