summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix array_char_idx.expTom Tromey2020-05-202-1/+7
| | | | | | | | | | | | | | Newer versions of GCC can statically initialize an array in the array_char_idx.exp test case. This leads to a spurious failure. This patch fixes the problem by having the test case recognize both possible results. I'm checking this in. gdb/testsuite/ChangeLog 2020-05-20 Tom Tromey <tromey@adacore.com> * gdb.ada/array_char_idx.exp: Recognize initialized array.
* Remove bound_name static from ada-lang.cTom Tromey2020-05-202-14/+14
| | | | | | | | | | | | | | | | ada-lang.c has a "bound_name" static that is used when finding fields in a structure in some cases. This patch removes it in favor of computing the desired field name at runtime; this avoids an artificial limit. I'm checking this in. Tested on x86-64 Fedora 30, and also on the internal AdaCore test suite. gdb/ChangeLog 2020-05-20 Tom Tromey <tromey@adacore.com> * ada-lang.c (bound_name, MAX_ADA_DIMENS): Remove. (desc_one_bound, desc_index_type): Compute field name.
* Fix thinko in bfd ChangeLog entryNick Clifton2020-05-201-2/+3
|
* [gdb/symtab] Handle .gdb_index in ada language modeTom de Vries2020-05-206-8/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running test-case gdb.base/with.exp with target board cc-with-gdb-index, we have: ... (gdb) PASS: gdb.base/with.exp: basics: show language with language ada -- print g_s^M 'g_s' has unknown type; cast it to its declared type^M (gdb) FAIL: gdb.base/with.exp: basics: with language ada -- print g_s ... This is due to this bit in dw2_map_matching_symbols: ... if (dwarf2_per_objfile->index_table != nullptr) { /* Ada currently doesn't support .gdb_index (see PR24713). We can get here though if the current language is Ada for a non-Ada objfile using GNU index. As Ada does not look for non-Ada symbols this function should just return. */ return; } ... While the reasoning in the comment may be sound from language perspective, it does introduce an inconsistency in gdb behaviour between: - having a .gdb_index section, and - having a .gdb_names section, or a partial symtab, or -readnow. Fix the inconsistency by completing implementation of dw2_map_matching_symbols. Tested on x86_64-linux, both with native and target board cc-with-debug-index. gdb/ChangeLog: 2020-05-20 Tom de Vries <tdevries@suse.de> PR symtab/25833 * dwarf2/read.c (dw2_map_matching_symbols): Handle .gdb_index. gdb/testsuite/ChangeLog: 2020-05-20 Tom de Vries <tdevries@suse.de> PR symtab/25833 * gdb.base/with-mf-inc.c: New test. * gdb.base/with-mf-main.c: New test. * gdb.base/with-mf.exp: New file.
* PR25993, read of freed memoryAlan Modra2020-05-2014-107/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ldmain.c:add_archive_element copies file name pointers from the bfd to a lang_input_statement_type. input->filename = abfd->filename; input->local_sym_name = abfd->filename; This results in stale pointers when twiddling the bfd filename in places like the pe ld after_open. So don't free the bfd filename, and make copies using bfd_alloc memory that won't result in small memory leaks that annoy memory checkers. PR 25993 bfd/ * archive.c (_bfd_get_elt_at_filepos): Don't strdup filename, use bfd_set_filename. * elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise. * mach-o.c (bfd_mach_o_fat_member_init): Likewise. * opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw), (bfd_create): Likewise. (_bfd_delete_bfd): Don't free filename. (bfd_set_filename): Copy filename param to bfd_alloc'd memory, return pointer to the copy or NULL on alloc fail. * vms-lib.c (_bfd_vms_lib_get_module): Free newname and test result of bfd_set_filename. * bfd-in2.h: Regenerate. gdb/ * solib-darwin.c (darwin_bfd_open): Don't strdup pathname for bfd_set_filename. * solib-aix.c (solib_aix_bfd_open): Use std::string for name passed to bfd_set_filename. * symfile-mem.c (add_vsyscall_page): Likewise for string passed to symbol_file_add_from_memory. (symbol_file_add_from_memory): Make name param a const char* and don't strdup. ld/ * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Don't copy other_bfd_filename for bfd_set_filename, and test result of bfd_set_filename call. Don't create a new is->filename, simply copy from bfd filename. Free new_name after bfd_set_filename. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
* Automatic date update in version.inGDB Administrator2020-05-201-1/+1
|
* Power10 dcbf, sync, and wait extensions.Peter Bergner2020-05-197-26/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | opcodes/ * ppc-opc.c (insert_ls, extract_ls): Handle 3-bit L fields and new WC values on POWER10 sync, dcbf and wait instructions. (insert_pl, extract_pl): New functions. (L2OPT, LS, WC): Use insert_ls and extract_ls. (LS3): New , 3-bit L for sync. (LS3, L3OPT): New, 3-bit L for sync and dcbf. (SC2, PL): New, 2-bit SC and PL for sync and wait. (XWCPL_MASK, XL3RT_MASK, XSYNCLS_MASK): New instruction masks. (XOPL3, XWCPL, XSYNCLS): New opcode macros. (powerpc_opcodes) <dcbflp, dcbfps, dcbstps pause_short, phwsync, plwsync, stcisync, stncisync, stsync, waitrsv>: New extended mnemonics. <wait>: Enable PL operand on POWER10. <dcbf>: Enable L3OPT operand on POWER10. <sync>: Enable SC2 operand on POWER10. gas/ * testsuite/gas/ppc/power9.s <dcbf, dcbfl, dcbflp>: Add tests. * testsuite/gas/ppc/power9.d: Likewise. * testsuite/gas/ppc/power10.s <dcbf, dcbfps, dcbstps, hwsync, lwsync, pause_short, phwsync, plwsync, ptesync, stcisync, stncisync, stsync, sync, wait, waitrsv>: Add tests. * testsuite/gas/ppc/power10.d: Likewise.
* PR26011, excessive memory allocation with fuzzed reloc sectionsAlan Modra2020-05-202-3/+41
| | | | | | | | | | Check sizes early, before users of slurp_relocs allocate buffers for the swapped in relocs. PR 26011 * elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc section size against file size. (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
* Use bfd_get_filename throughout gdbAlan Modra2020-05-208-12/+25
| | | | | | | | | | | | | | | This patch makes gdb use the inline accessor for all bfd->filename read accesses. * coff-pe-read.c (read_pe_exported_syms): Use bfd_get_filename rather than accessing bfd->filename directly. * dtrace-probe.c (dtrace_static_probe_ops::get_probes): Likewise, and use bfd_section_name. * dwarf2/frame.c (decode_frame_entry): Likewise. * exec.c (exec_set_section_address): Likewise. * solib-aix.c (solib_aix_bfd_open): Likewise. * stap-probe.c (get_stap_base_address): Likewise. * symfile.c (reread_symbols): Likewise.
* Restore missing Rust testTom Tromey2020-05-192-1/+5
| | | | | | | | | An earlier patch inadvertently broke a Rust test. This restores it. gdb/testsuite/ChangeLog 2020-05-19 Tom Tromey <tromey@adacore.com> * gdb.rust/simple.exp: Restore missing test result.
* [gdb/testsuite] Fix typo in gdb.base/gdb-caching-proc.expTom de Vries2020-05-192-1/+5
| | | | | | | | | | Fix intial -> initial typo. gdb/testsuite/ChangeLog: 2020-05-19 Tom de Vries <tdevries@suse.de> * gdb.base/gdb-caching-proc.exp: Fix typo.
* Fix duplicate tests in gdb.rustTom Tromey2020-05-192-8/+15
| | | | | | | | | | | gdb.rust complains about some duplicate test names. This patch fixes this in a straightforward way. 2020-05-19 Tom Tromey <tromey@adacore.com> * gdb.rust/simple.exp: Add some test descriptions. (test_one_slice): Use with_test_prefix.
* Update call to target_fileio_openTom Tromey2020-05-192-1/+5
| | | | | | | | | | An earlier patch changed target_fileio_open, but missed a caller. This patch fixes it. 2020-05-19 Tom Tromey <tromey@adacore.com> * sparc64-tdep.c (adi_tag_fd): Update call to target_fileio_open.
* gdb: fix off-by-one error in quirk_rust_enumSimon Marchi2020-05-192-1/+5
| | | | | | | | | | | | | | Found by inspection, so I don't have a test for it (I don't think it would be easy to have this bug cause a failure reliably). We allocate space for N fields into `new_fields`, then memcpy N fields at `new_fields + 1`. This overflows the allocated buffer by one field. Fix it by allocating `N + 1` fields. gdb/ChangeLog: * dwarf2/read.c (quirk_rust_enum): Allocate enough fields.
* Make exec-file-mismatch compare build IDsPedro Alves2020-05-197-36/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch makes GDB do exec-file-mismatch validation by comparing build IDs instead of the current method of comparing filenames. Currently, the exec-file-mismatch feature simply compares filenames to decide whether the exec file loaded in gdb and the exec file the target reports is running match. This causes false positives when remote debugging, because it'll often be the case that the paths in the host and the target won't match. And of course misses the case of the files having the same name but being actually different files (e.g., different builds). This also broke many testcases when running against gdbserver, causing tests to be skipped like (here native-extended-gdbserver): (gdb) run Starting program: /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink-filelink warning: Mismatch between current exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink-filelink and automatically determined exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink exec-file-mismatch handling is currently "ask" Load new symbol table from "/home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink"? (y or n) UNTESTED: gdb.base/argv0-symlink.exp: could not run to main or to fail like (here native-gdbserver): (gdb) spawn /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/../../gdbserver/gdbserver --once localhost:2346 /home/pedro/gdb/binutils-gdb/build/gdb/te stsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x Process /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x created; pid = 20040 Listening on port 2346 target remote localhost:2346 Remote debugging using localhost:2346 warning: Mismatch between current exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/temp/19968/skip_btrace_tests-19968.x and automatically determined exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x exec-file-mismatch handling is currently "ask" Load new symbol table from "/home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x"? (y or n) Quit (gdb) UNSUPPORTED: gdb.btrace/buffer-size.exp: target does not support record-btrace The former case is about GDB not realizing the two files are the same, because one of the them is a symlink to the other. The latter case is about GDB realizing that one file is a copy of the other. Over the years, the toolchain has settled on build ID matching being the canonical method to match core dumps to executables, and executables with no debug info to their debug info. This patch makes us use build IDs to match the running image of a binary with its version loaded in gdb, which may or may not have debug info. This is very much like the core dump/executable matching. The change to gdb_bfd_open is necessary to get rid of the "transfers from remote targets can be slow" warning when we open the remote file to read its build ID: (gdb) r Starting program: /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/break/break Reading /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink from remote target... warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: Mismatch between current exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/break/break and automatically determined exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink exec-file-mismatch handling is currently "ask" Load new symbol table from "/home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink"? (y or n) While trying this out, I was worried that bfd would read a lot of stuff from the binary in order to extract the build ID, making it potentially slow, but turns out we don't read all that much. Maybe a couple hundred bytes, and most of it seemingly is the read-ahead cache. So I'm not worried about that. Otherwise I'd consider whether a new qXfer:buildid:read would be better. But I'm happy that we seemingly don't need to worry about it. gdb/ChangeLog: 2020-05-19 Pedro Alves <palves@redhat.com> * NEWS (set exec-file-mismatch): Adjust entry. * exec.c: Include "build-id.h". (validate_exec_file): Try to match build IDs instead of filenames. * gdb_bfd.c (struct gdb_bfd_open_closure): New. (gdb_bfd_iovec_fileio_open): Adjust to use gdb_bfd_open_closure and pass down 'warn_if_slow'. (gdb_bfd_open): Add 'warn_if_slow' parameter. Use gdb_bfd_open_closure to pass it down. * gdb_bfd.h (gdb_bfd_open): Add 'warn_if_slow' parameter. gdb/doc/ChangeLog: 2020-05-19 Pedro Alves <palves@redhat.com> * gdb.texinfo (Attach): Update exec-file-mismatch description to mention build IDs. (Separate Debug Files): Add "build id" anchor.
* Eliminate target_fileio_open_warn_if_slowPedro Alves2020-05-194-46/+26
| | | | | | | | | | | | | | | | | | | | | This basically makes target_fileio_open_1 extern, renamed to target_fileio_open, and eliminates the current target_fileio_open_warn_if_slow and target_fileio_open. A following parameter will want to change gdb_bfd_iovec_fileio_open, the only caller of target_fileio_open_warn_if_slow, to pass down "warn_if_slow" true/false from the caller, instead of hardcoding "warn_if_slow" true. gdb/ChangeLog: 2020-05-19 Pedro Alves <palves@redhat.com> * gdb_bfd.c (gdb_bfd_iovec_fileio_open): Adjust. * target.c (target_fileio_open_1): Rename to target_fileio_open and make extern. Use bool. (target_fileio_open, target_fileio_open_warn_if_slow): Delete. (target_fileio_read_alloc_1): Adjust. * target.h (target_fileio_open): Add 'warn_if_slow' parameter. (target_fileio_open_warn_if_slow): Delete declaration.
* Default gdb_bfd_open's fd parameter to -1Pedro Alves2020-05-1910-13/+19
| | | | | | | | | A following patch will add one more defaulted parameter. gdb/ChangeLog: 2020-05-19 Pedro Alves <palves@redhat.com> * gdb_bfd.h: (gdb_bfd_open): Default to 'fd' parameter to -1. Adjust all callers.
* gdb: fix -Wtautological-overlap-compare error in h8300-tdep.cYoshinori Sato2020-05-192-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Compiling with clang 11 gives us: CXX h8300-tdep.o /home/smarchi/src/binutils-gdb/gdb/h8300-tdep.c:225:21: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] if (disp < 0 && disp > 0xffffff) ~~~~~~~~~^~~~~~~~~~~~~~~~~~ /home/smarchi/src/binutils-gdb/gdb/h8300-tdep.c:203:17: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] if (disp < 0 && disp > 0xffffff) ~~~~~~~~~^~~~~~~~~~~~~~~~~~ /home/smarchi/src/binutils-gdb/gdb/h8300-tdep.c:184:17: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare] if (disp < 0 && disp > 0xffffff) ~~~~~~~~~^~~~~~~~~~~~~~~~~~ Indeed, disp (of type LONGEST) can't be less than 0 and greater than 0xffffff. Fix it by changing the way we check if disp is negative. Check the sign bit of disp, which is a 24-bit number. gdb/ChangeLog: * h8300-tdep.c (h8300_is_argument_spill): Change how we check whether disp is negative.
* Fix thinko in recent update to bfd_section_from_shdr.Gunther Nikl2020-05-192-1/+7
| | | | | | PR 26005 * elf.c (bfd_section_from_shdr): Replace bfd_malloc + memset with bfd_zmalloc to allocate memory for the sections_being_created array.
* gdb: make symfile_segment_data::segment_info an std::vectorSimon Marchi2020-05-194-8/+15
| | | | | | | | | | | | | Change the symfile_segment_data::segment_info array to be an std::vector. No functional changes are expected. gdb/ChangeLog: * symfile.h (struct symfile_segment_data) <~symfile_segment_data>: Remove. <segment_info>: Change to std::vector. * symfile.c (default_symfile_segments): Update. * elfread.c (elf_symfile_segments): Update.
* gdb: use std::vector to store segments in symfile_segment_dataSimon Marchi2020-05-196-41/+45
| | | | | | | | | | | | | | | | | | | | Instead of maintaining two vectors, I added a small `segment` class which holds both the base address and size of one segment and replaced the two `segment_bases` and `segment_sizes` arrays with a single vector. The rest of the changes are straightforward, no behavior changes are expected. gdb/ChangeLog: * symfile.h (struct symfile_segment_data) <struct segment>: New. <segments>: New. <segment_bases, segment_sizes>: Remove. * symfile.c (default_symfile_segments): Update. * elfread.c (elf_symfile_segments): Update. * remote.c (remote_target::get_offsets): Update. * solib-target.c (solib_target_relocate_section_addresses): Update.
* gdb: allocate symfile_segment_data with newSimon Marchi2020-05-197-45/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Allocate this structure with new instead of XNEW, use a unique pointer to manage its lifetime. - Change a few functions to return a unique pointer instead of a plain pointer. - Change free_symfile_segment_data to be symfile_segment_data's destructor. gdb/ChangeLog: * symfile.h (struct symfile_segment_data): Initialize fields. <~symfile_segment_data>: Add. (symfile_segment_data_up): New. (struct sym_fns) <sym_segments>: Return a symfile_segment_data_up. (default_symfile_segments): Return a symfile_segment_data_up. (free_symfile_segment_data): Remove. (get_symfile_segment_data): Return a symfile_segment_data_up. * symfile.c (default_symfile_segments): Likewise. (get_symfile_segment_data): Likewise. (free_symfile_segment_data): Remove. (symfile_find_segment_sections): Update. * elfread.c (elf_symfile_segments): Return a symfile_segment_data_up. * remote.c (remote_target::get_offsets): Update. * solib-target.c (solib_target_relocate_section_addresses): Update. * symfile-debug.c (debug_sym_segments): Return a symfile_segment_data_up.
* Allow readelf to issue warnings if checking is enabled and there are ↵H.J. Lu2020-05-192-7/+47
| | | | | | | | | | | | | | | | | discrepancies between the dynamic tags and the dynamic sections. PR binutils/25809 * readelf.c (process_program_headers): Warn if the PT_DYNAMIC segment doesn't match the .dynamic section and checks are enabled. (struct filedata): Add dynamic_symtab_section and dynamic_strtab_section fields. (process_section_headers): Set dynamic_symtab_section to the .dynsym section. Set dynamic_strtab_section to the .dynstr section. (process_dynamic_section): Warn if the .dynsym section doesn't match DT_SYMTAB and DT_SYMENT or the .dynstr section doesn't DT_STRTAB and DT_STRSZ. But only if checks are enabled.
* OpenRISC BFD fixups for Glibc:Stafford Horne2020-05-192-132/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or1k: Fix static linking when with .rela.got relocations or1k: Fix dynamic TLS symbol flag or1k: Add TLS mask to handle multiple model access or1k: Fix issue with multiple PCREL relocations or1k: TLS offset to use tcb size and section alignment or1k: refactor: Rename p to sec_relocs or1k: refactor: Rename s to sgot and splt or1k: Add dynamic flag to tpoff bfd * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela to relgot. (or1k_elf_relocate_section): Access srelgot via htab->root.srelgot. Add assertions for srelgot->contents. Introduce local variable for srelgot to not reuse global sreloc. (or1k_elf_relocate_section): Fixup dynamic symbol detection. (or1k_set_got_and_rela_sizes): New function. (or1k_initial_exec_offset): New function. (TLS_GD, TLS_IE, TLS_LD, TLS_LE): Redefine macros as masks. (or1k_elf_relocate_section): Allow for TLS to handle multiple model access. (or1k_elf_check_relocs): Use OR to set TLS access. (allocate_dynrelocs): Use or1k_set_got_and_rela_sizes to set sizes. (or1k_elf_size_dynamic_sections): Use or1k_set_got_and_rela_sizes to set sizes. (or1k_elf_relocate_section): Fixup PCREL relocation calculation. (TCB_SIZE): New macro. (tpoff): Use TCB_SIZE and alignment to calculate offset. (allocate_dynrelocs, readonly_dynrelocs, or1k_elf_check_relocs) (or1k_elf_size_dynamic_sections): Rename p to sec_relocs. (allocate_dynrelocs): Rename s to splt or sgot based on usage. (tpoff): Add dynamic boolean argument. (or1k_elf_relocate_section): Pass dynamic flag to tpoff.
* Fix the ARM assembler to generate a Realtime profile for armv8-r.Alexander Fedotov2020-05-198-11/+28
| | | | | | | | | PR 25992 gas * config/tc-arm.c : Add arm_ext_v8r feature. (it_fsm_post_encode): Check arm_ext_v8r feature. (get_aeabi_cpu_arch_from_fset): Check arm_ext_v8r feature. include * opcode/arm.h (ARM_EXT2_V8R): Define. Modified ARM_AEXT2_V8R.
* or1k: Regenerate opcodes after removing 32-bit supportStafford Horne2020-05-199-1648/+1195
| | | | | | | | | | | | | | | | opcodes/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> PR 25184 * or1k-asm.c: Regenerate. * or1k-desc.c: Regenerate. * or1k-desc.h: Regenerate. * or1k-dis.c: Regenerate. * or1k-ibld.c: Regenerate. * or1k-opc.c: Regenerate. * or1k-opc.h: Regenerate. * or1k-opinst.c: Regenerate.
* or1k: Remove 64-bit support, it's not used and it breaks 32-bit hostsStafford Horne2020-05-194-110/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Rich Felker when building on 32-bit hosts. Backwards jump negative offsets were not calculated correctly due to improper 32-bit to 64-bit zero-extension. The 64-bit fields are present because we are mixing 32-bit and 64-bit architectures in our cpu descriptions. Removing 64-bit fixes the issue. We don't use 64-bit, there is an architecture spec for 64-bit but no implementations or simulators. My thought is if we need them in the future we should do the proper work to support both 32-bit and 64-bit implementations co-existing then. cpu/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> PR 25184 * or1k.cpu (arch or1k): Remove or64 and or64nd machs. (ORBIS-MACHS, ORFPX32-MACHS): Remove pmacros. (cpu or1k64bf, mach or64, mach or64nd): Remove definitions. * or1kcommon.cpu (h-fdr): Remove hardware. * or1korfpx.cpu (rDDF, rADF, rBDF): Remove operand definitions. (float-regreg-insn): Remove lf- mnemonic -d instruction pattern. (float-setflag-insn-base): Remove lf-sf mnemonic -d pattern. (float-cust-insn): Remove "lf-cust" cust-num "-d" pattern. (lf-rem-d, lf-itof-d, lf-ftoi-d, lf-madd-d): Remove.
* [PATCH v3] aarch64: Emit jump slot for conditional branch to undefined symbolsSiddhesh Poyarekar2020-05-196-4/+44
| | | | | | | | | | | | | | | | | | | | | | The linker silently writes out a conditional branch to 0 if the target symbol in R_AARCH64_CONDBR19 or R_AARCH64_TSTBR14 relocations is undefined. Emit a PLT instead so that behaviour is the same for these relocations as the llvm linker. The special behaviour for undefined weak symbols, where conditional branches to such symbols result in a branch unto themselves, has been retained. This is because the weak-undefined.s test explicitly checks for that, leading me to conclude that it's expected behaviour. bfd * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14 cases with BFD_RELOC_AARCH64_JUMP26. (elfNN_aarch64_check_relocs): Likewise. ld * testsuite/ld-aarch64/aarch64-elf.exp: New test emit-relocs-560. * testsuite/ld-aarch64/emit-relocs-560.d: New file. * testsuite/ld-aarch64/emit-relocs-560.s: New file.
* Use bfd_get_filename throughout ldAlan Modra2020-05-1910-55/+80
| | | | | | | | | | | | | | | * emultempl/beos.em (sort_by_file_name): Use bfd_get_filename rather than accessing bfd->filename directly. * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/spuelf.em (embedded_spu_file): Likewise. * ldlang.c (input_statement_is_archive_path, wild_sort), (check_excluded_libs): Likewise. * ldmain.c (add_archive_element): Likewise. * ldmisc.c (vfinfo): Likewise. * pe-dll.c (auto_export, generate_edata, pe_create_import_fixup), (pe_dll_generate_implib, pe_process_import_defs): Likewise. * plugin.c (plugin_object_p): Likewise.
* Use bfd_get_filename throughout gasAlan Modra2020-05-192-6/+16
| | | | | | * write.c (write_contents): Use bfd_get_filename rather than accessing bfd->filename directly. Use bfd_section_name rather than accessing section->name directly.
* Use bfd_get_filename throughout binutilsAlan Modra2020-05-195-16/+26
| | | | | | | | | * ar.c (map_over_members, get_pos_bfd, delete_members, move_members), (replace_members): Use bfd_get_filename rather than accessing bfd->filename directly. * arsup.c (map_over_list, ar_delete, ar_replace, ar_extract): Likewise. * binemul.c (do_ar_emul_append): Likewise. * coffgrok.c (coff_grok): Likewise.
* Use bfd_get_filename throughout bfdAlan Modra2020-05-1928-106/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use bfd_get_filename rather than accessing bfd->filename directly. * aout-target.h (MY (object_p)): Likewise. * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise. * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag), (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr), (_bfd_archive_bsd44_construct_extended_name_table), (_bfd_write_archive_contents, _bfd_compute_and_write_armap), (_bfd_bsd_write_armap): Likewise. * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise. * cache.c (bfd_open_file): Likewise. * ecoff.c (_bfd_ecoff_write_armap): Likewise. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_final_link): Likewise. * elf32-nds32.c (nds32_elf_output_symbol_hook), (patch_tls_desc_to_ie): Likewise. * elf32-spu.c (sort_bfds, print_one_overlay_section), (spu_elf_auto_overlay): Likewise. * elf64-hppa.c (elf_hppa_final_link): Likewise. * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise. * elfcore.h (elf_core_file_matches_executable_p): Likewise. * elflink.c (bfd_elf_size_dynamic_sections), (elf_link_input_bfd): Likewise. * linker.c (_bfd_generic_link_output_symbols): Likewise. * mach-o.c (bfd_mach_o_follow_dsym), (bfd_mach_o_close_and_cleanup): Likewise. * opncls.c (_bfd_delete_bfd, _maybe_make_executable), (find_separate_debug_file, get_build_id_name): Likewise. * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise. * plugin.c (bfd_plugin_open_input): Likewise. * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise. * som.c (som_write_armap): Likewise. * srec.c (srec_write_record, srec_write_symbols): Likewise. * vms-lib.c (_bfd_vms_lib_get_imagelib_file), (_bfd_vms_lib_write_archive_contents): Likewise. * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
* Clear all local_symbol.lsy_flagsAlan Modra2020-05-192-2/+6
| | | | * symbols.c (local_symbol_make): Init all of lsy_flags.
* win32 typo fixAlan Modra2020-05-192-1/+6
| | | | | PR 25713 * bfdio.c (_bfd_real_fopen): Typo fix.
* Automatic date update in version.inGDB Administrator2020-05-191-1/+1
|
* Avoid short i386 register names on Solaris/x86 [PR25981]Rainer Orth2020-05-182-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the 32-bit companion to Remove unused ps_lgetLDT etc. on Solaris/x86 [PR25981] https://sourceware.org/pipermail/gdb-patches/2020-May/168713.html A 32-bit-default gdb fails to compile with the updated <sys/regset.h>. While it is also affected by the lack of a GS definition, which the compantion patch above fixes, it also fails to compile i386-sol2-nat.c like this /vol/src/gnu/gdb/hg/master/git/gdb/i386-sol2-nat.c:181:3: error: 'EAX' was not declared in this scope 181 | EAX, ECX, EDX, EBX, | ^~~ and several more. While this could be fixed by either including <ucontext.h> here or provding fallback definitions of the register macros, I chose to do what the 64-bit-default code in the same file (amd64_sol2_gregset32_reg_offset[]) does, namely just hardcode the numeric values instead. They are part of the ABI and thus guaranteed not to change. With this patch, a i386-pc-solaris2.11 configuration on master compiles again, however, it doesn't work. However, I could successfully test it on the gdb-9 branch. Compiling and testing proved to be messy, unfortunately: * For one, Solaris <sys/procfs.h> and largefile support used to be mutually exclusive (fixed in Solaris 11.4 and Illumos), which was exacerbated by the fact that g++ predefines _FILE_OFFSET_BITS=64 since GCC 9.1.0. For now I've worked around this by adding -U_FILE_OFFSET_BITS to CXXFLAGS and configuring with --disable-largefile. I hope to clean this up in a future patch. * gdb still defaults to startup-with-shell on. However, /bin/bash is a 64-bit executable which cannot be debugged by a 32-bit gdb. I hacked around that part by pointing $SHELL at a 32-bit bash before running make check. PR build/25981 * i386-sol2-nat.c [PR_MODEL_NATIVE != PR_MODEL_LP64] (regmap): Hardcode register numbers.
* Remove unused ps_lgetLDT etc. on Solaris/x86 [PR25981]Rainer Orth2020-05-184-117/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported in PR build/25981, a future Solaris 11.4 update will soon remove the short i386 register names like SS etc. from <sys/regset.h>. They could leak into user code (e.g. via <signal.h> -> <sys/signal.h> -> <sys/ucontext.h>) and pollute the user namespace. Affected code would have a hard time avoiding the issue: LLVM is one of those. While the short names are required to be present by the i386 psABI, that document only demands that they exist in <ucontext.h>, which is what the upcoming update assures. With this change, in a 64-bit-default configuration, procfs.c fails to compile on Solaris/x86: /vol/src/gnu/gdb/hg/master/git/gdb/procfs.c: In function 'ssd* procfs_find_LDT_entry(ptid_t)': /vol/src/gnu/gdb/hg/master/git/gdb/procfs.c:1643:18: error: 'GS' was not declared in this scope 1643 | key = (*gregs)[GS] & 0xffff; | ^~ make[2]: *** [Makefile:1607: procfs.o] Error 1 Initially I meant to provide a definition using the planned replacement macro, but closer inspection revealed a better way. procfs_find_LDT_entry and its helper proc_get_LDT_entry are only used to implement ps_lgetLDT, one of the callback functions required by libthread_db.so.1 (cf. <proc_service.h>). While that function is still documented as being required even in Solaris 11.4, I found that calls to it had been removed long ago in Solaris 9, so just removing the three functions above is the easiest fix. The following patch does just that. It compiled successfully on amd64-pc-solaris2.11, however, as reported in PR gdb/25939, master is completely broken on Solaris since the multi-target patch. The patch applies cleanly to the gdb-9 branch and there I could test it successfully. PR build/25981 * procfs.c [(__i386__ || __x86_64__) && sun] (proc_get_LDT_entry, procfs_find_LDT_entry): Remove. * procfs.h [(__i386__ || __x86_64__) && sun] (struct ssd, procfs_find_LDT_entry): Remove. * sol-thread.c [(__i386__ || __x86_64__) && sun] (ps_lgetLDT): Remove.
* Fix a use-after-free bug in the BFD library when scanning a corrupt ELF file.Nick Clifton2020-05-182-2/+13
| | | | | | PR 26005 * elf.c (bfd_section_from_shdr): Use bfd_malloc to allocate memory for the sections_being_created array.
* [gdb/testsuite] Use with_test_prefix in gdb.base/gdb-caching-proc.expTom de Vries2020-05-182-18/+28
| | | | | | | | | | | | | | | When running test-case gdb.base/gdb-caching-proc.exp all passes are unique, but fails might not be. Fix this by using with_test_prefix. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-05-18 Tom de Vries <tdevries@suse.de> * gdb.base/gdb-caching-proc.exp: Use with_test_prefix.
* Show AIX gc'd symbol address adjustments in map fileDouglas B Rupp2020-05-1816-16/+100
| | | | | | | | | | | | | | | | | | | | | | | | * ldemul.h (ldemul_print_symbol): New. (ld_emulation_xfer_type) <print_symbol): Likewise. * ldemul.c (ldemul_print_symbol): New. * ldlang.c (SECTION_NAME_MAP_LANGTH): Move to ... (print_one_symbol): Make global and move declaration to ... (print_all_symbols): Rename print_one_symbol to ldemul_print_symbol (print_input_section): Likewise * ldlang.h: ... here. * emultempl/aix.em (gld${EMULATION_NAME}_print_symbol): New. (ld_emulation_xfer_struct): Use it. * emultempl/armcoff.em (ld_emulation_xfer_struct): Add print_symbol and default to NULL. * emultempl/beos.em (ld_emulation_xfer_struct): Likewise * emultempl/elf.em (ld_emulation_xfer_struct): Likewise * emultempl/generic.em (ld_emulation_xfer_struct): Likewise * emultempl/linux.em (ld_emulation_xfer_struct): Likewise * emultempl/msp430.em (ld_emulation_xfer_struct): Likewise * emultempl/pe.em (ld_emulation_xfer_struct): Likewise * emultempl/pep.em (ld_emulation_xfer_struct): Likewise * emultempl/ticoff.em (ld_emulation_xfer_struct): Likewise * emultempl/vanilla.em (ld_emulation_xfer_struct): Likewise
* [PATCH] ld: fix s/claimi/claim/ typoSergei Trofimovich2020-05-182-1/+6
| | | | | * ldmain.c (add_archive_element): Fix s/claimi/claim/ typo in info message.
* Updated translations for the gprof and ld sub-directoriesNick Clifton2020-05-184-1274/+5106
|
* ECOFF slurp_relocs thinkoAlan Modra2020-05-182-3/+8
| | | | | | | | | | | In git commit 806470a219 I swapped the order of internal vs. external relocs memory allocation in ecoff_slurp_reloc_table, the idea being that the external reloc size can be sanity checked against file size. However, that fails badly with bfd_alloc memory where releasing any block also releases all more recently allocated blocks. * ecoff.c (ecoff_slurp_reloc_table): Malloc external_relocs so they can be freed without also freeing internal_relocs.
* Fix the BFD library to handle Windows pathnames with more than 260 ↵Jaydeep Chauhan2020-05-182-2/+17
| | | | | | | | characters and UNIX style directory separators. PR 25713 * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory separators into DOS style when creating a WIN32 fullpath.
* Prevent a potential use-after-fee memory corruption bug in the linker (for ↵Nick Clifton2020-05-183-12/+46
| | | | | | | | | PE format files). PR 25993 * emultempl/pe.em (_after_open): Check for duplicate filename pointers before renaming the dll. * emultempl/pep.em (_after_open): Likewise.
* Re: Fix tight loop on recursively-defined symbolsAlan Modra2020-05-182-0/+6
| | | | | | | | sy_resolving ought to not be set for a struct local_symbol, but it is apparent from local_symbol_make that the field is not initialised. * symbols.c (resolve_symbol_value): Invoke LOCAL_SYMBOL_CHECK before looking at add_symbol->sy_flags.sy_resolving.
* Don't handle lret/iret when -mlfence-before-ret=[or|not|shl|yes] since they ↵liuhongt2020-05-1814-182/+22
| | | | | | | | | | | | | | | | | | | are invalid in SGX enclaves. gas/ChangeLog * gas/config/tc-i386.c: Not handle lret/iret. * gas/testsuite/gas/i386/lfence-ret-a.d: Adjust testcase. * gas/testsuite/gas/i386/lfence-ret-b.d: Ditto. * gas/testsuite/gas/i386/lfence-ret-c.d: Ditto. * gas/testsuite/gas/i386/lfence-ret-d.d: Ditto. * gas/testsuite/gas/i386/lfence-ret.s: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-a.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-b.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-c.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-d.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret-e.d: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret.s: Ditto. * gas/testsuite/gas/i386/x86-64-lfence-ret.e: Deleted.
* Automatic date update in version.inGDB Administrator2020-05-181-1/+1
|
* binutils: Add myself as maintainer for OpenRISCStafford Horne2020-05-182-0/+5
| | | | | | | | binutils/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * MAINTAINERS (OR1K): Add myself as maintainer.
* Stop considering hw and sw breakpoint locations duplicates (PR gdb/25741)Pedro Alves2020-05-174-86/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following conditions: - A target with hardware breakpoints available, and - A target that uses software single stepping, - An instruction at ADDRESS loops back to itself, Now consider the following steps: 1. The user places a hardware breakpoint at ADDRESS (an instruction that loops to itself), 2. The inferior runs and hits the breakpoint at ADDRESS, 3. The user tells GDB to 'continue'. In #3 when the user tells GDB to continue, GDB first disables the hardware breakpoint at ADDRESS, and then inserts a software single-step breakpoint at ADDRESS. The original user-created breakpoint was a hardware breakpoint, while the single-step breakpoint will be a software breakpoint. GDB continues and immediately hits the software single-step breakpoint. GDB then deletes the software single-step breakpoint by calling delete_single_step_breakpoints, which eventually calls delete_breakpoint, which, once the breakpoint (and its locations) are deleted, calls update_global_location_list. During update_global_location_list GDB spots that we have an old location (the software single step breakpoint location) that is inserted, but being deleted, and a location (the original hardware breakpoint) at the same address which we are keeping, but which is not currently inserted, GDB then calls breakpoint_locations_match on these two locations. Currently the locations do match, and so GDB calls swap_insertion which swaps the "inserted" state of the two locations. The user created hardware breakpoint is marked as inserted, while the GDB internal software single step breakpoint is now marked as not inserted. After this GDB returns through the call stack and leaves delete_single_step_breakpoints. After this GDB continues with its normal "stopping" process, as part of this stopping process GDB removes all the breakpoints from the target. Due to the swap it is now the user-created hardware breakpoint that is marked as inserted, so it is this breakpoint GDB tries to remove. The problem is that GDB inserted the software single-step breakpoint as a software breakpoint, but is now trying to remove the hardware breakpoint. The problem is removing a software breakpoint is very different to removing a hardware breakpoint, this could result is some undetected undefined behaviour, or as in the original bug report (PR gdb/25741), could result in the target throwing an error. With "set breakpoint always-inserted on", we can easily reproduce this against GDBserver. E.g.: (gdb) hbreak main Sending packet: $m400700,40#28...Packet received: 89e58b.... Sending packet: $m400736,1#fe...Packet received: 48 Hardware assisted breakpoint 1 at 0x400736: file threads.c, line 57. Sending packet: $Z1,400736,1#48...Packet received: OK Packet Z1 (hardware-breakpoint) is supported (gdb) b main Note: breakpoint 1 also set at pc 0x400736. Sending packet: $m400736,1#fe...Packet received: 48 Breakpoint 2 at 0x400736: file threads.c, line 57. (gdb) del Delete all breakpoints? (y or n) y Sending packet: $z0,400736,1#67...Packet received: E01 warning: Error removing breakpoint 2 This patch adds a testcase that does exactly that. Trying to enhance GDB to handle this scenario while continuing to avoid inserting redundant software and hardware breakpoints at the same address turns out futile, because, given non-stop and breakpoints always-inserted, if the user: #1 - inserts a hw breakpoint, then #2 - inserts a sw breakpoint at the same address, and then #3 - removes the original hw breakpoint, GDB would have to make sure to insert the sw breakpoint before removing the hw breakpoint, to avoid running threads missing the breakpoint. I.e., there's always going to be a window where a target needs to be able to handle both sw and a hw breakpoints installed at the same address. You can see more detailed description of that issue here: https://sourceware.org/pipermail/gdb-patches/2020-April/167738.html So the fix here is to just stop considering software breakpoints and hw breakpoints duplicates, and let GDB insert sw and hw breakpoints at the same address. The central change is to make breakpoint_locations_match consider the location's type too. There are several other changes necessary to actually make that that work correctly, however: - We need to handle the duplicates detection better. Take a look at the loop at the tail end of update_global_location_list. Currently, because breakpoint locations aren't sorted by type, we can end up with, at the same address, a sw break, then a hw break, then a sw break, etc. The result is that that second sw break won't be considered a duplicate of the first sw break. Seems like we already handle that incorrectly for range breakpoints. - The "set breakpoint auto-hw on" handling is moved out of insert_bp_location to update_global_location_list, before the duplicates determination. Moving "set breakpoint auto-hw off" handling as well and downgrading it to a warning+'disabling the location' was considered too, but in the end discarded, because we want to error out with internal and momentary breakpoints, like software single-step breakpoints. Disabling such locations at update_global_location_list time would make GDB lose control of the inferior. - In update_breakpoint_locations, the logic of matching old locations with new locations, in the have_ambiguous_names case, is updated to still consider sw vs hw locations the same. - Review all ALL_BP_LOCATIONS_AT_ADDR uses, and update those that might need to be updated, and update comments for those that don't. Note that that macro walks all locations at a given address, and doesn't call breakpoint_locations_match. The result against GDBserver (with "set breakpoint condition-evaluation host" to avoid seeing confusing reinsertions) is: (gdb) hbreak main Sending packet: $m400736,1#fe...Packet received: 48 Hardware assisted breakpoint 1 at 0x400736: file main.c, line 57. Sending packet: $Z1,400736,1#48...Packet received: OK (gdb) b main Note: breakpoint 1 also set at pc 0x400736. Sending packet: $m400736,1#fe...Packet received: 48 Breakpoint 4 at 0x400736: file main.c, line 57. Sending packet: $Z0,400736,1#47...Packet received: OK (gdb) del 3 Sending packet: $z1,400736,1#68...Packet received: OK gdb/ChangeLog: 2020-05-17 Pedro Alves <palves@redhat.com> Andrew Burgess <andrew.burgess@embecosm.com> Keno Fischer <keno@juliacomputing.com> PR gdb/25741 * breakpoint.c (build_target_condition_list): Update comments. (build_target_command_list): Update comments and skip matching locations. (insert_bp_location): Move "set breakpoint auto-hw on" handling to a separate function. Simplify "set breakpoint auto-hw off" handling. (insert_breakpoints): Update comment. (tracepoint_locations_match): New parameter. For breakpoints, compare location types too, if the caller wants to. (handle_automatic_hardware_breakpoints): New functions. (bp_location_is_less_than): Also sort by location type and hardware breakpoint length. (update_global_location_list): Handle "set breakpoint auto-hw on" here. (update_breakpoint_locations): Ask breakpoint_locations_match to ignore location types. gdb/testsuite/ChangeLog: 2020-05-17 Pedro Alves <palves@redhat.com> PR gdb/25741 * gdb.base/hw-sw-break-same-address.exp: New file.