aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-11-25Reverts patches providing octet support in dwarfChristian Eggers4-63/+22
Reverts "dwarf2: Align relocation within .debug_line section" commit 204f543cae7a5dc908264b49d558191d0ceb989c, Reverts "dwarf2: Pad size of .debug_line section." commit 145c4477d239fef4e31a457ff8a1ba7153e9a448, Reverts "dwarf2: Use octets for .debug_line prologue" commit 38c24f42c97af59ad83505ed735e689c63d3ca45, Mostly reverts "dwarf2: Use octets for dwarf2 headers" commit 7235427998571b6d8267e7ac72a52d7b082f4c2b, Mostly reverts "Symbols with octets value" commit d18d199917337537713f9fc4b7ae4d6568f740cf. * dwarf2dbg.c (out_set_addr): Revert 2019-03-13 change. (out_debug_line, out_debug_aranges, out_debug_info): Likewise. * symbols.h (symbol_set_value_now_octets, symbol_octets_p): Remove. * symbols.c (struct symbol_flags): Remove member sy_octets. (symbol_temp_new_now_octets): Don't set symbol_flags::sy_octets. (resolve_symbol_value): Revert: Return octets instead of bytes if sy_octets is set. (symbol_set_value_now_octets): Remove. (symbol_octets_p): Remove.
2019-11-25Automatic date update in version.inGDB Administrator1-1/+1
2019-11-24Include gdbarch.h in m68k-linux-nat.cSimon Marchi2-0/+5
Fix this compilation error, and a bunch of similar ones: CXX m68k-linux-nat.o /home/smarchi/src/binutils-gdb/gdb/m68k-linux-nat.c: In function ‘void fetch_register(regcache*, int)’: /home/smarchi/src/binutils-gdb/gdb/m68k-linux-nat.c:133:9: error: ‘gdbarch_register_name’ was not declared in this scope gdbarch_register_name (gdbarch, regno), ^~~~~~~~~~~~~~~~~~~~~ gdb/ChangeLog: * m68k-linux-nat.c: Include gdbarch.h. Change-Id: I7cd47bc5d094241b2596e29c244eb55ed11f7a02
2019-11-24Use bool in require_partial_symbolsTom Tromey4-20/+37
This changes require_partial_symbols to use bool as its parameter type. gdb/ChangeLog 2019-11-24 Tom Tromey <tom@tromey.com> * symfile.c (read_symbols): Update. * psymtab.c (require_partial_symbols): Change type of "verbose" to bool. (psym_map_symtabs_matching_filename, find_pc_sect_psymtab) (psym_lookup_symbol, psym_find_last_source_symtab) (psym_forget_cached_source_info, psym_print_stats) (psym_expand_symtabs_for_function, psym_expand_all_symtabs) (psym_expand_symtabs_with_fullname, psym_map_symbol_filenames) (psym_map_matching_symbols, psym_expand_symtabs_matching) (psym_find_compunit_symtab_by_address) (maintenance_print_psymbols, maintenance_info_psymtabs) (maintenance_check_psymtabs): Update. * psymtab.h (require_partial_symbols): Change type of "verbose" to bool. Change-Id: Iae87aa5e4590706bb9e90a33adb86f1fe0fbf3c7
2019-11-24Automatic date update in version.inGDB Administrator1-1/+1
2019-11-23Automatic date update in version.inGDB Administrator1-1/+1
2019-11-22Restore parameter names in observable.hTom Tromey2-80/+93
Ages ago, when we switched observables to be templates, Joel asked me to restore the parameter names that were used in the old observer.texi. I've finally done this, putting the names into comments. I also updated the comments in this file to use the GNU metasyntactic variable convention as well. gdb/ChangeLog 2019-11-22 Tom Tromey <tom@tromey.com> * observable.h: Update comments. Change-Id: Id71bea7a7fcaa8f5d4491f33aa8861c56ba9c3f0
2019-11-22Avoid crash in print_ada_task_infoTom Tromey5-6/+29
In MI mode, print_ada_task_info can crash in find_thread_ptid when trying to print an Ada task that is no longer alive. This patch avoids the problem by checking for this case. Because this is Ada-specific, and because Joel approved it internally, I am checking it in. gdb/ChangeLog 2019-11-22 Tom Tromey <tromey@adacore.com> * ada-tasks.c (ada_task_is_alive): Make parameter const. (print_ada_task_info): Don't try to fetch thread id if task is not alive. gdb/gdbserver/ChangeLog 2019-11-22 Tom Tromey <tromey@adacore.com> * gdb.ada/tasks.exp: Add -ada-task-info regression test. * gdb.ada/tasks/foo.adb: Add another stopping location. Change-Id: If25eae6507eebb7537eb8adbcbaa1fc1eec88f5c
2019-11-22Replace SYMBOL_*_NAME accessors with member functionsChristian Biesinger57-376/+481
Similar to the MSYMBOL version of this patch, improves readability and will eventually allow making name private. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-exp.y: Update. * ada-lang.c (sort_choices): Update. (ada_print_symbol_signature): Update. (resolve_subexp): Update. (ada_parse_renaming): Update. (ada_read_renaming_var_value): Update. (lesseq_defined_than): Update. (remove_extra_symbols): Update. (remove_irrelevant_renamings): Update. (ada_add_block_symbols): Update. (ada_collect_symbol_completion_matches): Update. (ada_is_renaming_symbol): Update. (aggregate_assign_from_choices): Update. (ada_evaluate_subexp): Update. (ada_has_this_exception_support): Update. (ada_is_non_standard_exception_sym): Update. (ada_add_exceptions_from_frame): Update. (ada_add_global_exceptions): Update. (ada_print_subexp): Update. * ax-gdb.c (gen_var_ref): Update. (gen_maybe_namespace_elt): Update. (gen_expr_for_cast): Update. (gen_expr): Update. * block.h: Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * buildsym.c (find_symbol_in_list): Update. * c-exp.y: Update. * c-typeprint.c (c_print_typedef): Update. (c_type_print_template_args): Update. * cli/cli-cmds.c (edit_command): Update. (list_command): Update. (print_sal_location): Update. * coffread.c (patch_opaque_types): Update. (process_coff_symbol): Update. (coff_read_enum_type): Update. * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. (convert_one_symbol): Update. (hash_symname): Update. (eq_symname): Update. * compile/compile-cplus-symbols.c (convert_one_symbol): Update. * compile/compile-cplus-types.c (debug_print_scope): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * compile/compile-object-load.c (get_out_value_type): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. (search_symbol_list): Update. (cp_lookup_symbol_imports_or_template): Update. * cp-support.c (overload_list_add_symbol): Update. * ctfread.c (psymtab_to_symtab): Update. * dbxread.c (cp_set_block_scope): Update. * dictionary.c (iter_match_first_hashed): Update. (iter_match_next_hashed): Update. (insert_symbol_hashed): Update. (iter_match_next_linear): Update. * dictionary.h: Update. * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. (locexpr_describe_location_piece): Update. (locexpr_describe_location_1): Update. (locexpr_generate_c_location): Update. (loclist_describe_location): Update. (loclist_generate_c_location): Update. * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. (read_func_scope): Update. (process_enumeration_scope): Update. (new_symbol): Update. (dwarf2_const_value): Update. (dwarf2_symbol_mark_computed): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * f-valprint.c (info_common_command_for_block): Update. * findvar.c (get_hosting_frame): Update. (default_read_var_value): Update. * go-lang.c (go_symbol_package_name): Update. * guile/scm-block.c (bkscm_print_block_smob): Update. * guile/scm-symbol.c (syscm_print_symbol_smob): Update. (gdbscm_symbol_name): Update. (gdbscm_symbol_linkage_name): Update. (gdbscm_symbol_print_name): Update. * infcall.c (get_function_name): Update. * infcmd.c (jump_command): Update. (finish_command): Update. * infrun.c (insert_exception_resume_breakpoint): Update. * linespec.c (canonicalize_linespec): Update. (create_sals_line_offset): Update. (convert_linespec_to_sals): Update. (complete_label): Update. (find_label_symbols_in_block): Update. * m2-typeprint.c (m2_print_typedef): Update. * mdebugread.c (mdebug_reg_to_regnum): Update. (parse_symbol): Update. (mylookup_symbol): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. (list_args_or_locals): Update. * objc-lang.c (compare_selectors): Update. (info_selectors_command): Update. (compare_classes): Update. (info_classes_command): Update. (find_imps): Update. * p-typeprint.c (pascal_print_typedef): Update. * printcmd.c (build_address_symbolic): Update. (info_address_command): Update. (print_variable_and_value): Update. * python/py-framefilter.c (extract_sym): Update. (py_print_single_arg): Update. * python/py-symbol.c (sympy_str): Update. (sympy_get_name): Update. (sympy_get_linkage_name): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rust-lang.c (rust_print_typedef): Update. * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. * stabsread.c (stab_reg_to_regnum): Update. (define_symbol): Update. (read_enum_type): Update. (common_block_end): Update. (cleanup_undefined_types_1): Update. (scan_file_globals): Update. * stack.c (print_frame_arg): Update. (print_frame_args): Update. (find_frame_funname): Update. (info_frame_command_core): Update. (iterate_over_block_locals): Update. (print_block_frame_labels): Update. (do_print_variable_and_value): Update. (iterate_over_block_arg_vars): Update. (return_command): Update. * symmisc.c (dump_symtab_1): Update. (print_symbol): Update. * symtab.c (eq_symbol_entry): Update. (symbol_cache_dump): Update. (lookup_language_this): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (symbol_search::compare_search_syms): Update. (treg_matches_sym_type_name): Update. (search_symbols): Update. (print_symbol_info): Update. (rbreak_command): Update. (completion_list_add_symbol): Update. (find_gnu_ifunc): Update. (get_symbol_address): Update. (search_module_symbols): Update. (info_module_subcommand): Update. * symtab.h (SYMBOL_NATURAL_NAME): Remove. (SYMBOL_LINKAGE_NAME): Remove. (SYMBOL_DEMANGLED_NAME): Remove. (SYMBOL_PRINT_NAME): Remove. (SYMBOL_SEARCH_NAME): Remove. * tracepoint.c (set_traceframe_context): Update. (validate_actionline): Update. (collection_list::collect_symbol): Update. (encode_actions_1): Update. (info_scope_command): Update. (print_one_static_tracepoint_marker): Update. * typeprint.c (typedef_hash_table::add_template_parameters): Update. * valops.c (address_of_variable): Update. (find_overload_match): Update. (find_oload_champ): Update. Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2
2019-11-22Replace the MSYMBOL_*_NAME macros with member functionsChristian Biesinger52-201/+320
Improves readability. In the future, it will also allow making the name private, once the name setter functions become member functions. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_lookup_simple_minsym): Update. (ada_collect_symbol_completion_matches): Update. * ada-tasks.c (read_atcb): Update. * amd64-windows-tdep.c (amd64_skip_main_prologue): Update. (amd64_windows_skip_trampoline_code): Update. * arm-tdep.c (skip_prologue_function): Update. (arm_skip_stack_protector): Update. * arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update. (arm_wince_skip_main_prologue): Update. * ax-gdb.c (gen_expr): Update. * block.c (call_site_for_pc): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (set_breakpoint_location_function): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * c-valprint.c (print_unpacked_pointer): Update. * coffread.c (coff_symfile_read): Update. * compile/compile-c-symbols.c (convert_symbol_bmsym): Update. * compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update. * dwarf-index-write.c (write_psymbols): Update. * dwarf2loc.c (call_site_to_target_addr): Update. (func_verify_no_selftailcall): Update. (tailcall_dump): Update. (call_site_find_chain_1): Update. (dwarf_expr_reg_to_entry_parameter): Update. * elfread.c (elf_gnu_ifunc_record_cache): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. (evaluate_subexp_for_sizeof): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * frame.c (get_prev_frame_always_1): Update. * frv-tdep.c (frv_skip_main_prologue): Update. * gnu-v2-abi.c (gnuv2_value_rtti_type): Update. * gnu-v3-abi.c (gnuv3_rtti_type): Update. (gnuv3_get_typename_from_type_info): Update. (gnuv3_skip_trampoline): Update. * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update. * i386-tdep.c (i386_skip_main_prologue): Update. (i386_pe_skip_trampoline_code): Update. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. * infcall.c (get_function_name): Update. * linespec.c (minsym_found): Update. * linux-fork.c (info_checkpoints_command): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. (m32c_m16c_pointer_to_address): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (add_minsym_to_hash_table): Update. (add_minsym_to_demangled_hash_table): Update. (lookup_minimal_symbol_mangled): Update. (lookup_minimal_symbol_demangled): Update. (lookup_minimal_symbol_linkage): Update. (lookup_minimal_symbol_text): Update. (lookup_minimal_symbol_by_pc_name): Update. (minimal_symbol_is_less_than): Update. (compact_minimal_symbols): Update. (build_minimal_symbol_hash_tables): Update. (find_solib_trampoline_target): Update. * mips-tdep.c (mips_stub_frame_sniffer): Update. (mips_skip_pic_trampoline_code): Update. * msp430-tdep.c (msp430_skip_trampoline_code): Update. * objc-lang.c (info_selectors_command): Update. (info_classes_command): Update. (find_methods): Update. (find_imps): Update. * p-valprint.c (pascal_val_print): Update. * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic): Update. (info_symbol_command): Update. * psymtab.c (psymbol_name_matches): Update. (match_partial_symbol): Update. (lookup_partial_symbol): Update. (print_partial_symbols): Update. (sort_pst_symbols): Update. (maintenance_check_psymtabs): Update. * python/py-framefilter.c (py_print_frame): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rs6000-tdep.c (rs6000_skip_main_prologue): Update. (rs6000_skip_trampoline_code): Update. * sol-thread.c (info_cb): Update. * stabsread.c (scan_file_globals): Update. * stack.c (find_frame_funname): Update. (info_frame_command_core): Update. * symmisc.c (dump_msymbols): Update. * symtab.c (symbol_natural_name): Rename to.., (general_symbol_info::natural_name): ...this. (symbol_demangled_name): Rename to... (general_symbol_info::demangled_name): ...this. (symbol_search_name): Rename to... (general_symbol_info::search_name): ...this. (symbol_matches_search_name): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (search_symbols): Update. (print_msymbol_info): Update. (rbreak_command): Update. (completion_list_add_msymbol): Update. (completion_list_objc_symbol): Update. (get_msymbol_address): Update. * symtab.h (struct general_symbol_info): Add member functions natural_name (), linkage_name (), print_name (), demangled_name (), and search_name (). (SYMBOL_NATURAL_NAME): Update. (symbol_natural_name): Move to a member function on general_symbol_info. (SYMBOL_DEMANGLED_NAME): Update. (symbol_demangled_name): Move to a member function on general_symbol_info. (SYMBOL_SEARCH_NAME): Update. (symbol_search_name): Move to a member function on general_symbol_info. (MSYMBOL_NATURAL_NAME): Remove. (MSYMBOL_LINKAGE_NAME): Remove. (MSYMBOL_PRINT_NAME): Remove. (MSYMBOL_DEMANGLED_NAME): Remove. (MSYMBOL_SEARCH_NAME): Remove. * x86-tdep.c (x86_in_indirect_branch_thunk): Update. Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee
2019-11-22Create a correctly-sized demangled names hashtableChristian Biesinger2-2/+18
If we have a minsym count, we know the demangled names hashtable will be at least that big. So use that count to size it, so we don't have to resize/rehash it as much. This is a 6% improvement in minsym loading time. 2019-11-22 Christian Biesinger <cbiesinger@google.com> * symtab.c (create_demangled_names_hash): Use per_bfd-> minimal_symbol_count for computing the initial size, if greater than our default size. Change-Id: I1f074d38e1d90af58705ec852f90c84cc034cd2e
2019-11-22[gdb/contrib] Improve words extraction in words.sh scriptTom de Vries2-1/+6
Remove more punctuation and quoting in words.sh script. gdb/ChangeLog: 2019-11-22 Tom de Vries <tdevries@suse.de> * contrib/words.sh: Improve words extraction. Change-Id: I1d9eea165731af4e6c4e1c7e09aed9b07af6395c
2019-11-22[gdb/contrib] Combine sed invocations in words.sh scriptTom de Vries2-5/+10
Currently running words.sh on all the c source and header files in the repo takes ~16s in user time: ... $ time ./gdb/contrib/words.sh \ $(find -type f -name "*.c" -o -name "*.h") \ >/dev/null real 0m7,787s user 0m16,349s sys 0m0,367s ... Rewrite the sed invocations using the -e option from this: ... | sed <sedprog1> | sed <sedprog2> ... into this: ... | sed \ -e <sedprog1> -e <sedprog2> ... and reduce user time to ~11s: ... $ time ./gdb/contrib/words.sh \ $(find -type f -name "*.c" -o -name "*.h") \ >/dev/null real 0m7,243s user 0m11,220s sys 0m0,205s ... gdb/ChangeLog: 2019-11-22 Tom de Vries <tdevries@suse.de> * contrib/words.sh: Combine sed invocations. Change-Id: Ib08453f3712f32ed02d9f503ee960711ebb9421b
2019-11-22Arm: Change CRC from fpu feature to archititectural extensionMihail Ionescu8-44/+106
This patch changes the CRC extension to use the core feature bits instead of the coproc/fpu feature bits. CRC is not an fpu feature and it causes issues with the new fpu reset patch (f439988037a589de3798f44e7268301adaec21a9). CRC can be set using the '.arch_extension' directive, which sets bits in the coproc bitfield. When a '.fpu' directive is encountered, the CRC feature bit gets removed and there is no way to set it back using '.fpu'. With this patch, CRC will be marked in the feature core bits, which prevents it from getting removed when setting/changing the fpu options. gas/ChangeLog: * config/tc-arm.c (arm_ext_crc): New. (crc_ext_armv8): Remove. (insns): Rename crc_ext_armv8 to arm_ext_crc. (arm_cpus): Replace CRC_EXT_ARMV8 with ARM_EXT2_CRC. (armv8a_ext_table, armv8r_ext_table, arm_option_extension_value_table): Redefine the crc extension in terms of ARM_EXT2_CRC. * gas/testsuite/gas/arm/crc-ext.s: New. * gas/testsuite/gas/arm/crc-ext.d: New. include/ChangeLog: * opcode/arm.h (ARM_EXT2_CRC): New extension feature to replace CRC_EXT_ARMV8. (CRC_EXT_ARMV8): Remove and mark bit as unused. (ARM_ARCH_V8A_CRC, ARM_ARCH_V8_1A, ARM_ARCH_V8_2A, ARM_ARCH_V8_3A, ARM_ARCH_V8_4A, ARM_ARCH_V8_5A, ARM_ARCH_V8_6A): Redefine using ARM_EXT2_CRC instead of CRC_EXT_ARMV8. opcodes/ChangeLog: * opcodes/arm-dis.c (arm_opcodes, thumb32_opcodes): Change the coproc CRC conditions to use the extension feature set, second word, base on ARM_EXT2_CRC.
2019-11-22Update the linker documentation regarding the /DISCARD/ linker script ↵Nick Clifton2-0/+10
section and its interaction with ELF section groups. * ld.texi (Output Section Discarding): Add note indicating that /DISCARD/ed sections ignore ELF section grouping.
2019-11-22Replace unnecessary null check with a cast.Nick Clifton2-1/+6
* ldlang.h (LANG_FOR_EACH_INPUT_STATEMENT): Use cast instead of extra check.
2019-11-22Automatic date update in version.inGDB Administrator1-1/+1
2019-11-21Rename demangle.c to gdb-demangle.c, and some cleanupChristian Biesinger5-5/+17
In addition to renaming demangle.c to match the header file naming, this also makes is_cplus_marker return a bool and removes a duplicate declaration of "bool demangle" from symtab.h. gdb/ChangeLog: 2019-11-21 Christian Biesinger <cbiesinger@google.com> * Makefile.in: Update. * demangle.c: Rename to... * gdb-demangle.c: ..this. (is_cplus_marker): Change return type to bool. (_initialize_demangler): Rename to... (_initialize_gdb_demangle): ...this. * gdb-demangle.h (is_cplus_marker): Change return type to bool. * symtab.h (demangle): Remove declaration; instead include gdb-demangle.h. Change-Id: I83c3b3f7ee71b2bf6f5b5d0f9eb1d4b5208f2a97
2019-11-21Handle %I64d in format_piecesTom Tromey3-21/+48
We found a bug internally where gdb would crash while disassembling a certain instruction. This was tracked down to the handling of %I64d in format_pieces. format_pieces will convert %ll to %I64d on mingw -- so format_pieces should also handle parsing this format. In this patch, I've made the parsing unconditional, since I think it is harmless to accept extra formats. I've also taken the opportunity to convert the length modifier test to a "switch". Tested internally using our failing test case. gdb/ChangeLog 2019-11-21 Tom Tromey <tromey@adacore.com> * gdbsupport/format.c (format_pieces): Parse %I64d. * unittests/format_pieces-selftests.c (test_windows_formats): New function. (run_tests): Call it. Change-Id: If335c7c2fc8d01e629cd55182394a483334d79c7
2019-11-21Adjust byte order variable display/change if DW_AT_endianity is present.Peeter Joot29-58/+269
- Rationale: It is possible for compilers to indicate the desired byte order interpretation of scalar variables using the DWARF attribute: DW_AT_endianity A type flagged with this variable would typically use one of: DW_END_big DW_END_little which instructs the debugger what the desired byte order interpretation of the variable should be. The GCC compiler (as of V6) has a mechanism for setting the desired byte ordering of the fields within a structure or union. For, example, on a little endian target, a structure declared as: struct big { int v; short a[4]; } __attribute__( ( scalar_storage_order( "big-endian" ) ) ); could be used to ensure all the structure members have a big-endian interpretation (the compiler would automatically insert byte swap instructions before and after respective store and load instructions). - To reproduce GCC V8 is required to correctly emit DW_AT_endianity DWARF attributes in all situations when the scalar_storage_order attribute is used. A fix for (dwarf endianity instrumentation) for GCC V6-V7 can be found in the URL field of the following PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82509 - Test-case: A new test case (testsuite/gdb.base/endianity.*) is included with this patch. Manual testing for mixed endianity code has also been done with GCC V8. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82509#c4 - Observed vs. expected: Without this change, using scalar_storage_order that doesn't match the target, such as struct otherendian { int v; } __attribute__( ( scalar_storage_order( "big-endian" ) ) ); would behave like the following on a little endian target: Breakpoint 1 at 0x401135: file endianity.c, line 41. (gdb) run Starting program: /home/pjoot/freeware/t/a.out Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.x86_64 Breakpoint 1, main () at endianity.c:41 41 struct otherendian o = {3}; (gdb) n 43 do_nothing (&o); /* START */ (gdb) p o $1 = {v = 50331648} (gdb) p /x $2 = {v = 0x3000000} whereas with this gdb enhancement we can access the variable with the user specified endianity: Breakpoint 1, main () at endianity.c:41 41 struct otherendian o = {3}; (gdb) p o $1 = {v = 0} (gdb) n 43 do_nothing (&o); /* START */ (gdb) p o $2 = {v = 3} (gdb) p o.v = 4 $3 = 4 (gdb) p o.v $4 = 4 (gdb) x/4xb &o.v 0x7fffffffd90c: 0x00 0x00 0x00 0x04 (observe that the 4 byte int variable has a big endian representation in the hex dump.) gdb/ChangeLog 2019-11-21 Peeter Joot <peeter.joot@lzlabs.com> Byte reverse display of variables with DW_END_big, DW_END_little (DW_AT_endianity) dwarf attributes if different than the native byte order. * ada-lang.c (ada_value_binop): Use type_byte_order instead of gdbarch_byte_order. * ada-valprint.c (printstr): (ada_val_print_string): * ada-lang.c (value_pointer): (ada_value_binop): Use type_byte_order instead of gdbarch_byte_order. * c-lang.c (c_get_string): Use type_byte_order instead of gdbarch_byte_order. * c-valprint.c (c_val_print_array): Use type_byte_order instead of gdbarch_byte_order. * cp-valprint.c (cp_print_class_member): Use type_byte_order instead of gdbarch_byte_order. * dwarf2loc.c (rw_pieced_value): Use type_byte_order instead of gdbarch_byte_order. * dwarf2read.c (read_base_type): Handle DW_END_big, DW_END_little * f-lang.c (f_get_encoding): Use type_byte_order instead of gdbarch_byte_order. * findvar.c (default_read_var_value): Use type_byte_order instead of gdbarch_byte_order. * gdbtypes.c (check_types_equal): Require matching TYPE_ENDIANITY_NOT_DEFAULT if set. (recursive_dump_type): Print TYPE_ENDIANITY_BIG, and TYPE_ENDIANITY_LITTLE if set. (type_byte_order): new function. * gdbtypes.h (TYPE_ENDIANITY_NOT_DEFAULT): New macro. (struct main_type) <flag_endianity_not_default>: New field. (type_byte_order): New function. * infcmd.c (default_print_one_register_info): Use type_byte_order instead of gdbarch_byte_order. * p-lang.c (pascal_printstr): Use type_byte_order instead of gdbarch_byte_order. * p-valprint.c (pascal_val_print): Use type_byte_order instead of gdbarch_byte_order. * printcmd.c (print_scalar_formatted): Use type_byte_order instead of gdbarch_byte_order. * solib-darwin.c (darwin_current_sos): Use type_byte_order instead of gdbarch_byte_order. * solib-svr4.c (solib_svr4_r_ldsomap): Use type_byte_order instead of gdbarch_byte_order. * stap-probe.c (stap_modify_semaphore): Use type_byte_order instead of gdbarch_byte_order. * target-float.c (target_float_same_format_p): Use type_byte_order instead of gdbarch_byte_order. * valarith.c (scalar_binop): (value_bit_index): Use type_byte_order instead of gdbarch_byte_order. * valops.c (value_cast): Use type_byte_order instead of gdbarch_byte_order. * valprint.c (generic_emit_char): (generic_printstr): (val_print_string): Use type_byte_order instead of gdbarch_byte_order. * value.c (unpack_long): (unpack_bits_as_long): (unpack_value_bitfield): (modify_field): (pack_long): (pack_unsigned_long): Use type_byte_order instead of gdbarch_byte_order. * findvar.c (unsigned_pointer_to_address): (signed_pointer_to_address): (unsigned_address_to_pointer): (address_to_signed_pointer): (default_read_var_value): (default_value_from_register): Use type_byte_order instead of gdbarch_byte_order. * gnu-v3-abi.c (gnuv3_make_method_ptr): Use type_byte_order instead of gdbarch_byte_order. * riscv-tdep.c (riscv_print_one_register_info): Use type_byte_order instead of gdbarch_byte_order. gdb/testsuite/ChangeLog 2019-11-21 Peeter Joot <peeter.joot@lzlabs.com> * gdb.base/endianity.c: New test. * gdb.base/endianity.exp: New file. Change-Id: I4bd98c1b4508c2d7c5a5dbb15d7b7b1cb4e667e2
2019-11-21Fix potentially undefined behaviour in the linker when parsing input statements.Nick Clifton2-1/+6
* ldlang.h (LANG_FOR_EACH_INPUT_STATEMENT): Check for an empty file chain before examining the first input statement.
2019-11-21gdb/testsuite: skip gdb.arch/amd64-eval.exp when target is not x86_64Lukas Durfina2-0/+9
2019-11-21gdb: remove gen_ret_current_ui_field_ptrSimon Marchi2-12/+35
I think it would be clearer to not use gen_ret_current_ui_field_ptr to generate the implementation of current_ui_gdb_stdout_ptr et al. It doesn't save much code, but adds a layer of complexity for the reader. Plus, it doesn't work well with IDEs, for example if you ask to find all usages the m_gdb_stdout field. gdb/ChangeLog: * top.c (current_ui_gdb_stdout_ptr): Spell out by hand. (current_ui_gdb_stdin_ptr): Likewise. (current_ui_gdb_stderr_ptr): Likewise. (current_ui_gdb_stdlog_ptr): Likewise. (current_ui_current_uiout_ptr): Likewise. (gen_ret_current_ui_field_ptr): Remove. Change-Id: I86f821c9d119453701caedf0e47124ccddfbab2d
2019-11-21PR273, SOM size -AAlan Modra3-3/+18
The SOM backend creates BFD sections for "spaces", and "sub-spaces". "sub-spaces" are what we normally think of as a section, "spaces" aggregate "sub-spaces". Thus it does not really make sense to include "spaces" for size -A since that would double count total size. It so happens that real sections ought to have at least one of the ALLOC and HAS_CONTENTS flags set, so this patch excludes "spaces" but excluding BFD sections with no flags set. PR 273 * size.c (sysv_internal_sizer, sysv_internal_printer): Exclude sections with no flag bits set. * testsuite/binutils-all/size.exp: Allow $CODE$ as a text section.
2019-11-21Fix potential buffer overrun in objcopy's note merging code.Nick Clifton2-3/+14
* objcopy.c (merge_gnu_build_notes): Allow for the possibility that the new notes might actually be larger than the original notes.
2019-11-21ARM cmse_scan segfaultAlan Modra2-2/+10
This code in elf_link_add_object_symbols: ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed); if (ret < 0) goto error_return; /* If we have already included this dynamic object in the link, just ignore it. There is no reason to include a particular dynamic object more than once. */ if (ret > 0) return TRUE; prevents a shared library from being loaded twice by ensuring that any library soname doesn't match the soname of one already loaded. This happens before sym_hashes are allocated, which leaves sym_hashes NULL. cmse_scan looks at library symbols, and when attempting to look up a global symbol will segfault if sym_hashes is zero. * elf32-arm.c (elf32_arm_size_stubs): Exclude dynamic library BFDs that have not been loaded.
2019-11-21[gdb] Only force INTERP_CONSOLE ui_out for breakpoint commands in MI modeTom de Vries4-0/+35
The problem reported in PR mi/25055 is that the output of the backtrace command, when executed as breakpoint command does not show when executing using the MI interpreter: ... $ gdb a.out Reading symbols from a.out... (gdb) break main Breakpoint 1 at 0x4003c0: file test.c, line 19. (gdb) commands Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". >bt >end (gdb) interpreter-exec mi "-exec-run" ^done Breakpoint 1, main () at test.c:19 19 return foo (4); (gdb) ... Interestingly, the function print_frame is called twice during -exec-run: - once during tui_on_normal_stop where the ui_out is temporarily set to tui->interp_ui_out (), resulting in the part after the comma in "Breakpoint 1, main () at test.c:19" - once during execute_control_command, where the ui_out is the default for the current interpreter: mi_ui_out, which ignores calls to output text. The commit 3a87ae656c2 "Use console uiout when executing breakpoint commands" fixes the problem by temporarily switching to the ui_out of INTERP_CONSOLE in execute_control_command. This however caused a regression in redirection (escaping '#' using '\' for git commit message convenience): ... $ rm -f gdb.txt; gdb a.out Reading symbols from a.out... (gdb) break main Breakpoint 1 at 0x4003c0: file test.c, line 19. (gdb) commands Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". >bt >end (gdb) set logging redirect on (gdb) set logging on Redirecting output to gdb.txt. Copying debug output to gdb.txt. (gdb) run \#0 main () at test.c:19 (gdb) q A debugging session is active. Inferior 1 [process 22428] will be killed. Quit anyway? (y or n) y $ cat gdb.txt Starting program: /data/gdb_versions/devel/a.out Breakpoint 1, main () at test.c:19 19 return foo (4); ... The problem is that the '#0 main () at test.c:19' ends up in the gdb output output rather than in gdb.txt. This is due to the fact that the redirect is setup for the current ui_out (which is tui->interp_ui_out ()), while the backtrace output is printed to the INTERP_CONSOLE ui_out. Fix this by limiting switching to INTERP_CONSOLE ui_out to when INTERP_MI is active. Tested on x86_64-linux. gdb/ChangeLog: 2019-11-21 Tom de Vries <tdevries@suse.de> PR gdb/24956 * cli/cli-script.c (execute_control_command): Only switch to INTERP_CONSOLE's ui_out when INTERP_MI is active. gdb/testsuite/ChangeLog: 2019-11-21 Tom de Vries <tdevries@suse.de> PR gdb/24956 * gdb.base/ui-redirect.exp: Test output of user-defined command. Change-Id: Id1771e7fcc9496a7d97ec2b2ea6b1487596f1ef7
2019-11-21PR46, cygwin: FAIL: cdtest with -UrAlan Modra8-13/+41
See the comment in pe.sc to understand why ld -Ur won't work. PR 46 binutils/ * testsuite/lib/binutils-common.exp (is_pecoff_format): Rewrite with positive logic and add more target triples. ld/ * scripttempl/pe.sc: Comment on ld -Ur fail. Wrap .gcc_exc comment. * scripttempl/pep.sc: Likewise. * testsuite/ld-cdtest/cdtest.exp (test2): xfail for pe.
2019-11-21Automatic date update in version.inGDB Administrator1-1/+1
2019-11-20Add missing parentheses on 'print' (gdb.python/py-progspace.exp)Sergio Durigan Junior2-3/+8
Commit 33d569b709886a1208145806da80b689d9cae9da ("gdb/python: Return None from Progspace.block_for_pc on error") added a few tests on gdb.python/py-progspace.exp which use 'print', but forgot to use parentheses when passing the arguments to be printed. This fails on Python 3. This commit adds these missing parentheses. Pushed as obvious. gdb/testsuite/ChangeLog: 2019-11-20 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.python/py-progspace.exp: Add missing parentheses on some 'print' commands. Change-Id: Iac0a7578855d128bbee3b98e7ea5888dae55fc00
2019-11-20Improve target description check for SVE in gdbserverLuis Machado4-1/+29
The current code checks for the presence of a SVE target description by comparing the number of registers. This is a bit fragile since the number of registers can change whenever we add new sets. Like PAC, for example. If the comparison breaks, then we're left with SVE registers in the description, but gdbserver doesn't send the registers to GDB, which in turn displays stale information to the user. The following patch changes the check to use the SVE feature string instead, which hopefully should be more stable. gdb/gdbserver/ChangeLog: 2019-11-20 Luis Machado <luis.machado@linaro.org> * linux-aarch64-low.c (is_sve_tdesc): Check against target feature instead of register count. * tdesc.c (tdesc_contains_feature): New function. * tdesc.h (tdesc_contains_feature): New prototype. Change-Id: I28b782cb1677560ca9a06a1be442974b25aabae4
2019-11-20PR24944, gas doesn't read enough digits when parsing a floating point numberAlan Modra4-8/+23
PR 24944 * atof-generic.c (atof_generic): Increase decimal guard digits. * testsuite/gas/i386/fp.s: Add more tests. * testsuite/gas/i386/fp.d: Update.
2019-11-20cpu: fix comment in bpf.cpuJose E. Marchesi2-1/+5
2019-11-20 Jose E. Marchesi <jose.marchesi@oracle.com> * bpf.cpu: Fix comment describing the 128-bit instruction format.
2019-11-20Automatic date update in version.inGDB Administrator1-1/+1
2019-11-19Fix the "winheight" commandTom Tromey6-27/+71
The "winheight" command is broken. I probably broke it in one of my TUI refactoring patches, though I didn't track down exactly which one. The bug is that the code does: *buf_ptr = '\0'; ... but then never advances buf_ptr past this point, so no window name is seen. This patch refactors the code a bit so that a copy of the argument string is not needed, also fixing the bug. A new test case is included. gdb/ChangeLog 2019-11-19 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_partial_win_by_name): Move from tui-data.c. Now static. Change type of "name". (tui_set_win_height_command): Don't copy "arg". * tui/tui-data.h (tui_partial_win_by_name): Don't declare. * tui/tui-data.c (tui_partial_win_by_name): Move to tui-win.c. gdb/testsuite/ChangeLog 2019-11-19 Tom Tromey <tom@tromey.com> * gdb.tui/winheight.exp: New file. Change-Id: I0871e93777a70036dbec9c9543f862f42e3a81e5
2019-11-19Replace "if (attr)" with "if (attr != nullptr)".Ali Tamur2-48/+75
This is a cleanup patch in response to a reviewer comment on "Dwarf 5: Handle debug_str_offsets" patch.
2019-11-19Report GetLastError value when DebugActiveProcess failsTom Tromey2-1/+7
When DebugActiveProcess fails, the error message is fairly generic: error (_("Can't attach to process.")); It would be more useful for diagnosing problems if the Windows error code was included in the message. This patch implements this. gdb/ChangeLog 2019-11-19 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat_target::attach): Include GetLastError result in error when DebugActiveProcess fails. Change-Id: Ie1bf502a0d96bb7c09bd5b1c5e0c924ba58cd68c
2019-11-19PR24499, ignore --add-gnu-debuglink for archivesAlan Modra2-0/+13
objcopy --add-gnu-debuglink=foo.a.dbg foo.a just doesn't make any sense. Who puts executables in archives? PR 24499 * objcopy.c (copy_file): Ignore --add-gnu-debuglink for archives.
2019-11-19PR24968, make objcopy use output ELF arch if -B not givenAlan Modra2-2/+16
This should make objcopy -B redundant for the common case of producing ELF output where the -O target defaults to the desired arch:mach. PR 24968 * objcopy.c (copy_object): For ELF output and non-ELF input without arch, take arch from output file if not given by -B. Don't bfd_get_arch_info when we already have iarch.
2019-11-19PR25191, internal error in _bfd_elf_set_section_contentsAlan Modra2-10/+24
This PR copies a fuzzed PE input file to ELF output, in the process confusing the ELF backend by copying COFF-only section flags to the output. SEC_COFF_SHARED has the same value as SEC_ELF_COMPRESS. One approach to fixing this problem is of course not to reuse flag bits, but we've run out. So this patch only copies section flags that are in the bfd_applicable_section_flags set when changing the flavour of the output file. PR 25191 * objcopy.c (is_nondebug_keep_contents_section): Use bfd_get_flavour. (copy_object): Likewise. (setup_section): Likewise. If flavour of input and output files differ, restrict section flags to the intersection of input and output bfd_applicable_section_flags.
2019-11-19PR25197, assertion fail coffgen.cAlan Modra2-15/+19
The testcase in this PR triggered "BFD_ASSERT (p2->is_sym)" by sneakily generating a C_FILE sym whose value pointed into auxents. The fix then is in the last changed line of this patch, to check p->is_sym as well as p->u.syment.n_sclass. The other changes fix various overflow checks that weren't as solid as they could be. PR 25197 * coffgen.c (coff_find_nearest_line_with_names): Check that C_FILE u.syment.n_value does point at another C_FILE sym and not into some auxent that happens to look like a C_FILE. Properly check for integer overflow and avoid possible pointer wrap-around. Simplify pr17512 checks.
2019-11-19Add space between program name and file for objcopy/strip/objdump messagesAlan Modra2-6/+11
The GNU coding standard does indicate there should be no space in messages like these, but we tend to put a space in all other messages. This patch cures the inconsistency in: $ binutils/strip-new -F elf32-little -N .text -o pr25200 pr25200.bin binutils/strip-new: pr25200: R_X86_64_PLT32 unsupported binutils/strip-new:pr25200: sorry, cannot handle this file * bucomm.c (bfd_nonfatal_message): Add a space between program name and file.
2019-11-19gdb/testsuite: Merge whatis.exp and ctf-whatis.expAndrew Burgess4-1142/+469
The recently added gdb.base/ctf-whatis.exp test is a slightly modified version of gdb.base/whatis.exp, with a few tests removed, and the source compiled with different compiler options. This patch merges the two tests together into a single test script. I tested using a version of GCC with CTF support added. gdb/testsuite/ChangeLog: * gdb.base/ctf-whatis.c: Delete. * gdb.base/ctf-whatis.exp: Delete. * gdb.base/whatis.exp: Rewrite to compile as both dwarf and ctf. Change-Id: I09e11c70f197b79d2b1e0ae8c86a21c622be6c51
2019-11-19gdb/testsuite: Merge cvexpr.exp and ctf-cvexpr.expAndrew Burgess3-718/+247
The recently added gdb.base/ctf-cvexpr.exp is just a copy of gdb.base/cvexpr.exp but compiled with different options. This patch merges these two tests together into a single test script. I tested this change using a version of GCC with CTF support added. gdb/testsuite/ChangeLog: * gdb.base/ctf-cvexpr.exp: Delete. * gdb.base/cvexpr.exp: Rewrite to compile as both dwarf and ctf. Change-Id: If678c3e38cb444867defa970203d26563f15dba4
2019-11-19gdb/testsuite: Introduce skip_ctf_tests guard functionAndrew Burgess5-20/+42
Most versions of GCC in the wild don't support CTF debug format right now, so, rather than attempting to compile the tests and failing each time, this patch introduces a guard function to check if the compiler supports CTF. If we don't have CTF support then the CTF tests are skipped. This patch only updates 3 of the 4 CTF tests, the fourth will be handled in the next patch. gdb/testsuite/ChangeLog: * gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in the compiler. Clean up header comment a little. * gdb.base/ctf-ptype.exp: Likewise. * gdb.base/ctf-whatis.exp: Likewise. * lib/gdb.exp (skip_ctf_tests): New proc. Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63
2019-11-18Fix crash with core + TUI + runSergio Durigan Junior4-5/+74
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1765117 A segfault can happen in a specific scenario when using TUI + a corefile, as explained in the bug mentioned above. The problem happens when opening a corefile on GDB: $ gdb ./core program entering TUI (C-x a), and then issuing a "run" command. GDB segfaults with the following stack trace: (top-gdb) bt #0 0x00000000004cd5da in target_ops::shortname (this=0x0) at ../../binutils-gdb/gdb/target.h:449 #1 0x0000000000ac08fb in target_shortname () at ../../binutils-gdb/gdb/target.h:1323 #2 0x0000000000ac09ae in tui_locator_window::make_status_line[abi:cxx11]() const (this=0x23e1fa0 <_locator>) at ../../binutils-gdb/gdb/tui/tui-stack.c:86 #3 0x0000000000ac1043 in tui_locator_window::rerender (this=0x23e1fa0 <_locator>) at ../../binutils-gdb/gdb/tui/tui-stack.c:231 #4 0x0000000000ac1632 in tui_show_locator_content () at ../../binutils-gdb/gdb/tui/tui-stack.c:369 #5 0x0000000000ac63b6 in tui_set_key_mode (mode=TUI_COMMAND_MODE) at ../../binutils-gdb/gdb/tui/tui.c:321 #6 0x0000000000aaf9be in tui_inferior_exit (inf=0x2d446a0) at ../../binutils-gdb/gdb/tui/tui-hooks.c:181 #7 0x000000000044cddf in std::_Function_handler<void (inferior*), void (*)(inferior*)>::_M_invoke(std::_Any_data const&, inferior*&&) (__functor=..., __args#0=@0x7fffffffd650: 0x2d446a0) at /usr/include/c++/9/bits/std_function.h:300 #8 0x0000000000757db9 in std::function<void (inferior*)>::operator()(inferior*) const (this=0x2cf3168, __args#0=0x2d446a0) at /usr/include/c++/9/bits/std_function.h:690 #9 0x0000000000757876 in gdb::observers::observable<inferior*>::notify (this=0x23de0c0 <gdb::observers::inferior_exit>, args#0=0x2d446a0) at ../../binutils-gdb/gdb/gdbsupport/observable.h:106 #10 0x000000000075532d in exit_inferior_1 (inftoex=0x2d446a0, silent=1) at ../../binutils-gdb/gdb/inferior.c:191 #11 0x0000000000755460 in exit_inferior_silent (inf=0x2d446a0) at ../../binutils-gdb/gdb/inferior.c:234 #12 0x000000000059f47c in core_target::close (this=0x2d68590) at ../../binutils-gdb/gdb/corelow.c:265 #13 0x0000000000a7688c in target_close (targ=0x2d68590) at ../../binutils-gdb/gdb/target.c:3293 #14 0x0000000000a63d74 in target_stack::push (this=0x23e1800 <g_target_stack>, t=0x23c38c8 <the_amd64_linux_nat_target>) at ../../binutils-gdb/gdb/target.c:568 #15 0x0000000000a63dbf in push_target (t=0x23c38c8 <the_amd64_linux_nat_target>) at ../../binutils-gdb/gdb/target.c:583 #16 0x0000000000748088 in inf_ptrace_target::create_inferior (this=0x23c38c8 <the_amd64_linux_nat_target>, exec_file=0x2d58d30 "/usr/bin/cat", allargs="", env=0x25f12b0, from_tty=1) at ../../binutils-gdb/gdb/inf-ptrace.c:128 #17 0x0000000000795ccb in linux_nat_target::create_inferior (this=0x23c38c8 <the_amd64_linux_nat_target>, exec_file=0x2d58d30 "/usr/bin/cat", allargs="", env=0x25f12b0, from_tty=1) at ../../binutils-gdb/gdb/linux-nat.c:1094 #18 0x000000000074eae9 in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at ../../binutils-gdb/gdb/infcmd.c:639 ... The problem happens because 'tui_locator_window::make_status_line' needs the value of 'target_shortname' in order to update the status line. 'target_shortname' is a macro which expands to: #define target_shortname (current_top_target ()->shortname ()) and, in our scenario, 'current_top_target ()' returns NULL, which obviously causes a segfault. But why does it return NULL, since, according to its comment on target.h, it should never do that? What is happening is that we're being caught in the middle of a "target switch". We had the 'core_target' on top, because we were inspecting a corefile, but when the user decided to invoke "run" GDB had to actually create the inferior, which ends up detecting that we have a target already, and tries to close it (from target.c): /* See target.h. */ void target_stack::push (target_ops *t) { /* If there's already a target at this stratum, remove it. */ strata stratum = t->stratum (); if (m_stack[stratum] != NULL) { target_ops *prev = m_stack[stratum]; m_stack[stratum] = NULL; target_close (prev); // <-- here } ... When the current target ('core_target') is being closed, it checks for possible observers registered with it and calls them. TUI is one of those observers, it gets called, tries to update the status line, and GDB crashes. The real problem is that we are clearing 'm_stack[stratum]', but forgetting to adjust 'm_top'. Interestingly, this scenario is covered in 'target_stack::unpush', but Pedro said he forgot to call it here.. The fix, therefore, is to call '::unpush' if there's a target on the stack. This patch has been tested on the Buildbot and no regressions have been found. I'm also submitting a testcase for it. gdb/ChangeLog: 2019-11-18 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> https://bugzilla.redhat.com/show_bug.cgi?id=1765117 * target.c (target_stack::push): Call 'unpush' if there's a target on top of the stack. gdb/testsuite/ChangeLog: 2019-11-18 Sergio Durigan Junior <sergiodj@redhat.com> https://bugzilla.redhat.com/show_bug.cgi?id=1765117 * gdb.tui/corefile-run.exp: New file. Change-Id: I39e2f8b538c580c8ea5bf1d657ee877e47746c8f
2019-11-19Automatic date update in version.inGDB Administrator1-1/+1
2019-11-19[GOLD] OSABI not set when STT_GNU_IFUNC or STB_GNU_UNIQUE symbols outputAlan Modra4-4/+52
This patch arranges to have OSABI set to ELFOSABI_GNU (if not set to some other non-zero value) when gold outputs an ifunc local or global symbol, or a unique global symbol to either .dynsym or .symtab. STT_GNU_IFUNC and STB_GNU_UNIQUE have values in the LOOS to HIOS range and therefore require interpretation according to OSABI. I'm not sure why parameters->target() is const Target& while parameters->sized_target() is Sized_target*, but it's inconvenient to use the latter in Symbol_table::finalize. So this patch adds another const_cast complained about in layout.cc and gold.cc. PR 24853 * symtab.h (set_has_gnu_output, has_gnu_output_): New. * symtab.cc (Symbol_table::Symbol_table): Init has_gnu_output_. (Symbol_table::finalize): Set ELFOSABI_GNU when has_gnu_output_. (Symbol_table::set_dynsym_indexes, Symbol_table::sized_finalize): Call set_has_gnu_output for STT_GNU_IFUNC and STB_GNU_UNIQUE globals. * object.cc (Sized_relobj_file::do_finalize_local_symbols): Call set_has_gnu_output when STT_GNU_IFUNC locals will be output.
2019-11-19PR25200, SIGSEGV in _bfd_elf_validate_relocAlan Modra3-23/+12
PR 25200 * reloc.c (bfd_default_reloc_type_lookup): Don't BFD_FAIL. * elf.c (_bfd_elf_validate_reloc): Don't segfault on NULL howto.
2019-11-18Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc ↵Philippe Waroquiers9-0/+21
functions. valgrind reports leaks in many python tests, such as: ==17162== VALGRIND_GDB_ERROR_BEGIN ==17162== 8,208 (5,472 direct, 2,736 indirect) bytes in 57 blocks are definitely lost in loss record 7,551 of 7,679 ==17162== at 0x4835753: malloc (vg_replace_malloc.c:307) ==17162== by 0x6EAFD1: _PyObject_New (object.c:279) ==17162== by 0x4720E6: blpy_iter(_object*) (py-block.c:92) ==17162== by 0x698772: PyObject_GetIter (abstract.c:2577) ==17162== by 0x2343BE: _PyEval_EvalFrameDefault (ceval.c:3159) ==17162== by 0x22E9E2: function_code_fastcall (call.c:283) ==17162== by 0x2340A8: _PyObject_Vectorcall (abstract.h:127) ==17162== by 0x2340A8: call_function (ceval.c:4987) ==17162== by 0x2340A8: _PyEval_EvalFrameDefault (ceval.c:3486) ==17162== by 0x22E9E2: function_code_fastcall (call.c:283) ==17162== by 0x82172B: _PyObject_Vectorcall (abstract.h:127) ==17162== by 0x82172B: method_vectorcall (classobject.c:67) ==17162== by 0x6AF474: _PyObject_Vectorcall (abstract.h:127) ==17162== by 0x6AF474: _PyObject_CallNoArg (abstract.h:153) ==17162== by 0x6AF474: _PyObject_CallFunctionVa (call.c:914) ==17162== by 0x6B0673: callmethod (call.c:1010) ==17162== by 0x6B0673: _PyObject_CallMethod_SizeT (call.c:1103) ==17162== by 0x477DFE: gdb_PyObject_CallMethod<> (python-internal.h:182) ==17162== by 0x477DFE: get_py_iter_from_func(_object*, char const*) (py-framefilter.c:272) ==17162== by 0x4791B4: py_print_args (py-framefilter.c:706) ==17162== by 0x4791B4: py_print_frame(_object*, enum_flags<frame_filter_flag>, ext_lang_frame_args, ui_out*, int, htab*) (py-framefilter.c:960) ==17162== by 0x47A130: gdbpy_apply_frame_filter(extension_language_defn const*, frame_info*, enum_flags<frame_filter_flag>, ext_lang_frame_args, ui_out*, int, int) (py-framefilter.c:1236) ==17162== by 0x369C39: apply_ext_lang_frame_filter(frame_info*, enum_flags<frame_filter_flag>, ext_lang_frame_args, ui_out*, int, int) (extension.c:563) ==17162== by 0x4EC9C9: backtrace_command_1 (stack.c:2031) ==17162== by 0x4EC9C9: backtrace_command(char const*, int) (stack.c:2183) ... Most of the leaks in python tests are due to the fact that many PyObject xxxxx_dealloc functions are missing the line to free self or obj such as: Py_TYPE (self)->tp_free (self); or Py_TYPE (obj)->tp_free (obj); With this patch, the number of python tests leaking decreases from 52 to 12. gdb/ChangeLog 2019-11-18 Philippe Waroquiers <philippe.waroquiers@skynet.be> * python/py-block.c (blpy_dealloc): Call tp_free. (blpy_block_syms_dealloc): Likewise. * python/py-finishbreakpoint.c (bpfinishpy_dealloc): Likewise. * python/py-inferior.c (infpy_dealloc): Likewise. * python/py-lazy-string.c (stpy_dealloc): Likewise. * python/py-linetable.c (ltpy_iterator_dealloc): Likewise. * python/py-symbol.c (sympy_dealloc): Likewise. * python/py-symtab.c (stpy_dealloc): Likewise. * python/py-type.c (typy_iterator_dealloc): Likewise.