bd2b9f1e2d
This patch introduces an option to enable the generation of location views along with location lists. The exact format depends on the DWARF version: it can be a separate attribute (DW_AT_GNU_locviews) or (DW_LLE_view_pair) entries in DWARF5+ loclists. Line number tables are also affected. If the assembler is found, at compiler build time, to support .loc views, we use them and assembler-computed view labels, otherwise we output compiler-generated line number programs with conservatively-computed view labels. In either case, we output view information next to line number changes when verbose assembly output is requested. This patch requires an LVU patch that modifies the exported API of final_scan_insn. It also expects the entire SFN patchset to be installed first, although SFN is not a requirement for LVU. for include/ChangeLog * dwarf2.def (DW_AT_GNU_locviews): New. * dwarf2.h (enum dwarf_location_list_entry_type): Add DW_LLE_GNU_view_pair. (DW_LLE_view_pair): Define. for gcc/ChangeLog * common.opt (gvariable-location-views): New. (gvariable-location-views=incompat5): New. * config.in: Rebuilt. * configure: Rebuilt. * configure.ac: Test assembler for view support. * dwarf2asm.c (dw2_asm_output_symname_uleb128): New. * dwarf2asm.h (dw2_asm_output_symname_uleb128): Declare. * dwarf2out.c (var_loc_view): New typedef. (struct dw_loc_list_struct): Add vl_symbol, vbegin, vend. (dwarf2out_locviews_in_attribute): New. (dwarf2out_locviews_in_loclist): New. (dw_val_equal_p): Compare val_view_list of dw_val_class_view_lists. (enum dw_line_info_opcode): Add LI_adv_address. (struct dw_line_info_table): Add view. (RESET_NEXT_VIEW, RESETTING_VIEW_P): New macros. (DWARF2_ASM_VIEW_DEBUG_INFO): Define default. (zero_view_p): New variable. (ZERO_VIEW_P): New macro. (output_asm_line_debug_info): New. (struct var_loc_node): Add view. (add_AT_view_list, AT_loc_list): New. (add_var_loc_to_decl): Add view param. Test it against last. (new_loc_list): Add view params. Record them. (AT_loc_list_ptr): Handle loc and view lists. (view_list_to_loc_list_val_node): New. (print_dw_val): Handle dw_val_class_view_list. (size_of_die): Likewise. (value_format): Likewise. (loc_list_has_views): New. (gen_llsym): Set vl_symbol too. (maybe_gen_llsym, skip_loc_list_entry): New. (dwarf2out_maybe_output_loclist_view_pair): New. (output_loc_list): Output view list or entries too. (output_view_list_offset): New. (output_die): Handle dw_val_class_view_list. (output_dwarf_version): New. (output_compilation_unit_header): Use it. (output_skeleton_debug_sections): Likewise. (output_rnglists, output_line_info): Likewise. (output_pubnames, output_aranges): Update version comments. (output_one_line_info_table): Output view numbers in asm comments. (dw_loc_list): Determine current endview, pass it to new_loc_list. Call maybe_gen_llsym. (loc_list_from_tree_1): Adjust. (add_AT_location_description): Create view list attribute if needed, check it's absent otherwise. (convert_cfa_to_fb_loc_list): Adjust. (maybe_emit_file): Call output_asm_line_debug_info for test. (dwarf2out_var_location): Reset views as needed. Precompute add_var_loc_to_decl args. Call get_attr_min_length only if we have the attribute. Set view. (new_line_info_table): Reset next view. (set_cur_line_info_table): Call output_asm_line_debug_info for test. (dwarf2out_source_line): Likewise. Output view resets and labels to the assembler, or select appropriate line info opcodes. (prune_unused_types_walk_attribs): Handle dw_val_class_view_list. (optimize_string_length): Catch it. Adjust. (resolve_addr): Copy vl_symbol along with ll_symbol. Handle dw_val_class_view_list, and remove it if no longer needed. (hash_loc_list): Hash view numbers. (loc_list_hasher::equal): Compare them. (optimize_location_lists): Check whether a view list symbol is needed, and whether the locview attribute is present, and whether they match. Remove the locview attribute if no longer needed. (index_location_lists): Call skip_loc_list_entry for test. (dwarf2out_finish): Call output_asm_line_debug_info for test. Use output_dwarf_version. * dwarf2out.h (enum dw_val_class): Add dw_val_class_view_list. (struct dw_val_node): Add val_view_list. * final.c (SEEN_NEXT_VIEW): New. (set_next_view_needed): New. (clear_next_view_needed): New. (maybe_output_next_view): New. (final_start_function): Rename to... (final_start_function_1): ... this. Take pointer to FIRST, add SEEN parameter. Emit param bindings in the initial view. (final_start_function): Reintroduce SEEN-less interface. (final): Rename to... (final_1): ... this. Take SEEN parameter. Output final pending next view at the end. (final): Reintroduce seen-less interface. (final_scan_insn): Output pending next view before switching sections or ending a block. Mark the next view as needed when outputting variable locations. Notify debug backend of section changes, and of location view changes. (rest_of_handle_final): Adjust. * toplev.c (process_options): Autodetect value for debug variable location views option. Warn on incompat5 without -gdwarf-5. * doc/invoke.texi (gvariable-location-views): New. (gvariable-location-views=incompat5): New. (gno-variable-location-views): New. From-SVN: r257510
101 lines
3.1 KiB
C
101 lines
3.1 KiB
C
/* Dwarf2 assembler output helper routines.
|
|
Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef GCC_DWARF2ASM_H
|
|
#define GCC_DWARF2ASM_H
|
|
|
|
extern void dw2_assemble_integer (int, rtx);
|
|
|
|
extern void dw2_asm_output_data_raw (int, unsigned HOST_WIDE_INT);
|
|
|
|
extern void dw2_asm_output_data (int, unsigned HOST_WIDE_INT,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
|
|
extern void dw2_asm_output_delta (int, const char *, const char *,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_4;
|
|
|
|
extern void dw2_asm_output_vms_delta (int, const char *, const char *,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_4;
|
|
|
|
extern void dw2_asm_output_offset (int, const char *, section *,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_4;
|
|
|
|
extern void dw2_asm_output_offset (int, const char *, HOST_WIDE_INT,
|
|
section *, const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_5;
|
|
|
|
extern void dw2_asm_output_addr (int, const char *, const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
|
|
extern void dw2_asm_output_addr_rtx (int, rtx, const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
|
|
extern void dw2_asm_output_encoded_addr_rtx (int, rtx, bool,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_4;
|
|
|
|
extern void dw2_asm_output_nstring (const char *, size_t,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
|
|
extern void dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT);
|
|
|
|
extern void dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_2;
|
|
|
|
extern void dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT);
|
|
|
|
extern void dw2_asm_output_data_sleb128 (HOST_WIDE_INT,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_2;
|
|
|
|
extern void dw2_asm_output_symname_uleb128 (const char *,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_2;
|
|
|
|
extern void dw2_asm_output_delta_uleb128 (const char *, const char *,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
|
|
extern int size_of_uleb128 (unsigned HOST_WIDE_INT);
|
|
extern int size_of_sleb128 (HOST_WIDE_INT);
|
|
extern int size_of_encoded_value (int);
|
|
extern const char *eh_data_format_name (int);
|
|
|
|
extern rtx dw2_force_const_mem (rtx, bool);
|
|
extern void dw2_output_indirect_constants (void);
|
|
|
|
/* These are currently unused. */
|
|
|
|
#if 0
|
|
extern void dw2_asm_output_pcrel (int, const char *, const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
|
|
extern void dw2_asm_output_delta_sleb128 (const char *, const char *,
|
|
const char *, ...)
|
|
ATTRIBUTE_NULL_PRINTF_3;
|
|
#endif
|
|
|
|
#endif /* GCC_DWARF2ASM_H */
|