I'm running the gdb testsuite with the debug-early branch compiler, and
fixing regressions.
gdb.base/label.c was causing gdb to ICE because we were generating
multiple DW_TAG_label's for the same DECL. Consequently, I have fixed
gen_label_die to handle multiple calls with the same DECL.
By the way Jason, is there any reason we previously called
equate_decl_number_to_die() only for abstract instances?:
if (DECL_ABSTRACT_P (decl))
equate_decl_number_to_die (decl, lbl_die);
else
{
insn = DECL_RTL_IF_SET (decl);
I was unable to find the original reasoning, because the original patch
setting this was from the 1990s, and it came en-masse when dwarf2out.c
was contributed. I don't see anything else in dwarf2out.c doing a
lookup_decl_die() on a LABEL_DECL, so I don't even know why the
equate_decl_number_to_die() is even there.
Anyways, in the immortal words of Shaggy... "wasn't me", so I'm leaving
this bit untouched.
Tested on x86-64 Linux with the gdb regression suite.
Committed to branch.
Aldy
commit 8fea2b5c37026b3121afc0a98630542bb9a733dd
Author: Aldy Hernandez <al...@redhat.com>
Date: Wed Mar 18 09:55:38 2015 -0700
Cache DW_TAG_label's if appropriate.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 30c6cc6..92f4903 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19725,14 +19725,20 @@ static void
gen_label_die (tree decl, dw_die_ref context_die)
{
tree origin = decl_ultimate_origin (decl);
- dw_die_ref lbl_die = new_die (DW_TAG_label, context_die, decl);
+ dw_die_ref lbl_die = lookup_decl_die (decl);
rtx insn;
char label[MAX_ARTIFICIAL_LABEL_BYTES];
- if (origin != NULL)
- add_abstract_origin_attribute (lbl_die, origin);
- else
- add_name_and_src_coords_attributes (lbl_die, decl);
+ if (!lbl_die)
+ {
+ lbl_die = new_die (DW_TAG_label, context_die, decl);
+ equate_decl_number_to_die (decl, lbl_die);
+
+ if (origin != NULL)
+ add_abstract_origin_attribute (lbl_die, origin);
+ else
+ add_name_and_src_coords_attributes (lbl_die, decl);
+ }
if (DECL_ABSTRACT_P (decl))
equate_decl_number_to_die (decl, lbl_die);