common.opt (gno-split-dwarf, [...]): New switches.

gcc/ChangeLog

2012-11-06  Sterling Augustine <saugustine@google.com>
            Cary Coutant <ccoutant@google.com>

	* common.opt (gno-split-dwarf, gsplit-dwarf): New switches.
	* doc/invoke.texi (Debugging Options): Document them.
	* gcc.c (replace_extension_spec_func):  New function.
	(ASM_FINAL_SPEC): Adjust.
	(static_spec_functions): Add new field for replace-extension.
	(check_live_switch): Adjust comment.  Add case for 'g'.
	* opts.c (finish_options): Set x_debug_generate_pub_sections based on
	x_dwarf_split_debug_info.
	(common_handle_option): Add case for OPT_gsplit_dwarf.
	* dwarf2out.h (addr_table_entry_struct): Add forward declaration.
	(dw_val_struct): Add val_entry pointer.
	* dwarf2out.c: (debug_skeleton_info_section,
	debug_skeleton_abbrev_section, debug_addr_section,
	debug_skeleton_line_section, debug_str_offsets_section): New globals.
	(NOT_INDEXED, NO_INDEX_ASSIGNED): New defines.
	(indirect_string_node): New field index.
	(ate_kind): New enum with fields ate_kind_rtc, ate_kind_rtx_dtprel,
	ate_kind_label.
	(addr_table_entry): New structure and type.
	(dw_loc_list_struct): Add field begin_entry.
	(new_loc_desc): Initialize val_entry.
	(size_of_loc_descr, output_loc_operands, output_loc_operands_raw):
	Add cases for DW_OP_GNU_addr_index and DW_OP_const_index.
	(build_cfa_loc): Initialize val_entry.
	(AT_index, add_addr_table_entry, remove_addr_table_entry,
	add_AT_lbl_id): New functions.
	(add_AT_addr, add_AT_range_list): New parameter force_direct.
	(output_die_abbrevs): New function.
	(add_ranges_by_labels): New parameter force_direct.
	(output_line_info): New parameter prologue_only.
	(dtprel_bool): New enum with dtprel_false and dtprel_true.
	(dw_addr_op, new_addr_loc_descr): New functions.
	(DEBUG_DWO_INFO_SECTION, DEBUG_DWO_ABBREV_SECTION,
	DEBUG_ADDR_SECTION, DEBUG_NORM_MACINFO_SECTION,
	DEBUG_DWO_MACINFO_SECTION, DEBUG_MACINFO_SECTION,
	DEBUG_NORM_MACRO_SECTION, DEBUG_DWO_MACRO_SECTION,
	DEBUG_MACRO_SECTION, DEBUG_DWO_LINE_SECTION,
	DEBUG_DWO_LOC_SECTION, DEBUG_NORM_STR_OFFSETS_SECTION,
	DEBUG_DWO_STR_OFFSETS_SECTION, DEBUG_STR_OFFSETS_SECTION,
	DEBUG_DWO_STR_SECTION, DEBUG_NORM_STR_SECTION, DEBUG_STR_SECTION,
	DEBUG_MACRO_SECTION_FLAGS, DEBUG_SKELETON_LINE_SECTION_LABEL,
	DEBUG_SKELETON_INFO_SECTION_LABEL, DEBUG_ADDR_SECTION_LABEL
	DEBUG_SKELETON_ABBREV_SECTION_LABEL): New macros.
	(DEBUG_STR_SECTION_FLAGS): Adjust.
	(TEXT_SECTION_LABEL, COLD_TEXT_SECTION_LABEL,
	DEBUG_LINE_SECTION_LABEL, DEBUG_INFO_SECTION_LABEL,
	DEBUG_ABBREV_SECTION_LABEL, DEBUG_ADDR_SECTION_LABEL,
	DEBUG_LOC_SECTION_LABEL, DEBUG_RANGES_SECTION_LABEL,
	DEBUG_MACINFO_SECTION_LABEL, DEBUG_MACRO_SECTION_LABEL): Adjust
	indentation.
	(debug_skeleton_abbrev_section_label, debug_addr_section_label,
	debug_skeleton_line_section_label, debug_skeleton_info_section_label):
	New global variables.
	(add_AT_flag, add_AT_int, add_AT_unsigned, add_AT_double, add_AT_vec,
	add_AT_data8): Initialize val_entry.
	(add_AT_low_high_pc): New parameter force_direct. Handle
	dwarf_split_debug_info.
	(set_indirect_string, find_AT_string_form): New functions.
	(AT_string_form): Adjust to call find_AT_string_from.
	(add_AT_die_ref, add_AT_fde_ref, add_AT_loc, add_AT_list):
	Initialize val_entry.
	(addr_index_table): New global variable.
	(addr_table_entry_do_hash, addr_table_entry_eq, add_addr_table_entry,
	init_addr_table_entry, remove_addr_table_entry, index_addr_table_entry,
	remove_loc_list_addr_table_entries): New functions.
	(add_AT_addr, add_AT_lbl_id, add_AT_range_list): New parameter
	force_direct.  Handle dwarf_split_debug_info.
	(add_AT_file, add_AT_vms_delta, add_AT_lineptr, add_AT_macptr,
	add_AT_offset): Initialize val_entry.
	(UNRELOCATED_OFFSET, RELOCATED_OFFSET): New defines.
	(size_of_die): Handle dwarf_split_debug_info.
	(size_of_aranges, value_format): Call AT_class.  Check AT_index.
	(output_die_abbrevs): New function.
	(output_abbrev_section): Call output_die_abbrevs.
	(new_loc_list): Initialize begin_entry.
	(output_loc_list): Handle dwarf_split_debug_info.
	(output_range_list_offset, output_loc_list_offset,
	output_attr_index_or_value, ): New functions.
	(output_die): Fix call to dw2_asm_output_data.  Call
	output_attr_index_or_value and output_range_list_offset.
	Adjust logic around dw_val_class_str.
	(add_top_lebel_skeleton_die_attrs, get_skeleton_type_unit,
	output_skeleton_debug_sections): New functions.
	(output_comdat_type_unit, output_pubname, output_aranges): Handle
	dwarf_split_debug_info.
	(add_ranges_by_labels): New parameter force_direct.
	(mem_loc_descriptor, loc_descr): Call new_addr_loc_descr.
	(loc_list_from_tree, add_const_value_attribtue): Use dtprel_bools in
	place of generic integer.
	(dwarf2out_vms_debug_main_pointer, gen_entry_point_die, gen_label_die,
	gen_call_site_die, gen_subprogram_die, gen_variable_die,
	add_high_low_attributes): Adjust calls to add_AT_lbl_id.
	(output_macinfo_op): Adjust indirect_string_logic.
	(save_macinfo_strings): New function.
	(output_macinfo): Adjust.
	(dwarf2out_init): Handle dwarf_split_debug_info.
	(index_string, output_index_string_offset, output_index_string): New
	functions.
	(output_indirect_string): Adjust.
	(output_indirect_strings, output_addr_table_entry, output_addr_table):
	New functions.
	(resolve_addr_in_expr, hash_loc_operands): Handle DW_OP_GNU_addr_index
	and DW_OP_GNU_const_index.  Handle dwarf_split_debug_info.  Call
	remove_loc_list_addr_table_entries and remove_addr_table_entry.
	(index_location_lists): New function.
	(dwarf2out_finish): Handle dwarf_split_debug_info.  New variable
	main_comp_unit_die.  Adjust calls to add_AT_low_high_pc,
	add_ranges_by_labels, add_AT_addr, and add_AT_lineptr. Call
	save_macinfo_strings and output_indirect_strings.

