aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2007-04-17 06:19:36 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2007-04-17 06:19:36 +0000
commit39ef65923c5943c0f04193463dee8eb46d249f12 (patch)
tree4e1b0eb361d1ad81f81cf74c4941675abea36a99 /gcc/dwarf2out.c
parentfc6827fe9fe4d3c72013462bf2d9d658bf73d7bb (diff)
downloadgcc-39ef65923c5943c0f04193463dee8eb46d249f12.zip
gcc-39ef65923c5943c0f04193463dee8eb46d249f12.tar.gz
gcc-39ef65923c5943c0f04193463dee8eb46d249f12.tar.bz2
invoke.texi (Debugging Options): Add documentation for the -femit-struct-debug options...
./: * doc/invoke.texi (Debugging Options): Add documentation for the -femit-struct-debug options -femit-struct-debug-baseonly, -femit-struct-debug-reduced, and -femit-struct-debug-detailed[=...]. * c-opts.c (c_common_handle_option): Add OPT_femit_struct_debug_baseonly, OPT_femit_struct_debug_reduced, and OPT_femit_struct_debug_detailed_. * c.opt: Add specifications for -femit-struct-debug-baseonly, -femit-struct-debug-reduced, and -femit-struct-debug-detailed[=...]. * opts.c (set_struct_debug_option): Parse the -femit-struct-debug-... options. * opts.c (matches_main_base, main_input_basename, main_input_baselength, base_of_path, matches_main_base): Add variables and functions to compare header base name to compilation unit base name. * opts.c (should_emit_struct_debug): Add to determine to emit a structure based on the option. (dump_struct_debug) Also disabled function to debug this function. * opts.c (handle_options): Save the base name of the compilation unit. * langhooks-def.h (LANG_HOOKS_GENERIC_TYPE_P): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add. This hook indicates if a type is generic. Set it by default to "never generic". * langhooks.h (struct lang_hooks_for_types): Add a new hook to determine if a struct type is generic or not. * cp/cp-tree.h (class_tmpl_impl_spec_p): Declare a C++ hook. * cp/tree.c (class_tmpl_impl_spec_p): Implement the C++ hook. * cp/cp-lang.c (LANG_HOOKS_GENERIC_TYPE_P): Override null C hook with live C++ hook. * flags.h (enum debug_info_usage): Add an enumeration to describe a program's use of a structure type. * dwarf2out.c (gen_struct_or_union_type_die): Add a new parameter to indicate the program's usage of the type. Filter structs based on the -femit-struct-debug-... specification. (gen_type_die): Split into two routines, gen_type_die and gen_type_die_with_usage. gen_type_die is now a wrapper that assumes direct usage. (gen_type_die_with_usage): Replace calls to gen_type_die with gen_type_die_with_usage adding the program usage of the referenced type. (dwarf2out_imported_module_or_decl): Suppress struct debug information using should_emit_struct_debug when appropriate. testsuite/: * g++.dg/other/fesd-any.C: Test -femit-struct-debug-detailed=any. * g++.dg/other/fesd-any.h: Test -femit-struct-debug-detailed=any. * g++.dg/other/fesd-baseonly.C: Test -femit-struct-debug-baseonly. * g++.dg/other/fesd-baseonly.h: Test -femit-struct-debug-baseonly. * g++.dg/other/fesd-none.C: Test -femit-struct-debug-detailed=none. * g++.dg/other/fesd-none.h: Test -femit-struct-debug-detailed=none. * g++.dg/other/fesd-reduced.C: Test -femit-struct-debug-reduced. * g++.dg/other/fesd-reduced.h: Test -femit-struct-debug-reduced. * g++.dg/other/fesd-sys.C: Test -femit-struct-debug-detailed=sys. * g++.dg/other/fesd-sys.h: Test -femit-struct-debug-detailed=sys. * g++.dg/other/fesd.h: Common to -femit-struct-debug-... tests. * gcc.dg/fesd-any.c: Test -femit-struct-debug-detailed=any. * gcc.dg/fesd-any.h: Test -femit-struct-debug-detailed=any. * gcc.dg/fesd-baseonly.c: Test -femit-struct-debug-baseonly. * gcc.dg/fesd-baseonly.h: Test -femit-struct-debug-baseonly. * gcc.dg/fesd-none.c: Test -femit-struct-debug-detailed=none. * gcc.dg/fesd-none.h: Test -femit-struct-debug-detailed=none. * gcc.dg/fesd-reduced.c: Test -femit-struct-debug-reduced. * gcc.dg/fesd-reduced.h: Test -femit-struct-debug-reduced. * gcc.dg/fesd-sys.c: Test -femit-struct-debug-detailed=sys. * gcc.dg/fesd-sys.h: Test -femit-struct-debug-detailed=sys. * gcc.dg/fesd.h: Common to -femit-struct-debug-... tests. From-SVN: r123909
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index cbaf063..bb70c29 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4236,7 +4236,8 @@ static void gen_ptr_to_mbr_type_die (tree, dw_die_ref);
static dw_die_ref gen_compile_unit_die (const char *);
static void gen_inheritance_die (tree, tree, dw_die_ref);
static void gen_member_die (tree, dw_die_ref);
-static void gen_struct_or_union_type_die (tree, dw_die_ref);
+static void gen_struct_or_union_type_die (tree, dw_die_ref,
+ enum debug_info_usage);
static void gen_subroutine_type_die (tree, dw_die_ref);
static void gen_typedef_die (tree, dw_die_ref);
static void gen_type_die (tree, dw_die_ref);
@@ -12604,7 +12605,8 @@ gen_member_die (tree type, dw_die_ref context_die)
member DIEs needed by later specification DIEs. */
static void
-gen_struct_or_union_type_die (tree type, dw_die_ref context_die)
+gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
+ enum debug_info_usage usage)
{
dw_die_ref type_die = lookup_type_die (type);
dw_die_ref scope_die = 0;
@@ -12613,6 +12615,7 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die)
&& (! TYPE_STUB_DECL (type)
|| ! TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type))));
int ns_decl = (context_die && context_die->die_tag == DW_TAG_namespace);
+ complete = complete && should_emit_struct_debug (type, usage);
if (type_die && ! complete)
return;
@@ -12749,7 +12752,8 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
/* Generate a type description DIE. */
static void
-gen_type_die (tree type, dw_die_ref context_die)
+gen_type_die_with_usage (tree type, dw_die_ref context_die,
+ enum debug_info_usage usage)
{
int need_pop;
@@ -12797,16 +12801,19 @@ gen_type_die (tree type, dw_die_ref context_die)
/* For these types, all that is required is that we output a DIE (or a
set of DIEs) to represent the "basis" type. */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_IND_USE);
break;
case OFFSET_TYPE:
/* This code is used for C++ pointer-to-data-member types.
Output a description of the relevant class type. */
- gen_type_die (TYPE_OFFSET_BASETYPE (type), context_die);
+ gen_type_die_with_usage (TYPE_OFFSET_BASETYPE (type), context_die,
+ DINFO_USAGE_IND_USE);
/* Output a description of the type of the object pointed to. */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_IND_USE);
/* Now output a DIE to represent this pointer-to-data-member type
itself. */
@@ -12815,13 +12822,15 @@ gen_type_die (tree type, dw_die_ref context_die)
case FUNCTION_TYPE:
/* Force out return type (in case it wasn't forced out already). */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_DIR_USE);
gen_subroutine_type_die (type, context_die);
break;
case METHOD_TYPE:
/* Force out return type (in case it wasn't forced out already). */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_DIR_USE);
gen_subroutine_type_die (type, context_die);
break;
@@ -12847,7 +12856,7 @@ gen_type_die (tree type, dw_die_ref context_die)
&& AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
&& ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
{
- gen_type_die (TYPE_CONTEXT (type), context_die);
+ gen_type_die_with_usage (TYPE_CONTEXT (type), context_die, usage);
if (TREE_ASM_WRITTEN (type))
return;
@@ -12871,7 +12880,7 @@ gen_type_die (tree type, dw_die_ref context_die)
gen_enumeration_type_die (type, context_die);
}
else
- gen_struct_or_union_type_die (type, context_die);
+ gen_struct_or_union_type_die (type, context_die, usage);
if (need_pop)
pop_decl_scope ();
@@ -12900,6 +12909,12 @@ gen_type_die (tree type, dw_die_ref context_die)
TREE_ASM_WRITTEN (type) = 1;
}
+static void
+gen_type_die (tree type, dw_die_ref context_die)
+{
+ gen_type_die_with_usage (type, context_die, DINFO_USAGE_DIR_USE);
+}
+
/* Generate a DIE for a tagged type instantiation. */
static void
@@ -13496,7 +13511,11 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
if (!context)
scope_die = comp_unit_die;
else if (TYPE_P (context))
+ {
+ if (!should_emit_struct_debug (context, DINFO_USAGE_DIR_USE))
+ return;
scope_die = force_type_die (context);
+ }
else
scope_die = force_decl_die (context);
@@ -13522,7 +13541,12 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
if (TYPE_CONTEXT (type))
if (TYPE_P (TYPE_CONTEXT (type)))
+ {
+ if (!should_emit_struct_debug (TYPE_CONTEXT (type),
+ DINFO_USAGE_DIR_USE))
+ return;
type_context_die = force_type_die (TYPE_CONTEXT (type));
+ }
else
type_context_die = force_decl_die (TYPE_CONTEXT (type));
else