+2012-10-23 Paul Koning <ni1d@arrl.net>
+
+ PR debug/54508
+ * dwarf2out.c (prune_unused_types_prune): If pruning a class and
+ not all its children were marked, add DW_AT_declaration flag.
+
2012-10-23 Ian Bolton <ian.bolton@arm.com>
James Greenhalgh <james.greenhalgh@arm.com>
Jim MacArthur <jim.macarthur@arm.com>
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);
prev->die_sib = c->die_sib;
die->die_child = prev;
}
- return;
+ pruned = 1;
+ goto finished;
}
if (c != prev->die_sib)
- prev->die_sib = c;
+ {
+ prev->die_sib = c;
+ pruned = 1;
+ }
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))
+ add_AT_flag (die, DW_AT_declaration, 1);
}
/* Remove dies representing declarations that we never use. */
--- /dev/null
+// PR debug/54508
+// { 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 "\"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-not "\"nc\\\\0\"\[ \t\]+\# DW_AT_name" } }
+
+class cbase
+
+{
+public:
+ static int si;
+ int bi;
+};
+
+class c : public cbase
+
+{
+public:
+ enum
+ {
+ OPCODE = 251
+ };
+ int i ;
+ static const char *testc (void) { return "foo"; }
+};
+
+struct s
+{
+ int f1;
+ static const char *tests (void) { return "test"; }
+};
+
+union u
+{
+ int f2;
+ double d;
+ static const char *testu (void) { return "test union"; }
+};
+
+namespace n
+{
+ const char *ntest (void) { return "test n"; }
+
+ class nc
+ {
+ public:
+ int i;
+ static int sj;
+ };
+}
+
+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, u::testu (), cookie);
+ send(src, c::OPCODE, n::ntest (), cookie);
+}