From 73861a4142c04fdeb77b72f8c534e2e967a69bae Mon Sep 17 00:00:00 2001 From: Paul Koning Date: Thu, 31 Jan 2013 13:29:15 -0500 Subject: [PATCH] re PR debug/55059 (DWARF missing concrete class definition) PR debug/55059 PR debug/54508 * dwarf2out.c (prune_unused_types_mark): Mark all of parent's children if parent is a class. (prune_unused_types_prune): Don't add DW_AT_declaration. From-SVN: r195622 --- gcc/ChangeLog | 8 ++++++++ gcc/dwarf2out.c | 23 ++++++----------------- gcc/testsuite/g++.dg/debug/dwarf2/localclass1.C | 6 +++--- gcc/testsuite/g++.dg/debug/dwarf2/localclass2.C | 6 +++--- gcc/testsuite/g++.dg/debug/dwarf2/pr54508.C | 17 ++++++----------- 5 files changed, 26 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 522d6af..b3c1c52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-01-31 Paul Koning + + PR debug/55059 + PR debug/54508 + * dwarf2out.c (prune_unused_types_mark): Mark all of parent's + children if parent is a class. + (prune_unused_types_prune): Don't add DW_AT_declaration. + 2013-01-31 Richard Biener PR tree-optimization/56157 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 3106dd9..75fea20 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21905,9 +21905,11 @@ prune_unused_types_mark (dw_die_ref die, int dokids) prune_unused_types_mark_generic_parms_dies (die); /* We also have to mark its parents as used. - (But we don't want to mark our parents' kids due to this.) */ + (But we don't want to mark our parent's kids due to this, + unless it is a class.) */ if (die->die_parent) - prune_unused_types_mark (die->die_parent, 0); + prune_unused_types_mark (die->die_parent, + class_scope_p (die->die_parent)); /* Mark any referenced nodes. */ prune_unused_types_walk_attribs (die); @@ -22082,7 +22084,6 @@ static void prune_unused_types_prune (dw_die_ref die) { dw_die_ref c; - int pruned = 0; gcc_assert (die->die_mark); prune_unused_types_update_strings (die); @@ -22105,25 +22106,13 @@ prune_unused_types_prune (dw_die_ref die) prev->die_sib = c->die_sib; die->die_child = prev; } - pruned = 1; - goto finished; + return; } if (c != prev->die_sib) - { - prev->die_sib = c; - pruned = 1; - } + prev->die_sib = c; prune_unused_types_prune (c); } while (c != die->die_child); - - finished: - /* If we pruned children, and this is a class, mark it as a - declaration to inform debuggers that this is not a complete - class definition. */ - if (pruned && die->die_mark == 1 && class_scope_p (die) - && ! is_declaration_die (die)) - add_AT_flag (die, DW_AT_declaration, 1); } /* Remove dies representing declarations that we never use. */ diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/localclass1.C b/gcc/testsuite/g++.dg/debug/dwarf2/localclass1.C index c7c55e1..6eb87bb 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/localclass1.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/localclass1.C @@ -59,11 +59,11 @@ main () // { dg-final { scan-assembler "foo\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "staticfn1\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "staticfn2\[^\n\r\]*DW_AT_name" } } -// { dg-final { scan-assembler-not "staticfn3\[^\n\r\]*DW_AT_name" } } -// { dg-final { scan-assembler-not "staticfn4\[^\n\r\]*DW_AT_name" } } +// { dg-final { scan-assembler "staticfn3\[^\n\r\]*DW_AT_name" } } +// { dg-final { scan-assembler "staticfn4\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler-not "staticfn5\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler-not "staticfn6\[^\n\r\]*DW_AT_name" } } -// { dg-final { scan-assembler-not "method1\[^\n\r\]*DW_AT_name" } } +// { dg-final { scan-assembler "method1\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "arg1\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "arg2\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "arg3\[^\n\r\]*DW_AT_name" } } diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/localclass2.C b/gcc/testsuite/g++.dg/debug/dwarf2/localclass2.C index 6e9a066..475f02b 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/localclass2.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/localclass2.C @@ -59,11 +59,11 @@ main () // { dg-final { scan-assembler "foo\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "staticfn1\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "staticfn2\[^\n\r\]*DW_AT_name" } } -// { dg-final { scan-assembler-not "staticfn3\[^\n\r\]*DW_AT_name" } } -// { dg-final { scan-assembler-not "staticfn4\[^\n\r\]*DW_AT_name" } } +// { dg-final { scan-assembler "staticfn3\[^\n\r\]*DW_AT_name" } } +// { dg-final { scan-assembler "staticfn4\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler-not "staticfn5\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler-not "staticfn6\[^\n\r\]*DW_AT_name" } } -// { dg-final { scan-assembler-not "method1\[^\n\r\]*DW_AT_name" } } +// { dg-final { scan-assembler "method1\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "arg1\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "arg2\[^\n\r\]*DW_AT_name" } } // { dg-final { scan-assembler "arg3\[^\n\r\]*DW_AT_name" } } diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr54508.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr54508.C index 4efc7ec..f1c77c5 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/pr54508.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr54508.C @@ -2,16 +2,12 @@ // { dg-do compile } // { dg-options "-g2 -dA -fno-merge-debug-strings" } -// { dg-final { scan-assembler-not "\"cbase\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } -// { dg-final { scan-assembler "\"c\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name\[\r\n\]+\[\^\r\n\]+\[\r\n\]+\[\^\r\n\]+\[\r\n\]+\[\^#;/!|@\]+\[#;/!|@\]+ +DW_AT_decl_line\[\r\n\]+\[\^#;/!|@\]+\[#;/!|@\]+ +DW_AT_declaration" } } -// { dg-final { scan-assembler-not "\"OPCODE\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } -// { dg-final { scan-assembler-not "\"bi\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } -// { dg-final { scan-assembler-not "\"si\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } -// { dg-final { scan-assembler "\"s\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } -// { dg-final { scan-assembler-not "\"s\\\\0\"\[^#;/!|@\]+\[#;/!|@\]+ +DW_AT_name\[\r\n\]+\[\^\r\n\]+\[\r\n\]+\[\^\r\n\]+\[\r\n\]+\[\^#;/!|@\]+\[#;/!|@\]+ +DW_AT_decl_line\[\r\n\]+\[ \t\]+\[#;/!|@\]+ +DW_AT_declaration" } } +// { dg-final { scan-assembler "\"cbase\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } +// { dg-final { scan-assembler "\"OPCODE\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } +// { dg-final { scan-assembler "\"bi\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } +// { dg-final { scan-assembler "\"si\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } // { dg-final { scan-assembler "\"f1\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } -// { dg-final { scan-assembler "\"u\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name\[\r\n\]+\[\^\r\n\]+\[\r\n\]+\[\^\r\n\]+\[\r\n\]+\[\^#;/!|@\]+\[#;/!|@\]+ +DW_AT_decl_line\[\r\n\]+\[^#;/!|@\]+\[#;/!|@\]+ +DW_AT_declaration" } } -// { dg-final { scan-assembler-not "\"f2\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } +// { dg-final { scan-assembler "\"f2\\\\0\"\[ \t\]+\[#;/!|@\]+ +DW_AT_name" } } // { dg-final { scan-assembler-not "\"nc\\\\0\"\[ \t\]+\# +DW_AT_name" } } class cbase @@ -64,9 +60,8 @@ extern void send (int, int, const void *, int); void test (int src) { int cookie = 1; - static struct s ss; - send(src, c::OPCODE, c::testc (), cookie); + send(src, c::OPCODE, s::tests (), cookie); send(src, c::OPCODE, u::testu (), cookie); send(src, c::OPCODE, n::ntest (), cookie); } -- 2.7.4