include/ChangeLog

2012-10-29  Sterling Augustine <saugustine@google.com>
            Cary Coutant <ccoutant@google.com>

	* dwarf2.h (dwarf_location_list_entry_type): New enum with fields
	DW_LLE_GNU_end_of_list_entry, DW_LLE_GNU_base_address_selection_entry,
	DW_LLE_GNU_start_end_entry and DW_LLE_GNU_start_length_entry.




Co-Authored-By: Cary Coutant <ccoutant@google.com>

From-SVN: r193267
This commit is contained in:
Sterling Augustine 2012-11-06 23:15:25 +00:00 committed by Sterling Augustine
parent e808687a8c
commit 99ea153e45
9 changed files with 1437 additions and 222 deletions

View File

@ -1,3 +1,116 @@
2012-11-06 Sterling Augustine <saugustine@google.com>
Cary Coutant <ccoutant@google.com>
* common.opt (gno-split-dwarf, gsplit-dwarf): New switches.
* doc/invoke.texi (Debugging Options): Document them.
* gcc.c (replace_extension_spec_func): New function.
(ASM_FINAL_SPEC): Adjust.
(static_spec_functions): Add new field for replace-extension.
(check_live_switch): Adjust comment. Add case for 'g'.
* opts.c (finish_options): Set x_debug_generate_pub_sections based on
x_dwarf_split_debug_info.
(common_handle_option): Add case for OPT_gsplit_dwarf.
* dwarf2out.h (addr_table_entry_struct): Add forward declaration.
(dw_val_struct): Add val_entry pointer.
* dwarf2out.c: (debug_skeleton_info_section,
debug_skeleton_abbrev_section, debug_addr_section,
debug_skeleton_line_section, debug_str_offsets_section): New globals.
(NOT_INDEXED, NO_INDEX_ASSIGNED): New defines.
(indirect_string_node): New field index.
(ate_kind): New enum with fields ate_kind_rtc, ate_kind_rtx_dtprel,
ate_kind_label.
(addr_table_entry): New structure and type.
(dw_loc_list_struct): Add field begin_entry.
(new_loc_desc): Initialize val_entry.
(size_of_loc_descr, output_loc_operands, output_loc_operands_raw):
Add cases for DW_OP_GNU_addr_index and DW_OP_const_index.
(build_cfa_loc): Initialize val_entry.
(AT_index, add_addr_table_entry, remove_addr_table_entry,
add_AT_lbl_id): New functions.
(add_AT_addr, add_AT_range_list): New parameter force_direct.
(output_die_abbrevs): New function.
(add_ranges_by_labels): New parameter force_direct.
(output_line_info): New parameter prologue_only.
(dtprel_bool): New enum with dtprel_false and dtprel_true.
(dw_addr_op, new_addr_loc_descr): New functions.
(DEBUG_DWO_INFO_SECTION, DEBUG_DWO_ABBREV_SECTION,
DEBUG_ADDR_SECTION, DEBUG_NORM_MACINFO_SECTION,
DEBUG_DWO_MACINFO_SECTION, DEBUG_MACINFO_SECTION,
DEBUG_NORM_MACRO_SECTION, DEBUG_DWO_MACRO_SECTION,
DEBUG_MACRO_SECTION, DEBUG_DWO_LINE_SECTION,
DEBUG_DWO_LOC_SECTION, DEBUG_NORM_STR_OFFSETS_SECTION,
DEBUG_DWO_STR_OFFSETS_SECTION, DEBUG_STR_OFFSETS_SECTION,
DEBUG_DWO_STR_SECTION, DEBUG_NORM_STR_SECTION, DEBUG_STR_SECTION,
DEBUG_MACRO_SECTION_FLAGS, DEBUG_SKELETON_LINE_SECTION_LABEL,
DEBUG_SKELETON_INFO_SECTION_LABEL, DEBUG_ADDR_SECTION_LABEL
DEBUG_SKELETON_ABBREV_SECTION_LABEL): New macros.
(DEBUG_STR_SECTION_FLAGS): Adjust.
(TEXT_SECTION_LABEL, COLD_TEXT_SECTION_LABEL,
DEBUG_LINE_SECTION_LABEL, DEBUG_INFO_SECTION_LABEL,
DEBUG_ABBREV_SECTION_LABEL, DEBUG_ADDR_SECTION_LABEL,
DEBUG_LOC_SECTION_LABEL, DEBUG_RANGES_SECTION_LABEL,
DEBUG_MACINFO_SECTION_LABEL, DEBUG_MACRO_SECTION_LABEL): Adjust
indentation.
(debug_skeleton_abbrev_section_label, debug_addr_section_label,
debug_skeleton_line_section_label, debug_skeleton_info_section_label):
New global variables.
(add_AT_flag, add_AT_int, add_AT_unsigned, add_AT_double, add_AT_vec,
add_AT_data8): Initialize val_entry.
(add_AT_low_high_pc): New parameter force_direct. Handle
dwarf_split_debug_info.
(set_indirect_string, find_AT_string_form): New functions.
(AT_string_form): Adjust to call find_AT_string_from.
(add_AT_die_ref, add_AT_fde_ref, add_AT_loc, add_AT_list):
Initialize val_entry.
(addr_index_table): New global variable.
(addr_table_entry_do_hash, addr_table_entry_eq, add_addr_table_entry,
init_addr_table_entry, remove_addr_table_entry, index_addr_table_entry,
remove_loc_list_addr_table_entries): New functions.
(add_AT_addr, add_AT_lbl_id, add_AT_range_list): New parameter
force_direct. Handle dwarf_split_debug_info.
(add_AT_file, add_AT_vms_delta, add_AT_lineptr, add_AT_macptr,
add_AT_offset): Initialize val_entry.
(UNRELOCATED_OFFSET, RELOCATED_OFFSET): New defines.
(size_of_die): Handle dwarf_split_debug_info.
(size_of_aranges, value_format): Call AT_class. Check AT_index.
(output_die_abbrevs): New function.
(output_abbrev_section): Call output_die_abbrevs.
(new_loc_list): Initialize begin_entry.
(output_loc_list): Handle dwarf_split_debug_info.
(output_range_list_offset, output_loc_list_offset,
output_attr_index_or_value, ): New functions.
(output_die): Fix call to dw2_asm_output_data. Call
output_attr_index_or_value and output_range_list_offset.
Adjust logic around dw_val_class_str.
(add_top_lebel_skeleton_die_attrs, get_skeleton_type_unit,
output_skeleton_debug_sections): New functions.
(output_comdat_type_unit, output_pubname, output_aranges): Handle
dwarf_split_debug_info.
(add_ranges_by_labels): New parameter force_direct.
(mem_loc_descriptor, loc_descr): Call new_addr_loc_descr.
(loc_list_from_tree, add_const_value_attribtue): Use dtprel_bools in
place of generic integer.
(dwarf2out_vms_debug_main_pointer, gen_entry_point_die, gen_label_die,
gen_call_site_die, gen_subprogram_die, gen_variable_die,
add_high_low_attributes): Adjust calls to add_AT_lbl_id.
(output_macinfo_op): Adjust indirect_string_logic.
(save_macinfo_strings): New function.
(output_macinfo): Adjust.
(dwarf2out_init): Handle dwarf_split_debug_info.
(index_string, output_index_string_offset, output_index_string): New
functions.
(output_indirect_string): Adjust.
(output_indirect_strings, output_addr_table_entry, output_addr_table):
New functions.
(resolve_addr_in_expr, hash_loc_operands): Handle DW_OP_GNU_addr_index
and DW_OP_GNU_const_index. Handle dwarf_split_debug_info. Call
remove_loc_list_addr_table_entries and remove_addr_table_entry.
(index_location_lists): New function.
(dwarf2out_finish): Handle dwarf_split_debug_info. New variable
main_comp_unit_die. Adjust calls to add_AT_low_high_pc,
add_ranges_by_labels, add_AT_addr, and add_AT_lineptr. Call
save_macinfo_strings and output_indirect_strings.
2012-11-06 Gerald Pfeifer <gerald@pfeifer.com>
* config/i386/i386.c (make_dispatcher_decl): Guard with

