5 #include <mono/metadata/class.h>
6 #include <mono/metadata/debug-symfile.h>
7 #include <mono/jit/codegen.h>
8 #include <mono/jit/debug.h>
10 #include "debug-private.h"
12 static MonoDebugMethodInfo *
13 method_info_func (MonoDebugSymbolFile *symfile, guint32 token, gpointer user_data)
15 AssemblyDebugInfo *info = user_data;
17 DebugMethodInfo *minfo;
19 method = g_hash_table_lookup (info->image->method_cache, GINT_TO_POINTER (token));
23 minfo = g_hash_table_lookup (info->handle->methods, method);
25 return (MonoDebugMethodInfo *) minfo;
29 mono_debug_open_assembly_dwarf2_plus (AssemblyDebugInfo *info)
31 if (!(info->handle->flags & MONO_DEBUG_FLAGS_DONT_ASSEMBLE)) {
32 struct stat stata, statb;
34 if (stat (info->filename, &stata)) {
35 g_warning ("cannot access assembly file (%s): %s",
36 info->filename, g_strerror (errno));
40 /* If the stat() failed or the file is older. */
41 if (stat (info->objfile, &statb) || (statb.st_mtime < stata.st_mtime)) {
44 buf = g_strdup_printf ("as %s -o %s", info->filename, info->objfile);
50 if (!(info->handle->flags & MONO_DEBUG_FLAGS_DONT_PRECOMPILE))
51 mono_jit_compile_image (info->image, FALSE);
53 info->symfile = mono_debug_open_symbol_file (info->image, info->objfile, TRUE);
57 mono_debug_close_assembly_dwarf2_plus (AssemblyDebugInfo *info)
60 mono_debug_close_symbol_file (info->symfile);
64 mono_debug_write_assembly_dwarf2_plus (AssemblyDebugInfo *info)
67 mono_debug_update_symbol_file (info->symfile, method_info_func, info);