2010-02-07 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / dwarfwriter.c
index cefa085a4a3b81bb73bfd7b3e88a9cd986ca0567..581f979ca8a8adb93bef81030e71cbd66da1f71d 100644 (file)
@@ -1068,6 +1068,9 @@ emit_type (MonoDwarfWriter *w, MonoType *t)
                                tdie = ".LDIE_I4";
                        }
                        break;
+               case MONO_TYPE_PTR:
+                       tdie = ".LDIE_I";
+                       break;
                default:
                        tdie = ".LDIE_I4";
                        break;
@@ -1345,7 +1348,10 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
 
        g_assert (code_size);
 
-#ifndef _EGLIB_MAJOR
+#ifdef _EGLIB_MAJOR
+       /* g_array is not implemented in eglib */
+       return;
+#else
        ln_array = g_array_sized_new (FALSE, FALSE, sizeof (MonoDebugLineNumberEntry), 
                                                                  debug_info->num_line_numbers);
        g_array_append_vals (ln_array, debug_info->line_numbers, debug_info->num_line_numbers);
@@ -1405,7 +1411,10 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
 
                loc = mono_debug_symfile_lookup_location (minfo, il_offset);
 
-               if (loc) {
+               // Added the loc->source_file check as otherwise we can
+               // crash, see the sample in bug 553191 that makes this code
+               // crash when we call strcmp on loc->source_file below
+               if (loc && loc->source_file) {
                        int line_diff = (gint32)loc->row - (gint32)prev_line;
                        int addr_diff = i - prev_native_offset;