View File

@ -2314,6 +2314,14 @@ grecord-gcc-switches
Common RejectNegative Var(dwarf_record_gcc_switches,1)
Record gcc command line switches in DWARF DW_AT_producer.
gno-split-dwarf
Common Driver RejectNegative Var(dwarf_split_debug_info,0) Init(0)
Don't generate debug information in separate .dwo files
gsplit-dwarf
Common Driver RejectNegative Var(dwarf_split_debug_info,1)
Generate debug information in separate .dwo files
gstabs
Common JoinedOrMissing Negative(gstabs+)
Generate debug information in STABS format

View File

@ -4846,6 +4846,14 @@ it reasonable to use the optimizer for programs that might have bugs.
The following options are useful when GCC is generated with the
capability for more than one debugging format.
@item -gsplit-dwarf
@opindex gsplit-dwarf
Separate as much dwarf debugging information as possible into a
separate output file with the extension .dwo. This option allows
the build system to avoid linking files with debug information. To
be useful, this option requires a debugger capable of reading .dwo
files.
@item -ggdb
@opindex ggdb
Produce debugging information for use by GDB@. This means to use the

File diff suppressed because it is too large Load Diff

View File

@ -167,11 +167,14 @@ typedef struct GTY(()) dw_vec_struct {
}
dw_vec_const;
struct addr_table_entry_struct;
/* The dw_val_node describes an attribute's value, as it is
represented internally. */
typedef struct GTY(()) dw_val_struct {
enum dw_val_class val_class;
struct addr_table_entry_struct * GTY(()) val_entry;
union dw_val_struct_union
{
rtx GTY ((tag ("dw_val_class_addr"))) val_addr;

View File

@ -267,6 +267,7 @@ static const char *compare_debug_dump_opt_spec_function (int, const char **);
static const char *compare_debug_self_opt_spec_function (int, const char **);
static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
static const char *pass_through_libs_spec_func (int, const char **);
static const char *replace_extension_spec_func (int, const char **);
/* The Specs Language
@ -447,7 +448,7 @@ ignored. White space may also appear anywhere on the left side of the
colon in these constructs, except between . or * and the corresponding
word.
The -O, -f, -m, and -W switches are handled specifically in these
The -O, -f, -g, -m, and -W switches are handled specifically in these
constructs. If another value of -O or the negated form of a -f, -m, or
-W switch is found later in the command line, the earlier switch
value is ignored, except with {S*} where S is just one letter; this
@ -480,7 +481,14 @@ proper position among the other output files. */
/* config.h can define ASM_FINAL_SPEC to run a post processor after
the assembler has run. */
#ifndef ASM_FINAL_SPEC
#define ASM_FINAL_SPEC ""
#define ASM_FINAL_SPEC \
"%{gsplit-dwarf: \n\
objcopy --extract-dwo \
%{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \
%{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} \n\
objcopy --strip-dwo \
%{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} \
}"
#endif
/* config.h can define CPP_SPEC to provide extra args to the C preprocessor
@ -1262,6 +1270,7 @@ static const struct spec_function static_spec_functions[] =
{ "compare-debug-self-opt", compare_debug_self_opt_spec_function },
{ "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
{ "pass-through-libs", pass_through_libs_spec_func },
{ "replace-extension", replace_extension_spec_func },
#ifdef EXTRA_SPEC_FUNCTIONS
EXTRA_SPEC_FUNCTIONS
#endif
@ -5814,7 +5823,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
on the command line. PREFIX_LENGTH is the length of XXX in an {XXX*}
spec, or -1 if either exact match or %* is used.
A -O switch is obsoleted by a later -O switch. A -f, -m, or -W switch
A -O switch is obsoleted by a later -O switch. A -f, -g, -m, or -W switch
whose value does not begin with "no-" is obsoleted by the same value
with the "no-", similarly for a switch with the "no-" prefix. */
@ -5851,7 +5860,7 @@ check_live_switch (int switchnum, int prefix_length)
}
break;
case 'W': case 'f': case 'm':
case 'W': case 'f': case 'm': case 'g':
if (! strncmp (name + 1, "no-", 3))
{
/* We have Xno-YYY, search for XYYY. */
@ -8380,3 +8389,33 @@ pass_through_libs_spec_func (int argc, const char **argv)
}
return prepended;
}
/* %:replace-extension spec function. Replaces the extension of the
first argument with the second argument. */
const char *
replace_extension_spec_func (int argc, const char **argv)
{
char *name;
char *p;
char *result;
int i;
if (argc != 2)
fatal_error ("too few arguments to %%:replace-extension");
name = xstrdup (argv[0]);
for (i = strlen(name) - 1; i >= 0; i--)
if (IS_DIR_SEPARATOR (name[i]))
break;
p = strrchr (name + i + 1, '.');
if (p != NULL)
*p = '\0';
result = concat (name, argv[1], NULL);
free (name);
return result;
}

