summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
Commit message (Collapse)AuthorAgeFilesLines
* * debug.h (struct gcc_debug_hooks): Add IMPLICIT argumentjakub2017-07-291-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to imported_module_or_decl hook. (debug_nothing_tree_tree_tree_bool): Remove. (debug_nothing_tree_tree_tree_bool_bool): New declaration. * debug.c (do_nothing_debug_hooks): Use debug_nothing_tree_tree_tree_bool_bool instead of debug_nothing_tree_tree_tree_bool. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise. * sdbout.c (sdb_debug_hooks): Likewise. * dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise. (gen_namespace_die): Add DW_AT_export_symbols attribute if langhook wants it. (dwarf2out_imported_module_or_decl): Add IMPLICIT argument, if true, -gdwarf-5 and decl will have DW_AT_export_symbols attribute, don't add anything. cp/ * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle DW_AT_export_symbols. * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT argument, pass it through to the debug hook. (finish_namespace_using_directive): Adjust emit_debug_info_using_namespace caller. (push_namespace): Likewise. Call it after setting DECL_NAMESPACE_INLINE_P. (cp_emit_debug_info_for_using): Pass false as new argument to the imported_module_or_decl debug hook. fortran/ * trans-decl.c (gfc_trans_use_stmts): Pass false as new argument to the imported_module_or_decl debug hook. ada/ * gcc-interface/utils.c (gnat_write_global_declarations): Pass false as new argument to the imported_module_or_decl debug hook. testsuite/ * g++.dg/debug/dwarf2/inline-ns-1.C: New test. * g++.dg/debug/dwarf2/inline-ns-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250713 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2asm.c (dw2_asm_output_nstring): Encode double quotedje2017-07-251-1/+8
| | | | | | | | | | character for AIX. * dwarf2out.c (output_macinfo): Copy debug_line_section_label to dl_section_ref. On AIX, append an expression to subtract the size of the section length to dl_section_ref. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250516 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/drepper2017-07-211-1/+1
| | | | | | | | * dwarf2out.c (output_file_names): Avoid double testing for dwarf_version >= 5. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250420 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/nathan2017-07-211-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove TYPE_METHODS. * tree.h (TYPE_METHODS): Delete. * dwarf2out.c (gen_member_die): Member fns are on TYPE_FIELDS. * dbxout.c (dbxout_type_fields): Ignore FUNCTION_DECLs. (dbxout_type_methods): Scan TYPE_FIELDS. (dbxout_type): Don't check TYPE_METHODS here. * function.c (use_register_for_decl): Always ignore register for class types when not optimizing. * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. * tree.c (free_lang_data_in_type): Stitch out member functions and templates from TYPE_FIELDS. (build_distinct_type_copy, verify_type_variant, verify_type): Member fns are on TYPE_FIELDS. * tree-dump.c (dequeue_and_dump): No TYPE_METHODS. * tree-pretty-print.c (dump_generic_node): Likewise. gcc/cp/ Remove TYPE_METHODS. * class.c (maybe_warn_about_overly_private_class, finish_struct_methods, one_inheriting_sig, count_fields, add_fields_to_record_type, check_field_decls, check_methods, clone_function_decl, set_method_tm_attributes, finalize_literal_type_property, check_bases_and_members, create_vtable_ptr, determine_key_method, unreverse_member_declarations, finish_struct, add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. * decl.c (fixup_anonymous_aggr): Likewise. * decl2.c (reset_type_linkage_2): Likewise. * method.c (after_nsdmi_defaulted_late_checks, lazily_declare_fn): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_class_template_1, tsubst_expr, do_type_instantiation, instantiate_pending_templates): Likewise. * search.c (lookup_field_1): Likewise. * semantics.c (finish_member_declaration, finish_omp_declare_simd_methods): Likewise. gcc/c-family/ Remove TYPE_METHODS. * c-ada-spec.c (is_tagged_type, has_nontrivial_methods, dump_ada_template, print_ada_methods, print_ada_declaration): Member fns are on TYPE_FIELDS. gcc/objc/ Remove TYPE_METHODS. * objc-runtime-shared-support.c (build_ivar_list_initializer): Don't presume first item is a FIELD_DECL. gcc/testsuite/ * g++.dg/ext/anon-struct6.C: Adjust diag. * g++.old-deja/g++.other/anon4.C: Adjust diag. libcc1/ Remove TYPE_METHODS. * libcp1plugin.cc (plugin_build_decl): Member fns are on TYPE_FIELDS. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250413 138bc75d-0d04-0410-961f-82ee72b054a4
* Remove Java references in source code.marxin2017-07-141-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2017-07-14 Martin Liska <mliska@suse.cz> * cfgexpand.c (expand_gimple_basic_block): Remove dead comment. * dwarf2out.c (is_java): Remove the function. (output_pubname): Remove usage of the function. (lower_bound_default): Remove usage of DW_LANG_Java. (gen_compile_unit_die): Likewise. * gcc.c: Remove compiler defaults for .java and .zip files. * gimple-expr.c (remove_suffix): Change as there's no longer extension than 4-letter one. * gimplify.c (mostly_copy_tree_r): Remove Java-special part. (gimplify_save_expr): Likewise. * ipa-utils.h (polymorphic_type_binfo_p): Remove the comment as it's possible even for other languages than Java. * langhooks.h (struct lang_hooks): Remove Java from a comment. * lto-opts.c (lto_write_options): Remove reference to Java. * opts.c (strip_off_ending): Update file extension handling. * tree-cfg.c (verify_gimple_call): Remove comment with Java. * tree-eh.c (lower_resx): Likewise. * tree.c (free_lang_data_in_type): Remove dead code. (find_decls_types_r): Likewise. (build_common_builtin_nodes): Remove Java from a comment. (verify_type): Remove dead code. * varasm.c (assemble_external): Remove Java from a comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250199 138bc75d-0d04-0410-961f-82ee72b054a4
* Remove Pascal language in source code.marxin2017-07-141-3/+0
| | | | | | | | | | | | | | | | | 2017-07-14 Martin Liska <mliska@suse.cz> * dbxout.c (get_lang_number): Do not handle GNU Pascal. * dbxout.h (extern void dbxout_stab_value_internal_label_diff): Remove N_SO_PASCAL. * dwarf2out.c (lower_bound_default): Do not handle DW_LANG_Pascal83. (gen_compile_unit_die): Likewise. * gcc.c: Remove default extension binding for GNU Pascal. * stmt.c: Remove Pascal language from a comment. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250197 138bc75d-0d04-0410-961f-82ee72b054a4
* Cleanup #2 of Pascal references.marxin2017-07-131-40/+0
| | | | | | | | | | | 2017-07-13 Martin Liska <mliska@suse.cz> * dwarf2out.c (gen_pointer_type_die): Remove dead code. (gen_reference_type_die): Likewise. * stor-layout.c: Remove Pascal-related comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250184 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (gen_member_die): Remove useless check for anon ctors.nathan2017-07-111-4/+0
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250127 138bc75d-0d04-0410-961f-82ee72b054a4
* DWARF: make it possible to emit debug info for declarations onlypmderodat2017-06-211-50/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DWARF back-end used to systematically ignore file-scope function and variable declarations. While this is justified in language like C/C++, where such declarations can appear in several translation units and thus bloat uselessly the debug info, this behavior is counter-productive in languages with a well-defined module system. Specifically, it prevents the description of imported entities, that belong to foreign languages, making them unavailable from debuggers. Take for instance: package C_Binding is function My_C_Function (I : Integer) return Integer; pragma Import (C, My_C_Function, "my_c_function"); end C_Binding; This makes available for Ada programs the C function "my_c_function" under the following name: C_Binding.My_C_Function. When GCC compiles it, though, it is represented as a FUNCTION_DECL node with DECL_EXTERNAL set and a null DECL_INITIAL, which used to be discarded unconditionally in the DWARF back-end. This patch moves such filter from the DWARF back-end to the relevant callers: passes.c:rest_of_decl_compilation and godump.c:go_early_global_decl. It also This patch also updates the Ada front-end to call debug hooks for functions such as in the above example, so that we do generate debugging information for them. gcc/ * dwarf2out.c (gen_decl_die): Remove the guard to skip file-scope FUNCTION_DECL declarations. (dwarf2out_early_global_decl): Remove the guard to skip FUNCTION_DECL declarations. (dwaf2out_decl): Likewise. * godump.c (go_early_global_decl): Skip call to the real debug hook for FUNCTION_DECL declarations. * passes.c (rest_of_decl_compilation): Skip call to the early_global_decl debug hook for FUNCTION_DECL declarations, unless -fdump-go-spec is passed. gcc/ada/ * gcc-interface/ada-tree.h (DECL_FUNCTION_IS_DEF): Update copyright notice. New macro. * gcc-interface/trans.c (Subprogram_Body_to_gnu): Tag the subprogram as a definition. (Compilation_Unit_to_gnu): Tag the elaboration procedure as a definition. * gcc-interface/decl.c (gnat_to_gnu_entity): Tag declarations of imported subprograms for the current compilation unit as definitions. Disable debug info for references to variables. * gcc-interface/gigi.h (create_subprog_decl): Update declaration. * gcc-interface/utils.c (gnat_pushdecl): Add external DECLs that are not built-in functions to their binding scope. (create_subprog_decl): Add a DEFINITION parameter. If it is true, tag the function as a definition. Update all callers. (gnat_write_global_declarations): Emit debug info for imported functions. Filter out external variables for which debug info is disabled. gcc/testsuite/ * gnat.dg/debug11_pkg.adb, gnat.dg/debug11_pkg.ads, gnat.dg/debug11_pkg2.ads: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249449 138bc75d-0d04-0410-961f-82ee72b054a4
* * tree.h (id_equal): New.jason2017-06-111-1/+1
| | | | | | | | | | | | * dwarf2out.c, hsa-gen.c, ipa-devirt.c, omp-expand.c, omp-simd-clone.c, read-rtl-function.c, tree-chkp.c, tree.c: Use it instead of strcmp of IDENTIFIER_POINTER. c-family/ * c-ada-spec.c, c-pragma.c: Use it. cp/ * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249103 138bc75d-0d04-0410-961f-82ee72b054a4
* * cfgrtl.c (cfg_layout_initialize): Check crtl->has_bb_partitionhubicka2017-06-081-3/+3
| | | | | | | | | | | | | | | instead of flag_reorder_blocks_and_partition. * dbxout.c (dbxout_function_end): Likewise. * dwarf2out.c (gen_subprogram_die): Likewise. * haifa-sched.c (sched_create_recovery_edges): Likewise. * hw-doloop.c (reorg_loops): Likewise. * varasm.c (assemble_start_function, assemble_end_function): Likewise. (decide_function_section): Do not check for flag_reorder_blocks_and_partition. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249017 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (DWARF_INITIAL_LENGTH_SIZE_STR): New.dje2017-06-021-2/+13
| | | | | | | | | | (dl_section_ref): New. (dwarf2out_finish): Copy debug_line_section_label to dl_section_ref. On AIX, append an expression to subtract the size of the section length to dl_section_ref. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248831 138bc75d-0d04-0410-961f-82ee72b054a4
* DWARF: add DW_AT_location for global decls with DECL_VALUE_EXPRpmderodat2017-06-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | In GNAT, we materialize renamings that cannot be described in standard DWARF as synthetic variables that describe how to fetch the renamed object. Look for "___XR" in gcc/ada/exp_dbug.ads for more details about this convention. In order to have a location for these variables in the debug info (GDB requires it not to discard the variable) but also to avoid allocating runtime space for them, we make these variable hold a DECL_VALUE_EXPR tree. However, since GCC 7, the DWARF back-end no longer generates a DW_AT_location attribute for those. This patch is an attempt to restore this attribute. gcc/ * dwarf2out.c (dwarf2out_late_global_decl): Add locations for symbols that hold a DECL_VALUE_EXPR. gcc/testsuite/ * debug12.adb, debug12.ads: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248792 138bc75d-0d04-0410-961f-82ee72b054a4
* DWARF: for variants, produce unsigned discr. when debug type is unsignedpmderodat2017-06-011-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | In Ada, the Character type is supposed to be unsigned. However, depending on the sign of C char types, GNAT can materialize it as a signed type for code generation purposes. When this is the case, GNAT also attach a debug type to it so it is represented as an unsigned base type in the debug information. This change adapts record variant parts processing in the DWARF back-end so that when the debug type of discriminant is unsigned while discriminant values are signed themselves, we output unsigned discriminant values in DWARF. gcc/ * dwarf2out.c (get_discr_value): Call the get_debug_type hook on the type of the input discriminant value. Convert the discriminant value of signedness vary. gcc/testsuite/ * gnat.dg/debug11.adb: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248773 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-05-16 Richard Biener <rguenther@suse.de>rguenth2017-05-161-0/+1
| | | | | | | | * dwarf2out.c (loc_list_from_tree_1): Do not create DW_OP_GNU_variable_value for DECL_IGNORED_P decls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248094 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-05-16 Richard Biener <rguenther@suse.de>rguenth2017-05-161-2/+4
| | | | | | | | | | * dwarf2out.c (resolve_variable_value_in_expr): Lookup DIE just generated. (note_variable_value_in_expr): If we resolved the decl ref do not push to the stack. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248093 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/80461jakub2017-04-191-8/+10
| | | | | | | | | | * dwarf2out.c (modified_type_die, gen_type_die_with_usage): Check for t with zero TYPE_QUALS_NO_ADDR_SPACE. * g++.dg/debug/pr80461.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247002 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/80263jakub2017-04-181-10/+19
| | | | | | | | | | * dwarf2out.c (modified_type_die): Try harder not to emit internal sizetype type into debug info. * gcc.dg/debug/dwarf2/pr80263.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246973 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/80321jakub2017-04-131-1/+6
| | | | | | | | | | | | | | | * dwarf2out.c (decls_for_scope): Ignore declarations of current_function_decl in BLOCK_NONLOCALIZED_VARS. * gcc.dg/debug/pr80321.c: New test. 2017-04-13 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/debug10.adb: New test. * gnat.dg/debug10_pkg.ads: New helper. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246900 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/80234jakub2017-04-061-4/+30
| | | | | | | | | | | * dwarf2out.c (gen_member_die): Handle C++17 inline static data members with redundant out-of-class redeclaration. * g++.dg/debug/dwarf2/pr80234-1.C: New test. * g++.dg/debug/dwarf2/pr80234-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246743 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/79255jakub2017-03-311-2/+7
| | | | | | | | | | | * dwarf2out.c (decls_for_scope): If BLOCK_NONLOCALIZED_VAR is a FUNCTION_DECL, pass it as decl instead of origin to process_scope_var. * gcc.dg/pr79255.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246622 138bc75d-0d04-0410-961f-82ee72b054a4
* [PR63238] include alignment debug information in DIE checksumaoliva2017-03-211-0/+5
| | | | | | | | | | | | | Add DW_AT_alignment to the DIE checksum. for gcc/ChangeLog PR debug/63238 * dwarf2out.c (struct checksum_attributes): Add at_alignment. (collect_checksum_attributes): Set it. (die_checksum_ordered): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246331 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c++/79821jakub2017-03-061-3/+3
| | | | | | | | | | * dwarf2out.h (dw_vec_const): Change array type from unsigned char * to void * for PCH reasons. * dwarf2out.c (output_loc_operands, output_die): Cast v.val_vec.array to unsigned char *. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245932 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/77589jakub2017-02-251-142/+495
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | include/ * dwarf2.def (DW_OP_GNU_variable_value): New opcode. gcc/ * dwarf2out.c (struct dw_loc_list_struct): Add noted_variable_value bitfield. (size_of_loc_descr): Handle DW_OP_GNU_variable_value. (output_loc_operands): Handle DW_OP_call_ref and DW_OP_GNU_variable_value. (struct variable_value_struct): New type. (struct variable_value_hasher): Likewise. (variable_value_hash): New variable. (string_types): Remove. (copy_loc_descr): New function. (add_loc_descr_to_each): Clarify comment. Use copy_loc_descr. (prepend_loc_descr_to_each): New function. (add_loc_list): Fix comment typo. Use prepend_loc_descr_to_each instead of add_loc_descr_to_each if the first argument is single location list and the second has multiple. (resolve_args_picking_1): Handle DW_OP_GNU_variable_value. (loc_list_from_tree_1): For early_dwarf, emit DW_OP_GNU_variable_value when looking for variable value which doesn't have other location info. (loc_list_from_tree): Formatting fix. (gen_array_type_die): Simplify DW_AT_string_length handling. (adjust_string_types): Remove. (gen_subprogram_die): Don't call adjust_string_types nor test/set string_types. Call resolve_variable_values. (prune_unused_types_walk_loc_descr): Handle DW_OP_GNU_variable_value. (resolve_addr_in_expr): Likewise. Add A argument. (copy_deref_exprloc): Remove deref argument. Adjust for the original expression being DW_OP_GNU_variable_value with optionally DW_OP_stack_value after it instead of DW_OP_call4 with DW_OP_deref optionally after it. (optimize_string_length): Rework for DW_OP_GNU_variable_value. (resolve_addr): Adjust optimize_string_length and resolve_addr_in_expr callers. Set remove_AT_byte_size if removing DW_AT_string_length. (variable_value_hasher::hash, variable_value_hasher::equal): New methods. (resolve_variable_value_in_expr, resolve_variable_value, resolve_variable_values, note_variable_value_in_expr, note_variable_value): New functions. (dwarf2out_early_finish): Call note_variable_value on all toplevel DIEs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245733 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (gen_variable_die): For -gdwarf-5, use DW_TAG_variablejakub2017-02-221-6/+9
| | | | | | | | | | | | instead of DW_TAG_member for static data member declarations and don't set no_linkage_name for static inline data members. (gen_member_die): For -gdwarf-5 don't change DW_TAG_variable to DW_TAG_member. * g++.dg/debug/dwarf2/inline-var-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245661 138bc75d-0d04-0410-961f-82ee72b054a4
* * final.c (last_columnnum, override_columnnum): New variables.jakub2017-02-181-7/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (final_start_function): Set last_columnnum, pass it to begin_prologue hook and pass 0 to dwarf2out_begin_prologue. (final_scan_insn): Update override_columnnum. Pass last_columnnum to source_line debug hook. (notice_source_line): Compute last_columnnum and for debug_column_info return true on column changes. * debug.h (struct gcc_debug_hooks): Add column argument to source_line and begin_prologue hooks. (debug_nothing_int_charstar_int_bool): Remove prototype. (debug_nothing_int_int_charstar, debug_nothing_int_int_charstar_int_bool): New prototypes. (dwarf2out_begin_prologue): Add column argument. * debug.c (do_nothing_debug_hooks): Adjust source_line and begin_prologue hooks. (debug_nothing_int_charstar_int_bool): Remove. (debug_nothing_int_int_charstar, debug_nothing_int_int_charstar_int_bool): New functions. * dwarf2out.c (dwarf2out_begin_prologue): Add column argument, pass it through to dwarf2out_source_line. (dwarf2_lineno_debug_hooks): Adjust begin_prologue hook. (dwarf2out_source_line): Add column argument, emit it if requested. * sdbout.c (sdbout_source_line, sdbout_begin_prologue): Add column arguments. * xcoffout.h (xcoffout_begin_prologue, xcoffout_source_line): Likewise. * xcoffout.c (xcoffout_begin_prologue, xcoffout_source_line): Likewise. * vmsdbgout.c (vmsdbgout_begin_prologue): Add column argument, pass it through to dwarf2out_begin_prologue. (vmsdbgout_source_line): Add column argument, pass it through to dwarf2out_source_line. * dbxout.c (dbxout_begin_prologue): Add column argument, adjust dbxout_source_line caller. (dbxout_source_line): Add column argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245564 138bc75d-0d04-0410-961f-82ee72b054a4
* * common.opt (gno-column-info, gcolumn-info): New options.jakub2017-02-181-6/+32
| | | | | | | | | | | | | | | * dwarf2out.c (dwarf2_lineno_debug_hooks): Formatting fix. (check_die): Also test for multiple DW_AT_decl_column attributes. (add_src_coords_attributes, dwarf2out_imported_module_or_decl_1): Add DW_AT_decl_column if requested. (gen_subprogram_die): Compare and/or add also DW_AT_decl_column if requested. (gen_variable_die): Likewise. (add_call_src_coords_attributes): Add DW_AT_call_column if requested. * doc/invoke.texi (-gcolumn-info, -gno-column-info): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245563 138bc75d-0d04-0410-961f-82ee72b054a4
* [PR63238] output alignment debug informationaoliva2017-01-311-6/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Output DWARFv5+ DW_AT_alignment for non-default alignment of variables, fields and types. for gcc/ChangeLog PR debug/63238 * dwarf2out.c (clone_as_declaration): Drop DW_AT_alignment. (add_alignment_attribute): New. (base_type_die): Add alignment attribute. (subrange_type_die): Likewise. (modified_type_die): Likewise. (gen_array_type_die): Likewise. (gen_descr_array_type_die: Likewise. (gen_enumeration_type_die): Likewise. (gen_subprogram_die): Likewise. (gen_variable_die): Likewise. (gen_field_die): Likewise. (gen_ptr_to_mbr_type_die): Likewise. (gen_struct_or_union_type_die): Likewise. (gen_subroutine_type_die): Likewise. (gen_typedef_die): Likewise. (base_type_cmp): Compare alignment attribute. for gcc/testsuite/ChangeLog PR debug/63238 * gcc.dg/debug/dwarf2/align-1.c: New. * gcc.dg/debug/dwarf2/align-2.c: New. * gcc.dg/debug/dwarf2/align-3.c: New. * gcc.dg/debug/dwarf2/align-4.c: New. * gcc.dg/debug/dwarf2/align-5.c: New. * gcc.dg/debug/dwarf2/align-6.c: New. * gcc.dg/debug/dwarf2/align-as-1.c: New. * g++.dg/debug/dwarf2/align-1.C: New. * g++.dg/debug/dwarf2/align-2.C: New. * g++.dg/debug/dwarf2/align-3.C: New. * g++.dg/debug/dwarf2/align-4.C: New. * g++.dg/debug/dwarf2/align-5.C: New. * g++.dg/debug/dwarf2/align-6.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245052 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/79289ian2017-01-301-2/+7
| | | | | | | | * dwarf2out.c (gen_type_die_with_usage): When picking a variant for FUNCTION_TYPE/METHOD_TYPE, use the first matching one. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245039 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/79129jakub2017-01-261-0/+14
| | | | | | | | | | | * dwarf2out.c (generate_skeleton_bottom_up): For children with comdat_type_p set, just clone them, but keep the children in the original DIE. * g++.dg/debug/dwarf2/pr79129.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244955 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/78835jakub2017-01-261-10/+40
| | | | | | | | | | | | | * dwarf2out.c (prune_unused_types): Mark all functions with DIEs which have direct callers with -fvar-tracking-assignments enabled in the current TU. (resolve_addr): Avoid adding skeleton DIEs for DW_AT_call_origin inside of type units. * g++.dg/debug/dwarf2/pr78835.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244954 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (output_compilation_unit_header, output_file_names):jakub2017-01-241-4/+7
| | | | | | | Avoid -Wformat-security warning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244855 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/78839jakub2017-01-171-20/+25
| | | | | | | | | | | * dwarf2out.c (field_byte_offset): Restore the PCC_BITFIELD_TYPE_MATTERS behavior for INTEGER_CST DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET. Use fold_build2 instead of build2 + fold. (analyze_variants_discr, gen_variant_part): Use fold_build2 instead of build2 + fold. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244545 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/71669jakub2017-01-171-0/+17
| | | | | | | | | | * dwarf2out.c (add_data_member_location_attribute): For constant offset bitfield emit for -gdwarf-5 DW_AT_data_bit_offset attribute instead of DW_AT_data_member_location, DW_AT_bit_offset and DW_AT_byte_size attributes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244542 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (DWARF_COMPILE_UNIT_HEADER_SIZE): For DWARF5 decreasejakub2017-01-111-20/+17
| | | | | | | | | | | | | | | | | | by 12. (DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE): Always DWARF_COMPILE_UNIT_HEADER_SIZE plus 12. (DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE): Define. (calc_base_type_die_sizes): Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE for initial die_offset if dwarf_split_debug_info. (output_comp_unit): Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE for initial next_die_offset if dwo_id is non-NULL. Don't emit padding fields. (output_skeleton_debug_sections): Formatting fix. Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE instead of DWARF_COMPILE_UNIT_HEADER_SIZE. Don't emit padding. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244323 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-01-09 Richard Biener <rguenther@suse.de>rguenth2017-01-091-1/+23
| | | | | | | | | | | | PR debug/79000 * dwarf2out.c (is_cxx): New overload with context. (is_naming_typedef_decl): Use it. * g++.dg/lto/pr79000_0.C: New testcase. * g++.dg/lto/pr79000_1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244217 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (output_loc_list): Don't throw away 64K+ locationjakub2017-01-041-5/+8
| | | | | | | | descriptions for -gdwarf-5 and emit them as uleb128 instead of 2-byte data. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244069 138bc75d-0d04-0410-961f-82ee72b054a4
* DWARF: add DW_AT_encoding attributes for DW_TAG_enumeration_type DIEspmderodat2017-01-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the DWARF description does not specify the signedness of the representation of enumeration types. This is a problem in some contexts where DWARF consumers need to determine if value X is greater than value Y. For instance in Ada: type Enum_Type is ( A, B, C, D); for Enum_Type use (-1, 0, 1, 2); type Rec_Type (E : Enum_Type) is record when A .. B => null; when others => B : Booleann; end record; The above can be described in DWARF the following way: DW_TAG_enumeration_type(Enum_Type) | DW_AT_byte_size: 1 DW_TAG_enumerator(A) | DW_AT_const_value: -1 DW_TAG_enumerator(B) | DW_AT_const_value: 0 DW_TAG_enumerator(C) | DW_AT_const_value: 1 DW_TAG_enumerator(D) | DW_AT_const_value: 2 DW_TAG_structure_type(Rec_Type) DW_TAG_member(E) | DW_AT_type: <Enum_Type> DW_TAG_variant_part | DW_AT_discr: <E> DW_TAG_variant | DW_AT_discr_list: DW_DSC_range 0x7f 0 DW_TAG_variant | DW_TAG_member(b) DWARF consumers need to know that enumerators (A, B, C and D) are signed in order to determine the set of E values for which Rec_Type has a B field. In practice, they need to know how to interpret the 0x7f LEB128 number above (-1, not 127). When in non-strict DWARF mode, this patch adds a DW_AT_encoding attribute to generated DW_TAG_enumeration_type DIEs to make this signedness explicit. gcc/ * dwarf2out.c (gen_enumeration_type_die): When -gno-strict-dwarf, add a DW_AT_encoding attribute. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244015 138bc75d-0d04-0410-961f-82ee72b054a4
* Update copyright years.jakub2017-01-011-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243994 138bc75d-0d04-0410-961f-82ee72b054a4
* dwarf2out.c: fix jit issue with early_dwarf_finisheddmalcolm2016-12-011-0/+3
| | | | | | | | | | | | | | | | | | | All of the jit testcases that generate debuginfo appear to have been failing since r240228 on their 2nd in-process iteration on this assertion in set_early_dwarf's ctor: gcc_assert (! early_dwarf_finished); Root cause is that the global is never reset at the end of compilation, which this patch fixes in the obvious way. gcc/ChangeLog: * dwarf2out.c (dwarf2out_c_finalize): Reset early_dwarf and early_dwarf_finished. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243136 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/78587jakub2016-12-011-3/+4
| | | | | | | | | | | | * dwarf2out.c (loc_descr_plus_const): For negative offset use uint_loc_descriptor instead of int_loc_descriptor and perform negation in unsigned HOST_WIDE_INT type. (scompare_loc_descriptor): Shift UINTVAL left instead of INTVAL. * gcc.dg/debug/pr78587.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243100 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (size_of_discr_list): Fix typo in function comment.jakub2016-11-181-10/+30
| | | | | | | | | | | | | | | | | PR debug/78191 * dwarf2out.c (abbrev_opt_base_type_end): New variable. (die_abbrev_cmp): Sort dies with die_abbrev smaller than abbrev_opt_base_type_end only by increasing die_abbrev, before any other dies. (optimize_abbrev_table): Don't change abbrev numbers of base types and CU or optimize implicit consts in them if calc_base_type_die_sizes has been called during build_abbrev_table. (calc_base_type_die_sizes): If abbrev_opt_start, set abbrev_opt_base_type_end to one plus largest base type's die_abbrev. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242606 138bc75d-0d04-0410-961f-82ee72b054a4
* Use rtx_mode_t instead of std::make_pairrsandifo2016-11-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes the code less sensitive to the exact type of the mode, i.e. it forces a conversion where necessary. This becomes important when wrappers like scalar_int_mode and scalar_mode can also be used instead of machine_mode. Using rtx_mode_t also abstracts away the representation. The fact that it's a std::pair rather than a custom class isn't important to users of the interface. gcc/ 2016-11-18 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * combine.c (try_combine): Use rtx_mode_t instead of std::make_pair. * dwarf2out.c (mem_loc_descriptor, loc_descriptor): Likewise. (add_const_value_attribute): Likewise. * explow.c (plus_constant): Likewise. * expmed.c (expand_mult, make_tree): Likewise. * expr.c (convert_modes): Likewise. * loop-doloop.c (doloop_optimize): Likewise. * postreload.c (reload_cse_simplify_set): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_binary_operation_1, simplify_const_binary_operation): (simplify_const_relational_operation, simplify_immed_subreg): Likewise. * wide-int.h: Update documentation to recommend rtx_mode_t instead of std::make_pair. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242586 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix a GET_MODE_CLASS typo in mem_loc_descriptorrsandifo2016-11-151-1/+1
| | | | | | | | | | | | | | | It should have been checking the size instead. gcc/ 2016-11-15 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * dwarf2out.c (mem_loc_descriptor): Fix GET_MODE_CLASS/ GET_MODE_SIZE typo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242409 138bc75d-0d04-0410-961f-82ee72b054a4
* remove conditional compilation of HAVE_AS_LEB128 codetbsaunde2016-11-141-79/+74
| | | | | | | | | | | | | | | | | | | | | | | gcc/ChangeLog: 2016-08-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * acinclude.m4 (gcc_GAS_CHECK_FEATURE): Support doing an action if the feature isn't available. * configure: Regenerate. * configure.ac: define HAVE_AS_LEB128 to 0 when not available. * dwarf2asm.c (dw2_asm_output_data_uleb128): Always compile code for HAVE_AS_LEB128. (dw2_asm_output_data_sleb128): Likewise. (dw2_asm_output_delta_uleb128): Likewise. (dw2_asm_output_delta_sleb128): Likewise. * except.c (output_one_function_exception_table): Likewise. (dw2_size_of_call_site_table): Likewise. (sjlj_size_of_call_site_table): Likewise. * dwarf2out.c (output_loc_list): Likewise. (output_rnglists): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242381 138bc75d-0d04-0410-961f-82ee72b054a4
* debug/78112: remove recent duplicates for DW_TAG_subprogram attributespmderodat2016-11-101-4/+4
| | | | | | | | | | | | | | | | | | | | | Disable unnecessary calls to dwarf2out_decl for the parents of nested functions. This fixes a libstdc++ build regression on x86_64-apple-darwin, as these calls used to add duplicate attributes (for instance DW_AT_inline and DW_AT_object_pointer) to the corresponding DW_TAG_subprogram DIE. Bootstrapped and regtested on x86_64-linux. gcc/ PR debug/78112 * dwarf2out.c (dwarf2out_early_global_decl): Call dwarf2out_decl on the context only when it has no DIE yet. testsuite/ PR debug/78112 * g++.dg/pr78112.C: New testcase git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242035 138bc75d-0d04-0410-961f-82ee72b054a4
* PR debug/28767jakub2016-11-031-14/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR debug/56974 * langhooks.h (struct lang_hooks_for_types): Add type_dwarf_attribute langhook. * langhooks.c (lhd_type_dwarf_attribute): New function. * langhooks-def.h (lhd_type_dwarf_attribute): Declare. (LANG_HOOKS_TYPE_DWARF_ATTRIBUTE): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add LANG_HOOKS_TYPE_DWARF_ATTRIBUTE. (check_qualified_type, check_aligned_type): Call it. * dwarf2out.c (modified_type_die): Don't use type_main_variant for FUNCTION_TYPE or METHOD_TYPE, instead walk over variants with check_base_type and check_lang_type. (gen_ptr_to_mbr_type_die): If lookup_type_die is already non-NULL, return early. For pointer-to-data-member add DW_AT_use_location attribute. (gen_subroutine_type_die): Add DW_AT_{,rvalue_}reference attribute if needed. (gen_type_die_with_usage): Don't use type_main_variant for FUNCTION_TYPE or METHOD_TYPE, instead walk over variants with check_base_type and check_lang_type. Formatting fixes. Call get_debug_type langhook. cp/ * tree.c (cp_check_qualified_type): Use check_base_type and TYPE_QUALS comparison instead of check_qualified_type. (cxx_type_hash_eq): Return false if type_memfn_rqual don't match. * cp-objcp-common.c (cp_get_debug_type): New function. (cp_decl_dwarf_attribute): Don't handle types here. (cp_type_dwarf_attribute): New function. * cp-objcp-common.h (cp_get_debug_type, cp_type_dwarf_attribute): Declare. (LANG_HOOKS_GET_DEBUG_TYPE, LANG_HOOKS_TYPE_DWARF_ATTRIBUTE): Define. testsuite/ * g++.dg/debug/dwarf2/ptrdmem-1.C: New test. * g++.dg/debug/dwarf2/ref-3.C: New test. * g++.dg/debug/dwarf2/ref-4.C: New test. * g++.dg/debug/dwarf2/refqual-1.C: New test. * g++.dg/debug/dwarf2/refqual-2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241832 138bc75d-0d04-0410-961f-82ee72b054a4
* [DWARF] Enable DW_CFA_VAL_EXPRESSION supportjiwang2016-11-031-0/+42
| | | | | | | | | | | | | | | | | | | gcc/ * reg-notes.def (CFA_VAL_EXPRESSION): New entry. * dwarf2cfi.c (dwarf2out_frame_debug_cfa_val_expression): New function. (dwarf2out_frame_debug): Support REG_CFA_VAL_EXPRESSION. (output_cfa_loc): Support DW_CFA_val_expression. (output_cfa_loc_raw): Likewise. (output_cfi): Likewise. (output_cfi_directive): Likewise. * dwarf2out.c (dw_cfi_oprnd1_desc): Support DW_CFA_val_expression. (dw_cfi_oprnd2_desc): Likewise. (mem_loc_descriptor): Recognize new pattern generated for value expression. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241826 138bc75d-0d04-0410-961f-82ee72b054a4
* * dwarf2out.c (gen_variable_die): Remove again origin_die variablejakub2016-11-011-2/+1
| | | | | | | and its initialization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241759 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix dwarf2out.c non-HAVE_AS_LEB128 bootstrap failurero2016-11-011-1/+3
| | | | | | | * dwarf2out.c (output_rnglists): Wrap basebuf, len in HAVE_AS_LEB128. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241758 138bc75d-0d04-0410-961f-82ee72b054a4