X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=mono%2Fmini%2Fdwarfwriter.c;h=9f2c405b68360afdf129e789ed284a382f25fe3a;hb=908e8381f067f41e4b456464944d0cb0eabcb4a7;hp=a0929da221856c4447540dfd691a84bb5bded0e1;hpb=f0527c1d77c96d40ad2af82bfb5667a81d2ba2f6;p=mono.git diff --git a/mono/mini/dwarfwriter.c b/mono/mini/dwarfwriter.c index a0929da2218..9f2c405b683 100644 --- a/mono/mini/dwarfwriter.c +++ b/mono/mini/dwarfwriter.c @@ -1,5 +1,6 @@ -/* - * dwarfwriter.c: Creation of DWARF debug information +/** + * \file + * Creation of DWARF debug information * * Author: * Zoltan Varga (vargaz@gmail.com) @@ -8,6 +9,7 @@ */ #include "config.h" +#include #if !defined(DISABLE_AOT) && !defined(DISABLE_JIT) #include "dwarfwriter.h" @@ -20,9 +22,7 @@ #endif #include -#include -#include -#include +#include #ifndef HOST_WIN32 #include @@ -572,71 +572,6 @@ static DwarfBasicType basic_types [] = { #define LINE_BASE -5 #define LINE_RANGE 14 -/* Subsections of the .debug_line section */ -#define LINE_SUBSECTION_HEADER 1 -#define LINE_SUBSECTION_INCLUDES 2 -#define LINE_SUBSECTION_FILES 3 -#define LINE_SUBSECTION_DATA 4 -#define LINE_SUBSECTION_END 5 - -static int -emit_line_number_file_name (MonoDwarfWriter *w, const char *name, - gint64 last_mod_time, gint64 file_size) -{ - int index; - int dir_index; - char *basename = NULL; - - if (!w->file_to_index) - w->file_to_index = g_hash_table_new (g_str_hash, g_str_equal); - - index = GPOINTER_TO_UINT (g_hash_table_lookup (w->file_to_index, name)); - if (index > 0) - return index; - - if (g_path_is_absolute (name)) { - char *dir = g_path_get_dirname (name); - - if (!w->dir_to_index) - w->dir_to_index = g_hash_table_new (g_str_hash, g_str_equal); - - dir_index = GPOINTER_TO_UINT (g_hash_table_lookup (w->dir_to_index, dir)); - if (dir_index == 0) { - emit_section_change (w, ".debug_line", LINE_SUBSECTION_INCLUDES); - emit_string (w, dir); - - dir_index = ++ w->line_number_dir_index; - g_hash_table_insert (w->dir_to_index, g_strdup (dir), GUINT_TO_POINTER (dir_index)); - } - - g_free (dir); - - basename = g_path_get_basename (name); - } else { - dir_index = 0; - } - - emit_section_change (w, ".debug_line", LINE_SUBSECTION_FILES); - - if (basename) - emit_string (w, basename); - else - emit_string (w, name); - emit_uleb128 (w, dir_index); - emit_byte (w, 0); - emit_byte (w, 0); - - emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA); - - if (basename) - g_free (basename); - - index = ++ w->line_number_file_index; - g_hash_table_insert (w->file_to_index, g_strdup (name), GUINT_TO_POINTER (index)); - - return index; -} - static int get_line_number_file_name (MonoDwarfWriter *w, const char *name) { @@ -854,6 +789,12 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis char *s, *build_info; int i; + if (!w->emit_line) { + emit_section_change (w, ".debug_line", 0); + emit_label (w, ".Ldebug_line_section_start"); + emit_label (w, ".Ldebug_line_start"); + } + w->cie_program = base_unwind_program; emit_section_change (w, ".debug_abbrev", 0); @@ -916,10 +857,7 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis emit_pointer_value (w, 0); emit_pointer_value (w, 0); /* offset into .debug_line section */ - if (w->emit_line) - emit_symbol_diff (w, ".Ldebug_line_start", ".Ldebug_line_section_start", 0); - else - emit_pointer_value (w, 0); + emit_symbol_diff (w, ".Ldebug_line_start", ".Ldebug_line_section_start", 0); /* Base types */ for (i = 0; i < G_N_ELEMENTS (basic_types); ++i) { @@ -1643,11 +1581,11 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, prev_il_offset = il_offset; - loc = mono_debug_symfile_lookup_location (minfo, il_offset); + loc = mono_debug_method_lookup_location (minfo, il_offset); if (!loc) continue; if (!loc->source_file) { - mono_debug_symfile_free_location (loc); + mono_debug_free_source_location (loc); continue; } @@ -1655,7 +1593,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, addr_diff = i - prev_native_offset; if (first) { - emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA); + emit_section_change (w, ".debug_line", 0); emit_byte (w, 0); emit_byte (w, sizeof (gpointer) + 1); @@ -1695,7 +1633,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, prev_native_offset = i; } - mono_debug_symfile_free_location (loc); + mono_debug_free_source_location (loc); first = FALSE; } @@ -1729,7 +1667,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, il_to_line = g_new0 (int, header->code_size); - emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA); + emit_section_change (w, ".debug_line", 0); emit_byte (w, 0); emit_byte (w, sizeof (gpointer) + 1); emit_byte (w, DW_LNE_set_address); @@ -1859,7 +1797,7 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod minfo = mono_debug_lookup_method (method); if (minfo) - loc = mono_debug_symfile_lookup_location (minfo, 0); + loc = mono_debug_method_lookup_location (minfo, 0); /* Subprogram */ names = g_new0 (char *, sig->param_count); @@ -1880,7 +1818,7 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod emit_uleb128 (w, file_index + 1); emit_uleb128 (w, loc->row); - mono_debug_symfile_free_location (loc); + mono_debug_free_source_location (loc); loc = NULL; } else { emit_uleb128 (w, 0); @@ -2064,4 +2002,9 @@ mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, c emit_fde (w, w->fde_index, start_symbol, end_symbol, code, code_size, unwind_info, FALSE); w->fde_index ++; } + +#else /* !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */ + +MONO_EMPTY_SOURCE_FILE (dwarfwriter); + #endif /* End of: !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */