2002-06-26 Martin Baulig <martin@gnome.org>
authorMartin Baulig <martin@novell.com>
Wed, 26 Jun 2002 17:37:39 +0000 (17:37 -0000)
committerMartin Baulig <martin@novell.com>
Wed, 26 Jun 2002 17:37:39 +0000 (17:37 -0000)
* debug.c (mono_debug_source_location_from_address): Added
`guint32 *line_number' argument.  If it's not NULL, store the line number
there and return the file name without the line number.

* exception.c (ves_icall_get_trace): Fill in `sf->filename' and `sf->line'.
(ves_icall_get_frame_info): Likewise.

svn path=/trunk/mono/; revision=5469

mono/jit/ChangeLog
mono/jit/debug.c
mono/jit/debug.h
mono/jit/exception.c

index 72410847eff8e7d823a911ee83fe88e57d7bd584..a91b2a121ae88e454c41171b77fdcbf043b68261 100644 (file)
@@ -1,3 +1,12 @@
+2002-06-26  Martin Baulig  <martin@gnome.org>
+
+       * debug.c (mono_debug_source_location_from_address): Added
+       `guint32 *line_number' argument.  If it's not NULL, store the line number
+       there and return the file name without the line number.
+
+       * exception.c (ves_icall_get_trace): Fill in `sf->filename' and `sf->line'.
+       (ves_icall_get_frame_info): Likewise.
+
 2002-06-25  Dick Porter  <dick@ximian.com>
 
        * jit.c (mono_jit_exec): Pass the assembly to mono_runtime_run_main
index 81a60db8208fec2bf2acef5e72d3d87cf19043b3..c380b8c1b6d3a7e1553b9a2b31c722ffe620ce50 100644 (file)
@@ -757,7 +757,7 @@ mono_debug_add_method (MonoFlowGraph *cfg)
 }
 
 gchar *
-mono_debug_source_location_from_address (MonoMethod *method, guint32 address)
+mono_debug_source_location_from_address (MonoMethod *method, guint32 address, guint32 *line_number)
 {
        MonoDebugHandle *debug;
        DebugMethodInfo *minfo = NULL;
@@ -779,7 +779,7 @@ mono_debug_source_location_from_address (MonoMethod *method, guint32 address)
                if (offset < 0)
                        return NULL;
 
-               return mono_debug_find_source_location (minfo->info->symfile, method, offset);
+               return mono_debug_find_source_location (minfo->info->symfile, method, offset, line_number);
        }
 
        if (!minfo->line_numbers)
@@ -791,7 +791,11 @@ mono_debug_source_location_from_address (MonoMethod *method, guint32 address)
                if ((gchar *)lni->address > minfo->method_info.code_start + address) {
                        gchar *source_file = g_ptr_array_index (debug->source_files, lni->source_file);
 
-                       return g_strdup_printf ("%s:%d", source_file, lni->line);
+                       if (line_number) {
+                               *line_number = lni->line;
+                               return g_strdup (source_file);
+                       } else
+                               return g_strdup_printf ("%s:%d", source_file, lni->line);
                }
        }
 
index 775dc0aa1addf43cef5a08ed2e021eb6908062e5..6b4de2d1ecd118c278a46001d57740c59d191fa5 100644 (file)
@@ -68,7 +68,8 @@ void           mono_debug_add_method (MonoFlowGraph *cfg);
 
 void           mono_debug_add_type (MonoClass *klass);
 
-gchar *        mono_debug_source_location_from_address (MonoMethod *method, guint32 address);
+gchar *        mono_debug_source_location_from_address (MonoMethod *method, guint32 address,
+                                                       guint32 *line_number);
 
 gint32         mono_debug_il_offset_from_address (MonoMethod *method, guint32 address);
 
index 5cbc63e1bfc548e033efcd7fccd1f8cc22263337..f7e712160ddaeff121fb9ace8ee190dc1c39117f 100644 (file)
@@ -193,7 +193,7 @@ arch_exc_is_caught (MonoDomain *domain, MonoJitTlsData *jit_tls, gpointer ip,
 
                                address = (char *)ip - (char *)ji->code_start;
 
-                               source_location = mono_debug_source_location_from_address (m, address);
+                               source_location = mono_debug_source_location_from_address (m, address, NULL);
                                iloffset = mono_debug_il_offset_from_address (m, address);
 
                                if (iloffset < 0)
@@ -321,9 +321,14 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info
                sf->il_offset = mono_debug_il_offset_from_address (ji->method, sf->native_offset);
 
                if (need_file_info) {
-                       sf->filename = mono_string_new (domain, ji->method->klass->image->name);
-                       sf->line = 0; // fixme:
-                       sf->column = 0; // fixme:
+                       gchar *filename;
+
+                       filename = mono_debug_source_location_from_address (ji->method, sf->native_offset, &sf->line);
+
+                       sf->filename = mono_string_new (domain, filename);
+                       sf->column = 0;
+
+                       g_free (filename);
                }
 
                mono_array_set (res, gpointer, i, sf);
@@ -380,9 +385,14 @@ ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info,
        *native_offset = addr;
 
        if (need_file_info) {
-               *file = mono_string_new (domain, m->klass->image->name);
-               *column = 0; // fixme
-               *line = 0; // fixme
+               gchar *filename;
+
+               filename = mono_debug_source_location_from_address (m, addr, line);
+
+               *file = mono_string_new (domain, filename);
+               *column = 0;
+
+               g_free (filename);
        }
 
        return TRUE;