Hi - I'm working on a little patch that extends the data produced for the little-used (?) -g1 mode. Normally, this produces very little DWARF data (basically just function declaration locus, PC range, and basic backtrace-enabling data). Compared to normal -g (== -g2) mode, this is very small.
It would be desirable to have an additional level in between -g1 and -g2, one that also emits just enough data to decode ordinary functions' parameters at the entry point. No locals or blocks for what's inside the function, such as data for inlined functions. Just enough to generate call-graphy traces. The attached patch is a stab in the dim, and eyeballing the results seems to accomplish the goal (as tested by systemtap gaily tracing function call graphs with parameters), at the cost of enlarging the debug data. For a fedoraish linux kernel (vmlinux), I get these numbers: vmlinux size stripped 18299708 old-style -g1 23307848 <-- new -g1 58265716 <-- -g2 93232955 The stab-in-the-dim -g1 is ten times bigger than the old -g1, but half the size of -g2. I am certain that a "stab-in-the-bright" version should be smaller, if a wise one treaded upon dwarf2out.c more gingerly than my stomp of a hack. The basic question though is whether there is interest here for this sort of -g1.5 mode. We could ... - ignore the value of this enlarged -g1 and forget the idea - adopt the enlarged definition for -g1 and live with the size penalty - introduce a new -g1.5 (between DINFO_LEVEL_TERSE and DINFO_LEVEL_NORMAL) to select the enlarged definition (syntax suggestions wanted) Suggestions please? - FChE diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 69cdb03..eb2116c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -13437,7 +13437,7 @@ dwarf2out_abstract_function (tree decl) /* Be sure we've emitted the in-class declaration DIE (if any) first, so we don't get confused by DECL_ABSTRACT. */ - if (debug_info_level > DINFO_LEVEL_TERSE) + if (debug_info_level >= DINFO_LEVEL_TERSE) { context = decl_class_context (decl); if (context) @@ -13520,7 +13520,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) if (!declaration && !origin && !old_die && DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)) && !class_or_namespace_scope_p (context_die) - && debug_info_level > DINFO_LEVEL_TERSE) + && debug_info_level >= DINFO_LEVEL_TERSE) old_die = force_decl_die (decl); if (origin != NULL) @@ -13592,7 +13592,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) add_AT_flag (subr_die, DW_AT_external, 1); add_name_and_src_coords_attributes (subr_die, decl); - if (debug_info_level > DINFO_LEVEL_TERSE) + if (debug_info_level >= DINFO_LEVEL_TERSE) { add_prototyped_attribute (subr_die, TREE_TYPE (decl)); add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)), @@ -13740,7 +13740,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) /* In the case where we are describing a mere function declaration, all we need to do here (and all we *can* do here) is to describe the *types* of its formal parameters. */ - if (debug_info_level <= DINFO_LEVEL_TERSE) + if (debug_info_level < DINFO_LEVEL_TERSE) ; else if (declaration) gen_formal_types_die (decl, subr_die);