diff options
author | Geoffrey Keating <geoffk@apple.com> | 2006-03-17 00:35:32 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2006-03-17 00:35:32 +0000 |
commit | 192d0f895b931ae17d477ea07046980f15dc0ec5 (patch) | |
tree | 359478b0e30ffc64cd80686f3c7f1ec0e630674d /gcc/dwarf2out.c | |
parent | 8e9103166d10c2e69fd9d7474a8d34171c2fcb70 (diff) | |
download | gcc-192d0f895b931ae17d477ea07046980f15dc0ec5.zip gcc-192d0f895b931ae17d477ea07046980f15dc0ec5.tar.gz gcc-192d0f895b931ae17d477ea07046980f15dc0ec5.tar.bz2 |
tm.texi (SDB and DWARF): Add extra parameter to ASM_OUTPUT_DWARF_OFFSET.
* doc/tm.texi (SDB and DWARF): Add extra parameter to
ASM_OUTPUT_DWARF_OFFSET. Use @var to indicate metavariables.
* dwarf2asm.h (dw2_asm_output_offset): Add section parameter.
* dwarf2asm.c (dw2_asm_output_offset): Add base section parameter.
Pass to ASM_OUTPUT_DWARF_OFFSET.
* dwarf2out.c (debug_frame_section): New.
(output_call_frame_info): Use debug_frame_section. Pass it to
dw2_asm_output_offset.
(output_die): Pass appropriate section to dw2_asm_output_offset.
(output_compilation_unit_header): Likewise.
(output_pubnames): Likewise.
(output_aranges): Likewise.
(enum dw_val_class): Break dw_val_class_lbl_offset into
dw_val_class_lineptr and dw_val_class_macptr.
(add_AT_lbl_offset): Delete.
(add_AT_lineptr): New.
(add_AT_macptr): New.
(AT_lbl): Expect a lineptr or macptr.
(print_die): Handle dw_val_class_lineptr and dw_val_class_macptr.
(attr_checksum): Likewise.
(same_dw_val_p): Likewise.
(size_of_die): Likewise.
(value_format): Likewise.
(output_die): Likewise.
(dwarf2out_finish): Call add_AT_lineptr and add_AT_macptr instead of
add_AT_lbl_offset.
* config/i386/cygming.h (ASM_OUTPUT_DWARF_OFFSET): Add extra parameter.
* config/i386/i386.c (x86_file_start): Call darwin_file_start.
* config/darwin-protos.h (darwin_file_start): New.
(darwin_asm_output_dwarf_offset): New.
* config/ia64/ia64.h (ASM_OUTPUT_DWARF_OFFSET): Add extra parameter.
* config/rs6000/rs6000.c (rs6000_darwin_file_start): Call
darwin_file_start.
* config/darwin.c (darwin_emit_unwind_label): Don't output label
if not EH section; simplify.
(darwin_file_start): New.
(darwin_asm_output_dwarf_offset): New.
* config/darwin.h (DEBUG_FRAME_SECTION): In __DWARF segment,
mark as 'debug'.
(DEBUG_INFO_SECTION): Likewise.
(DEBUG_ABBREV_SECTION): Likewise.
(DEBUG_ARANGES_SECTION): Likewise.
(DEBUG_MACINFO_SECTION): Likewise.
(DEBUG_LINE_SECTION): Likewise.
(DEBUG_LOC_SECTION): Likewise.
(DEBUG_PUBNAMES_SECTION): Likewise.
(DEBUG_STR_SECTION): Likewise.
(DEBUG_RANGES_SECTION): Likewise.
(FRAME_BEGIN_LABEL): Must start with 'L' in debug section.
(ASM_OUTPUT_DWARF_OFFSET): New.
From-SVN: r112168
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 88 |
1 files changed, 65 insertions, 23 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6e98a4f..9308cce 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -158,6 +158,7 @@ static GTY(()) section *debug_loc_section; static GTY(()) section *debug_pubnames_section; static GTY(()) section *debug_str_section; static GTY(()) section *debug_ranges_section; +static GTY(()) section *debug_frame_section; /* How to start an assembler comment. */ #ifndef ASM_COMMENT_START @@ -2212,7 +2213,7 @@ output_call_frame_info (int for_eh) if (for_eh) switch_to_eh_frame_section (); else - switch_to_section (get_section (DEBUG_FRAME_SECTION, SECTION_DEBUG, NULL)); + switch_to_section (debug_frame_section); ASM_GENERATE_INTERNAL_LABEL (section_start_label, FRAME_BEGIN_LABEL, for_eh); ASM_OUTPUT_LABEL (asm_out_file, section_start_label); @@ -2360,7 +2361,7 @@ output_call_frame_info (int for_eh) dw2_asm_output_delta (4, l1, section_start_label, "FDE CIE offset"); else dw2_asm_output_offset (DWARF_OFFSET_SIZE, section_start_label, - "FDE CIE offset"); + debug_frame_section, "FDE CIE offset"); if (for_eh) { @@ -2655,8 +2656,9 @@ enum dw_val_class dw_val_class_die_ref, dw_val_class_fde_ref, dw_val_class_lbl_id, - dw_val_class_lbl_offset, - dw_val_class_str + dw_val_class_lineptr, + dw_val_class_str, + dw_val_class_macptr }; /* Describe a double word constant value. */ @@ -3984,7 +3986,8 @@ static inline dw_loc_list_ref AT_loc_list (dw_attr_ref); static void add_AT_addr (dw_die_ref, enum dwarf_attribute, rtx); static inline rtx AT_addr (dw_attr_ref); static void add_AT_lbl_id (dw_die_ref, enum dwarf_attribute, const char *); -static void add_AT_lbl_offset (dw_die_ref, enum dwarf_attribute, const char *); +static void add_AT_lineptr (dw_die_ref, enum dwarf_attribute, const char *); +static void add_AT_macptr (dw_die_ref, enum dwarf_attribute, const char *); static void add_AT_offset (dw_die_ref, enum dwarf_attribute, unsigned HOST_WIDE_INT); static void add_AT_range_list (dw_die_ref, enum dwarf_attribute, @@ -5159,16 +5162,34 @@ add_AT_lbl_id (dw_die_ref die, enum dwarf_attribute attr_kind, const char *lbl_i add_dwarf_attr (die, attr); } -/* Add a section offset attribute value to a DIE. */ +/* Add a section offset attribute value to a DIE, an offset into the + debug_line section. */ static inline void -add_AT_lbl_offset (dw_die_ref die, enum dwarf_attribute attr_kind, const char *label) +add_AT_lineptr (dw_die_ref die, enum dwarf_attribute attr_kind, + const char *label) { dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr_next = NULL; attr->dw_attr = attr_kind; - attr->dw_attr_val.val_class = dw_val_class_lbl_offset; + attr->dw_attr_val.val_class = dw_val_class_lineptr; + attr->dw_attr_val.v.val_lbl_id = xstrdup (label); + add_dwarf_attr (die, attr); +} + +/* Add a section offset attribute value to a DIE, an offset into the + debug_macinfo section. */ + +static inline void +add_AT_macptr (dw_die_ref die, enum dwarf_attribute attr_kind, + const char *label) +{ + dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node)); + + attr->dw_attr_next = NULL; + attr->dw_attr = attr_kind; + attr->dw_attr_val.val_class = dw_val_class_macptr; attr->dw_attr_val.v.val_lbl_id = xstrdup (label); add_dwarf_attr (die, attr); } @@ -5207,7 +5228,8 @@ static inline const char * AT_lbl (dw_attr_ref a) { gcc_assert (a && (AT_class (a) == dw_val_class_lbl_id - || AT_class (a) == dw_val_class_lbl_offset)); + || AT_class (a) == dw_val_class_lineptr + || AT_class (a) == dw_val_class_macptr)); return a->dw_attr_val.v.val_lbl_id; } @@ -5723,7 +5745,8 @@ print_die (dw_die_ref die, FILE *outfile) fprintf (outfile, "die -> <null>"); break; case dw_val_class_lbl_id: - case dw_val_class_lbl_offset: + case dw_val_class_lineptr: + case dw_val_class_macptr: fprintf (outfile, "label: %s", AT_lbl (a)); break; case dw_val_class_str: @@ -5937,7 +5960,8 @@ attr_checksum (dw_attr_ref at, struct md5_ctx *ctx, int *mark) case dw_val_class_fde_ref: case dw_val_class_lbl_id: - case dw_val_class_lbl_offset: + case dw_val_class_lineptr: + case dw_val_class_macptr: break; default: @@ -6038,7 +6062,8 @@ same_dw_val_p (dw_val_node *v1, dw_val_node *v2, int *mark) case dw_val_class_fde_ref: case dw_val_class_lbl_id: - case dw_val_class_lbl_offset: + case dw_val_class_lineptr: + case dw_val_class_macptr: return 1; default: @@ -6612,7 +6637,8 @@ size_of_die (dw_die_ref die) case dw_val_class_lbl_id: size += DWARF2_ADDR_SIZE; break; - case dw_val_class_lbl_offset: + case dw_val_class_lineptr: + case dw_val_class_macptr: size += DWARF_OFFSET_SIZE; break; case dw_val_class_str: @@ -6804,7 +6830,8 @@ value_format (dw_attr_ref a) return DW_FORM_data; case dw_val_class_lbl_id: return DW_FORM_addr; - case dw_val_class_lbl_offset: + case dw_val_class_lineptr: + case dw_val_class_macptr: return DW_FORM_data; case dw_val_class_str: return AT_string_form (a); @@ -7023,7 +7050,7 @@ output_die (dw_die_ref die) sprintf (p, "+" HOST_WIDE_INT_PRINT_HEX, a->dw_attr_val.v.val_offset); dw2_asm_output_offset (DWARF_OFFSET_SIZE, ranges_section_label, - "%s", name); + debug_ranges_section, "%s", name); *p = '\0'; } break; @@ -7105,7 +7132,8 @@ output_die (dw_die_ref die) char *sym = AT_loc_list (a)->ll_symbol; gcc_assert (sym); - dw2_asm_output_offset (DWARF_OFFSET_SIZE, sym, "%s", name); + dw2_asm_output_offset (DWARF_OFFSET_SIZE, sym, debug_loc_section, + "%s", name); } break; @@ -7115,7 +7143,8 @@ output_die (dw_die_ref die) char *sym = AT_ref (a)->die_symbol; gcc_assert (sym); - dw2_asm_output_offset (DWARF2_ADDR_SIZE, sym, "%s", name); + dw2_asm_output_offset (DWARF2_ADDR_SIZE, sym, debug_info_section, + "%s", name); } else { @@ -7131,7 +7160,8 @@ output_die (dw_die_ref die) ASM_GENERATE_INTERNAL_LABEL (l1, FDE_LABEL, a->dw_attr_val.v.val_fde_index * 2); - dw2_asm_output_offset (DWARF_OFFSET_SIZE, l1, "%s", name); + dw2_asm_output_offset (DWARF_OFFSET_SIZE, l1, debug_frame_section, + "%s", name); } break; @@ -7139,14 +7169,21 @@ output_die (dw_die_ref die) dw2_asm_output_addr (DWARF2_ADDR_SIZE, AT_lbl (a), "%s", name); break; - case dw_val_class_lbl_offset: - dw2_asm_output_offset (DWARF_OFFSET_SIZE, AT_lbl (a), "%s", name); + case dw_val_class_lineptr: + dw2_asm_output_offset (DWARF_OFFSET_SIZE, AT_lbl (a), + debug_line_section, "%s", name); + break; + + case dw_val_class_macptr: + dw2_asm_output_offset (DWARF_OFFSET_SIZE, AT_lbl (a), + debug_macinfo_section, "%s", name); break; case dw_val_class_str: if (AT_string_form (a) == DW_FORM_strp) dw2_asm_output_offset (DWARF_OFFSET_SIZE, a->dw_attr_val.v.val_str->label, + debug_str_section, "%s: \"%s\"", name, AT_string (a)); else dw2_asm_output_nstring (AT_string (a), -1, "%s", name); @@ -7180,6 +7217,7 @@ output_compilation_unit_header (void) "Length of Compilation Unit Info"); dw2_asm_output_data (2, DWARF_VERSION, "DWARF version number"); dw2_asm_output_offset (DWARF_OFFSET_SIZE, abbrev_section_label, + debug_abbrev_section, "Offset Into Abbrev. Section"); dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Pointer Size (in bytes)"); } @@ -7287,6 +7325,7 @@ output_pubnames (void) "Length of Public Names Info"); dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, + debug_info_section, "Offset of Compilation Unit Info"); dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset, "Compilation Unit Length"); @@ -7345,6 +7384,7 @@ output_aranges (void) "Length of Address Ranges Info"); dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, + debug_info_section, "Offset of Compilation Unit Info"); dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Size of Address"); dw2_asm_output_data (1, 0, "Size of Segment Descriptor"); @@ -13732,6 +13772,8 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED) DEBUG_STR_SECTION_FLAGS, NULL); debug_ranges_section = get_section (DEBUG_RANGES_SECTION, SECTION_DEBUG, NULL); + debug_frame_section = get_section (DEBUG_FRAME_SECTION, + SECTION_DEBUG, NULL); ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label, @@ -14142,11 +14184,11 @@ dwarf2out_finish (const char *filename) } if (debug_info_level >= DINFO_LEVEL_NORMAL) - add_AT_lbl_offset (comp_unit_die, DW_AT_stmt_list, - debug_line_section_label); + add_AT_lineptr (comp_unit_die, DW_AT_stmt_list, + debug_line_section_label); if (debug_info_level >= DINFO_LEVEL_VERBOSE) - add_AT_lbl_offset (comp_unit_die, DW_AT_macro_info, macinfo_section_label); + add_AT_macptr (comp_unit_die, DW_AT_macro_info, macinfo_section_label); /* Output all of the compilation units. We put the main one last so that the offsets are available to output_pubnames. */ |