View File

@ -829,6 +829,9 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
opts->x_param_values, opts_set->x_param_values);
/* The -gsplit-dwarf option requires -gpubnames. */
if (opts->x_dwarf_split_debug_info)
opts->x_debug_generate_pub_sections = 1;
}
#define LEFT_COLUMN 27
@ -1705,6 +1708,11 @@ common_handle_option (struct gcc_options *opts,
set_debug_level (DWARF2_DEBUG, false, "", opts, opts_set, loc);
break;
case OPT_gsplit_dwarf:
set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, "", opts, opts_set,
loc);
break;
case OPT_ggdb:
set_debug_level (NO_DEBUG, 2, arg, opts, opts_set, loc);
break;

View File

@ -1,3 +1,11 @@
2012-10-29 Sterling Augustine <saugustine@google.com>
Cary Coutant <ccoutant@google.com>
* dwarf2.h (dwarf_location_list_entry_type): New enum with fields
DW_LLE_GNU_end_of_list_entry, DW_LLE_GNU_base_address_selection_entry,
DW_LLE_GNU_start_end_entry and DW_LLE_GNU_start_length_entry.
2012-10-08 Jason Merrill <jason@redhat.com>
* demangle.h (enum demangle_component_type): Add

View File

@ -259,6 +259,17 @@ enum dwarf_line_number_hp_sfc_ops
DW_LNE_HP_SFC_associate = 3
};
/* Type codes for location list entries.
Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
enum dwarf_location_list_entry_type
{
DW_LLE_GNU_end_of_list_entry = 0,
DW_LLE_GNU_base_address_selection_entry = 1,
DW_LLE_GNU_start_end_entry = 2,
DW_LLE_GNU_start_length_entry = 3
};
#define DW_CIE_ID 0xffffffff
#define DW64_CIE_ID 0xffffffffffffffffULL
#define DW_CIE_VERSION 1