This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for debug/27473 - new tests failing for darwin/stabs
- From: Daniel Jacobowitz <drow at false dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 22 Jul 2006 23:28:35 -0400
- Subject: PATCH for debug/27473 - new tests failing for darwin/stabs
This patch extends Aldy's DWARF-2 -feliminate-unused-debug-types
fix to work for stabs -feliminate-unused-debug-symbols too (the two options
really are basically the same despite the different implementations; it's a
pity there's two spellings).
I tested this by hand with -gstabs+ -feliminate-unused-debug-symbols on the
previously failing testcase, and also regtested it on x86_64-pc-linux-gnu.
That's not much coverage, but I think the patch is correct and safe, so OK
to commit? Or, someone else is invited to test it on Darwin :-)
--
Daniel Jacobowitz
CodeSourcery
2006-07-22 Daniel Jacobowitz <dan@codesourcery.com>
PR debug/27473
* dbxout.c (output_used_types_helper, output_used_types): New.
(dbxout_symbol): Call output_used_types.
Index: dbxout.c
===================================================================
--- dbxout.c (revision 115676)
+++ dbxout.c (working copy)
@@ -2369,6 +2369,38 @@ dbxout_expand_expr (tree expr)
}
}
+/* Helper function for output_used_types. Queue one entry from the
+ used types hash to be output. */
+
+static int
+output_used_types_helper (void **slot, void *data ATTRIBUTE_UNUSED)
+{
+ tree type = *slot;
+
+ if ((TREE_CODE (type) == RECORD_TYPE
+ || TREE_CODE (type) == UNION_TYPE
+ || TREE_CODE (type) == QUAL_UNION_TYPE
+ || TREE_CODE (type) == ENUMERAL_TYPE)
+ && TYPE_STUB_DECL (type)
+ && DECL_P (TYPE_STUB_DECL (type))
+ && ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
+ debug_queue_symbol (TYPE_STUB_DECL (type));
+ else if (TYPE_NAME (type)
+ && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
+ debug_queue_symbol (TYPE_NAME (type));
+
+ return 1;
+}
+
+/* Force all types used by this function to be output in debug
+ information. */
+static void
+output_used_types (void)
+{
+ if (cfun && cfun->used_types_hash)
+ htab_traverse (cfun->used_types_hash, output_used_types_helper, NULL);
+}
+
/* Output a .stabs for the symbol defined by DECL,
which must be a ..._DECL node in the normal namespace.
It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
@@ -2482,6 +2514,9 @@ dbxout_symbol (tree decl, int local ATTR
|| GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
break;
+ if (flag_debug_only_used_symbols)
+ output_used_types ();
+
dbxout_begin_complex_stabs ();
stabstr_I (DECL_ASSEMBLER_NAME (decl));
stabstr_S (TREE_PUBLIC (decl) ? ":F" : ":f");