From a26ff5b54967f1e7873a8e34c4194ffe568cc34d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 11 Oct 2016 12:56:49 +0000 Subject: [PATCH] dwarf2out.c (DEBUG_STR_OFFSETS_SECTION): Remove conditional. 2016-10-11 Richard Biener * dwarf2out.c (DEBUG_STR_OFFSETS_SECTION): Remove conditional. (init_sections_and_labels): Use DEBUG_DWO_STR_OFFSETS_SECTION. (verify_die): New function. (dwarf2out_finish): Call it. (output_line_info): Handle case of -gsplit-dwarf without DWARF2_ASM_LINE_DEBUG_INFO. From-SVN: r240992 --- gcc/ChangeLog | 9 +++++++ gcc/dwarf2out.c | 62 +++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03c5fa570ef..3c15156a402 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-10-11 Richard Biener + + * dwarf2out.c (DEBUG_STR_OFFSETS_SECTION): Remove conditional. + (init_sections_and_labels): Use DEBUG_DWO_STR_OFFSETS_SECTION. + (verify_die): New function. + (dwarf2out_finish): Call it. + (output_line_info): Handle case of -gsplit-dwarf without + DWARF2_ASM_LINE_DEBUG_INFO. + 2016-10-11 Richard Biener PR debug/77931 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 4a3df339df2..3f7833ff9cd 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3538,12 +3538,11 @@ new_addr_loc_descr (rtx addr, enum dtprel_bool dtprel) ((debug_generate_pub_sections == 2) \ ? ".debug_gnu_pubtypes" : ".debug_pubtypes") #endif -#define DEBUG_NORM_STR_OFFSETS_SECTION ".debug_str_offsets" -#define DEBUG_DWO_STR_OFFSETS_SECTION ".debug_str_offsets.dwo" #ifndef DEBUG_STR_OFFSETS_SECTION -#define DEBUG_STR_OFFSETS_SECTION \ - (!dwarf_split_debug_info \ - ? (DEBUG_NORM_STR_OFFSETS_SECTION) : (DEBUG_DWO_STR_OFFSETS_SECTION)) +#define DEBUG_STR_OFFSETS_SECTION ".debug_str_offsets" +#endif +#ifndef DEBUG_DWO_STR_OFFSETS_SECTION +#define DEBUG_DWO_STR_OFFSETS_SECTION ".debug_str_offsets.dwo" #endif #ifndef DEBUG_STR_DWO_SECTION #define DEBUG_STR_DWO_SECTION ".debug_str.dwo" @@ -5835,6 +5834,41 @@ debug_dwarf (void) print_die (comp_unit_die (), stderr); } +/* Verify the DIE tree structure. */ + +DEBUG_FUNCTION void +verify_die (dw_die_ref die) +{ + gcc_assert (!die->die_mark); + if (die->die_parent == NULL + && die->die_sib == NULL) + return; + /* Verify the die_sib list is cyclic. */ + dw_die_ref x = die; + do + { + x->die_mark = 1; + x = x->die_sib; + } + while (x && !x->die_mark); + gcc_assert (x == die); + x = die; + do + { + /* Verify all dies have the same parent. */ + gcc_assert (x->die_parent == die->die_parent); + if (x->die_child) + { + /* Verify the child has the proper parent and recurse. */ + gcc_assert (x->die_child->die_parent == x); + verify_die (x->die_child); + } + x->die_mark = 0; + x = x->die_sib; + } + while (x && x->die_mark); +} + /* Sanity checks on DIEs. */ static void @@ -10710,6 +10744,7 @@ output_one_line_info_table (dw_line_info_table *table) static void output_line_info (bool prologue_only) { + static unsigned int generation; char l1[MAX_ARTIFICIAL_LABEL_BYTES], l2[MAX_ARTIFICIAL_LABEL_BYTES]; char p1[MAX_ARTIFICIAL_LABEL_BYTES], p2[MAX_ARTIFICIAL_LABEL_BYTES]; /* We don't support DWARFv5 line tables yet. */ @@ -10717,10 +10752,10 @@ output_line_info (bool prologue_only) bool saw_one = false; int opc; - ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL, 0); - ASM_GENERATE_INTERNAL_LABEL (l2, LINE_NUMBER_END_LABEL, 0); - ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL, 0); - ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL, 0); + ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL, generation); + ASM_GENERATE_INTERNAL_LABEL (l2, LINE_NUMBER_END_LABEL, generation); + ASM_GENERATE_INTERNAL_LABEL (p1, LN_PROLOG_AS_LABEL, generation); + ASM_GENERATE_INTERNAL_LABEL (p2, LN_PROLOG_END_LABEL, generation++); if (!XCOFF_DEBUGGING_INFO) { @@ -25590,7 +25625,7 @@ init_sections_and_labels (void) SECTION_DEBUG | SECTION_EXCLUDE, NULL); ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_line_section_label, DEBUG_SKELETON_LINE_SECTION_LABEL, 0); - debug_str_offsets_section = get_section (DEBUG_STR_OFFSETS_SECTION, + debug_str_offsets_section = get_section (DEBUG_DWO_STR_OFFSETS_SECTION, SECTION_DEBUG | SECTION_EXCLUDE, NULL); ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_info_section_label, @@ -27844,6 +27879,13 @@ dwarf2out_finish (const char *) /* Flush out any latecomers to the limbo party. */ flush_limbo_die_list (); + if (flag_checking) + { + verify_die (comp_unit_die ()); + for (limbo_die_node *node = cu_die_list; node; node = node->next) + verify_die (node->die); + } + /* We shouldn't have any symbols with delayed asm names for DIEs generated after early finish. */ gcc_assert (deferred_asm_name == NULL); -- 2.30.2