2 * dwarfwriter.c: Creation of DWARF debug information
5 * Zoltan Varga (vargaz@gmail.com)
7 * (C) 2008-2009 Novell, Inc.
11 #include "dwarfwriter.h"
13 #include <sys/types.h>
20 #include <mono/metadata/mono-endian.h>
21 #include <mono/metadata/debug-mono-symfile.h>
22 #include <mono/utils/mono-compiler.h>
24 #ifndef PLATFORM_WIN32
25 #include <mono/utils/freebsd-elf32.h>
26 #include <mono/utils/freebsd-elf64.h>
29 #include <mono/utils/freebsd-dwarf.h>
31 struct _MonoDwarfWriter
34 GHashTable *class_to_die, *class_to_vtype_die, *class_to_pointer_die;
35 GHashTable *class_to_reference_die;
36 int fde_index, tdie_index, line_number_file_index, line_number_dir_index;
37 GHashTable *file_to_index, *dir_to_index;
39 int il_file_line_index, loclist_index;
44 * mono_dwarf_writer_create:
46 * Create a DWARF writer object. WRITER is the underlying image writer this
47 * writer will emit to. IL_FILE is the file where IL code will be dumped to for
48 * methods which have no line number info. It can be NULL.
51 mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file)
53 MonoDwarfWriter *w = g_new0 (MonoDwarfWriter, 1);
62 mono_dwarf_writer_destroy (MonoDwarfWriter *w)
67 /* Wrappers around the image writer functions */
70 emit_section_change (MonoDwarfWriter *w, const char *section_name, int subsection_index)
72 img_writer_emit_section_change (w->w, section_name, subsection_index);
76 emit_push_section (MonoDwarfWriter *w, const char *section_name, int subsection)
78 img_writer_emit_push_section (w->w, section_name, subsection);
82 emit_pop_section (MonoDwarfWriter *w)
84 img_writer_emit_pop_section (w->w);
88 emit_local_symbol (MonoDwarfWriter *w, const char *name, const char *end_label, gboolean func)
90 img_writer_emit_local_symbol (w->w, name, end_label, func);
94 emit_label (MonoDwarfWriter *w, const char *name)
96 img_writer_emit_label (w->w, name);
100 emit_bytes (MonoDwarfWriter *w, const guint8* buf, int size)
102 img_writer_emit_bytes (w->w, buf, size);
106 emit_string (MonoDwarfWriter *w, const char *value)
108 img_writer_emit_string (w->w, value);
112 emit_line (MonoDwarfWriter *w)
114 img_writer_emit_line (w->w);
118 emit_alignment (MonoDwarfWriter *w, int size)
120 img_writer_emit_alignment (w->w, size);
124 emit_pointer_unaligned (MonoDwarfWriter *w, const char *target)
126 img_writer_emit_pointer_unaligned (w->w, target);
130 emit_pointer (MonoDwarfWriter *w, const char *target)
132 img_writer_emit_pointer (w->w, target);
136 emit_int16 (MonoDwarfWriter *w, int value)
138 img_writer_emit_int16 (w->w, value);
142 emit_int32 (MonoDwarfWriter *w, int value)
144 img_writer_emit_int32 (w->w, value);
148 emit_symbol_diff (MonoDwarfWriter *w, const char *end, const char* start, int offset)
150 img_writer_emit_symbol_diff (w->w, end, start, offset);
154 emit_zero_bytes (MonoDwarfWriter *w, int num)
156 img_writer_emit_zero_bytes (w->w, num);
160 emit_byte (MonoDwarfWriter *w, guint8 val)
162 img_writer_emit_byte (w->w, val);
165 static G_GNUC_UNUSED void
166 emit_uleb128 (MonoDwarfWriter *w, guint32 value)
169 guint8 b = value & 0x7f;
171 if (value != 0) /* more bytes to come */
177 static G_GNUC_UNUSED void
178 emit_sleb128 (MonoDwarfWriter *w, gint64 value)
181 gboolean negative = (value < 0);
188 /* the following is unnecessary if the
189 * implementation of >>= uses an arithmetic rather
190 * than logical shift for a signed left operand
194 value |= - ((gint64)1 <<(size - 7));
195 /* sign bit of byte is second high order bit (0x40) */
196 if ((value == 0 && !(byte & 0x40)) ||
197 (value == -1 && (byte & 0x40)))
205 static G_GNUC_UNUSED void
206 encode_uleb128 (guint32 value, guint8 *buf, guint8 **endbuf)
211 guint8 b = value & 0x7f;
213 if (value != 0) /* more bytes to come */
221 static G_GNUC_UNUSED void
222 encode_sleb128 (gint32 value, guint8 *buf, guint8 **endbuf)
225 gboolean negative = (value < 0);
233 /* the following is unnecessary if the
234 * implementation of >>= uses an arithmetic rather
235 * than logical shift for a signed left operand
239 value |= - (1 <<(size - 7));
240 /* sign bit of byte is second high order bit (0x40) */
241 if ((value == 0 && !(byte & 0x40)) ||
242 (value == -1 && (byte & 0x40)))
253 emit_dwarf_abbrev (MonoDwarfWriter *w, int code, int tag, gboolean has_child,
254 int *attrs, int attrs_len)
258 emit_uleb128 (w, code);
259 emit_uleb128 (w, tag);
260 emit_byte (w, has_child);
262 for (i = 0; i < attrs_len; i++)
263 emit_uleb128 (w, attrs [i]);
269 emit_cie (MonoDwarfWriter *w)
271 emit_section_change (w, ".debug_frame", 0);
273 emit_alignment (w, 8);
276 emit_symbol_diff (w, ".Lcie0_end", ".", -4); /* length */
277 emit_int32 (w, 0xffffffff); /* CIE id */
278 emit_byte (w, 3); /* version */
279 emit_string (w, ""); /* augmention */
280 emit_sleb128 (w, 1); /* code alignment factor */
281 emit_sleb128 (w, mono_unwind_get_dwarf_data_align ()); /* data alignment factor */
282 emit_uleb128 (w, mono_unwind_get_dwarf_pc_reg ());
284 w->cie_program = w->cie_program;
285 if (w->cie_program) {
287 guint8 *uw_info = mono_unwind_ops_encode (w->cie_program, &uw_info_len);
288 emit_bytes (w, uw_info, uw_info_len);
292 emit_alignment (w, sizeof (gpointer));
293 emit_label (w, ".Lcie0_end");
297 emit_pointer_value (MonoDwarfWriter *w, gpointer ptr)
299 gssize val = (gssize)ptr;
300 emit_bytes (w, (guint8*)&val, sizeof (gpointer));
304 emit_fde (MonoDwarfWriter *w, int fde_index, char *start_symbol, char *end_symbol,
305 guint8 *code, guint32 code_size, GSList *unwind_ops, gboolean use_cie)
312 emit_section_change (w, ".debug_frame", 0);
314 sprintf (symbol, ".Lfde%d_end", fde_index);
315 emit_symbol_diff (w, symbol, ".", -4); /* length */
316 emit_int32 (w, 0); /* CIE_pointer */
318 emit_pointer (w, start_symbol); /* initial_location */
320 emit_symbol_diff (w, end_symbol, start_symbol, 0); /* address_range */
322 g_assert (code_size);
323 emit_int32 (w, code_size);
326 emit_pointer_value (w, code);
327 emit_int32 (w, code_size);
329 #if SIZEOF_VOID_P == 8
330 /* Upper 32 bits of code size */
335 if (w->cie_program) {
336 // FIXME: Check that the ops really begin with the CIE program */
339 for (i = 0; i < g_slist_length (w->cie_program); ++i)
343 /* Convert the list of MonoUnwindOps to the format used by DWARF */
344 uw_info = mono_unwind_ops_encode (l, &uw_info_len);
345 emit_bytes (w, uw_info, uw_info_len);
348 emit_alignment (w, sizeof (gpointer));
349 sprintf (symbol, ".Lfde%d_end", fde_index);
350 emit_label (w, symbol);
354 #define ABBREV_COMPILE_UNIT 1
355 #define ABBREV_SUBPROGRAM 2
356 #define ABBREV_PARAM 3
357 #define ABBREV_BASE_TYPE 4
358 #define ABBREV_STRUCT_TYPE 5
359 #define ABBREV_DATA_MEMBER 6
360 #define ABBREV_TYPEDEF 7
361 #define ABBREV_ENUM_TYPE 8
362 #define ABBREV_ENUMERATOR 9
363 #define ABBREV_NAMESPACE 10
364 #define ABBREV_VARIABLE 11
365 #define ABBREV_VARIABLE_LOCLIST 12
366 #define ABBREV_POINTER_TYPE 13
367 #define ABBREV_REFERENCE_TYPE 14
368 #define ABBREV_PARAM_LOCLIST 15
369 #define ABBREV_INHERITANCE 16
371 static int compile_unit_attr [] = {
372 DW_AT_producer ,DW_FORM_string,
373 DW_AT_name ,DW_FORM_string,
374 DW_AT_comp_dir ,DW_FORM_string,
375 DW_AT_language ,DW_FORM_data1,
376 DW_AT_low_pc ,DW_FORM_addr,
377 DW_AT_high_pc ,DW_FORM_addr,
378 DW_AT_stmt_list ,DW_FORM_data4
381 static int subprogram_attr [] = {
382 DW_AT_name , DW_FORM_string,
383 DW_AT_low_pc , DW_FORM_addr,
384 DW_AT_high_pc , DW_FORM_addr,
385 DW_AT_frame_base , DW_FORM_block1
388 static int param_attr [] = {
389 DW_AT_name, DW_FORM_string,
390 DW_AT_type, DW_FORM_ref4,
391 DW_AT_location, DW_FORM_block1
394 static int param_loclist_attr [] = {
395 DW_AT_name, DW_FORM_string,
396 DW_AT_type, DW_FORM_ref4,
397 DW_AT_location, DW_FORM_data4
400 static int base_type_attr [] = {
401 DW_AT_byte_size, DW_FORM_data1,
402 DW_AT_encoding, DW_FORM_data1,
403 DW_AT_name, DW_FORM_string
406 static int struct_type_attr [] = {
407 DW_AT_name, DW_FORM_string,
408 DW_AT_byte_size, DW_FORM_udata,
411 static int data_member_attr [] = {
412 DW_AT_name, DW_FORM_string,
413 DW_AT_type, DW_FORM_ref4,
414 DW_AT_data_member_location, DW_FORM_block1
417 static int typedef_attr [] = {
418 DW_AT_name, DW_FORM_string,
419 DW_AT_type, DW_FORM_ref4
422 static int pointer_type_attr [] = {
423 DW_AT_type, DW_FORM_ref4,
426 static int reference_type_attr [] = {
427 DW_AT_type, DW_FORM_ref4,
430 static int enum_type_attr [] = {
431 DW_AT_name, DW_FORM_string,
432 DW_AT_byte_size, DW_FORM_udata,
433 DW_AT_type, DW_FORM_ref4,
436 static int enumerator_attr [] = {
437 DW_AT_name, DW_FORM_string,
438 DW_AT_const_value, DW_FORM_sdata,
441 static int namespace_attr [] = {
442 DW_AT_name, DW_FORM_string,
445 static int variable_attr [] = {
446 DW_AT_name, DW_FORM_string,
447 DW_AT_type, DW_FORM_ref4,
448 DW_AT_location, DW_FORM_block1
451 static int variable_loclist_attr [] = {
452 DW_AT_name, DW_FORM_string,
453 DW_AT_type, DW_FORM_ref4,
454 DW_AT_location, DW_FORM_data4
457 static int inheritance_attr [] = {
458 DW_AT_type, DW_FORM_ref4,
459 DW_AT_data_member_location, DW_FORM_block1
462 typedef struct DwarfBasicType {
463 const char *die_name, *name;
469 static DwarfBasicType basic_types [] = {
470 { ".LDIE_I1", "sbyte", MONO_TYPE_I1, 1, DW_ATE_signed },
471 { ".LDIE_U1", "byte", MONO_TYPE_U1, 1, DW_ATE_unsigned },
472 { ".LDIE_I2", "short", MONO_TYPE_I2, 2, DW_ATE_signed },
473 { ".LDIE_U2", "ushort", MONO_TYPE_U2, 2, DW_ATE_unsigned },
474 { ".LDIE_I4", "int", MONO_TYPE_I4, 4, DW_ATE_signed },
475 { ".LDIE_U4", "uint", MONO_TYPE_U4, 4, DW_ATE_unsigned },
476 { ".LDIE_I8", "long", MONO_TYPE_I8, 8, DW_ATE_signed },
477 { ".LDIE_U8", "ulong", MONO_TYPE_U8, 8, DW_ATE_unsigned },
478 { ".LDIE_I", "intptr", MONO_TYPE_I, SIZEOF_VOID_P, DW_ATE_signed },
479 { ".LDIE_U", "uintptr", MONO_TYPE_U, SIZEOF_VOID_P, DW_ATE_unsigned },
480 { ".LDIE_R4", "float", MONO_TYPE_R4, 4, DW_ATE_float },
481 { ".LDIE_R8", "double", MONO_TYPE_R8, 8, DW_ATE_float },
482 { ".LDIE_BOOLEAN", "boolean", MONO_TYPE_BOOLEAN, 1, DW_ATE_boolean },
483 { ".LDIE_CHAR", "char", MONO_TYPE_CHAR, 2, DW_ATE_unsigned_char },
484 { ".LDIE_STRING", "string", MONO_TYPE_STRING, sizeof (gpointer), DW_ATE_address },
485 { ".LDIE_OBJECT", "object", MONO_TYPE_OBJECT, sizeof (gpointer), DW_ATE_address },
486 { ".LDIE_SZARRAY", "object", MONO_TYPE_SZARRAY, sizeof (gpointer), DW_ATE_address },
489 /* Constants for encoding line number special opcodes */
490 #define OPCODE_BASE 13
492 #define LINE_RANGE 14
494 /* Subsections of the .debug_line section */
495 #define LINE_SUBSECTION_HEADER 1
496 #define LINE_SUBSECTION_INCLUDES 2
497 #define LINE_SUBSECTION_FILES 3
498 #define LINE_SUBSECTION_DATA 4
499 #define LINE_SUBSECTION_END 5
502 emit_line_number_file_name (MonoDwarfWriter *w, const char *name,
503 gint64 last_mod_time, gint64 file_size)
507 char *basename = NULL;
509 if (!w->file_to_index)
510 w->file_to_index = g_hash_table_new (g_str_hash, g_str_equal);
512 index = GPOINTER_TO_UINT (g_hash_table_lookup (w->file_to_index, name));
516 if (g_path_is_absolute (name)) {
517 char *dir = g_path_get_dirname (name);
519 if (!w->dir_to_index)
520 w->dir_to_index = g_hash_table_new (g_str_hash, g_str_equal);
522 dir_index = GPOINTER_TO_UINT (g_hash_table_lookup (w->dir_to_index, dir));
523 if (dir_index == 0) {
524 emit_section_change (w, ".debug_line", LINE_SUBSECTION_INCLUDES);
525 emit_string (w, dir);
527 dir_index = ++ w->line_number_dir_index;
528 g_hash_table_insert (w->dir_to_index, g_strdup (dir), GUINT_TO_POINTER (dir_index));
533 basename = g_path_get_basename (name);
538 emit_section_change (w, ".debug_line", LINE_SUBSECTION_FILES);
541 emit_string (w, basename);
543 emit_string (w, name);
544 emit_uleb128 (w, dir_index);
548 emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
553 index = ++ w->line_number_file_index;
554 g_hash_table_insert (w->file_to_index, g_strdup (name), GUINT_TO_POINTER (index));
560 emit_line_number_info_begin (MonoDwarfWriter *w)
563 /* FIXME: This doesn't seem to work with !xdebug */
564 emit_section_change (w, ".debug_line", 0);
565 emit_label (w, ".Ldebug_line_start");
566 emit_label (w, ".Ldebug_line_section_start");
570 /* Line number info header */
572 * GAS seems to emit its own data to the end of the first subsection, so we use
573 * subsections 1, 2 etc:
574 * 1 - contains the header
575 * 2 - contains the file names
576 * 3 - contains the end of the header + the data
579 emit_section_change (w, ".debug_line", 0);
580 emit_label (w, ".Ldebug_line_section_start");
581 emit_section_change (w, ".debug_line", LINE_SUBSECTION_HEADER);
582 emit_label (w, ".Ldebug_line_start");
583 emit_symbol_diff (w, ".Ldebug_line_end", ".", -4); /* length */
584 emit_int16 (w, 0x2); /* version */
585 emit_symbol_diff (w, ".Ldebug_line_header_end", ".", -4); /* header_length */
586 emit_byte (w, 1); /* minimum_instruction_length */
587 emit_byte (w, 1); /* default_is_stmt */
588 emit_byte (w, LINE_BASE); /* line_base */
589 emit_byte (w, LINE_RANGE); /* line_range */
590 emit_byte (w, OPCODE_BASE); /* opcode_base */
591 emit_byte (w, 0); /* standard_opcode_lengths */
605 emit_section_change (w, ".debug_line", LINE_SUBSECTION_INCLUDES);
607 /* End of Includes */
608 emit_section_change (w, ".debug_line", LINE_SUBSECTION_FILES);
612 emit_line_number_file_name (w, "xdb.il", 0, 0);
615 emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
618 emit_label (w, ".Ldebug_line_header_end");
620 /* Emit this into a separate subsection so it gets placed at the end */
621 emit_section_change (w, ".debug_line", LINE_SUBSECTION_END);
625 emit_byte (w, DW_LNE_end_sequence);
627 emit_label (w, ".Ldebug_line_end");
631 mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, GSList *base_unwind_program)
633 char *s, *build_info;
636 w->cie_program = base_unwind_program;
638 emit_section_change (w, ".debug_abbrev", 0);
639 emit_dwarf_abbrev (w, ABBREV_COMPILE_UNIT, DW_TAG_compile_unit, TRUE,
640 compile_unit_attr, G_N_ELEMENTS (compile_unit_attr));
641 emit_dwarf_abbrev (w, ABBREV_SUBPROGRAM, DW_TAG_subprogram, TRUE,
642 subprogram_attr, G_N_ELEMENTS (subprogram_attr));
643 emit_dwarf_abbrev (w, ABBREV_PARAM, DW_TAG_formal_parameter, FALSE,
644 param_attr, G_N_ELEMENTS (param_attr));
645 emit_dwarf_abbrev (w, ABBREV_PARAM_LOCLIST, DW_TAG_formal_parameter, FALSE,
646 param_loclist_attr, G_N_ELEMENTS (param_loclist_attr));
647 emit_dwarf_abbrev (w, ABBREV_BASE_TYPE, DW_TAG_base_type, FALSE,
648 base_type_attr, G_N_ELEMENTS (base_type_attr));
649 emit_dwarf_abbrev (w, ABBREV_STRUCT_TYPE, DW_TAG_class_type, TRUE,
650 struct_type_attr, G_N_ELEMENTS (struct_type_attr));
651 emit_dwarf_abbrev (w, ABBREV_DATA_MEMBER, DW_TAG_member, FALSE,
652 data_member_attr, G_N_ELEMENTS (data_member_attr));
653 emit_dwarf_abbrev (w, ABBREV_TYPEDEF, DW_TAG_typedef, FALSE,
654 typedef_attr, G_N_ELEMENTS (typedef_attr));
655 emit_dwarf_abbrev (w, ABBREV_ENUM_TYPE, DW_TAG_enumeration_type, TRUE,
656 enum_type_attr, G_N_ELEMENTS (enum_type_attr));
657 emit_dwarf_abbrev (w, ABBREV_ENUMERATOR, DW_TAG_enumerator, FALSE,
658 enumerator_attr, G_N_ELEMENTS (enumerator_attr));
659 emit_dwarf_abbrev (w, ABBREV_NAMESPACE, DW_TAG_namespace, TRUE,
660 namespace_attr, G_N_ELEMENTS (namespace_attr));
661 emit_dwarf_abbrev (w, ABBREV_VARIABLE, DW_TAG_variable, FALSE,
662 variable_attr, G_N_ELEMENTS (variable_attr));
663 emit_dwarf_abbrev (w, ABBREV_VARIABLE_LOCLIST, DW_TAG_variable, FALSE,
664 variable_loclist_attr, G_N_ELEMENTS (variable_loclist_attr));
665 emit_dwarf_abbrev (w, ABBREV_POINTER_TYPE, DW_TAG_pointer_type, FALSE,
666 pointer_type_attr, G_N_ELEMENTS (pointer_type_attr));
667 emit_dwarf_abbrev (w, ABBREV_REFERENCE_TYPE, DW_TAG_reference_type, FALSE,
668 reference_type_attr, G_N_ELEMENTS (reference_type_attr));
669 emit_dwarf_abbrev (w, ABBREV_INHERITANCE, DW_TAG_inheritance, FALSE,
670 inheritance_attr, G_N_ELEMENTS (inheritance_attr));
673 emit_section_change (w, ".debug_info", 0);
674 emit_label (w, ".Ldebug_info_start");
675 emit_symbol_diff (w, ".Ldebug_info_end", ".", -4); /* length */
676 emit_int16 (w, 0x2); /* DWARF version 2 */
677 emit_int32 (w, 0); /* .debug_abbrev offset */
678 emit_byte (w, sizeof (gpointer)); /* address size */
680 /* Emit this into a separate section so it gets placed at the end */
681 emit_section_change (w, ".debug_info", 1);
682 emit_int32 (w, 0); /* close everything */
683 emit_label (w, ".Ldebug_info_end");
684 emit_section_change (w, ".debug_info", 0);
686 /* Compilation unit */
687 emit_uleb128 (w, ABBREV_COMPILE_UNIT);
688 build_info = mono_get_runtime_build_info ();
689 s = g_strdup_printf ("Mono AOT Compiler %s", build_info);
693 emit_string (w, "JITted code");
695 emit_byte (w, DW_LANG_C);
696 emit_pointer_value (w, 0);
697 emit_pointer_value (w, 0);
698 /* offset into .debug_line section */
699 emit_symbol_diff (w, ".Ldebug_line_start", ".Ldebug_line_section_start", 0);
702 for (i = 0; i < G_N_ELEMENTS (basic_types); ++i) {
703 emit_label (w, basic_types [i].die_name);
704 emit_uleb128 (w, ABBREV_BASE_TYPE);
705 emit_byte (w, basic_types [i].size);
706 emit_byte (w, basic_types [i].encoding);
707 emit_string (w, basic_types [i].name);
710 /* debug_loc section */
711 emit_section_change (w, ".debug_loc", 0);
712 emit_label (w, ".Ldebug_loc_start");
714 /* debug_line section */
715 emit_line_number_info_begin (w);
720 static const char* emit_type (MonoDwarfWriter *w, MonoType *t);
722 /* Returns the local symbol pointing to the emitted debug info */
724 emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype)
726 char *die, *pointer_die, *reference_die;
729 MonoClassField *field;
732 gboolean emit_namespace = FALSE;
736 if (!w->class_to_die)
737 w->class_to_die = g_hash_table_new (NULL, NULL);
738 if (!w->class_to_vtype_die)
739 w->class_to_vtype_die = g_hash_table_new (NULL, NULL);
740 if (!w->class_to_pointer_die)
741 w->class_to_pointer_die = g_hash_table_new (NULL, NULL);
742 if (!w->class_to_reference_die)
743 w->class_to_reference_die = g_hash_table_new (NULL, NULL);
746 cache = w->class_to_vtype_die;
748 cache = w->class_to_die;
750 die = g_hash_table_lookup (cache, klass);
754 if (!((klass->byval_arg.type == MONO_TYPE_CLASS) || (klass->byval_arg.type == MONO_TYPE_OBJECT) || klass->byval_arg.type == MONO_TYPE_GENERICINST || klass->enumtype || (klass->byval_arg.type == MONO_TYPE_VALUETYPE && vtype)))
758 * FIXME: gdb can't handle namespaces in languages it doesn't know about.
761 if (klass->name_space && klass->name_space [0] != '\0')
762 emit_namespace = TRUE;
764 if (emit_namespace) {
765 emit_uleb128 (w, ABBREV_NAMESPACE);
766 emit_string (w, klass->name_space);
769 full_name = g_strdup_printf ("%s%s%s", klass->name_space, klass->name_space ? "." : "", klass->name);
771 * gdb doesn't support namespaces for non-C++ dwarf objects, so use _
772 * to separate components.
774 for (p = full_name; *p; p ++)
778 die = g_strdup_printf (".LTDIE_%d", w->tdie_index);
779 pointer_die = g_strdup_printf (".LTDIE_%d_POINTER", w->tdie_index);
780 reference_die = g_strdup_printf (".LTDIE_%d_REFERENCE", w->tdie_index);
783 g_hash_table_insert (w->class_to_pointer_die, klass, pointer_die);
784 g_hash_table_insert (w->class_to_reference_die, klass, reference_die);
785 g_hash_table_insert (cache, klass, die);
787 if (klass->enumtype) {
788 int size = mono_class_value_size (mono_class_from_mono_type (mono_class_enum_basetype (klass)), NULL);
792 emit_uleb128 (w, ABBREV_ENUM_TYPE);
793 emit_string (w, full_name);
794 emit_uleb128 (w, size);
795 for (k = 0; k < G_N_ELEMENTS (basic_types); ++k)
796 if (basic_types [k].type == mono_class_enum_basetype (klass)->type)
798 g_assert (k < G_N_ELEMENTS (basic_types));
799 emit_symbol_diff (w, basic_types [k].die_name, ".Ldebug_info_start", 0);
801 /* Emit enum values */
803 while ((field = mono_class_get_fields (klass, &iter))) {
806 MonoTypeEnum def_type;
808 if (strcmp ("value__", mono_field_get_name (field)) == 0)
810 if (mono_field_is_deleted (field))
813 emit_uleb128 (w, ABBREV_ENUMERATOR);
814 emit_string (w, mono_field_get_name (field));
816 p = mono_class_get_field_default_value (field, &def_type);
817 len = mono_metadata_decode_blob_size (p, &p);
818 switch (mono_class_enum_basetype (klass)->type) {
821 case MONO_TYPE_BOOLEAN:
822 emit_sleb128 (w, *p);
827 emit_sleb128 (w, read16 (p));
831 emit_sleb128 (w, read32 (p));
835 emit_sleb128 (w, read64 (p));
839 #if SIZEOF_VOID_P == 8
840 emit_sleb128 (w, read64 (p));
842 emit_sleb128 (w, read32 (p));
846 g_assert_not_reached ();
855 parent_die = emit_class_dwarf_info (w, klass->parent, FALSE);
859 /* Emit field types */
861 while ((field = mono_class_get_fields (klass, &iter))) {
862 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
865 emit_type (w, field->type);
870 emit_uleb128 (w, ABBREV_STRUCT_TYPE);
871 emit_string (w, full_name);
872 emit_uleb128 (w, klass->instance_size);
875 emit_uleb128 (w, ABBREV_INHERITANCE);
876 emit_symbol_diff (w, parent_die, ".Ldebug_info_start", 0);
879 *p ++= DW_OP_plus_uconst;
880 encode_uleb128 (0, p, &p);
881 emit_byte (w, p - buf);
882 emit_bytes (w, buf, p - buf);
887 while ((field = mono_class_get_fields (klass, &iter))) {
888 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
891 fdie = emit_type (w, field->type);
893 emit_uleb128 (w, ABBREV_DATA_MEMBER);
894 emit_string (w, field->name);
895 emit_symbol_diff (w, fdie, ".Ldebug_info_start", 0);
898 *p ++= DW_OP_plus_uconst;
899 if (klass->valuetype && vtype)
900 encode_uleb128 (field->offset - sizeof (MonoObject), p, &p);
902 encode_uleb128 (field->offset, p, &p);
904 emit_byte (w, p - buf);
905 emit_bytes (w, buf, p - buf);
911 emit_uleb128 (w, 0x0);
913 /* Add a typedef, so we can reference the type without a 'struct' in gdb */
914 emit_uleb128 (w, ABBREV_TYPEDEF);
915 emit_string (w, full_name);
916 emit_symbol_diff (w, die, ".Ldebug_info_start", 0);
918 /* Add a pointer type */
919 emit_label (w, pointer_die);
921 emit_uleb128 (w, ABBREV_POINTER_TYPE);
922 emit_symbol_diff (w, die, ".Ldebug_info_start", 0);
924 /* Add a reference type */
925 emit_label (w, reference_die);
927 emit_uleb128 (w, ABBREV_REFERENCE_TYPE);
928 emit_symbol_diff (w, die, ".Ldebug_info_start", 0);
932 if (emit_namespace) {
934 emit_uleb128 (w, 0x0);
941 emit_type (MonoDwarfWriter *w, MonoType *t)
943 MonoClass *klass = mono_class_from_mono_type (t);
948 if (t->type == MONO_TYPE_VALUETYPE) {
949 tdie = emit_class_dwarf_info (w, klass, TRUE);
951 return g_hash_table_lookup (w->class_to_pointer_die, klass);
954 tdie = emit_class_dwarf_info (w, klass, FALSE);
955 /* Should return a pointer type to a reference */
958 t = &mono_defaults.int_class->byval_arg;
960 for (j = 0; j < G_N_ELEMENTS (basic_types); ++j)
961 if (basic_types [j].type == t->type)
963 if (j < G_N_ELEMENTS (basic_types))
964 tdie = basic_types [j].die_name;
967 case MONO_TYPE_CLASS:
968 emit_class_dwarf_info (w, klass, FALSE);
969 tdie = g_hash_table_lookup (w->class_to_reference_die, klass);
970 //tdie = ".LDIE_OBJECT";
972 case MONO_TYPE_ARRAY:
973 tdie = ".LDIE_OBJECT";
975 case MONO_TYPE_VALUETYPE:
977 tdie = emit_class_dwarf_info (w, klass, FALSE);
981 case MONO_TYPE_GENERICINST:
982 if (!MONO_TYPE_ISSTRUCT (t)) {
983 emit_class_dwarf_info (w, klass, FALSE);
984 tdie = g_hash_table_lookup (w->class_to_reference_die, klass);
999 emit_var_type (MonoDwarfWriter *w, MonoType *t)
1003 tdie = emit_type (w, t);
1005 emit_symbol_diff (w, tdie, ".Ldebug_info_start", 0);
1009 encode_var_location (MonoDwarfWriter *w, MonoInst *ins, guint8 *p, guint8 **endp)
1012 /* FIXME: This needs a location list, since the args can go from reg->stack */
1013 if (!ins || ins->flags & MONO_INST_IS_DEAD) {
1014 /* gdb treats this as optimized out */
1015 } else if (ins->opcode == OP_REGVAR) {
1016 *p = DW_OP_reg0 + mono_hw_reg_to_dwarf_reg (ins->dreg);
1018 } else if (ins->opcode == OP_REGOFFSET) {
1019 *p ++= DW_OP_breg0 + mono_hw_reg_to_dwarf_reg (ins->inst_basereg);
1020 encode_sleb128 (ins->inst_offset, p, &p);
1030 emit_loclist (MonoDwarfWriter *w, MonoInst *ins,
1031 guint8 *loclist_begin_addr, guint8 *loclist_end_addr,
1032 guint8 *expr, guint32 expr_len)
1036 emit_push_section (w, ".debug_loc", 0);
1037 sprintf (label, ".Lloclist_%d", w->loclist_index ++ );
1038 emit_label (w, label);
1040 emit_pointer_value (w, loclist_begin_addr);
1041 emit_pointer_value (w, loclist_end_addr);
1042 emit_byte (w, expr_len % 256);
1043 emit_byte (w, expr_len / 256);
1044 emit_bytes (w, expr, expr_len);
1046 emit_pointer_value (w, NULL);
1047 emit_pointer_value (w, NULL);
1049 emit_pop_section (w);
1050 emit_symbol_diff (w, label, ".Ldebug_loc_start", 0);
1054 * MonoDisHelper->tokener doesn't take an IP argument, and we can't add one since
1055 * it is a public header.
1057 static const guint8 *token_handler_ip;
1060 token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token)
1063 MonoMethod *cmethod;
1065 MonoClassField *field;
1066 gpointer data = NULL;
1068 if (method->wrapper_type)
1069 data = mono_method_get_wrapper_data (method, token);
1071 switch (*token_handler_ip) {
1075 if (method->wrapper_type)
1078 klass = mono_class_get_full (method->klass->image, token, NULL);
1079 res = g_strdup_printf ("<%s>", klass->name);
1084 if (method->wrapper_type)
1087 cmethod = mono_get_method_full (method->klass->image, token, NULL, NULL);
1088 desc = mono_method_full_name (cmethod, TRUE);
1089 res = g_strdup_printf ("<%s>", desc);
1093 if (method->wrapper_type) {
1094 desc = mono_signature_get_desc (data, FALSE);
1095 res = g_strdup_printf ("<%s>", desc);
1098 res = g_strdup_printf ("<0x%08x>", token);
1105 if (method->wrapper_type)
1108 field = mono_field_from_token (method->klass->image, token, &klass, NULL);
1109 desc = mono_field_full_name (field);
1110 res = g_strdup_printf ("<%s>", desc);
1114 res = g_strdup_printf ("<0x%08x>", token);
1124 * Produce a disassembled form of the IL instruction at IP. This is an extension
1125 * of mono_disasm_code_one () which can disasm tokens, handle wrapper methods, and
1126 * CEE_MONO_ opcodes.
1129 disasm_ins (MonoMethod *method, const guchar *ip, const guint8 **endip)
1133 MonoMethodHeader *header = mono_method_get_header (method);
1135 memset (&dh, 0, sizeof (dh));
1137 dh.label_format = "IL_%04x: ";
1138 dh.label_target = "IL_%04x";
1139 dh.tokener = token_handler;
1141 token_handler_ip = ip;
1142 if (*ip == MONO_CUSTOM_PREFIX) {
1147 case CEE_MONO_ICALL: {
1148 MonoJitICallInfo *info;
1150 token = read32 (ip + 2);
1151 data = mono_method_get_wrapper_data (method, token);
1152 info = mono_find_jit_icall_by_addr (data);
1155 dis = g_strdup_printf ("IL_%04x: mono_icall <%s>", (int)(ip - header->code), info->name);
1159 case CEE_MONO_CLASSCONST: {
1160 token = read32 (ip + 2);
1161 data = mono_method_get_wrapper_data (method, token);
1163 dis = g_strdup_printf ("IL_%04x: mono_classconst <%s>", (int)(ip - header->code), ((MonoClass*)data)->name);
1168 dis = mono_disasm_code_one (&dh, method, ip, &ip);
1171 dis = mono_disasm_code_one (&dh, method, ip, &ip);
1173 token_handler_ip = NULL;
1180 il_offset_from_address (MonoMethod *method, MonoDebugMethodJitInfo *jit,
1181 guint32 native_offset)
1185 if (!jit->line_numbers)
1188 for (i = jit->num_line_numbers - 1; i >= 0; i--) {
1189 MonoDebugLineNumberEntry lne = jit->line_numbers [i];
1191 if (lne.native_offset <= native_offset)
1192 return lne.il_offset;
1198 static int max_special_addr_diff = 0;
1201 emit_advance_op (MonoDwarfWriter *w, int line_diff, int addr_diff)
1205 /* Use a special opcode if possible */
1206 if (line_diff - LINE_BASE >= 0 && line_diff - LINE_BASE < LINE_RANGE) {
1207 if (max_special_addr_diff == 0)
1208 max_special_addr_diff = (255 - OPCODE_BASE) / LINE_RANGE;
1210 if (addr_diff > max_special_addr_diff && (addr_diff < 2 * max_special_addr_diff)) {
1211 emit_byte (w, DW_LNS_const_add_pc);
1212 addr_diff -= max_special_addr_diff;
1215 opcode = (line_diff - LINE_BASE) + (LINE_RANGE * addr_diff) + OPCODE_BASE;
1221 emit_byte (w, opcode);
1223 emit_byte (w, DW_LNS_advance_line);
1224 emit_sleb128 (w, line_diff);
1225 emit_byte (w, DW_LNS_advance_pc);
1226 emit_sleb128 (w, addr_diff);
1227 emit_byte (w, DW_LNS_copy);
1232 compare_lne (MonoDebugLineNumberEntry *a, MonoDebugLineNumberEntry *b)
1234 if (a->native_offset == b->native_offset)
1235 return a->il_offset - b->il_offset;
1237 return a->native_offset - b->native_offset;
1241 emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, guint8 *code,
1242 guint32 code_size, MonoDebugMethodJitInfo *debug_info)
1244 guint32 prev_line = 0;
1245 guint32 prev_native_offset = 0;
1246 int i, file_index, il_offset, prev_il_offset;
1247 gboolean first = TRUE;
1248 MonoDebugSourceLocation *loc;
1249 char *prev_file_name = NULL;
1250 MonoMethodHeader *header = mono_method_get_header (method);
1251 MonoDebugMethodInfo *minfo;
1253 int *native_to_il_offset = NULL;
1256 // FIXME: The set_address op below only works with xdebug
1259 minfo = mono_debug_lookup_method (method);
1261 /* Compute the native->IL offset mapping */
1263 #ifndef _EGLIB_MAJOR
1264 ln_array = g_array_sized_new (FALSE, FALSE, sizeof (MonoDebugLineNumberEntry),
1265 debug_info->num_line_numbers);
1266 g_array_append_vals (ln_array, debug_info->line_numbers, debug_info->num_line_numbers);
1267 g_array_sort (ln_array, (GCompareFunc)compare_lne);
1268 native_to_il_offset = g_new0 (int, code_size + 1);
1270 for (i = 0; i < debug_info->num_line_numbers; ++i) {
1272 MonoDebugLineNumberEntry lne = g_array_index (ln_array, MonoDebugLineNumberEntry, i);
1275 for (j = 0; j < lne.native_offset; ++j)
1276 native_to_il_offset [j] = -1;
1279 if (i < debug_info->num_line_numbers - 1) {
1280 MonoDebugLineNumberEntry lne_next = g_array_index (ln_array, MonoDebugLineNumberEntry, i + 1);
1282 for (j = lne.native_offset; j < lne_next.native_offset; ++j)
1283 native_to_il_offset [j] = lne.il_offset;
1285 for (j = lne.native_offset; j < code_size; ++j)
1286 native_to_il_offset [j] = lne.il_offset;
1289 g_array_free (ln_array, TRUE);
1293 prev_il_offset = -1;
1295 for (i = 0; i < code_size; ++i) {
1299 if (!debug_info->line_numbers)
1302 if (native_to_il_offset)
1303 il_offset = native_to_il_offset [i];
1305 il_offset = il_offset_from_address (method, debug_info, i);
1307 il_offset = il_offset_from_address (method, debug_info, i);
1309 g_assert (il_offset == native_to_il_offset [i]);
1312 il_offset = native_to_il_offset [i];
1316 if (il_offset == prev_il_offset)
1319 prev_il_offset = il_offset;
1321 loc = mono_debug_symfile_lookup_location (minfo, il_offset);
1324 int line_diff = (gint32)loc->row - (gint32)prev_line;
1325 int addr_diff = i - prev_native_offset;
1328 emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
1331 emit_byte (w, sizeof (gpointer) + 1);
1332 emit_byte (w, DW_LNE_set_address);
1333 emit_pointer_value (w, code);
1336 * The prolog+initlocals region does not have a line number, this
1337 * makes them belong to the first line of the method.
1339 emit_byte (w, DW_LNS_advance_line);
1340 emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
1341 prev_line = loc->row;
1344 if (loc->row != prev_line) {
1345 if (!prev_file_name || strcmp (loc->source_file, prev_file_name) != 0) {
1346 /* Add an entry to the file table */
1347 /* FIXME: Avoid duplicates */
1348 file_index = emit_line_number_file_name (w, loc->source_file, 0, 0);
1349 g_free (prev_file_name);
1350 prev_file_name = g_strdup (loc->source_file);
1352 emit_byte (w, DW_LNS_set_file);
1353 emit_uleb128 (w, file_index);
1354 emit_byte (w, DW_LNS_copy);
1357 //printf ("X: %p(+0x%x) %d %s:%d(+%d)\n", code + i, addr_diff, loc->il_offset, loc->source_file, loc->row, line_diff);
1359 emit_advance_op (w, line_diff, addr_diff);
1361 prev_line = loc->row;
1362 prev_native_offset = i;
1370 g_free (prev_file_name);
1373 emit_byte (w, DW_LNS_advance_pc);
1374 emit_sleb128 (w, code_size - prev_native_offset);
1375 emit_byte (w, DW_LNS_copy);
1379 emit_byte (w, DW_LNE_end_sequence);
1381 /* No debug info, XDEBUG mode */
1383 const guint8 *ip = header->code;
1384 int prev_line, prev_native_offset;
1388 * Emit the IL code into a temporary file and emit line number info
1389 * referencing that file.
1392 name = mono_method_full_name (method, TRUE);
1393 fprintf (w->il_file, "// %s\n", name);
1394 w->il_file_line_index ++;
1397 il_to_line = g_new0 (int, header->code_size);
1399 emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA);
1401 emit_byte (w, sizeof (gpointer) + 1);
1402 emit_byte (w, DW_LNE_set_address);
1403 emit_pointer_value (w, code);
1405 // FIXME: Optimize this
1406 while (ip < header->code + header->code_size) {
1407 int il_offset = ip - header->code;
1410 w->il_file_line_index ++;
1412 dis = disasm_ins (method, ip, &ip);
1413 fprintf (w->il_file, "%s\n", dis);
1416 il_to_line [il_offset] = w->il_file_line_index;
1419 /* Emit line number info */
1421 prev_native_offset = 0;
1422 for (i = 0; i < debug_info->num_line_numbers; ++i) {
1423 MonoDebugLineNumberEntry *lne = &debug_info->line_numbers [i];
1426 if (lne->il_offset >= header->code_size)
1428 line = il_to_line [lne->il_offset];
1431 * This seems to happen randomly, it looks like il_offset points
1432 * into the middle of an instruction.
1436 printf ("%s\n", mono_method_full_name (method, TRUE));
1437 printf ("%d %d\n", lne->il_offset, header->code_size);
1442 if (line - prev_line != 0) {
1443 emit_advance_op (w, line - prev_line, (gint32)lne->native_offset - prev_native_offset);
1446 prev_native_offset = lne->native_offset;
1450 emit_byte (w, DW_LNS_advance_pc);
1451 emit_sleb128 (w, code_size - prev_native_offset);
1452 emit_byte (w, DW_LNS_copy);
1456 emit_byte (w, DW_LNE_end_sequence);
1458 fflush (w->il_file);
1459 g_free (il_to_line);
1463 static MonoMethodVar*
1464 find_vmv (MonoCompile *cfg, MonoInst *ins)
1469 for (j = 0; j < cfg->num_varinfo; ++j) {
1470 if (cfg->varinfo [j] == ins)
1474 if (j < cfg->num_varinfo) {
1475 return MONO_VARINFO (cfg, j);
1483 mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info)
1486 MonoMethodSignature *sig;
1487 MonoMethodHeader *header;
1488 char **names, **tdies, **local_tdies;
1495 emit_section_change (w, ".debug_info", 0);
1497 sig = mono_method_signature (method);
1498 header = mono_method_get_header (method);
1500 /* Parameter types */
1501 tdies = g_new0 (char *, sig->param_count + sig->hasthis);
1502 for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
1505 if (i == 0 && sig->hasthis) {
1506 if (method->klass->valuetype)
1507 t = &method->klass->this_arg;
1509 t = &method->klass->byval_arg;
1511 t = sig->params [i - sig->hasthis];
1518 local_tdies = g_new0 (char *, header->num_locals);
1519 for (i = 0; i < header->num_locals; ++i) {
1520 emit_type (w, header->locals [i]);
1524 names = g_new0 (char *, sig->param_count);
1525 mono_method_get_param_names (method, (const char **) names);
1527 emit_uleb128 (w, ABBREV_SUBPROGRAM);
1528 name = mono_method_full_name (method, FALSE);
1529 emit_string (w, name);
1532 emit_pointer_unaligned (w, start_symbol);
1533 emit_pointer_unaligned (w, end_symbol);
1535 emit_pointer_value (w, code);
1536 emit_pointer_value (w, code + code_size);
1540 emit_byte (w, DW_OP_breg6);
1544 for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
1545 MonoInst *arg = args ? args [i] : NULL;
1548 char pname_buf [128];
1549 MonoMethodVar *vmv = NULL;
1550 gboolean need_loclist = FALSE;
1552 vmv = find_vmv (cfg, arg);
1553 if (code && vmv && (vmv->live_range_start || vmv->live_range_end))
1554 need_loclist = TRUE;
1556 if (i == 0 && sig->hasthis) {
1557 if (method->klass->valuetype)
1558 t = &method->klass->this_arg;
1560 t = &method->klass->byval_arg;
1563 t = sig->params [i - sig->hasthis];
1564 pname = names [i - sig->hasthis];
1567 emit_uleb128 (w, need_loclist ? ABBREV_PARAM_LOCLIST : ABBREV_PARAM);
1569 if (pname[0] == '\0') {
1570 sprintf (pname_buf, "param%d", i - sig->hasthis);
1573 emit_string (w, pname);
1575 if (!arg || arg->flags & MONO_INST_IS_DEAD)
1576 emit_var_type (w, &mono_defaults.int32_class->byval_arg);
1578 emit_var_type (w, t);
1581 encode_var_location (w, arg, p, &p);
1583 vmv->live_range_start = 0;
1584 if (vmv->live_range_end == 0)
1585 /* FIXME: Uses made in calls are not recorded */
1586 vmv->live_range_end = code_size;
1587 emit_loclist (w, arg, code + vmv->live_range_start, code + vmv->live_range_end, buf, p - buf);
1589 emit_byte (w, p - buf);
1590 emit_bytes (w, buf, p - buf);
1596 num_locals = mono_debug_lookup_locals (method, &local_names, &local_indexes);
1598 for (i = 0; i < header->num_locals; ++i) {
1599 MonoInst *ins = locals [i];
1600 char name_buf [128];
1602 MonoMethodVar *vmv = NULL;
1603 gboolean need_loclist = FALSE;
1605 /* ins->dreg no longer contains the original vreg */
1606 vmv = find_vmv (cfg, ins);
1608 if (vmv->live_range_start) {
1609 /* This variable has a precise live range */
1610 need_loclist = TRUE;
1614 emit_uleb128 (w, need_loclist ? ABBREV_VARIABLE_LOCLIST : ABBREV_VARIABLE);
1616 for (j = 0; j < num_locals; ++j)
1617 if (local_indexes [j] == i)
1619 if (j < num_locals) {
1620 emit_string (w, local_names [j]);
1622 sprintf (name_buf, "V_%d", i);
1623 emit_string (w, name_buf);
1626 if (!ins || ins->flags & MONO_INST_IS_DEAD)
1627 emit_var_type (w, &mono_defaults.int32_class->byval_arg);
1629 emit_var_type (w, header->locals [i]);
1632 encode_var_location (w, ins, p, &p);
1635 if (vmv->live_range_end == 0)
1636 /* FIXME: Uses made in calls are not recorded */
1637 vmv->live_range_end = code_size;
1638 emit_loclist (w, ins, code + vmv->live_range_start, code + vmv->live_range_end, buf, p - buf);
1640 emit_byte (w, p - buf);
1641 emit_bytes (w, buf, p - buf);
1645 g_free (local_names);
1646 g_free (local_indexes);
1648 /* Subprogram end */
1649 emit_uleb128 (w, 0x0);
1653 /* Emit unwind info */
1655 emit_fde (w, w->fde_index, start_symbol, end_symbol, code, code_size, unwind_info, TRUE);
1659 /* Emit line number info */
1660 if (code && debug_info)
1661 /* != could happen when using --regression */
1662 if (debug_info->code_start == code)
1663 emit_line_number_info (w, method, code, code_size, debug_info);
1669 mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, GSList *unwind_info)
1671 emit_section_change (w, ".debug_info", 0);
1674 emit_uleb128 (w, ABBREV_SUBPROGRAM);
1675 emit_string (w, tramp_name);
1676 emit_pointer_value (w, code);
1677 emit_pointer_value (w, code + code_size);
1680 emit_byte (w, DW_OP_breg6);
1683 /* Subprogram end */
1684 emit_uleb128 (w, 0x0);
1686 /* Emit unwind info */
1687 emit_fde (w, w->fde_index, start_symbol, end_symbol, code, code_size, unwind_info, FALSE);