aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-04-20[AArch64, Binutils] Add missing TSB instructionSudakshina Das15-1385/+1447
This patch implements the TSB instructions: https://developer.arm.com/docs/ddi0596/f/base-instructions-alphabetic-order/ tsb-csync-trace-synchronization-barrier Since TSB and PSB both use the same (and only) argument "CSYNC", this patch reuses it for TSB. However, the same argument would imply different value for CRm:Op2 which are anyway fixed values, so I have diverted the inserter/extracter function to dummy versions instead of the "hint" version. The operand checker part still uses the existing infratructure for AARCH64_OPND_BARRIER_PSB to make sure the operand is parsed correctly. gas/ChangeLog: 2020-04-20 Sudakshina Das <sudi.das@arm.com> * config/tc-aarch64.c (parse_barrier_psb): Update error messages to include TSB. * testsuite/gas/aarch64/system-2.d: Update -march and new tsb tests. * testsuite/gas/aarch64/system-2.s: Add new tsb tests. * testsuite/gas/aarch64/system.d: Update. opcodes/ChangeLog: 2020-04-20 Sudakshina Das <sudi.das@arm.com> * aarch64-asm.c (aarch64_ins_none): New. * aarch64-asm.h (ins_none): New declaration. * aarch64-dis.c (aarch64_ext_none): New. * aarch64-dis.h (ext_none): New declaration. * aarch64-opc.c (aarch64_print_operand): Update case for AARCH64_OPND_BARRIER_PSB. * aarch64-tbl.h (aarch64_opcode_table): Add tsb. (AARCH64_OPERANDS): Update inserter/extracter for AARCH64_OPND_BARRIER_PSB to use new dummy functions. * aarch64-asm-2.c: Regenerated. * aarch64-dis-2.c: Regenerated. * aarch64-opc-2.c: Regenerated.
2020-04-20[AArch64, Binutils] Make hint space instructions valid for Armv8-aSudakshina Das11-1386/+1378
There are a few instruction in AArch64 that are in the HINT space. Any of these instructions should be accepted by the assembler/disassembler at any architecture version. This patch fixes the existing instructions that are not behaving accordingly. I have used all of the instructions mentioned in the following to make the changes: https://developer.arm.com/docs/ddi0596/f/base-instructions-alphabetic-order/ hint-hint-instruction gas/ChangeLog: 2020-04-20 Sudakshina Das <sudi.das@arm.com> * testsuite/gas/aarch64/bti.d: Update -march option. * testsuite/gas/aarch64/illegal-bti.d: Remove. * testsuite/gas/aarch64/illegal-bti.l: Remove. * testsuite/gas/aarch64/illegal-ras-1.l: Remove esb. * testsuite/gas/aarch64/illegal-ras-1.s: Remove esb. opcodes/ChangeLog: 2020-04-20 Sudakshina Das <sudi.das@arm.com> * aarch64-tbl.h (aarch64_feature_bti, BTI, BTI_INSN): Remove. (aarch64_feature_ras, RAS): Likewise. (aarch64_feature_stat_profile, STAT_PROFILE): Likewise. (aarch64_opcode_table): Update bti, xpaclri, pacia1716, pacib1716, autia1716, autib1716, esb, psb, dgh, paciaz, paciasp, pacibz, pacibsp, autiaz, autiasp, autibz, autibsp to be CORE_INSN. * aarch64-asm-2.c: Regenerated. * aarch64-dis-2.c: Regenerated. * aarch64-opc-2.c: Regenerated.
2020-04-20fix typo last commitAlan Modra1-1/+1
2020-04-20readelf: segfault at readelf.c:12227Alan Modra2-0/+11
This is another one where not cleaning up sufficiently after processing one file can lead to errors when processing the next file. We have ngnuchains non-zero but gnuchains NULL in the following: off < ngnuchains && (gnuchains[off] & 1) == 0 * readelf.c (process_symbol_table): Clear ngnuchains, ngnubuckets and nbuckets.
2020-04-20readelf: segfaults fuzzing multiple object filesAlan Modra2-15/+19
This patch is aimed at fixing a number of oss-fuzz segfaults that don't reproduce reliably with their current infrastructure, the problem being that one invocation of readelf is effectively being run on multiple object files. I believe that these segfaults could be reliably reproduced with just two fuzzed objects being presented to readelf, but those inputs are currently not identified by oss-fuzz. So there is some guesswork involved in this patch. The idea here is to clear stashed data such as symtab_shndx_list that is processed using section header info, at the same time that header info is cleared. * readelf.c (process_section_headers): Free dynamic symbols etc. earlier.
2020-04-20Automatic date update in version.inGDB Administrator1-1/+1
2020-04-20readelf memory leaksAlan Modra2-5/+14
This fixes two leaks found in the new code supporting display of dynamic symbols retrieved via dynamic tags. * readelf.c (get_num_dynamic_syms): Formatting. Don't return on error without freeing. (process_dynamic_section): Don't recreate dynamic symbols from dynamic tag info when the dynamic symbols have already been read via section headers.
2020-04-20PowerPC64: remove empty .rela.dyn (.rela.branch_lt)Alan Modra6-14/+26
Stripping .rela.branch_lt is easy enough but messes with the testsuite due to stub symbols (that use section id) changing. Tests that run on more than one target variant can be tricky to fix, this renaming happened to work. bfd/ * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too. ld/ * testsuite/ld-powerpc/tlsopt5.s: Rename foo to aaaaa. * testsuite/ld-powerpc/tlsopt5.d: Adjust to suit. * testsuite/ld-powerpc/tlsopt6.d: Likewise.
2020-04-18Restore some windows-tdep.c codeTom Tromey2-4/+22
When I removed init_w32_command_list, I weirdly neglected to see if it was called anywhere else. This patch restores the function, which is called from windows-nat.c. Sorry about the breakage. Is it possible to have a windows-native gdb that isn't also using windows-tdep? Anyway, I'm checking this in. gdb/ChangeLog 2020-04-18 Tom Tromey <tom@tromey.com> * windows-tdep.c (init_w32_command_list) (w32_prefix_command_valid): Restore. (_initialize_windows_tdep): Call init_w32_command_list.
2020-04-19Automatic date update in version.inGDB Administrator1-1/+1
2020-04-18ld: Don't xfail ld-elf/warn[12] on 64-bit Solaris/SPARCRainer Orth3-2/+5
Two ld tests currently XPASS on 64-bit Solaris/SPARC: XPASS: ld-elf/warn1 XPASS: ld-elf/warn2 They were xfail'ed on Solaris/SPARCv9 back in 2005 https://sourceware.org/pipermail/binutils/2005-February/039268.html but obviously this no longer appplies. Fixed by removing the xfail's. Tested on sparcv9-sun-solaris2.11 and sparc-sun-solaris2.11. * testsuite/ld-elf/warn1.d: Don't xfail on 64-bit Solaris/SPARC. * testsuite/ld-elf/warn2.d: Likewise.
2020-04-18elf: Don't use .set for alpha targetH.J. Lu3-0/+11
Since the .set directive of ELF/alpha target is different, define NO_SET to 1 to use "=" for ELF/alpha target. * testsuite/ld-elf/elf.exp (ASFLAGS): Add "--defsym NO_SET=1" for alpha target. * testsuite/ld-elf/pr19789.s: Use "=" if NO_SET is defined.
2020-04-18Change get_objfile_arch to a method on objfileTom Tromey47-142/+231
This changes get_objfile_arch to be a new inline method, objfile::arch. To my surprise, this function came up while profiling DWARF psymbol reading. Making this change improved performance from 1.986 seconds to 1.869 seconds. Both measurements were done by taking the mean of 10 runs on a fixed copy of the gdb executable. gdb/ChangeLog 2020-04-18 Tom Tromey <tom@tromey.com> * xcoffread.c (enter_line_range, scan_xcoff_symtab): Update. * value.c (value_fn_field): Update. * valops.c (find_function_in_inferior) (value_allocate_space_in_inferior): Update. * tui/tui-winsource.c (tui_update_source_windows_with_line): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * symtab.c (lookup_global_or_static_symbol) (find_function_start_sal_1, skip_prologue_sal) (print_msymbol_info, find_gnu_ifunc, symbol_arch): Update. * symmisc.c (dump_msymbols, dump_symtab_1) (maintenance_print_one_line_table): Update. * symfile.c (init_entry_point_info, section_is_mapped) (list_overlays_command, simple_read_overlay_table) (simple_overlay_update_1): Update. * stap-probe.c (handle_stap_probe): Update. * stabsread.c (dbx_init_float_type, define_symbol) (read_one_struct_field, read_enum_type, read_range_type): Update. * source.c (info_line_command): Update. * python/python.c (gdbpy_source_objfile_script) (gdbpy_execute_objfile_script): Update. * python/py-type.c (save_objfile_types): Update. * python/py-objfile.c (py_free_objfile): Update. * python/py-inferior.c (python_new_objfile): Update. * psymtab.c (psym_find_pc_sect_compunit_symtab, dump_psymtab) (dump_psymtab_addrmap_1, maintenance_info_psymtabs) (maintenance_check_psymtabs): Update. * printcmd.c (info_address_command): Update. * objfiles.h (struct objfile) <arch>: New method, from get_objfile_arch. (get_objfile_arch): Don't declare. * objfiles.c (get_objfile_arch): Remove. (filter_overlapping_sections): Update. * minsyms.c (msymbol_is_function): Update. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines) (output_nondebug_symbol): Update. * mdebugread.c (parse_symbol, basic_type, parse_partial_symbols) (mdebug_expand_psymtab): Update. * machoread.c (macho_add_oso_symfile): Update. * linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap): Update. * linux-fork.c (checkpoint_command): Update. * linespec.c (convert_linespec_to_sals): Update. * jit.c (finalize_symtab): Update. * infrun.c (insert_exception_resume_from_probe): Update. * ia64-tdep.c (ia64_find_unwind_table): Update. * hppa-tdep.c (internalize_unwinds): Update. * gdbtypes.c (get_type_arch, init_float_type, objfile_type): Update. * gcore.c (call_target_sbrk): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read, elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2/read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab) (read_debug_names_from_section) (process_psymtab_comp_unit_reader, add_partial_symbol) (add_partial_subprogram, process_full_comp_unit) (read_file_scope, read_func_scope, read_lexical_block_scope) (read_call_site_scope, dwarf2_ranges_read) (dwarf2_record_block_ranges, dwarf2_add_field) (mark_common_block_symbol_computed, read_tag_pointer_type) (read_tag_string_type, dwarf2_init_float_type) (dwarf2_init_complex_target_type, read_base_type) (partial_die_info::read, partial_die_info::read) (read_attribute_value, dwarf_decode_lines_1, new_symbol) (dwarf2_fetch_die_loc_sect_off): Update. * dwarf2/loc.c (dwarf2_find_location_expression) (class dwarf_evaluate_loc_desc, rw_pieced_value) (dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval) (dwarf2_loc_desc_get_symbol_read_needs) (locexpr_describe_location_piece, locexpr_describe_location_1) (loclist_describe_location): Update. * dwarf2/index-write.c (write_debug_names): Update. * dwarf2/frame.c (dwarf2_build_frame_info): Update. * dtrace-probe.c (dtrace_process_dof): Update. * dbxread.c (read_dbx_symtab, dbx_end_psymtab) (process_one_symbol): Update. * ctfread.c (ctf_init_float_type, read_base_type): Update. * coffread.c (coff_symtab_read, enter_linenos, decode_base_type) (coff_read_enum_type): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * buildsym.c (buildsym_compunit::finish_block_internal): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, get_sal_arch): Update. * block.c (block_gdbarch): Update. * annotate.c (annotate_source_line): Update.
2020-04-18bfd_is_const_section thinkoAlan Modra3-2/+12
* section.c (bfd_is_const_section): Correct test for special sections. * bfd-in2.h: Regenerate.
2020-04-18Automatic date update in version.inGDB Administrator1-1/+1
2020-04-18Fix gdb.base/attach-twice.c build on NetBSDKamil Rytarowski2-1/+14
Add a fallback definition of PTRACE_ATTACH that is an alias of PT_ATTACH. Change the 4th argument of ptrace(2) to 0 as it is compatible with void * (Linux) and int (NetBSD) arguments. Include <sys/types.h> for <sys/ptrace.h>. gdb/testsuite/ChangeLog: * gdb.base/attach-twice.c: Include "sys/types.h". (PTRACE_ATTACH): Add fallback definition. (main): Pass `0' to the 4th argument of `ptrace'.
2020-04-17Fix the build of fork-running-state.c on NetBSDKamil Rytarowski2-0/+5
Include <signal.h> for kill(2). gdb/testsuite/ChangeLog: * gdb.base/fork-running-state.c: Include "signal.h".
2020-04-17Replace most calls to help_list and cmd_show_listTom Tromey55-1299/+656
Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17[PATCH v2] binutils: arm: Fix disassembly of conditional VDUPs.Fredrik Strupe7-10/+127
VDUP (neon) instructions can be conditional, but this is not taken into account in the current master. This commit fixes that by i) fixing the VDUP instruction masks and ii) adding logic for disassembling conditional neon instructions. opcodes * arm-dis.c (neon_opcodes): Fix VDUP instruction masks. (print_insn_neon): Support disassembly of conditional instructions. binutils* testsuite/binutils-all/arm/vdup-cond.d: New test for testing that conditional VDUP instructions are disassembled correctly. * testsuite/binutils-all/arm/vdup-cond.s: New file used by vdup-cond.d. * testsuite/binutils-all/arm/vdup-thumb.d: New test for testing that VDUP instructions (which are conditional in A32) can be disassembled in thumb mode. * testsuite/binutils-all/arm/vdup-cond.s: New file used by vdup-thumb.d.
2020-04-17Fix the test for PR 18963 so that it will work on 16-bit targets.Stephen Casner3-9/+20
PR 18963 * testsuite/ld-scripts/pr18963.t: Reduce section sizes to fit in 16-bit address space. * testsuite/ld-scripts/pr18963.d: Likewise.
2020-04-17Revert "Fix the test for PR 18963 so that it will work on 16-bit targets."Nick Clifton5-33/+16
This reverts commit 7a1a12f4d1c6152017142d74c736dc1cc6b0e81c.
2020-04-17[PATCH 1/2] coff-go32: update ldscriptJuan Manuel Guerrero2-0/+18
* scripttempl/i386go32.sc: Provide symbol _environ. Link in .ctors and .dtors. Discard LTO sections.
2020-04-17 Commit: Running the linker testsuite with clangNick Clifton4-3/+71
* testsuite/config/default.exp: If not already set then create the CCC_OVERRIDE_OPTIONS environment variable to help when running the testsuite with clang. * testsuite/ld-elf/pr22269-1.c: Add a missing return statement. * testsuite/ld-elfvers/vers.exp: Add checks to detect if files were built before attempting to copy them.
2020-04-17Remove obsolete and unused inf_ptrace_target::auxv_parseKamil Rytarowski3-41/+5
The only two potential users (NetBSD, OpenBSD) use svr4_auxv_parse. gdb/ChangeLog: * nbsd-nat.c (inf_ptrace_target::auxv_parse): Remove. * nbsd-nat.h (inf_ptrace_target::auxv_parse): Likewise.
2020-04-17bfin: allow ".=.+delta"Alan Modra2-1/+5
BFIN has lots of instructions that contain "=", so "sym = expression" is disabled for that target. This makes an exception for assignment to dot, fixing the recent regression of ld-scripts/pr18963. * config/tc-bfin.h (TC_EQUAL_IN_INSN): Allow assignment to dot.
2020-04-17PR25842, Null pointer dereference in nm-newAlan Modra2-2/+12
PR 25842 * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on NULL nodename.
2020-04-17PR25840, Null pointer dereference in objdumpAlan Modra2-0/+7
PR 25840 * debug.c (debug_class_type_samep): Don't segfault on NULL type.
2020-04-17Automatic date update in version.inGDB Administrator1-1/+1
2020-04-16gdb: is_linked_with_cygwin_dll: mention filename in warning messagesSimon Marchi2-6/+13
When a warning is displayed, it isn't clear to the user which file is the cause of the warning. Add the filename in there. Remove the "Failed to parse .idata section" part, since the .idata section is always mentioned one way or another anyway, so it just contributes to make the message longer than it needs to be. gdb/ChangeLog: * windows-tdep.c (is_linked_with_cygwin_dll): Add filename to warning messages.
2020-04-16gdb: is_linked_with_cygwin_dll: handle import table not at beginning of ↵Simon Marchi2-13/+39
.idata section When loading the file C:\Windows\SysWOW64\msvcrt.dll, taken from a Windows 10 system, into GDB, we get the following warning: warning: Failed to parse .idata section: name's virtual address (0x0) is outside .idata section's range [0xb82b8, 0xb97f0[. This uncovers an issue with how we parse the import table, part of the .idata section. Right now, we assume that the import table is located at the beginning of the section. That was the case in everything I had tried so far, but this file is an example where that's not true. We need to compute the offset of the import table within the .idata section, and start there, instead of at the beginning of the .idata section. Using the file mentioned above, this is the values we have to work with: A) bfd_section_vma (idata_section) 101b8000 B) Import table's virtual address b82b8 C) Image base 10100000 The virtual address that BFD returns us for the section has the image base applied, so we need to subtract it first. The offset of the table in the section is therefore: B - (A - C) This patch implements that. gdb/ChangeLog: * windows-tdep.c (is_linked_with_cygwin_dll): Consider case where import table is not at beginning of .idata section.
2020-04-16Stop the MIPS assembler from accepting ifunc symbols.Nick Clifton6-9/+40
PR 25803 gas * config/obj-elf.c (obj_elf_type): Reject ifunc symbols on MIPS targets. * testsuite/gas/elf/elf.exp: Add MIPS targets to the list to skip for the type-2 test. * testsuite/gas/elf/type-noifunc.e: Update to allow for MIPS targets running this test. bfd * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an abort with a more helpful error message.
2020-04-16Fix the test for PR 18963 so that it will work on 16-bit targets.Stephen Casner5-16/+33
PR ld/18963 * testsuite/ld-scripts/pr18963.s: New, replaces empty data.s to allocate space in text, data, bss here rather than pr18963.t. * testsuite/ld-scripts/pr18963.t: Remove assignments to dot. * testsuite/ld-scripts/pr18963.d: Change addresses to fit 16 bits.
2020-04-16Refactor delete_program_space as a destructorPedro Alves4-47/+71
Currently, while the program_space's ctor adds the new pspace to the pspaces list, the destructor doesn't remove the pspace from the pspace list. Instead, you're supposed to use delete_program_space, to both remove the pspace from the list, and deleting the pspace. This patch eliminates delete_program_space, and makes the pspace dtor remove the deleted pspace from the pspace list itself, i.e., makes the dtor do the mirror opposite of the ctor. I found this helps with a following patch that will allocate a mock program_space on the stack. It's easier to just let the regular dtor remove the mock pspace from the pspace list than arrange to call delete_program_space instead of the pspace dtor in that situation. While at it, move the ctor/dtor intro comments to the header file, and make the ctor explicit. gdb/ChangeLog: 2020-04-16 Pedro Alves <palves@redhat.com> * inferior.c (delete_inferior): Use delete operator directly instead of delete_program_space. * progspace.c (add_program_space): New, factored out from program_space::program_space. (remove_program_space): New, factored out from delete_program_space. (program_space::program_space): Remove intro comment. Rewrite. (program_space::~program_space): Remove intro comment. Call remove_program_space. (delete_program_space): Delete. * progspace.h (program_space::program_space): Make explicit. Move intro comment here, adjusted. (program_space::~program_space): Move intro comment here, adjusted. (delete_program_space): Remove.
2020-04-16Fix Cygwin gdb buildTom Tromey6-20/+55
Simon pointed out that the windows-nat sharing series broke the Cygwin build. This patch fixes the problem, by moving the Cygwin-specific code to a new handler function. This approach is taken because this code calls find_pc_partial_function, which isn't available in gdbserver. gdb/ChangeLog 2020-04-16 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat::handle_access_violation): New function. * nat/windows-nat.h (handle_access_violation): Declare. * nat/windows-nat.c (handle_exception): Move Cygwin code to windows-nat.c. Call handle_access_violation. gdbserver/ChangeLog 2020-04-16 Tom Tromey <tromey@adacore.com> * win32-low.cc (windows_nat::handle_access_violation): New function.
2020-04-16[gdb/symtab] Handle PU without import in "save gdb-index"Tom de Vries6-48/+160
Consider the test-case added in this patch, with resulting dwarf: ... Compilation Unit @ offset 0xc7: Length: 0x2c (32-bit) Version: 4 Abbrev Offset: 0x64 Pointer Size: 8 <0><d2>: Abbrev Number: 2 (DW_TAG_partial_unit) <d3> DW_AT_language : 2 (non-ANSI C) <d4> DW_AT_name : imported_unit.c <1><e4>: Abbrev Number: 3 (DW_TAG_base_type) <e5> DW_AT_byte_size : 4 <e6> DW_AT_encoding : 5 (signed) <e7> DW_AT_name : int <1><eb>: Abbrev Number: 4 (DW_TAG_subprogram) <ec> DW_AT_name : main <f1> DW_AT_type : <0xe4> <f5> DW_AT_external : 1 <1><f6>: Abbrev Number: 0 Compilation Unit @ offset 0xf7: Length: 0x2c (32-bit) Version: 4 Abbrev Offset: 0x85 Pointer Size: 8 <0><102>: Abbrev Number: 2 (DW_TAG_compile_unit) <103> DW_AT_language : 2 (non-ANSI C) <104> DW_AT_name : <artificial> <1><111>: Abbrev Number: 3 (DW_TAG_subprogram) <112> DW_AT_abstract_origin: <0xeb> <116> DW_AT_low_pc : 0x4004a7 <11e> DW_AT_high_pc : 0x4004b2 <1><126>: Abbrev Number: 0 ... When run with target board cc-with-gdb-index, we run into: ... (gdb) break main warning: (Internal error: pc 0x4004a7 in read in CU, but not in symtab.) <repeat> warning: (Internal error: pc 0x4004ab in read in CU, but not in symtab.) <repeat> Breakpoint 1 at 0x4004ab (gdb) PASS: gdb.dwarf2/imported-unit-runto-main.exp: setting breakpoint at main run Starting program: /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/imported-unit-runto-main/imported-unit-runto-main warning: (Internal error: pc 0x4004a7 in read in CU, but not in symtab.) <repeat> warning: (Internal error: pc 0x4004ab in read in CU, but not in symtab.) <repeat> Breakpoint 1, warning: (Internal error: pc 0x4004ab in read in CU, but not in symtab.) warning: (Internal error: pc 0x4004ab in read in CU, but not in symtab.) <repeat> 0x00000000004004ab in main () warning: (Internal error: pc 0x4004ab in read in CU, but not in symtab.) <repeat> (gdb) FAIL: gdb.dwarf2/imported-unit-runto-main.exp: running to main in runto ... Looking at the .gdb_index section contents using objdump --dwarf=gdb_index, we have: ... CU table: [ 0] 0x0 - 0x2d [ 1] 0x2e - 0xa4 [ 2] 0xa5 - 0xc6 [ 3] 0xf7 - 0x126 [ 4] 0x127 - 0x2de [ 5] 0x2df - 0x300 Address table: 00000000004004a7 00000000004004b2 4 Symbol table: [489] main: 4 [global, function] ... We see that both the main symbol, and main address range map to CU 4, which has offset range 0x127 - 0x2de, while main actually is contained in CU 3 at offset range 0xf7 - 0x126. This is caused by this continue in write_gdbindex, which triggers for the PU: ... /* CU of a shared file from 'dwz -m' may be unused by this main file. It may be referenced from a local scope but in such case it does not need to be present in .gdb_index. */ if (psymtab == NULL) continue; ... The continue causes the PU to be skipped in the CU table (we can see that the PU offset range 0xc7-0xf6 is missing) but the references are not taking that into account. I've tried fixing this in the optimal way, by updating the references, but ran into trouble when follow_die_offset tries to find the CU for the inter-CU ref. Because the PU is missing from the CU table, dwarf2_find_containing_comp_unit bisects to the wrong CU. Fix this by not skipping the PU in the CU table. Build and reg-tested on x86_64-linux, with native and target boards cc-with-gdb-index, cc-with-dwz and cc-with-dwz-m. gdb/ChangeLog: 2020-04-16 Tom de Vries <tdevries@suse.de> PR symtab/25791 * dwarf2/index-write.c (write_gdbindex): Generate CU table entries for CUs without psymtab. gdb/testsuite/ChangeLog: 2020-04-16 Tom de Vries <tdevries@suse.de> PR symtab/25791 * gdb.dwarf2/gdb-add-index.exp (add_gdb_index): Move ... (ensure_gdb_index): and factor out and move ... * lib/gdb.exp (add_gdb_index, ensure_gdb_index): ... here. * gdb.dwarf2/imported-unit-runto-main.exp: New file.
2020-04-16Fix compilation of python/python.c for Python 3.9Kevin Buettner2-0/+10
This commit fixes a compilation warning/error when building GDB with Python 3.9: g++ -x c++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DDNF_DEBUGINFO_INSTALL -I. -I../../gdb -I../../gdb/config -DLOCALEDIR="\"/usr/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../bfd -I../../gdb/../bfd -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber -I../../gdb/../gnulib/import -I../gnulib/import -DTUI=1 -I/usr/include/guile/2.0 -pthread -I/usr/include/python3.9 -I/usr/include/python3.9 -I../../gdb/.. -pthread -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wformat -Wformat-nonliteral -Wno-unused -Werror -c -o ser-tcp.o -MT ser-tcp.o -MMD -MP -MF ./.deps/ser-tcp.Tpo ../../gdb/ser-tcp.c ../../gdb/python/python.c: In function 'bool do_start_initialization()': ../../gdb/python/python.c:1621:23: error: 'void PyEval_InitThreads()' is deprecated [-Werror=deprecated-declarations] 1621 | PyEval_InitThreads (); | ^ In file included from /usr/include/python3.9/Python.h:141, from ../../gdb/python/python-internal.h:86, from ../../gdb/python/python.c:92: /usr/include/python3.9/ceval.h:132:37: note: declared here 132 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void); | ^~~~~~~~~~~~~~~~~~ Information about the deprecated function can be found here: https://docs.python.org/3.9/whatsnew/3.9.html#deprecated Specifically, with regard to PyEval_InitThreads(), it says: The PyEval_InitThreads() and PyEval_ThreadsInitialized() functions are now deprecated and will be removed in Python 3.11. Calling PyEval_InitThreads() now does nothing. The GIL is initialized by Py_Initialize() since Python 3.7. (Contributed by Victor Stinner in bpo-39877.) I chose to disable the call with a #if test using PY_VERSION_HEX. There is precedent for use of PY_VERSION_HEX; it's used in two places in python-internal.h. I noticed that under certain circumstances python-internal.h defines PyEval_InitThreads to be nothing, which accomplishes the same thing. I considered doing something similar for this case, but decided against it because, at some point in the future, the presence of PyEval_InitThreads() without some explanation will be confusing to a reader who won't be able to find PyEval_InitThreads in the current (future for us) Python API. IMO, use of the #if along with an accompanying comment seemed more straightforward. gdb/ChangeLog: * python/python.c (do_start_initialization): Don't call PyEval_InitThreads for Python 3.9 and beyond. Change-Id: I0679fc10b6b76761a99538568f13188c6d8014e0
2020-04-16PR25827, Null pointer dereferencing in scan_unit_for_symbolsAlan Modra2-5/+13
PR 25827 * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't strdup(0).
2020-04-16cpu,gas,opcodes: support for eBPF JMP32 instruction classDavid Faust11-25/+600
Add support for the JMP32 class of eBPF instructions. cpu/ChangeLog * bpf.cpu (define-cond-jump-insn): Renamed from djci. (dcji) New version with support for JMP32 gas/ChangeLog * testsuite/gas/bpf/bpf.exp: Run jump32 tests. * testsuite/gas/bpf/jump32.s: New file. * testsuite/gas/bpf/jump32.d: Likewise. opcodes/ChangeLog * bpf-desc.c: Regenerate. * bpf-desc.h: Likewise. * bpf-opc.c: Regenerate. * bpf-opc.h: Likewise.
2020-04-16[gdb/testsuite] Fix maint-expand-symbols-header-file.exp for cc-with-gdb-indexTom de Vries2-1/+12
With test-case gdb.base/maint-expand-symbols-header-file.exp and target board cc-with-gdb-index, we have: ... FAIL: gdb.base/maint-expand-symbols-header-file.exp: \ verify no symtabs are expanded ... By default, with partial symbols, we find the main function in the partial symbols, and derive the initial language setting from that, without expanding any psymtab. But that doesn't work with the indices, because the indices don't store the language with the symbols. So instead, the main psymtab is expanded to get the language of main, which causes the FAIL. Fix this by manually setting the language. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-16 Tom de Vries <tdevries@suse.de> * gdb.base/maint-expand-symbols-header-file.exp: Set language before loading exec.
2020-04-16PowerPC64 GOT reloc reserving PLT entry for ifuncAlan Modra1-8/+0
I can't see any reason why ELFv2 should create a PLT entry for ifuncs referenced by GOT relocs as long as the GOT entry remains. The GOT entry ought to be resolved by ld.so to the value returned by the ifunc resolver, or if there is global entry stub created for some other reason, by the linker to the stub address. * elf64-ppc.c (ppc64_elf_check_relocs): Don't create plt entries for GOT relocs against ifuncs.
2020-04-16PowerPC64 GOT reloc optimisationAlan Modra1-0/+9
When the symbol referenced by a GOT reloc is an ifunc, we can't optimise away the GOT indirection. Well, we can, but only if a global entry stub is created with the ifunc symbol redefined to the stub. But that results in slower code and an indirection via the PLT so there isn't much to like about that solution. * elf64-ppc.c (ppc64_elf_edit_toc): Exclude ifunc from GOT optimisation. (ppc64_elf_relocate_section): Likewise.
2020-04-16Extend objdump --no-addresses infoAlan Modra2-1/+7
* doc/binutils.texi: Mention --no-show-raw-insn in objdump --no-addresses description.
2020-04-15gdbserver: fix format string warning in win32-low.ccSimon Marchi2-1/+5
When compiling on Cygwin, we get: CXX win32-low.o /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc: In function ‘int get_child_debug_event(DWORD*, target_waitstatus*)’: /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc:1459:17: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long int’ [-Werror=format=] 1459 | OUTMSG2 (("get_windows_debug_event - " | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1460 | "unexpected stop in 0x%x (expecting 0x%x)\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1461 | ptid.lwp (), desired_stop_thread_id)); | ~~~~~~~~~~~ | | | long int /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc:52:11: note: in definition of macro ‘OUTMSG2’ 52 | printf X; \ | ^ /home/smarchi/src/binutils-gdb/gdbserver/win32-low.cc:1460:26: note: format string is defined here 1460 | "unexpected stop in 0x%x (expecting 0x%x)\n", | ~^ | | | unsigned int | %lx `ptid.lwp ()` is a `long` value, so it indeed needs the `l` size modifier. gdbserver/ChangeLog: * win32-low.cc (get_child_debug_event): Fix format string warning.
2020-04-16Automatic date update in version.inGDB Administrator1-1/+1
2020-04-15Fix OpenBSD build error.Kamil Rytarowski2-6/+12
This was likely introduced by 5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2 gdb/ChangeLog: 2020-04-15 Kamil Rytarowski <n54@gmx.com> * obsd-nat.c (obsd_nat_target::update_thread_list): Pass "this" to thread functions. (obsd_nat_target::wait): Likewise. Change-Id: Ib8d11238c55e0ebdbcf127d1f28c9693c785527a
2020-04-15Use debug_printf in windows-nat.cTom Tromey2-4/+9
While debugging a bug on Windows, I noticed that windows-nat.c is not sending its debugging output to gdb_stdlog. This is unfortunate because it means that "set logging debugredirect" doesn't work properly. This patch fixes the problem by changing windows-nat.c to use debug_printf. Note that get_windows_debug_event also writes one debugging message unconditionally. It isn't clear to me if this really ought to use DEBUG_EVENTS or not, since it seems like perhaps it is intended to note an unexpected event occurring. So, I didn't change this. I'm checking this in. gdb/ChangeLog 2020-04-15 Tom Tromey <tromey@adacore.com> * windows-nat.c (DEBUG_EXEC, DEBUG_EVENTS, DEBUG_MEM) (DEBUG_EXCEPT): Use debug_printf.
2020-04-15gdb: Don't corrupt completions hash when expanding the hash tableAndrew Burgess4-1/+120
Commit: commit 724fd9ba432a20ef2e3f2c0d6060bff131226816 Date: Mon Jan 27 17:37:20 2020 +0000 gdb: Restructure the completion_tracker class caused the completion hash table to become corrupted if the table ever needed to grow beyond its original size of 200 elements. The hash table stores completion_tracker::completion_hash_entry objects, but hashes them based on their name, which is only one field of the object. When possibly inserting a new element we compute the hash with htab_hash_string of the new elements name, and then lookup matching elements using htab_find_slot_with_hash. If there's not matching element we create a completion_hash_entry object within the hash table. However, when we allocate the hash we pass htab_hash_string to htab_create_alloc as the hash function, and this is not OK. This means that when the hash table needs to grow, existing elements within the hash are re-hashed by passing the completion_hash_entry pointer to htab_hash_string, which obviously does not do what we expect. The solution is to create a new hash function that takes a pointer to a completion_hash_entry, and then calls htab_hash_string on the name of the entry only. This regression was spotted when running the gdb.base/completion.exp test on the aarch64 target. gdb/ChangeLog: * completer.c (class completion_tracker::completion_hash_entry) <hash_name>: New member function. (completion_tracker::discard_completions): New callback to hash a completion_hash_entry, pass this to htab_create_alloc. gdb/testsuite/ChangeLog: * gdb.base/many-completions.exp: New file.
2020-04-15Better handling of realpath() failure in windows_make_so() on CygwinJon Turney2-1/+9
It seems Cygwin's realpath() can fail on certain DLLs (apparently some AV software prevent it working on it's DLLs; See [1], [2]). Warn rather than stopping with an error if that occurs. Based on an original patch from Tim Chick. [1] https://cygwin.com/ml/cygwin/2014-08/msg00401.html [2] https://cygwin.com/ml/cygwin/2015-11/msg00353.html gdb/ChangeLog: 2016-01-20 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (windows_make_so): Warn rather than stopping with an error if realpath() fails.
2020-04-15Unify the behaviour of ld.bfd and ld.gold with respect to warning about ↵Fangrui Song18-86/+115
unresolved symbol references. (PR 24613) PR binutils/24613 include * bfdlink.h (enum report_method): Delete RM_GENERATE_WARNING and RM_GENERATE_ERROR. Add RM_DIAGNOSE. (struct bfd_link_info): Add warn_unresolved_syms. ld * lexsup.c (parse_args): Change RM_GENERATE_WARNING and RM_GENERATE_ERROR to RM_DIAGNOSE. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Change RM_GENERATE_ERROR to RM_DIAGNOSE. * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise. bfd * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR to RM_DIAGNOSE plus a check of warn_unresolved_syms. * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise. * elf-bfd.h (_bfd_elf_large_com_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise. * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-hppa.c (elf64_hppa_relocate_section): Likewise. * elflink.c (elf_link_output_extsym): Likewise. * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
2020-04-15objdump --no-addressesAlan Modra3-18/+54
I find this useful when needing to compare compiler output, where the address of the instruction and the value of symbols results in unwanted differences. * objdump.c (no_addresses): New static var. (usage): Print help for --no-addresses. (long_options): Add --no-addresses entry. (objdump_print_addr_with_sym, objdump_print_addr): Omit symbol address. (disassemble_bytes): Don't print current line address, or reloc address. * doc/binutils.texi: Document objdump --no-addresses.