aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-03-20Silence warnings due to plugin API changeAlan Modra5-4/+24
* testplug.c (parse_symdefstr): Use %hhi to read sym->def, and clear new fields. * testplug2.c (parse_symdefstr): Likewise. * testplug3.c (parse_symdefstr): Likewise. * testplug4.c (parse_symdefstr): Likewise.
2020-03-20XCOFF uninitialized readAlan Modra2-4/+9
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large enough to read number of symbols.
2020-03-20metag uninitialized memory readAlan Modra2-2/+13
* metag-dis.c (print_insn_metag): Don't ignore status from read_memory_func.
2020-03-20NDS32 disassembly of odd sized sectionsAlan Modra2-9/+22
* nds32-dis.c (print_insn_nds32): Remove unnecessary casts. Initialize parts of buffer not written when handling a possible 2-byte insn at end of section. Don't attempt decoding of such an insn by the 4-byte machinery.
2020-03-20PowerPC disassembly of odd sized sectionsAlan Modra2-10/+25
We shouldn't really decode a 2-byte left-over at the end of a section as if the section contains two more bytes of zeros. Not that it matters very much, but this patch tidies the corner case. * ppc-dis.c (print_insn_powerpc): Only clear needed bytes of partially filled buffer. Prevent lookup of 4-byte insns when only VLE 2-byte insns are possible due to section size. Print ".word" rather than ".long" for 2-byte leftovers.
2020-03-20tidy elf_backend callsAlan Modra4-27/+37
Function pointers in elfNN_bed that are initialized by elfxx-target.h to non-zero values generally don't need a non-NULL test before calling them. Targets don't set a non-NULL function to NULL. The one exception being elfnn-ia64.c and that exception is removed here. * elf.c (_bfd_elf_setup_sections): Don't test known non-NULL backend functions for NULL before calling. (copy_special_section_fields, _bfd_elf_copy_private_bfd_data), (bfd_section_from_shdr, assign_section_numbers): Likewise. * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise. * elfnn-ia64.c (ignore_errors): New function. (elf_backend_link_order_error_handler): Redefine as ignore_errors.
2020-03-20Automatic date update in version.inGDB Administrator1-1/+1
2020-03-19Add support for --no-rosegment option.Fangrui Song2-1/+5
gold/ * options.h (General_options): Add --no-rosegment option.
2020-03-19Disable get_ptrace_pid for NetBSDKamil Rytarowski3-19/+44
Unlike most other Operating Systems, NetBSD tracks both pid and lwp. The process id on NetBSD is stored always in the pid field of ptid. gdb/ChangeLog: * inf-ptrace.h: Disable get_ptrace_pid on NetBSD. * inf-ptrace.c: Likewise. * (gdb_ptrace): Add. * (inf_ptrace_target::resume): Update. * (inf_ptrace_target::xfer_partial): Likewise. * (inf_ptrace_peek_poke): Change argument `pid' to `ptid'. * (inf_ptrace_peek_poke): Update.
2020-03-19Fix discrepancies in nm's --line-number output by adding support for the ↵Nick Clifton5-18/+2107
DW_AT_specification DWARF Attttribute. PR 25676 bfd * dwarf2.c (struct varinfo): Add unit_offset field to record the location of the varinfo in the unit's debug info data. Change the type of the stack field to a boolean. (lookup_var_by_offset): New function. Returns the varinfo structure for the variable described at the given offset in the unit's debug info. (scan_unit_for_symbols): Add support for variables which have the DW_AT_specification attribute. binutils* testsuite/binutils-all/dw4.s: New test source file. * testsuite/binutils-all/nm.exp: Run the new test.
2020-03-19Include: Sync lto-symtab.h and plugin-api.h with GCCMartin Liska3-2/+56
2020-03-19 Martin Liska <mliska@suse.cz> * lto-symtab.h (enum gcc_plugin_symbol_type): New. (enum gcc_plugin_symbol_section_kind): Likewise. 2020-03-19 Martin Liska <mliska@suse.cz> * plugin-api.h (struct ld_plugin_symbol): Split int def into 4 char fields. (enum ld_plugin_symbol_type): New. (enum ld_plugin_symbol_section_kind): New. (enum ld_plugin_tag): Add LDPT_ADD_SYMBOLS_V2.
2020-03-19[AArch64] When unavailable, fetch VG from ptrace.Luis Machado2-3/+23
I was doing some SVE tests on system QEMU and noticed quite a few failures related to inferior function calls. Any attempt to do an inferior function call would result in the following: Unable to set VG register.: Success. This happens because, after an inferior function call, GDB attempts to restore the regcache state and updates the SVE register in order. Since the Z registers show up before the VG register, VG is still INVALID by the time the first Z register is being updated. So when executing the following code in aarch64_sve_set_vq: if (reg_buf->get_register_status (AARCH64_SVE_VG_REGNUM) != REG_VALID) return false; By returning false, we signal something is wrong, then we get to this: /* First store vector length to the thread. This is done first to ensure the ptrace buffers read from the kernel are the correct size. */ if (!aarch64_sve_set_vq (tid, regcache)) perror_with_name (_("Unable to set VG register.")); Ideally we'd always have a valid VG before attempting to set the Z registers, but in this case the ordering of registers doesn't make that possible. I considered reordering the registers to put VG before the Z registers, like the DWARF numbering, but that would break backwards compatibility with existing implementations. Also, the Z register numbering is pinned to the V registers, and adding VG before Z would create a gap for non-SVE targets, since we wouldn't be able to undefine VG for non-SVE targets. As a compromise, it seems we can safely fetch the VG register value from ptrace. The value in the kernel is likely the updated value anyway. This patch fixed all the failures i saw in the testsuite and caused no further regressions. gdb/ChangeLog: 2020-03-19 Luis Machado <luis.machado@linaro.org> * nat/aarch64-sve-linux-ptrace.c (aarch64_sve_set_vq): If vg is not valid, fetch vg value from ptrace.
2020-03-19Fix assertion failure in the BFD library when called to parse a file ↵Nick Clifton2-2/+13
containing corrupt ELF group information. PR 25699 * elf.c (bfd_elf_set_group_contents): Replace assertion with an error return.
2020-03-19Avoid get_ptrace_pid() usage on NetBSD in x86-bsd-nat.cKamil Rytarowski2-23/+27
Add gdb_ptrace() that wraps the ptrace(2) API and correctly passes the pid,lwp pair to the calls on NetBSD; and the result of get_ptrace_pid() on other BSD Operating Systems. gdb/ChangeLog: * x86-bsd-nat.c (gdb_ptrace): New. * (x86bsd_dr_set): Add new argument `ptid'. * (x86bsd_dr_get, x86bsd_dr_set, x86bsd_dr_set_control, x86bsd_dr_set_addr): Update.
2020-03-19readelf.c: Use unsigned long to iterate over num_symsH.J. Lu2-4/+7
process_symbol_table () has unsigned long num_syms; ... for (si = 0, psym = symtab; si < num_syms; si++, psym++) We should use unsigned long to iterate over num_syms. * readelf.c (process_symbol_table): Use unsigned long for si.
2020-03-19gdb: Handle W and X remote packets without giving a warningAndrew Burgess5-10/+384
In this commit: commit 24ed6739b699f329c2c45aedee5f8c7d2f54e493 Date: Thu Jan 30 14:35:40 2020 +0000 gdb/remote: Restore support for 'S' stop reply packet A regression was introduced such that the W and X packets would give a warning in some cases. The warning was: warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread This problem would arise when: 1. The multi-process extensions to the remote protocol were not being used, and 2. The inferior has multiple threads. In this case when the W (or X) packet arrives the ptid of the stop_reply is set to null_ptid, then when we arrive in process_stop_reply GDB spots that we have multiple non-exited theads, but the stop event didn't specify a thread-id. The problem with this is that the W (and X) packets are actually process wide events, they apply to all threads. So not specifying a thread-id is not a problem, in fact, the best these packets allow is for the remote to specify a process-id, not a thread-id. If we look at how the W (and X) packets deal with a specified process-id, then what happens is GDB sets to stop_reply ptid to a value which indicates all threads in the process, this is done by creating a value `ptid_t (pid)`, which sets the pid field of the ptid_t, but leaves the tid field as 0, indicating all threads. So, this commit does the same thing for the case where there is not process-id specified. In process_stop_reply we not distinguish between stop events that apply to all threads, and those that apply to only one. If the stop event applies to only one thread then we treat it as before. If, however, the stop event applies to all threads, then we find the first non-exited thread, and use the pid from this thread to create a `ptid_t (pid)` value. If the target has multiple inferiors, and receives a process wide event without specifying a process-id GDB now gives this warning: warning: multi-inferior target stopped without sending a process-id, using first non-exited inferior gdb/ChangeLog: * remote.c (remote_target::process_stop_reply): Handle events for all threads differently. gdb/testsuite/ChangeLog: * gdb.server/exit-multiple-threads.c: New file. * gdb.server/exit-multiple-threads.exp: New file.
2020-03-19gdb/testsuite/fortran: Add mixed language stack testAndrew Burgess5-0/+408
This commit adds a test that builds a mixed language stack, the stack contains frames of Fortran, C, and C++. The test prints the backtrace and explores the stack printing arguments of different types in frames of different languages. The core of the test is repeated with GDB's language set to auto, fortran, c, and c++ in turn to ensure that GDB is happy to print frames and frame arguments when the language is set to a value that doesn't match the frame language. This test currently passes, and there are no known bugs in this area. The aim of this commit is simply to increase test coverage, as I don't believe this functionality is currently tested. gdb/testsuite/ChangeLog: * gdb.fortran/mixed-lang-stack.c: New file. * gdb.fortran/mixed-lang-stack.cpp: New file. * gdb.fortran/mixed-lang-stack.exp: New file. * gdb.fortran/mixed-lang-stack.f90: New file.
2020-03-19gdb: Remove C++ symbol aliases from completion listAndrew Burgess7-0/+180
Consider debugging the following C++ program: struct object { int a; }; typedef object *object_p; static int get_value (object_p obj) { return obj->a; } int main () { object obj; obj.a = 0; return get_value (&obj); } Now in a GDB session: (gdb) complete break get_value break get_value(object*) break get_value(object_p) Or: (gdb) break get_va<TAB> (gdb) break get_value(object<RETURN> Function "get_value(object" not defined. Make breakpoint pending on future shared library load? (y or [n]) n The reason this happens is that we add completions based on the msymbol names and on the symbol names. For C++ both of these names include the parameter list, however, the msymbol names have some differences from the symbol names, for example: + typedefs are resolved, + whitespace rules are different around pointers, + the 'const' keyword is placed differently. What this means is that the msymbol names and symbol names appear to be completely different to GDB's completion tracker, and therefore to readline when it offers the completions. This commit builds on the previous commit which reworked the completion_tracker class. It is now trivial to add a remove_completion member function, this is then used along with cp_canonicalize_string_no_typedefs to remove the msymbol aliases from the completion tracker as we add the symbol names. Now, for the above program GDB only presents a single completion for 'get_value', which is 'get_value(object_p)'. It is still possible to reference the symbol using the msymbol name, so a user can manually type out 'break get_value (object *)' if they wish and will get the expected behaviour. I did consider adding an option to make this alias exclusion optional, in the end I didn't bother as I didn't think it would be very useful, but I can easily add such an option if people think it would be useful. gdb/ChangeLog: * completer.c (completion_tracker::remove_completion): Define new function. * completer.h (completion_tracker::remove_completion): Declare new function. * symtab.c (completion_list_add_symbol): Remove aliasing msymbols when adding a C++ function symbol. gdb/testsuite/ChangeLog: * gdb.linespec/cp-completion-aliases.cc: New file. * gdb.linespec/cp-completion-aliases.exp: New file. Change-Id: Ie5c7c9fc8ecf973072cfb4a9650867104bf7f50c
2020-03-19gdb: Restructure the completion_tracker classAndrew Burgess3-48/+222
In this commit I rewrite how the completion tracker tracks the completions, and builds its lowest common denominator (LCD) string. The LCD string is now built lazily when required, and we only track the completions in one place, the hash table, rather than maintaining a separate vector of completions. The motivation for these changes is that the next commit will add the ability to remove completions from the list, removing a completion will invalidate the LCD string, so we need to keep hold of enough information to recompute the LCD string as needed. Additionally, keeping the completions in a vector makes removing a completion expensive, so better to only keep the completions in the hash table. This commit doesn't add any new functionality itself, and there should be no user visible changes after this commit. For testing, I ran the testsuite as usual, but I also ran some manual completion tests under valgrind, and didn't get any reports about leaked memory. gdb/ChangeLog: * completer.c (completion_tracker::completion_hash_entry): Define new class. (advance_to_filename_complete_word_point): Call recompute_lowest_common_denominator. (completion_tracker::completion_tracker): Call discard_completions to setup the hash table. (completion_tracker::discard_completions): Allow for being called from the constructor, pass new equal function, and element deleter when constructing the hash table. Initialise new class member variables. (completion_tracker::maybe_add_completion): Remove use of m_entries_vec, and store more information into m_entries_hash. (completion_tracker::recompute_lcd_visitor): New function, most content taken from... (completion_tracker::recompute_lowest_common_denominator): ...here, this now just visits each item in the hash calling the above visitor. (completion_tracker::build_completion_result): Remove use of m_entries_vec, call recompute_lowest_common_denominator. * completer.h (completion_tracker::have_completions): Remove use of m_entries_vec. (completion_tracker::completion_hash_entry): Declare new class. (completion_tracker::recompute_lowest_common_denominator): Change function signature. (completion_tracker::recompute_lcd_visitor): Declare new function. (completion_tracker::m_entries_vec): Delete. (completion_tracker::m_entries_hash): Initialize to NULL. (completion_tracker::m_lowest_common_denominator_valid): New member variable. (completion_tracker::m_lowest_common_denominator_max_length): New member variable. Change-Id: I9d1db52c489ca0041b8959ca0d53b7d3af8aea72
2020-03-19[gdb/testsuite] Fix gdb.opt/inline-locals.exp KFAILsTom de Vries2-4/+27
When running test-case gdb.opt/inline-locals.exp, I get: ... Running src/gdb/testsuite/gdb.opt/inline-locals.exp ... KPASS: gdb.opt/inline-locals.exp: info locals above bar 2 (PRMS gdb/xyz) KPASS: gdb.opt/inline-locals.exp: info locals above bar 3 (PRMS gdb/xyz) ... I've opened PR25695 - 'abstract and concrete variable listed both with "info locals"' to refer to in the PRMS field, and this patch adds that reference. Furthermore, I noticed that while I see KPASSes, given the problem description the tests should actually be KFAILs. This patch also fixes that. Tested on x86_64-linux. With gcc 7.5.0, I get 2 KFAILs. With clang 5.0.2, the tests pass. gdb/testsuite/ChangeLog: 2020-03-19 Tom de Vries <tdevries@suse.de> * gdb.opt/inline-locals.exp: Add kfail PR number. Make kfail matching more precise.
2020-03-19Additional c99 elfxx-riscv.c fixSebastian Huber2-1/+6
Similar to 2d0e121701a95e0f37af02bc622393b1ccd88c76. bfd/ * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
2020-03-19Don't use bfd.h in binutils/elfcomm.cAlan Modra3-31/+39
Better than warning about bfd types, just don't include bfd.h and warn against including the header again. * elfcomm.c: Don't include bfd.h or bucomm.h. (program_name): Declare. (process_archive_index_and_symbols): Replace bfd_boolean with int, and substitute FALSE and TRUE. (setup_archive, setup_nested_archive): Likewise. * elfcomm.h: Likewise.
2020-03-19readelf leak in process_archiveAlan Modra2-76/+95
* readelf.c (process_archive): Always return via path freeing memory. Formatting.
2020-03-19Invalid read in process_netbsd_elf_noteAlan Modra2-7/+15
* readelf.c (process_netbsd_elf_note): Validate descsz before accessing descdata. Formatting.
2020-03-19setup_archive parameter mismatchAlan Modra3-3/+13
* elfcomm.c (setup_archive): Make file_size an off_t. Comment. * elfcomm.h (setup_archive): Update prototype.
2020-03-19Automatic date update in version.inGDB Administrator1-1/+1
2020-03-18[gdb/testsuite] Add test-case gdb.dwarf2/break-inline-psymtab.expTom de Vries4-0/+99
Add a test-case that tests whether we can set a breakpoint on an inlined inline function in CU for which the partial symtab has not yet been expanded. Tested on x86_64-linux, with gcc 4.8.5, gcc-7.5.0, gcc-10.0.1, and clang 5.0.2. gdb/testsuite/ChangeLog: 2020-03-18 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/break-inline-psymtab-2.c: New test. * gdb.dwarf2/break-inline-psymtab.c: New test. * gdb.dwarf2/break-inline-psymtab.exp: New file.
2020-03-18Non-contiguous memory regions support: Fix testcases after previous commitChristophe Lyon3-2/+7
2020-03-18 Christophe Lyon <christophe.lyon@linaro.org> * testsuite/ld-arm/non-contiguous-arm4.d: Fix expected output. * testsuite/ld-powerpc/non-contiguous-powerpc.d: Likewise. Change-Id: I8870800177e1ff79cdd05af13613ec53ef95681f
2020-03-18Fix seg-fault in strip when copying a file containing corrupt secondary relocs.Nick Clifton2-40/+97
PR 25673 * elf.c (_bfd_elf_write_secondary_reloc_section): Fix illegal memory access when processing a corrupt secondary reloc section.
2020-03-18Non-contiguous memory regions support: Avoid calls to abortChristophe Lyon13-105/+82
Use '%F' format when printing error messages to exit cleanly rather than by calling abort(). 2020-03-18 Christophe Lyon <christophe.lyon@linaro.org> bfd/ * elf32-arm.c (arm_build_one_stub): Emit a fatal error message instead of calling abort. * elf32-csky.c (csky_build_one_stub): Likewise. * elf32-hppa.c (hppa_build_one_stub): Likewise. * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise. * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise. * elf32-metag.c (metag_build_one_stub): Likewise. * elf32-nios2.c (nios2_build_one_stub): Likewise. * elf64-ppc.c (ppc_build_one_stub): Likewise. (ppc_size_one_stub): Likewise. * elfnn-aarch64.c (aarch64_build_one_stub): Likewise. ld/ * emultempl/xtensaelf.em: Emit a fatal error message instead of calling abort. * ldlang.c: Likewise. Change-Id: I60deaeeee59d4e7cab06b8a40a3e51837c43a8ab
2020-03-18Namespace the reg class to avoid clashes with OS headersKamil Rytarowski6-3/+17
Fix build issues on NetBSD where the reg symbol exists in public headers. regformats/regdef.h:22:8: error: redefinition struct struct reg ^~~ /usr/include/amd64/reg.h:51:8: note: previous definition struct struct reg { ^~~ gdb/ChangeLog: * regformats/regdef.h: Put reg in gdb namespace. gdbserver/ChangeLog: * regcache.cc (find_register_by_number): Update. * tdesc.cc (init_target_desc): Likewise. * tdesc.h (target_desc::reg_defs): Likewise.
2020-03-18Add support for NetBSD threads in i386-bsd-nat.cKamil Rytarowski2-21/+50
NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads. Define gdb_ptrace() a wrapper function for ptrace(2) that properly passes the pid,lwp pair on NetBSD and the result of get_ptrace_pid() for others. gdb/ChangeLog: * i386-bsd-nat.c (gdb_ptrace): New. * (i386bsd_fetch_inferior_registers, i386bsd_store_inferior_registers) Switch from pid_t to ptid_t. * (i386bsd_fetch_inferior_registers, i386bsd_store_inferior_registers) Use gdb_ptrace.
2020-03-18Add support for NetBSD threads in amd64-bsd-nat.cKamil Rytarowski2-16/+39
NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads. Define gdb_ptrace() a wrapper function for ptrace(2) that properly passes the pid,lwp pair on NetBSD and the result of get_ptrace_pid() for others. gdb/ChangeLog: * amd64-bsd-nat.c (gdb_ptrace): New. * (amd64bsd_fetch_inferior_registers, amd64bsd_store_inferior_registers) Switch from pid_t to ptid_t. * (amd64bsd_fetch_inferior_registers, amd64bsd_store_inferior_registers) Use gdb_ptrace.
2020-03-18Include <alloca.h> conditionallyKamil Rytarowski2-0/+6
Fixes build on NetBSD, where alloca() is defined in <stdlib.h>. gdbsupport: * common-defs.h: Include alloca.h if HAVE_ALLOCA_H is defined.
2020-03-18Rename the read symbol to xreadKamil Rytarowski2-9/+21
This avoids clashes with macro read in the NetBSD headers. gdb/ChangeLog: * user-regs.c (user_reg::read): Rename to... (user_reg::xread): ...this. * (append_user_reg): Rename argument `read' to `xread'. * (user_reg_add_builtin): Likewise. * (user_reg_add): Likewise. * (value_of_user_reg): Likewise.
2020-03-18Automatic date update in version.inGDB Administrator1-1/+1
2020-03-17Add support for NetBSD threads in sparc-nat.cKamil Rytarowski2-28/+32
NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads. Define gdb_ptrace() a wrapper function for ptrace(2) that properly passes the pid,lwp pair on NetBSD and the result of get_ptrace_pid() for others. gdb/ChangeLog: * sparc-nat.c (gdb_ptrace): New. * sparc-nat.c (sparc_fetch_inferior_registers) (sparc_store_inferior_registers) Remove obsolete comment. * sparc-nat.c (sparc_fetch_inferior_registers) (sparc_store_inferior_registers) Switch from pid_t to ptid_t. * sparc-nat.c (sparc_fetch_inferior_registers) (sparc_store_inferior_registers) Use gdb_ptrace.
2020-03-17Fix PR number in previous deltaNick Clifton1-1/+1
2020-03-17Replace a couple of assertions in the BFD library that can be triggered by ↵Nick Clifton4-5/+59
attempts to parse corrupt input files. PR 25633 * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions with error messages.
2020-03-17Fix a small set of Z80 problems.Sergey Belyashov16-175/+436
PR 25641 PR 25668 PR 25633 gas Fix disassembling ED+A4/AC/B4/BC opcodes. Fix assembling lines containing colonless label and instruction with first operand inside parentheses. Fix registration of unsupported by target CPU registers. * config/tc-z80.c: See above. * config/tc-z80.h: See above. * testsuite/gas/z80/colonless.d: Update test. * testsuite/gas/z80/colonless.s: Likewise. * testsuite/gas/z80/ez80_adl_all.d: Likewise. * testsuite/gas/z80/ez80_unsup_regs.d: Likewise. * testsuite/gas/z80/ez80_z80_all.d: Likewise. * testsuite/gas/z80/gbz80_unsup_regs.d: Likewise. * testsuite/gas/z80/r800_unsup_regs.d: Likewise. * testsuite/gas/z80/unsup_regs.s: Likewise. * testsuite/gas/z80/z180_unsup_regs.d: Likewise. * testsuite/gas/z80/z80.exp: Likewise. * testsuite/gas/z80/z80_strict_unsup_regs.d: Likewise. * testsuite/gas/z80/z80_unsup_regs.d: Likewise. * testsuite/gas/z80/z80n_unsup_regs.d: Likewise. opcodes * z80-dis.c: Fix disassembling ED+A4/AC/B4/BC opcodes.
2020-03-17Remove a double free in the BFD library triggered when parsing a corrupt file.Nick Clifton2-1/+9
PR 25687 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Remove redundant free. Add free on another failure path.
2020-03-17Add support for NetBSD threads in sh-nbsd-nat.cKamil Rytarowski2-3/+11
NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads. gdb/ChangeLog: * sh-nbsd-nat.c (fetch_registers): New variable lwp and pass it to the ptrace call. * sh-nbsd-nat.c (store_registers): Likewise.
2020-03-17Inherit sh_nbsd_nat_target from nbsd_nat_targetKamil Rytarowski2-1/+9
gdb/ChangeLog: * sh-nbsd-nat.c (sh_nbsd_nat_target): Inherit from nbsd_nat_target instead of inf_ptrace_target. * sh-nbsd-nat.c: Include "nbsd-nat.h", as we are now using nbsd_nat_target.
2020-03-17Automatic date update in version.inGDB Administrator1-1/+1
2020-03-17Include missing header to get missing declarationsKamil Rytarowski2-0/+5
CXX amd64-bsd-nat.o amd64-bsd-nat.c:42:1: error: no previous declaration void amd64bsd_fetch_inferior_registers(regcache*, [-Werror=missing-declarations] amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ amd64-bsd-nat.c:118:1: error: no previous declaration void amd64bsd_store_inferior_registers(regcache*, [-Werror=missing-declarations] amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Detected on NetBSD/amd64 9.99.49. gdb/ChangeLog: * amd64-bsd-nat.c: Include amd64-bsd-nat.h".
2020-03-17Rewrite nbsd_nat_target::pid_to_exec_file to sysctl(3)Kamil Rytarowski2-12/+16
procfs on NetBSD is optional and not recommended. * nbsd-nat.c: Include <sys/types.h>, <sys/ptrace.h> and <sys/sysctl.h>. * nbsd-nat.c (nbsd_nat_target::pid_to_exec_file): Rewrite.
2020-03-17[gdb] Skip imports of c++ CUsTom de Vries3-0/+37
The DWARF standard appendix E.1 describes techniques that can be used for compression and deduplication: DIEs can be factored out into a new compilation unit, and referenced using DW_FORM_ref_addr. Such a new compilation unit can either use a DW_TAG_compile_unit or DW_TAG_partial_unit. If a DW_TAG_compile_unit is used, its contents is evaluated by consumers as though it were an ordinary compilation unit. If a DW_TAG_partial_unit is used, it's only considered by consumers in the context of a DW_TAG_imported_unit. An example of when DW_TAG_partial_unit is required is when the factored out DIEs are not top-level, f.i. because they were children of a namespace. In such a case the corresponding DW_TAG_imported_unit will occur as child of the namespace. In the case of factoring out DIEs from c++ compilation units, we can factor out into a new DW_TAG_compile_unit, and no DW_TAG_imported_unit is required. This begs the question how to interpret a top-level DW_TAG_imported_unit of a c++ DW_TAG_compile_unit compilation unit. The semantics of DW_TAG_imported_unit describe that the imported unit logically appears at the point of the DW_TAG_imported_unit entry. But it's not clear what the effect should be in this case, since all the imported DIEs are already globally visible anyway, due to the use of DW_TAG_compile_unit. So, skip top-level imports of c++ DW_TAG_compile_unit compilation units in process_imported_unit_die. Using the cc1 binary from PR23710 comment 1 and setting a breakpoint on do_rpo_vn: ... $ gdb \ -batch \ -iex "maint set dwarf max-cache-age 316" \ -iex "set language c++" \ -ex "b do_rpo_vn" \ cc1 ... we get a 8.1% reduction in execution time, due to reducing the number of partial symtabs expanded into full symtabs from 212 to 175. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-03-17 Tom de Vries <tdevries@suse.de> PR gdb/23710 * dwarf2/read.h (struct dwarf2_per_cu_data): Add unit_type and lang fields. * dwarf2/read.c (process_psymtab_comp_unit): Initialize unit_type and lang fields. (process_imported_unit_die): Skip import of c++ CUs.
2020-03-17[gdb/testsuite] Give up after consecutive timeouts in completion-support.expTom de Vries1-2/+25
When running test-case gdb.linespec/cpcompletion.exp with target board unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects, we run into lots of timeouts, in particular with this pattern: ... FAIL: gdb.linespec/cpcompletion.exp: template-ret-type: \ cmd complete "b template2_" FAIL: gdb.linespec/cpcompletion.exp: template-ret-type: \ tab complete "b template2_st" (timeout) FAIL: gdb.linespec/cpcompletion.exp: template-ret-type: \ cmd complete "b template2_st" FAIL: gdb.linespec/cpcompletion.exp: template-ret-type: \ tab complete "b template2_str" (timeout) FAIL: gdb.linespec/cpcompletion.exp: template-ret-type: \ cmd complete "b template2_str" FAIL: gdb.linespec/cpcompletion.exp: template-ret-type: \ tab complete "b template2_stru" (timeout) ... Fix this by detecting timeouts in test_complete_prefix_range_re and giving up after 3 consecutive timeouts. This reduces testing time from ~39m to ~9m. Tested on x86_64-linux.
2020-03-16Initialize base_value in pascal_object_print_valueTom Tromey2-0/+6
The val_print removal series introduced a new possibly-uninitialized warning in p-valprint.c. Examination of the code shows that the warning does not indicate a real bug, so this patch silences the warning by setting the variable in the catch clause of a try/catch. (The obvious initialization did not work due to a "goto" in this function.) gdb/ChangeLog 2020-03-16 Tom Tromey <tom@tromey.com> * p-valprint.c (pascal_object_print_value): Initialize base_value.
2020-03-16arc: Migrate to new target featuresAnton Kolesov21-351/+525
This patch replaces usage of target descriptions in ARC, where the whole description is fixed in XML, with new target descriptions where XML describes individual features, and GDB assembles those features into actual target description. v2: Removed arc.c from ALLDEPFILES in gdb/Makefile.in. Removed vim modeline from arc-tdep.c to have it in a separate patch. Removed braces from one line "if/else". Undid the type change for "jb_pc" (kept it as "int"). Joined the unnecessary line breaks into one line. No more moving around arm targets in gdb/features/Makefile. Changed pattern checking for ARC features from "arc/{aux,core}" to "arc/". v3: Added include gaurds to arc.h. Added arc_read_description to _create_ target descriptions less. v4: Got rid of ARC_SYS_TYPE_NONE. Renamed ARC_SYS_TYPE_INVALID to ARC_SYS_TYPE_NUM. Fixed a few indentations/curly braces. Converted arc_sys_type_to_str from a macro to an inline function. gdb/ChangeLog: 2020-03-16 Anton Kolesov <anton.kolesov@synopsys.com> Shahab Vahedi <shahab@synopsys.com> * Makefile.in: Add arch/arc.o * configure.tgt: Likewise. * arc-tdep.c (arc_tdesc_init): Use arc_read_description. (_initialize_arc_tdep): Don't initialize old target descriptions. (arc_read_description): New function to cache target descriptions. * arc-tdep.h (arc_read_description): Add proto type. * arch/arc.c: New file. * arch/arc.h: Likewise. * features/Makefile: Replace old target descriptions with new. * features/arc-arcompact.c: Remove. * features/arc-arcompact.xml: Likewise. * features/arc-v2.c: Likewise * features/arc-v2.xml: Likewise * features/arc/aux-arcompact.xml: New file. * features/arc/aux-v2.xml: Likewise. * features/arc/core-arcompact.xml: Likewise. * features/arc/core-v2.xml: Likewise. * features/arc/aux-arcompact.c: Generate. * features/arc/aux-v2.c: Likewise. * features/arc/core-arcompact.c: Likewise. * features/arc/core-v2.c: Likewise. * target-descriptions (maint_print_c_tdesc_cmd): Support ARC features.