[Mono-list] JIT patch for stabs debugging
Paolo Molaro
lupus@ximian.com
Tue, 12 Mar 2002 15:15:17 +0100
On 03/12/02 Martin Baulig wrote:
> > I'd say that the debug object size is not a problem, so I wouldn't
> > introduce a switch for this reason alone.
>
> Hmm, this would elimitate a lot of code which looks like this (which isn't even 64bit-clean):
>
> if (info->flags & DEBUG_FLAGS_DWARF2_USE_STRP)
> fprintf (info->f, "\t.byte\t\t%d\n\t.long\t\t.L_DSTR_%d\n\t.2byte\t\t%d\n"
> "\t.long\t\t.L_DSTR_%d\n\t.long\t\t.L_debug_info_b\n\n",
> ABBREV_GLOBAL_COMPILE_UNIT, dwarf2_get_string_index (info, source_file),
> DW_LANG_C_plus_plus, dwarf2_get_string_index (info, info->producer_name));
> else
> fprintf (info->f, "\t.byte\t\t%d\n\t.string\t\t\"%s\"\n\t.2byte\t\t%d\n"
> "\t.string\t\t\"%s\"\n\t.long\t\t.L_debug_info_b\n\n",
> ABBREV_GLOBAL_COMPILE_UNIT, source_file, DW_LANG_C_plus_plus,
> info->producer_name);
Yes, yet more reasons to prefer only the second version.
May I suggest we use a couple of helper functions to make the code
even cleaner?
dwarf_output_byte (FILE *f, guint8 value);
dwarf_output_string (FILE *f, const char* str);
etc...
so that code becomes:
dwarf_output_byte (info->f, ABBREV_GLOBAL_COMPILE_UNIT);
dwarf_output_string (info->f, source_file);
...
lupus
--
-----------------------------------------------------------------
lupus@debian.org debian/rules
lupus@ximian.com Monkeys do it better