+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
}
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;
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)
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);
}
}
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);
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)
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);
*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;