Alan Modra [Tue, 31 Mar 2020 04:31:01 +0000 (15:01 +1030)]
alpha-coff: unitialised read
* coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
return value check.
Alan Modra [Tue, 31 Mar 2020 04:23:27 +0000 (14:53 +1030)]
alpha-vms: sanity checks for image_write
* vms-alpha.c (image_write): Check bounds for sections without
contents too. Error on non-zero write to section without
contents.
(_bfd_vms_slurp_etir): Check return of image_write* functions.
Alan Modra [Tue, 31 Mar 2020 04:21:25 +0000 (14:51 +1030)]
tekhex: Uninitialised read
* tekhex.c (pass_over): Check is_eof before reading buffer.
GDB Administrator [Tue, 31 Mar 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Nelson Chu [Thu, 12 Mar 2020 09:48:39 +0000 (02:48 -0700)]
RISC-V: Update CSR to privileged spec 1.11.
gas/
* testsuite/gas/riscv/alias-csr.d: Move this to priv-reg-pseudo.
* testsuite/gas/riscv/alias-csr.s: Likewise.
* testsuite/gas/riscv/no-aliases-csr.d: Move this
to priv-reg-pseudo-noalias.
* testsuite/gas/riscv/bad-csr.d: Rename to priv-reg-fail-nonexistent.
* testsuite/gas/riscv/bad-csr.l: Likewise.
* testsuite/gas/riscv/bad-csr.s: Likewise.
* testsuite/gas/riscv/satp.d: Removed. Already included in priv-reg.
* testsuite/gas/riscv/satp.s: Likewise.
* testsuite/gas/riscv/priv-reg-pseudo.d: New testcase for all pseudo
csr instruction, including alias-csr testcase.
* testsuite/gas/riscv/priv-reg-pseudo.s: Likewise.
* testsuite/gas/riscv/priv-reg-pseudo-noalias.d: New testcase for all
pseudo instruction with objdump -Mno-aliases.
* testsuite/gas/riscv/priv-reg-fail-nonexistent.d: New testcase.
* testsuite/gas/riscv/priv-reg-fail-nonexistent.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-nonexistent.s: Likewise.
* testsuite/gas/riscv/priv-reg.d: Update CSR to 1.11.
* testsuite/gas/riscv/priv-reg.s: Likewise.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.
* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
include/
* opcode/riscv-opc.h: Update CSR to 1.11.
gdb/
* features/riscv/32bit-csr.xml: Regenerated.
* features/riscv/64bit-csr.xml: Regenerated.
Tom Tromey [Mon, 30 Mar 2020 17:50:35 +0000 (11:50 -0600)]
Change ada_which_variant_applies to value API
While debugging an Ada regression, I noticed that all the callers of
ada_which_variant_applies desconstruct a value, only to have it be
reconstructed by this function.
This patch removes this inefficiency in favor of simply passing in the
value directly.
Tested on x86-64 Fedora 30.
gdb/ChangeLog
2020-03-30 Tom Tromey <tromey@adacore.com>
* ada-valprint.c (print_variant_part): Update.
* ada-lang.h (ada_which_variant_applies): Update.
* ada-lang.c (ada_which_variant_applies): Remove outer_type and
outer_valaddr parameters; replace with "outer" value parameter.
(to_fixed_variant_branch_type): Update.
Nick Clifton [Mon, 30 Mar 2020 15:30:02 +0000 (16:30 +0100)]
Fix objcopy's --preserve-dates command line option so that it will work with PE format files.
PR binutils/pr25662
bfd * libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
field to timestamp and make it an integer.
* libcoff.h: Regenerate.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
field in the pe_data structure rather than the insert_timestamp
field.
binutils* objcopy.c (copy_object): When copying PE format files set the
timestamp field in the pe_data structure if the preserve_dates
flag is set.
* testsuite/binutils-all/objcopy.exp (objcopy_test) Use
--preserve-dates in place of the -p option, in order to make its
effect more obvious.
ld * emultempl/pe.em (after_open): Replace initialisation of the
insert_timestamp field in the pe_data structure with an
initialisation of the timestamp field.
* emultemp/pep.em: Likewise.
* pe-dll.c (fill_edata): Use the timestamp field in the pe_data
structure instead of the insert_timestamp field.
Pedro Franco de Carvalho [Mon, 30 Mar 2020 15:04:25 +0000 (12:04 -0300)]
[PowerPC] Fix debug register issues in ppc-linux-nat
This patch fixes some issues with debug register handling for the powerpc
linux native target.
Currently, the target methods for installing and removing hardware
breakpoints and watchpoints in ppc-linux-nat.c affect all threads known to
linux-nat, including threads of different processes.
This patch changes ppc-linux-nat.c so that only the process of
inferior_ptid is affected by these target methods, as GDB expects.
This is done in the same way as various other architectures. The
install/remove target methods only register a hardware breakpoint or
watchpoint, and then send a stop signal to the threads. The debug
registers are only changed with ptrace right before each thread is next
resumed, using low_prepare_to_resume.
There are two interfaces to modify debug registers for linux running on
powerpc, with different sets of ptrace requests:
- PPC_PTRACE_GETHWDBGINFO, PPC_PTRACE_SETHWDEBUG, and
PPC_PTRACE_DELHWDEBUG.
Or
- PTRACE_SET_DEBUGREG and PTRACE_GET_DEBUGREG
The first set (HWDEBUG) is the more flexible one and allows setting
watchpoints with a variable watched region length and, for certain
embedded processors, multiple types of debug registers (e.g. hardware
breakpoints and hardware-assisted conditions for watchpoints).
Currently, server processors only provide one watchpoint. The second one
(DEBUGREG) only allows setting one debug register, a watchpoint, so we
only use it if the first one is not available.
The HWDEBUG interface handles debug registers with slot numbers. Once a
hardware watchpoint or breakpoint is installed (with
PPC_PTRACE_SETHWDEBUG), ptrace returns a slot number. This slot number
can then be used to remove the watchpoint or breakpoint from the inferior
(with PPC_PTRACE_DELHWDEBUG). The first interface also provides a
bitmask of available debug register features, which can be obtained with
PPC_PTRACE_GETHWDBGINFO.
When GDB first tries to use debug registers, we try the first interface
with a ptrace call, and if it isn't available, we fall back to the second
one, if available. We use EIO as an indicator that an interface is not
available in the kernel. For simplicity, with any other error we
immediately assume no interface is available. Unfortunately this means
that if a process is killed by a signal right before we try to detect the
interface, we might get an ESRCH, which would prevent debug registers to
be used in the GDB session. However, it isn't clear that we can safely
raise an exception and try again in the future in all the contexts where
we try to detect the interface.
If the HWDEBUG interface works but provides no feature bits, the target
falls back to the DEBUGREG interface. When the kernel is configured
without CONFIG_HW_BREAKPOINTS (selected by CONFIG_PERF_EVENTS), there is
a bug that causes watchpoints installed with the HWDEBUG interface not to
trigger. When this is the case, the feature bits will be zero, which is
used as the indicator to fall back to the DEBUGREG interface. This isn't
ideal, but has always been the behavior of GDB before this patch, so I
decided not to change it.
A flag indicates for each thread if its debug registers need to be
updated the next time it is resumed. The flag is set whenever the upper
layers request or remove a hardware watchpoint or breakpoint, or when a
new thread is detected. Because some kernel configurations disable
watchpoints after they are hit, we also use the last stop reason of the
LWP to determine whether we should update the debug registers. It isn't
clear that this is also true of BookE hardware breakpoints, but we also
check their stop reason to be on the safe side, since it doesn't hurt.
A map from process numbers to hardware watchpoint or breakpoint objects
keeps track of what has been requested by the upper layers of GDB, since
for GDB installing a hardware watchpoint or breakpoint means doing so for
the whole process.
When using the HWDEBUG interface we also have to keep track of which
slots were last installed in each thread with a map from threads to the
slots, so that they can be removed when needed. When resuming a thread,
we remove all the slots using this map, then we install all the hardware
watchpoints and breakpoints from the per-process map of requests, and
then update the per-thread map accordingly.
This per-thread state is also used for copying the debug register state
after a fork or a clone is detected. The kernel might do this depending
on the configuration. Recent kernels running on server processors that
were configured with CONFIG_PERF_EVENTS (and therefore
CONFIG_HW_BREAKPOINTS) don't copy debug registers across forks and
clones. Recent kernels without CONFIG_HW_BREAKPOINTS copy this state. I
believe that on embedded processors (e.g. a ppc440) the debug register
state is copied, but I haven't been able to test this. To handle both
cases, the per-thread state is always copied when forks and clones are
detected, and when we resume the thread and delete the debug register
slots before updating them, we ignore ENOENT errors.
We don't need to handle this when using the DEBUGREG interface since it
only allows one hardware watchpoint and doesn't return slot numbers, we
just set or clear this watchpoint when needed.
Since we signal running threads to stop after a request is processed, so
that we can update their debug registers when they are next resumed,
there will be a time between signalling the threads and their stop during
which the debug registers haven't been updated, even if the target
methods completed.
The tests in gdb.threads/watchpoint-fork.exp no longer fail with this
patch.
gdb/ChangeLog:
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* ppc-linux-nat.c: Include <algorithm>, <unordered_map>, and
<list>. Remove inclusion of observable.h.
(PPC_DEBUG_CURRENT_VERSION): Move up define.
(struct arch_lwp_info): New struct.
(class ppc_linux_dreg_interface): New class.
(struct ppc_linux_process_info): New struct.
(struct ppc_linux_nat_target) <low_delete_thread, low_new_fork>
<low_new_clone, low_forget_process, low_prepare_to_resume>
<copy_thread_dreg_state, mark_thread_stale>
<mark_debug_registers_changed, register_hw_breakpoint>
<clear_hw_breakpoint, register_wp, clear_wp>
<can_use_watchpoint_cond_accel, calculate_dvc, check_condition>
<num_memory_accesses, get_trigger_type>
<create_watchpoint_request, hwdebug_point_cmp>
<init_arch_lwp_info, get_arch_lwp_info>
<low_stopped_by_watchpoint, low_stopped_data_address>: Declare as
methods.
<struct ptid_hash>: New inner struct.
<m_dreg_interface, m_process_info, m_installed_hw_bps>: Declare
members.
(saved_dabr_value, hwdebug_info, max_slots_number)
(struct hw_break_tuple, struct thread_points, ppc_threads)
(have_ptrace_hwdebug_interface)
(hwdebug_find_thread_points_by_tid)
(hwdebug_insert_point, hwdebug_remove_point): Remove.
(ppc_linux_nat_target::can_use_hw_breakpoint): Use
m_dreg_interface, remove call to PTRACE_SET_DEBUGREG.
(ppc_linux_nat_target::region_ok_for_hw_watchpoint): Add comment,
use m_dreg_interface.
(hwdebug_point_cmp): Change to...
(ppc_linux_nat_target::hwdebug_point_cmp): ...this method. Use
reference arguments instead of pointers.
(ppc_linux_nat_target::ranged_break_num_registers): Use
m_dreg_interface.
(ppc_linux_nat_target::insert_hw_breakpoint): Add comment, use
m_dreg_interface. Call register_hw_breakpoint.
(ppc_linux_nat_target::remove_hw_breakpoint): Add comment, use
m_dreg_interface. Call clear_hw_breakpoint.
(get_trigger_type): Change to...
(ppc_linux_nat_target::get_trigger_type): ...this method. Add
comment.
(ppc_linux_nat_target::insert_mask_watchpoint): Update comment,
use m_dreg_interface. Call register_hw_breakpoint.
(ppc_linux_nat_target::remove_mask_watchpoint): Update comment,
use m_dreg_interface. Call clear_hw_breakpoint.
(can_use_watchpoint_cond_accel): Change to...
(ppc_linux_nat_target::can_use_watchpoint_cond_accel): ...this
method. Update comment, use m_dreg_interface and
m_process_info.
(calculate_dvc): Change to...
(ppc_linux_nat_target::calculate_dvc): ...this method. Use
m_dreg_interface.
(num_memory_accesses): Change to...
(ppc_linux_nat_target::num_memory_accesses): ...this method.
(check_condition): Change to...
(ppc_linux_nat_target::check_condition): ...this method.
(ppc_linux_nat_target::can_accel_watchpoint_condition): Update
comment, use m_dreg_interface.
(create_watchpoint_request): Change to...
(ppc_linux_nat_target::create_watchpoint_request): ...this
method. Use m_dreg_interface.
(ppc_linux_nat_target::insert_watchpoint): Add comment, use
m_dreg_interface. Call register_hw_breakpoint or register_wp.
(ppc_linux_nat_target::remove_watchpoint): Add comment, use
m_dreg_interface. Call clear_hw_breakpoint or clear_wp.
(ppc_linux_nat_target::low_forget_process)
(ppc_linux_nat_target::low_new_fork)
(ppc_linux_nat_target::low_new_clone)
(ppc_linux_nat_target::low_delete_thread)
(ppc_linux_nat_target::low_prepare_to_resume): New methods.
(ppc_linux_nat_target::low_new_thread): Remove previous logic,
only call mark_thread_stale.
(ppc_linux_thread_exit): Remove.
(ppc_linux_nat_target::stopped_data_address): Change to...
(ppc_linux_nat_target::low_stopped_data_address): This. Add
comment, use m_dreg_interface and m_thread_hw_breakpoints.
(ppc_linux_nat_target::stopped_by_watchpoint): Change to...
(ppc_linux_nat_target::stopped_by_watchpoint): This. Add
comment. Call low_stopped_data_address.
(ppc_linux_nat_target::watchpoint_addr_within_range): Use
m_dreg_interface.
(ppc_linux_nat_target::masked_watch_num_registers): Use
m_dreg_interface.
(ppc_linux_nat_target::copy_thread_dreg_state)
(ppc_linux_nat_target::mark_thread_stale)
(ppc_linux_nat_target::mark_debug_registers_changed)
(ppc_linux_nat_target::register_hw_breakpoint)
(ppc_linux_nat_target::clear_hw_breakpoint)
(ppc_linux_nat_target::register_wp)
(ppc_linux_nat_target::clear_wp)
(ppc_linux_nat_target::init_arch_lwp_info)
(ppc_linux_nat_target::get_arch_lwp_info): New methods.
(_initialize_ppc_linux_nat): Remove observer callback.
Pedro Franco de Carvalho [Mon, 30 Mar 2020 15:04:25 +0000 (12:04 -0300)]
[PowerPC] Move up some register access routines
Keep the routines related to register access grouped together.
gdb/ChangeLog:
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* ppc-linux-nat.c (ppc_linux_nat_target::store_registers)
(ppc_linux_nat_target::auxv_parse)
(ppc_linux_nat_target::read_description)
(supply_gregset, fill_gregset, supply_fpregset, fill_fpregset):
Move up.
Pedro Franco de Carvalho [Mon, 30 Mar 2020 15:04:25 +0000 (12:04 -0300)]
Add low_new_clone method to linux_nat_target.
This patch adds a low_new_clone method to linux_nat_target, called after
a PTRACE_EVENT_CLONE is detected, similar to how low_new_fork is called
after PTRACE_EVENT_(V)FORK.
This is useful for targets that need to copy state associated with a
thread that is inherited across clones.
gdb/ChangeLog:
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* linux-nat.h (low_new_clone): New method.
* linux-nat.c (linux_handle_extended_wait): Call low_new_clone.
Tom de Vries [Mon, 30 Mar 2020 08:52:59 +0000 (10:52 +0200)]
[gdb/testsuite] Fix c-linkage-name.exp with {cc-with-gdb-index,readnow}.exp
When running test-case gdb.base/c-linkage-name.exp with target board
cc-with-gdb-index.exp, I see:
...
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: no
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: yes
...
The FAILs are due to the fact that partial symbol tables are not generated for
indexed executables.
When running the same test-case with target board readnow.exp, I see:
...
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: no
FAIL: gdb.base/c-linkage-name.exp: print symada__cS before partial symtab \
expansion
FAIL: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: yes
...
The "maint info psymtab" FAILs are also due to fact that the partial symbol
tables not generated, but in this case it's because the symtabs are fully
expanded upon load due to using -readnow. The "print symada__cS before
partial symtab expansion" test intends to test the state before symbol table
expansion, and with -readnow that's not possible.
Mark these FAILs as UNSUPPORTED.
Tested on x86_64-linux, with native, and target boards cc-with-gdb-index.exp,
cc-with-debug-names.exp and readnow.exp.
gdb/testsuite/ChangeLog:
2020-03-30 Tom de Vries <tdevries@suse.de>
* gdb.base/c-linkage-name.exp: Use readnow call to mark a test
unsupported.
(verify_psymtab_expanded): Move ...
* lib/gdb.exp (verify_psymtab_expanded): ... here. Add unsupported
test.
(readnow): New proc.
GDB Administrator [Mon, 30 Mar 2020 00:00:05 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sun, 29 Mar 2020 22:58:02 +0000 (09:28 +1030)]
PR25745, powerpc64-ld overflows string buffer in --stats mode
PR 25745
* elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
statistics message.
Simon Marchi [Sun, 29 Mar 2020 19:24:48 +0000 (15:24 -0400)]
gdb: rename partial symtab expand functions of debug info readers using legacy_psymtab
As I am trying to understand the dynamic of partial_symtab::read_symtab
and partial_symtab::expand_psymtab, I think that renaming these
functions helps make it clear that they are effectively implementations
of the partial_symtab::expand_psymtab method.
gdb/ChangeLog:
* dbxread.c (dbx_psymtab_to_symtab_1): Rename to...
(dbx_expand_psymtab): ... this.
(start_psymtab): Update.
* mdebugread.c (psymtab_to_symtab_1): Rename to...
(mdebug_expand_psymtab): ... this.
(parse_partial_symbols): Update.
(new_psymtab): Update.
* xcoffread.c (xcoff_psymtab_to_symtab_1): Rename to...
(xcoff_expand_psymtab): ... this.
(xcoff_start_psymtab): Update.
Simon Marchi [Sun, 29 Mar 2020 19:23:48 +0000 (15:23 -0400)]
gdb: rename partial_symtab::read_dependencies to expand_dependencies
This method calls partial_symtab::expand_psymtab on all dependencies of
a psymtab. Given that there is also a partial_symtab::read_symtab
method, I think it would be clearer to name this function
expand_dependencies, rather than read_dependencies.
gdb/ChangeLog:
* psympriv.h (partial_symtab) <read_dependencies>: Rename to...
<expand_dependencies>: ... this.
* psymtab.c (partial_symtab::read_dependencies): Rename to...
(partial_symtab::expand_dependencies): ... this.
* dwarf2/read.c (dwarf2_include_psymtab) <expand_psymtab>:
Update.
(dwarf2_psymtab::expand_psymtab): Update.
* dbxread.c (dbx_psymtab_to_symtab_1): Update.
* mdebugread.c (psymtab_to_symtab_1): Update.
* xcoffread.c (xcoff_psymtab_to_symtab_1): Update.
Simon Marchi [Sun, 29 Mar 2020 19:23:31 +0000 (15:23 -0400)]
gdb: remove discard_psymtab function
This function does not add much value, compared to calling the method on
the psymtab_storage object directly.
gdb/ChangeLog:
* psympriv.h (discard_psymtab): Remove.
* dbxread.c (dbx_end_psymtab): Update.
* xcoffread.c (xcoff_end_psymtab): Update.
GDB Administrator [Sun, 29 Mar 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 28 Mar 2020 15:25:41 +0000 (09:25 -0600)]
Fix comment in dwarf2/attribute.h
I noticed that a comment in dwarf2/attribute.h still referred to
dwarf2_get_attr_constant_value. However, this is now a method on
struct attribute.
gdb/ChangeLog
2020-03-28 Tom Tromey <tom@tromey.com>
* dwarf2/attribute.h (struct attribute) <form_is_constant>: Update
comment.
Tom Tromey [Thu, 26 Mar 2020 17:11:40 +0000 (11:11 -0600)]
Fix formatting of read_attribute_reprocess
I noticed that the start of read_attribute_reprocess had the wrong
formatting. This patch fixes it.
gdb/ChangeLog
2020-03-28 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_attribute_reprocess): Fix formatting.
H.J. Lu [Sat, 28 Mar 2020 12:06:58 +0000 (05:06 -0700)]
ld: Set COMMONPAGESIZE for i386 Solaris
Since COMMONPAGESIZE is set for other Solaris targets, including x86-64
Solaris, also set COMMONPAGESIZE for i386 Solaris to fix
FAIL: Build pr20995-2.so
FAIL: pr20995-2
PR 25732
* emulparams/elf_i386_ldso.sh (COMMONPAGESIZE): New.
* testsuite/ld-elf/shared.exp:Don't xfail pr20995-2 tests for
Solaris.
Alan Modra [Sat, 28 Mar 2020 04:01:02 +0000 (14:31 +1030)]
Re: Adjust objcopy_test
Last patch didn't manage to xfail spu due to clear_xfail *-*-*elf*.
Clearing *-*-*elf* dates back to a time when we had rather a lot more
setup_xfail patterns, so limiting it to hppa*-*-*elf*. Also,
mips-*-irix ought to have been mips-*-irix* and I'm having second
thoughts about xfailing mips and hiding what looks like a problem: If
the mips target is supposed to emit names for local section symbols
and does so for objcopy, why isn't it doing the same for ld? Also,
lots more mips targets would be subject to this test failing. So I'm
backing out those xfails and leaving it to someone more knowledgeable
about mips.
* testsuite/binutils-all/objcopy.exp (objcopy_test): Only
clear_xfail hppa*-*-*elf*. Revert mips xfails.
Alan Modra [Fri, 27 Mar 2020 23:58:03 +0000 (10:28 +1030)]
Adjust objcopy_test
xfails spu due to a note section getting a different vma, and some
mips targets that give section symbols a name string. I added -p
for the executable test in an attempt to fix all the pe target fails,
but that doesn't preserve the date/time for some reason.
* testsuite/binutils-all/objcopy.exp (objcopy_test): Move xfails
from here to calls. Remove "m8*-*-*" entry. Don't xfail tic54x
but do xfail spu, mipstx39 and mips-sgi-irix for the executable
test. Pass "-p" to objcopy for the executable test.
GDB Administrator [Sat, 28 Mar 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Hannes Domani [Fri, 27 Mar 2020 11:34:02 +0000 (12:34 +0100)]
Always fix system DLL paths for 32bit programs
GetModuleFileNameEx might also return the 64bit system directory for 32bit
programs even for a 32bit gdb:
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x779d0000 0x77b34d20 Yes (*) C:\Windows\SysWOW64\ntdll.dll
0x76850000 0x7694ad9c Yes (*) C:\Windows\syswow64\kernel32.dll
0x75421000 0x75466a18 Yes (*) C:\Windows\syswow64\KernelBase.dll
0x6fbe1000 0x6fcca1c0 Yes (*) C:\Windows\system32\dbghelp.dll
0x76d31000 0x76ddb2c4 Yes (*) C:\Windows\syswow64\msvcrt.dll
So this makes the path conversion for all 32bit programs.
gdb/ChangeLog:
2020-03-27 Hannes Domani <ssbssa@yahoo.de>
* windows-nat.c (windows_add_all_dlls): Fix system dll paths.
H.J. Lu [Fri, 27 Mar 2020 14:31:35 +0000 (07:31 -0700)]
ld: Xfail pr20995-2 tests for Solaris
Xfail pr20995-2 tests for Solaris since Solaris doesn't support RELRO.
PR 25732
* testsuite/ld-elf/shared.exp: Xfail pr20995-2 tests for Solaris.
H.J. Lu [Fri, 27 Mar 2020 13:59:41 +0000 (06:59 -0700)]
ld: Skip some x86 IFUNC tests for Solaris
Since Solaris ld.so.1 doesn't support ifunc and never will, skip some
x86 IFUNC tests for Solaris.
PR 25732
* testsuite/ld-ifunc/ifunc-23a-x86.d: Add notarget for Solaris.
* testsuite/ld-ifunc/ifunc-24a-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-25a-x86.d: Likewise.
Andrew Burgess [Fri, 27 Mar 2020 11:56:33 +0000 (11:56 +0000)]
gdbsupport: Resolve shellcheck issues in create-version.sh script
Run shellcheck (version 0.4.7) on the create-version.sh script, and
resolve the issues it highlighter - they all seemed reasonable.
gdbsupport/ChangeLog:
* create-version.sh: Resolve issues highlighted by shellcheck.
Jozef Lawrynowicz [Fri, 27 Mar 2020 10:54:26 +0000 (10:54 +0000)]
Add testcase for PR 25662 invalid sh_offset for section
binutils/ChangeLog:
2020-03-27 Jozef Lawrynowicz <jozef.l@mittosystems.com>
PR binutils/25662
* testsuite/binutils-all/objcopy.exp (objcopy_test): Add argument to
specify whether an object file or executable should be built and tested.
Change test names to report whether an object file or executable is
being tested.
* testsuite/binutils-all/pr25662.ld: New test.
* testsuite/binutils-all/pr25662.s: New test.
Alan Modra [Fri, 27 Mar 2020 00:00:56 +0000 (10:30 +1030)]
Re: readelf looping in process_archive
This patch fixes a leak of qualified_name caused by
4c83662712 and a
double free introduced by
fd486f32d1. Not breaking out of the loop
results in an error: "failed to seek to next archive header". That's
slightly better than silently preventing the possibility of endless
loops.
* readelf.c (process_archive): Don't double free qualified_name.
Don't break out of loop with "negative" archive_file_size, just
set file offset to max.
GDB Administrator [Fri, 27 Mar 2020 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Thu, 26 Mar 2020 16:48:28 +0000 (09:48 -0700)]
Support AT_BSDFLAGS on FreeBSD.
FreeBSD's kernel recently added a new ELF auxiliary vector entry
holding a mask of software features provided by the kernel. This
change fixes 'info auxv' to report the name and description for this
vector entry instead of '???'.
include/ChangeLog:
* elf/common.h (AT_FREEBSD_BSDFLAGS): Define.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_BSDFLAGS.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Change two functions to be methods on struct attribute
This changes dwarf2_get_ref_die_offset and
dwarf2_get_attr_constant_value to be methods on struct attribute.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (handle_data_member_location, dwarf2_add_field)
(mark_common_block_symbol_computed, read_tag_string_type)
(attr_to_dynamic_prop, read_subrange_type): Update.
(dwarf2_get_ref_die_offset, dwarf2_get_attr_constant_value): Move
to be methods on struct attribute.
(skip_one_die, process_imported_unit_die, read_namespace_alias)
(read_call_site_scope, partial_die_info::read)
(partial_die_info::read, lookup_die_type, follow_die_ref):
Update.
* dwarf2/attribute.c (attribute::get_ref_die_offset): New method,
from dwarf2_get_ref_die_offset.
(attribute::constant_value): New method, from
dwarf2_get_attr_constant_value.
* dwarf2/attribute.h (struct attribute) <get_ref_die_offset>:
Declare method.
<constant_value>: New method.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Move DWARF-constant stringifying code to new file
This moves the DWARF debugging functions that stringify various
constants to a new file, dwarf2/stringify.c.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf_unit_type_name, dwarf_tag_name)
(dwarf_attr_name, dwarf_form_name, dwarf_bool_name)
(dwarf_type_encoding_name): Move to stringify.c.
* Makefile.in (COMMON_SFILES): Add dwarf2/stringify.c.
* dwarf2/stringify.c: New file.
* dwarf2/stringify.h: New file.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Rewrite new die_info methods
This rewrites the two new die_info methods to iterate over attributes
rather than to do two separate searches.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/die.h (struct die_info) <addr_base, ranges_base>:
Rewrite.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Change two more functions to be methods on die_info
This changes lookup_addr_base and lookup_ranges_base to be methods on
die_info.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/die.h (struct die_info) <addr_base, ranges_base>: New
methods.
* dwarf2/read.c (lookup_addr_base): Move to die.h.
(lookup_ranges_base): Likewise.
(read_cutu_die_from_dwo, read_full_die_1): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Remove sibling_die
The sibling_die helper function does not seem to add much value,
considering that many other fields of die_info are directly accessed.
So, this removes it.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_import_statement, read_file_scope)
(read_type_unit_scope, inherit_abstract_dies, read_func_scope)
(read_lexical_block_scope, read_call_site_scope)
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds)
(handle_struct_member_die, process_structure_scope)
(update_enumeration_type_from_children)
(process_enumeration_scope, read_array_type, read_common_block)
(read_namespace, read_module, read_subroutine_type): Update.
(sibling_die): Remove.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Change dwarf2_attr_no_follow to be a method
This changes dwarf2_attr_no_follow to be a method on die_info.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (lookup_addr_base, lookup_ranges_base)
(build_type_psymtabs_reader, read_structure_type)
(read_enumeration_type, read_full_die_1): Update.
(dwarf2_attr_no_follow): Move to die.h.
* dwarf2/die.h (struct die_info) <attr>: New method.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Remove dwarf2_cu::base_known
This removes dwarf2_cu::base_known, changing base_address to be a
gdb::optional.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct dwarf2_cu) <base_known>: Remove.
<base_address>: Now an optional.
(dwarf2_find_base_address, dwarf2_rnglists_process)
(dwarf2_ranges_process, fill_in_loclist_baton)
(dwarf2_symbol_mark_computed): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Move die_info to new header
This moves struct die_info to a new header, dwarf2/die.h.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (struct die_info): Move to die.h.
* dwarf2/die.h: New file.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Move more code to line-header.c
This moves some more code out of read.c and into line-header.c.
dwarf_decode_line_header is split into two -- the part remaining in
read.c handles interfacing to the dwarf2_cu; while the part in
line-header.c (more or less) purely handles the actual decoding.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/line-header.h (dwarf_decode_line_header): Declare.
* dwarf2/read.c
(dwarf2_statement_list_fits_in_line_number_section_complaint):
Move to line-header.c.
(read_checked_initial_length_and_offset, read_formatted_entries):
Likewise.
(dwarf_decode_line_header): Split into two.
* dwarf2/line-header.c
(dwarf2_statement_list_fits_in_line_number_section_complaint):
Move from read.c.
(read_checked_initial_length_and_offset, read_formatted_entries):
Likewise.
(dwarf_decode_line_header): New function, split from read.c.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Convert read_indirect_line_string to a method
This changes read_indirect_line_string to be a method on
dwarf2_per_objfile. This makes it a bit simpler to share between
files.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_objfile) <read_line_string>:
Declare method.
* dwarf2/read.c (read_attribute_value): Update.
(dwarf2_per_objfile::read_line_string): Rename from
read_indirect_line_string.
(read_formatted_entries): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Trivial fix in dwarf_decode_macro_bytes
One spot in dwarf_decode_macro_bytes could use the existing "objfile"
local variable.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/macro.c (dwarf_decode_macro_bytes): Use objfile local
variable.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Use a const dwarf2_section_info in macro reader
This changes the DWARF macro reader to use a const dwarf2_section_info.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/macro.h (dwarf_decode_macros): Make section parameter
const.
* dwarf2/macro.c (skip_form_bytes, skip_unknown_opcode)
(dwarf_decode_macro_bytes, dwarf_decode_macros): Make section
parameter const.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Use a const line_header in macro reader
This changes the DWARF macro reader to use a const line_header.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf_decode_macros): Make "lh" const.
* dwarf2/macro.h (dwarf_decode_macros): Constify "lh" parameter.
* dwarf2/macro.c (macro_start_file): Constify "lh" parameter.
(dwarf_decode_macro_bytes, dwarf_decode_macros): Likewise.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Make some line_header methods const
This changes a few line_header methods to be const. In some cases, a
const overload is added.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/line-header.h (struct line_header) <is_valid_file_index,
file_names_size, file_full_name, file_file_name>: Use const.
<file_name_at, file_names>: Add const overload.
* dwarf2/line-header.c (line_header::file_file_name)
(line_header::file_full_name): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Move code to new file dwarf2/macro.c
This moves some more code out of dwarf2/read.c, introducing new files
dwarf2/macro.c and dwarf2/macro.h.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_macro_malformed_definition_complaint)
(macro_start_file, consume_improper_spaces)
(parse_macro_definition, skip_form_bytes, skip_unknown_opcode)
(dwarf_parse_macro_header, dwarf_decode_macro_bytes)
(dwarf_decode_macros): Move to macro.c.
* dwarf2/macro.c: New file.
* dwarf2/macro.h: New file.
* Makefile.in (COMMON_SFILES): Add dwarf2/macro.c.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Add dwarf2_section_info::read_string method
This moves a string-reading function to be a method on
dwarf2_section_info, and then updates the users.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/section.h (struct dwarf2_section_info) <read_string>: New
method.
* dwarf2/section.c: New method. From
read_indirect_string_at_offset_from.
* dwarf2/read.c (mapped_debug_names::namei_to_name): Update.
(read_indirect_string_at_offset_from): Move to section.c.
(read_indirect_string_at_offset): Rewrite.
(read_indirect_line_string_at_offset): Remove.
(read_indirect_string, read_indirect_line_string)
(dwarf_decode_macro_bytes): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Convert dwarf2_section_buffer_overflow_complaint to a method
This changes dwarf2_section_buffer_overflow_complaint to be a method
on dwarf2_section_info.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/section.h (struct dwarf2_section_info)
<overload_complaint>: Declare.
(dwarf2_section_buffer_overflow_complaint): Don't declare.
* dwarf2/section.c (dwarf2_section_info::overflow_complaint):
Rename from dwarf2_section_buffer_overflow_complaint.
* dwarf2/read.c (skip_one_die, partial_die_info::read)
(skip_form_bytes, dwarf_decode_macro_bytes): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Move dwarf2_section_buffer_overflow_complaint to dwarf2/section.c
This moves dwarf2_section_buffer_overflow_complaint to
dwarf2/section.c.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/section.h (dwarf2_section_buffer_overflow_complaint):
Declare.
* dwarf2/section.c (dwarf2_section_buffer_overflow_complaint):
Move from read.c.
* dwarf2/read.c (dwarf2_section_buffer_overflow_complaint): Move
to section.c.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Split dwarf_decode_macros into two overloads
This splits dwarf_decode_macros into two overloads -- one that's
suitable for splitting into a separate file, and one that finds the
correct section and should remain in dwarf2/read.c.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf_decode_macros): Split into two overloads.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Change dwarf_decode_macro_bytes calling convention
This changes dwarf_decode_macro_bytes to accept a buildsym_compunit
rather than a dwarf2_cu. This enables some subsequent changes; and
also makes the function accept a "more specific" parameter.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (macro_start_file): Change "cu" parameter to
"builder".
(dwarf_decode_macro_bytes): Likewise. Add dwarf2_per_objfile
parameter.
(dwarf_decode_macros): Update.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Add dwz.c and dwz_file::read_string
This changes read_indirect_string_from_dwz to be a method on the
dwz_file, and adds a new dwarf2/dwz.c file.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_attribute_value): Update.
(read_indirect_string_from_dwz): Move to dwz.c; change into
method.
(dwarf_decode_macro_bytes): Update.
* dwarf2/dwz.h (struct dwz_file) <read_string>: Declare method.
* dwarf2/dwz.c: New file.
* Makefile.in (COMMON_SFILES): Add dwz.c.
Tom Tromey [Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)]
Introduce dwarf2/dwz.h
This moves "struct dwz_file" to a new header file, dwarf2/dwz.h.
gdb/ChangeLog
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwz_file): Move to dwz.h.
* dwarf2/read.c: Add include.
* dwarf2/index-write.c: Add include.
* dwarf2/index-cache.c: Add include.
* dwarf2/dwz.h: New file.
Nick Clifton [Thu, 26 Mar 2020 10:46:25 +0000 (10:46 +0000)]
Revert earlier delta adding bfd_coff_get_internal_extra_pe_aouthdr() function.
* cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): Delete.
* libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Remove
prototype.
* libbfd.h: Regenerate.
Alan Modra [Thu, 26 Mar 2020 05:56:16 +0000 (16:26 +1030)]
Re: H8300 use of uninitialised value
This patch also had some problems. Calculation of maxlen was wrong,
and the insn arg loop needed rearranging to work with a correct length.
* disassemble.h (opcodes_assert): Declare.
(OPCODES_ASSERT): Define.
* disassemble.c: Don't include assert.h. Include opintl.h.
(opcodes_assert): New function.
* h8300-dis.c (bfd_h8_disassemble_init): Use OPCODES_ASSERT.
(bfd_h8_disassemble): Reduce size of data array. Correctly
calculate maxlen. Omit insn decoding when insn length exceeds
maxlen. Exit from nibble loop when looking for E, before
accessing next data byte. Move processing of E outside loop.
Replace tests of maxlen in loop with assertions.
Alan Modra [Thu, 26 Mar 2020 07:27:18 +0000 (17:57 +1030)]
Re: i386msdos uninitialised read
Another fix.
* i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
Alan Modra [Thu, 26 Mar 2020 05:50:47 +0000 (16:20 +1030)]
Re: ARC: Use of uninitialised value
git commit
beea5cc1bc fixed one use of an uninitialised value but
ignored another one a few lines later.
* arc-dis.c (find_format): Init needs_limm. Simplify use of limm.
Alan Modra [Thu, 26 Mar 2020 00:19:27 +0000 (10:49 +1030)]
alpha-vms: Sanity check ETIR__C_CTL_DFLOC index
I doubt anyone will want to create more than 16M debug location
entries. If there is no bound the object format allows for 32-bit
indices and of course fuzzers find that and attempt allocation of up
to a 16G byte array. The patch also fixes potential integer overflows
in calculating the array size.
* vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
array.
(_bfd_vms_slurp_object_records): Rename "err" to "ok".
GDB Administrator [Thu, 26 Mar 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 25 Mar 2020 16:26:38 +0000 (10:26 -0600)]
Fix error message in compile-object-load.c
I noticed that an error message in compile-object-load.c mentions the
wrong symbol name. The loop just above the error is looking for
COMPILE_I_EXPR_VAL, but the error references COMPILE_I_EXPR_PTR_TYPE.
I'm checking this in as obvious. I don't have a test case -- I
noticed it because another patch I'm working on caused this error to
be thrown, but that was due to regression in my patch.
gdb/ChangeLog
2020-03-25 Tom Tromey <tom@tromey.com>
* compile/compile-object-load.c (get_out_value_type): Mention
correct symbol name in error message.
Hannes Domani [Tue, 24 Mar 2020 17:03:08 +0000 (18:03 +0100)]
Fix WOW64 process system DLL paths
GetModuleFileNameEx returns for some DLLs of WOW64 processes
the path inside the 64bit system directory instead of the 32bit
syswow64 directory.
Problem happens e.g. with dbghelp.dll:
(gdb) start
Temporary breakpoint 1 at 0x415a00: file fiber.cpp, line 430.
Starting program: C:\src\tests\fiber.exe
warning: `C:\Windows\system32\dbghelp.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
Temporary breakpoint 1, main () at fiber.cpp:430
430 {
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x77070000 0x771d4d20 Yes (*) C:\Windows\SysWOW64\ntdll.dll
0x74dc0000 0x74ebad9c Yes (*) C:\Windows\syswow64\kernel32.dll
0x75341000 0x75386a18 Yes (*) C:\Windows\syswow64\KernelBase.dll
0x6f6a1000 0x6f7c48fc Yes (*) C:\Windows\system32\dbghelp.dll
0x74d01000 0x74dab2c4 Yes (*) C:\Windows\syswow64\msvcrt.dll
(*): Shared library is missing debugging information.
This detects this situation and converts the DLL path to the
syswow64 equivalent.
gdb/ChangeLog:
2020-03-25 Hannes Domani <ssbssa@yahoo.de>
* windows-nat.c (windows_add_all_dlls): Fix system dll paths.
Alan Modra [Wed, 25 Mar 2020 11:55:37 +0000 (22:25 +1030)]
readelf looping in process_archive
With a crafted "negative" ar_hdr.ar_size it is possible to make
readelf loop. This patch catches the overflow in a file offset
calculation.
* readelf.c (process_archive): Prevent endless loop.
Nick Clifton [Wed, 25 Mar 2020 11:58:49 +0000 (11:58 +0000)]
Add a new function to the BFD library to allow users access to the COFF internal_extra_pe_outhdr structure.
* cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New
function.
* libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype.
* libbfd.h: Regenerate.
J.W. Jagersma [Wed, 25 Mar 2020 11:52:07 +0000 (11:52 +0000)]
The "b" flag for COFF sections only unsets the LOAD attribute. It should also clear the CONTENTS attribute so that named bss sections don't take up space in an object file. This can be achieved by setting the 'bss' flag in seg_info.
* config/obj-coff.c (obj_coff_section): Set the bss flag on
sections with the "b" attribute.
Tom de Vries [Wed, 25 Mar 2020 11:38:05 +0000 (12:38 +0100)]
[gdb] Print user/includes fields for maint commands
The type struct compunit_symtab contains two fields (disregarding field next)
that express relations with other compunit_symtabs: user and includes.
These fields are currently not printed with "maint info symtabs" and
"maint print symbols".
Fix this such that for "maint info symtabs" we print:
...
{ ((struct compunit_symtab *) 0x23e8450)
debugformat DWARF 2
producer (null)
dirname (null)
blockvector ((struct blockvector *) 0x23e8590)
+ user ((struct compunit_symtab *) 0x2336280)
+ ( includes
+ ((struct compunit_symtab *) 0x23e85e0)
+ ((struct compunit_symtab *) 0x23e8960)
+ )
{ symtab <unknown> ((struct symtab *) 0x23e85b0)
fullname (null)
linetable ((struct linetable *) 0x0)
}
}
...
And for "maint print symbols" we print:
...
-Symtab for file <unknown>
+Symtab for file <unknown> at 0x23e85b0
Read from object file /data/gdb_versions/devel/a.out (0x233ccf0)
Language: c
Blockvector:
block #000, object at 0x23e8530, 0 syms/buckets in 0x0..0x0
block #001, object at 0x23e84d0 under 0x23e8530, 0 syms/buckets in 0x0..0x0
+Compunit user: 0x2336300
+Compunit include: 0x23e8900
+Compunit include: 0x23dd970
...
Note: for user and includes we don't list the actual compunit_symtab address,
but instead the corresponding symtab address, which allows us to find that
symtab elsewhere in the output (given that we also now print the address of
symtabs).
gdb/ChangeLog:
2020-03-25 Tom de Vries <tdevries@suse.de>
* symtab.h (is_main_symtab_of_compunit_symtab): New function.
* symmisc.c (dump_symtab_1): Print user and includes fields.
(maintenance_info_symtabs): Same.
Andrew Burgess [Fri, 13 Mar 2020 15:50:28 +0000 (15:50 +0000)]
gdb/riscv: Apply NaN boxing when writing return values into registers
When setting up function parameters we already perform NaN boxing, as
required by the RISC-V ABI, however, we don't do this when writing
values into registers as part of setting up a return value.
This commit moves the NaN boxing code into a small helper function,
and then makes use of this function when setting up function
parameters, and also when setting up return values.
This should resolve this failure:
FAIL: gdb.base/return-nodebug.exp: float: full width of the returned result
gdb/ChangeLog:
PR gdb/25489
* riscv-tdep.c (riscv_arg_info::c_offset): Update comment.
(riscv_regcache_cooked_write): New function.
(riscv_push_dummy_call): Use new function.
(riscv_return_value): Likewise.
Shahab Vahedi [Tue, 24 Mar 2020 14:25:24 +0000 (15:25 +0100)]
arc: Use correct string when printing bfd DEBUG data
PRINT_DEBUG_RELOC_INFO_BEFORE() macro prints bunch of parameters
for debugging purposes. Due to a seemingly copy/paste mistake,
the "input_section->vma" is printed under the field name
"symbol_section->vma". This commit fixes that.
This fix is a courtesy of xiangzhai.
* elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the
correct field name in the output string.
Alan Modra [Wed, 25 Mar 2020 02:37:54 +0000 (13:07 +1030)]
h8300-linux ld testsuite
This fixes lots of fails caused by h8300-linux not supporting -shared
and related options. I've also fixed ld-h8300 tests to accept the
valid h8300-linux -m options .
pr22450.d is also fixed for avr, crx, ip2k, m68hc11 and xc16x, and the
new pr25708 test for hppa64.
* testsuite/ld-elf/compress1c.d: xfail h8300.
* testsuite/ld-elf/compressed1c.d: Likewise.
* testsuite/ld-elf/compressed1e.d: Likewise.
* testsuite/ld-elf/dynamic1.d: Likewise.
* testsuite/ld-elf/dynsym1.d: Likewise.
* testsuite/ld-elf/ehdr_start-shared.d: Likewise.
* testsuite/ld-elf/exclude3b.d: Likewise.
* testsuite/ld-elf/export-class.exp: Don't run without -shared support.
* testsuite/ld-elf/global1.d: xfail h8300.
* testsuite/ld-elf/hash.d: Likewise.
* testsuite/ld-elf/loadaddr1.d: Likewise.
* testsuite/ld-elf/loadaddr2.d: Likewise.
* testsuite/ld-elf/local1.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/now-1.d: Likewise.
* testsuite/ld-elf/now-2.d: Likewise.
* testsuite/ld-elf/now-3.d: Likewise.
* testsuite/ld-elf/now-4.d: Likewise.
* testsuite/ld-elf/pie.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr16322.d: Likewise.
* testsuite/ld-elf/pr16498a.d: Likewise.
* testsuite/ld-elf/pr16498b.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/pr19539.d: Likewise.
* testsuite/ld-elf/pr19617a.d: Likewise.
* testsuite/ld-elf/pr19698.d: Likewise.
* testsuite/ld-elf/pr20513c.d: Likewise.
* testsuite/ld-elf/pr20513d.d: Likewise.
* testsuite/ld-elf/pr21389a.d: Likewise.
* testsuite/ld-elf/pr21389b.d: Likewise.
* testsuite/ld-elf/pr21389c.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562e.d: Likewise.
* testsuite/ld-elf/pr21562f.d: Likewise.
* testsuite/ld-elf/pr21562g.d: Likewise.
* testsuite/ld-elf/pr21562h.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr21903a.d: Likewise.
* testsuite/ld-elf/pr21903b.d: Likewise.
* testsuite/ld-elf/pr21903d.d: Likewise.
* testsuite/ld-elf/pr22269a.d: Likewise.
* testsuite/ld-elf/pr22269b.d: Likewise.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/pr22393-1c.d: Likewise.
* testsuite/ld-elf/pr22393-1d.d: Likewise.
* testsuite/ld-elf/pr22393-1e.d: Likewise.
* testsuite/ld-elf/pr22393-1f.d: Likewise.
* testsuite/ld-elf/pr22423.d: Likewise.
* testsuite/ld-elf/pr22450.d: xfail avr, crx, h8300, ip2k, m68hc11,
and xc16x.
* testsuite/ld-elf/pr23658-1c.d: xfail h8300.
* testsuite/ld-elf/pr25708.d: xfail h8300 and hppa64.
* testsuite/ld-elf/rpath-1.d: xfail h8300.
* testsuite/ld-elf/rpath-2.d: Likewise.
* testsuite/ld-elf/runpath-1.d: Likewise.
* testsuite/ld-elf/runpath-2.d: Likewise.
* testsuite/ld-elf/sizeofb.d: Likewise.
* testsuite/ld-elf/startofb.d: Likewise.
* testsuite/ld-elf/strtab.d: Likewise.
* testsuite/ld-elf/textaddr1.d: Likewise.
* testsuite/ld-elf/textaddr2.d: Likewise.
* testsuite/ld-elf/textaddr4.d: Likewise.
* testsuite/ld-elf/textaddr5.d: Likewise.
* testsuite/ld-elf/textaddr6.d: Likewise.
* testsuite/ld-elf/unknown2.d: Likewise.
* testsuite/ld-undefined/entry-3.d: Likewise.
* testsuite/ld-undefined/entry-4.d: Likewise.
* testsuite/ld-h8300/h8300.exp: Pass appropriate ld -m option.
* testsuite/ld-h8300/gcsection.d: Remove ld -m option and relax
file format match.
* testsuite/ld-h8300/relax-2.d: Likewise.
* testsuite/ld-h8300/relax-3.d: Likewise.
* testsuite/ld-h8300/relax-4.d: Likewise.
* testsuite/ld-h8300/relax-5.d: Likewise.
* testsuite/ld-h8300/relax-6.d: Likewise.
* testsuite/ld-h8300/relax-7.d: Likewise.
* testsuite/ld-h8300/relax.d: Relax file format match.
Alan Modra [Tue, 24 Mar 2020 00:12:45 +0000 (10:42 +1030)]
PR25662, invalid sh_offset for first section in segment with phdrs
PR 25662
* elf.c (assign_file_positions_for_load_sections): Adjust offset
for SHT_NOBITS section if first in segment.
GDB Administrator [Wed, 25 Mar 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 24 Mar 2020 22:37:14 +0000 (15:37 -0700)]
bfd: Add a bfd_boolean argument to bfd_get_symbol_version_string
We can't call _bfd_elf_get_symbol_version_name from nm.c since it isn't
available for all target configurations. This patch add a bfd_boolean
argument to bfd_get_symbol_version_string instead.
bfd/
PR binutils/25708
* elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
(_bfd_elf_get_symbol_version_string): This.
* elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
(_bfd_elf_get_symbol_version_string): This.
(bfd_elf_print_symbol): Pass TRUE to
_bfd_elf_get_symbol_version_string.
* libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
bfd_boolean argument.
* syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
* targets.c (_bfd_get_symbol_version_string): Likewise.
(bfd_get_symbol_version_string): Likewise.
* bfd-in2.h: Regenerated.
binutils/
PR binutils/25708
* nm.c (print_symname): Replace _bfd_elf_get_symbol_version_name
with bfd_get_symbol_version_string.
(print_symbo): Pass TRUE to bfd_get_symbol_version_string.
* objdump.c (objdump_print_symname): Likewise.
Alan Modra [Tue, 24 Mar 2020 22:20:21 +0000 (08:50 +1030)]
Uninitialised memory read in z80-dis.c
objdump -d -m ez80-adl testcase:
.byte 0x40,0xfd
* z80-dis.c (suffix): Init mybuf.
Simon Marchi [Tue, 24 Mar 2020 17:44:58 +0000 (13:44 -0400)]
gdb: bool-ify follow_fork
Change parameters and return value of the various follow_fork
functions/methods from int to bool.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_nat_target::follow_fork): Change bool to int.
* fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Likewise.
* inf-ptrace.c (inf_ptrace_target::follow_fork): Likewise.
* inf-ptrace.h (struct inf_ptrace_target) <follow_fork>: Likewise.
* infrun.c (follow_fork): Likewise.
(follow_fork_inferior): Likewise.
* linux-nat.c (linux_nat_target::follow_fork): Likewise.
* linux-nat.h (class linux_nat_target): Likewise.
* remote.c (class remote_target) <follow_fork>: Likewise.
(remote_target::follow_fork): Likewise.
* target-delegates.c: Re-generate.
* target.c (default_follow_fork): Likewise.
(target_follow_fork): Likewise.
* target.h (struct target_ops) <follow_fork>: Likewise.
(target_follow_fork): Likewise.
Nick Clifton [Tue, 24 Mar 2020 15:25:36 +0000 (15:25 +0000)]
Update changelog.
Nick Clifton [Tue, 24 Mar 2020 15:24:02 +0000 (15:24 +0000)]
Add code to the BFD library to handle opening files with pathnames longer than MAX_PATH on Win32 systems.
PR 25713
* bfdio.c (_bfd_real_fopen): Add code to handle long filenames on
Win32 systems.
Nick Clifton [Tue, 24 Mar 2020 13:35:53 +0000 (13:35 +0000)]
Fix assertion failure in the BFD library when linking with --emit-relocs enabled.
PR 25681
* elf.c (_bfd_elf_map_sections_to_segments): When looking for a
segment to use for PT_GNU_RELRO, ignore empty sections in a
segment's current list.
H.J. Lu [Tue, 24 Mar 2020 11:52:39 +0000 (04:52 -0700)]
bfd: Change num_group to unsigned int
elf.c failed with to with GCC 10 as of
commit
906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536
Author: Martin Liska <mliska@suse.cz>
Date: Tue Mar 24 11:40:10 2020 +0100
Improve endianess detection.
PR lto/94249
* plugin-api.h: Add more robust endianess detection.
binutils-gdb/bfd/elf.c: In function ‘setup_group’:
binutils-gdb/bfd/elf.c:740:35: error: overflow in conversion from ‘unsigned int’ to ‘int’ changes value from ‘num_group =
4294967295’ to ‘-1’ [-Werror=overflow]
740 | elf_tdata (abfd)->num_group = num_group = -1;
| ^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:1608: elf.lo] Error 1
Change num_group in elf_obj_tdata to unsigned int to compile with GCC 10.
PR binutils/25717
* elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
Martin Liska [Tue, 24 Mar 2020 10:40:10 +0000 (11:40 +0100)]
include: Sync plugin-api.h with GCC
Improve endianess detection.
PR lto/94249
* plugin-api.h: Add more robust endianess detection.
H.J. Lu [Tue, 24 Mar 2020 11:23:11 +0000 (04:23 -0700)]
bfd: Display symbol version for nm -D
Extend _bfd_elf_get_symbol_version_string for nm -D to display symbol
version. _bfd_elf_get_symbol_version_name is added to avoid updating
all XXX_get_symbol_version_string functions.
bfd/
PR binutils/25708
* elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
* elf.c (_bfd_elf_get_symbol_version_name): New function. Based
on the previous _bfd_elf_get_symbol_version_string.
(_bfd_elf_get_symbol_version_string): Use it.
binutils/
PR binutils/25708
* nm.c (SYM_NAME): Removed.
(print_symname): Add a pointer to struct extended_symbol_info
argument. Call _bfd_elf_get_symbol_version_name to get symbol
version.
(print_symdef_entry): Pass NULL to print_symname.
(print_symbol_info_bsd): Update call to print_symname.
(print_symbol_info_sysv): Likewise.
(print_symbol_info_posix): Likewise.
ld/
PR binutils/25708
* testsuite/ld-elf/pr25708.d: New file.
Tom de Vries [Tue, 24 Mar 2020 09:00:51 +0000 (10:00 +0100)]
[gdb] Print user for maint info psymtabs
The type struct partial_symtab contains two fields (disregarding field next)
that express relations with other symtabs: user and dependencies.
When using "maint print psymbols", we see both the dependencies and the user
fields:
...
Partial symtab for source file (object 0x35ef270)
...
Depends on 0 other partial symtabs.
Shared partial symtab with user 0x35d5f40
...
But with "maint info psymtabs", we only see dependencies:
...
{ psymtab ((struct partial_symtab *) 0x35ef270)
...
dependencies (none)
}
...
Add printing of the user field for "maint info psymtabs", such that we have:
...
{ psymtab ((struct partial_symtab *) 0x35ef270)
...
+ user hello.c ((struct partial_symtab *) 0x35d5f40)
dependencies (none)
}
...
Tested on x86_64-linux.
gdb/ChangeLog:
2020-03-24 Tom de Vries <tdevries@suse.de>
* psymtab.c (maintenance_info_psymtabs): Print user field.
Alan Modra [Tue, 24 Mar 2020 06:56:40 +0000 (17:26 +1030)]
Overlarge allocation in _bfd_generic_read_ar_hdr_mag
* archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended
name size. Use bfd_malloc rather than bfd_zmalloc, clearing just
struct areltdata.
Alan Modra [Tue, 24 Mar 2020 01:42:24 +0000 (12:12 +1030)]
readelf memory leak in process_mips_specific
* readelf.c (process_mips_specific): Free iconf on error path.
GDB Administrator [Tue, 24 Mar 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Mon, 23 Mar 2020 16:17:51 +0000 (16:17 +0000)]
Avoid trigger an assertion failure in the STABS parser by replacing the abort with an error return.
PR 25714
* wrstabs.c (stab_pop_type): Replace assertion with error return.
* write_stabs_in_sections_debugging_info: Likewise.
* stab_enum_type: Likewise.
* stab_modify_type: Likewise.
* stab_struct_field: Likewise.
* stab_end_struct_type: Likewise.
* stab_start_class_type: Likewise.
* stab_class_static_member: Likewise.
* stab_class_baseclass: Likewise.
* stab_class_start_method: Likewise.
* stab_class_method_var: Likewise.
* stab_class_end_method: Likewise.
* stab_end_class_type: Likewise.
* stab_typedef_type: Likewise.
* stab_start_function: Likewise.
* stab_end_block: Likewise.
* stab_lineno: Likewise.
Sebastian Huber [Mon, 23 Mar 2020 13:01:05 +0000 (14:01 +0100)]
Mention .tdata in comment in _bfd_elf_tls_setup()
This helps to find code areas which deal with the .tdata section.
bfd/
* elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
Alan Modra [Mon, 23 Mar 2020 12:53:31 +0000 (23:23 +1030)]
ECOFF archive uninitialised read
* ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and
symbol count. Allocate an extra byte to ensure name strings
are terminated. Sanity check name offsets. Release memory on
error return.
Alan Modra [Mon, 23 Mar 2020 10:50:54 +0000 (21:20 +1030)]
i386msdos uninitialised read
Also reinstate ld i386aout for i386-msdos target, which doesn't build
otherwise.
bfd/
* i386msdos.c (msdos_object_p): Don't access e_lfanew when that
field hasn't been read. Remove unnecessary casts.
ld/
* Makefile.am (ALL_EMULATION_SOURCES): Reinstate ei386aout.c.
Include ei386aout dep file.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.
Andrew Burgess [Mon, 23 Mar 2020 12:01:08 +0000 (12:01 +0000)]
gdb/testsuite: Remove hard coded addresses from expected results
In commit:
commit
6b8c53f2f1c0cf5bee46120d892d4c72571375eb
Date: Sat Feb 8 21:26:31 2020 +0000
gdb/testsuite/fortran: Add mixed language stack test
The test incorrectly included two hard coded addresses in the expected
output, this commit replaces them with the $hex pattern.
gdb/testsuite/ChangeLog:
* gdb.fortran/mixed-lang-stack.exp: Replace two hard coded address
with $hex.
GDB Administrator [Mon, 23 Mar 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sun, 22 Mar 2020 09:59:16 +0000 (20:29 +1030)]
XCOFF64 uninitialised read
Like git commit
67338173a4.
* coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large
enough to read number of symbols.
Alan Modra [Sun, 22 Mar 2020 09:56:31 +0000 (20:26 +1030)]
H8300 use of uninitialised value
* h8300-dis.c (bfd_h8_disassemble): Limit data[] access to that
successflly read from section.
Alan Modra [Sun, 22 Mar 2020 09:32:55 +0000 (20:02 +1030)]
ARC: Use of uninitialised value
* arc-dis.c (find_format): Use ISO C string concatenation rather
than line continuation within a string. Don't access needs_limm
before testing opcode != NULL.
Alan Modra [Sun, 22 Mar 2020 07:45:41 +0000 (18:15 +1030)]
NS32K arg_bufs uninitialised
git commit
d1e304bc27 was aimed at stopping uninitialised memory
access to the index_offset array. Unfortunately that patch resulted
in a different array being uninitialised for all instructions with
more than two arguments.
* ns32k-dis.c (print_insn_arg): Update comment.
(print_insn_ns32k): Reduce size of index_offset array, and
initialize, passing -1 to print_insn_arg for args that are not
an index. Don't exit arg loop early. Abort on bad arg number.
Alan Modra [Sun, 22 Mar 2020 04:32:27 +0000 (15:02 +1030)]
s12z disassembler tidy
Don't ignore buffer memory read failure, or malloc failure. Lots of
functions get a return status to pass these failures up the chain in
this patch.
opcodes/
* s12z-dis.c (abstract_read_memory): Don't print error on EOI.
* s12z-opc.c: Formatting.
(operands_f): Return an int.
(opr_n_bytes_p1): Return -1 on reaching buffer memory limit.
(opr_n_bytes2, bfextins_n_bytes, mul_n_bytes, bm_n_bytes),
(shift_n_bytes, mov_imm_opr_n_bytes, loop_prim_n_bytes),
(exg_sex_discrim): Likewise.
(create_immediate_operand, create_bitfield_operand),
(create_register_operand_with_size, create_register_all_operand),
(create_register_all16_operand, create_simple_memory_operand),
(create_memory_operand, create_memory_auto_operand): Don't
segfault on malloc failure.
(z_ext24_decode): Return an int status, negative on fail, zero
on success.
(x_imm1, imm1_decode, trap_decode, z_opr_decode, z_opr_decode2),
(imm1234, reg_s_imm, reg_s_opr, z_imm1234_8base, z_imm1234_0base),
(z_tfr, z_reg, reg_xy, lea_reg_xys_opr, lea_reg_xys, rel_15_7),
(decode_rel_15_7, cmp_xy, sub_d6_x_y, sub_d6_y_x),
(ld_18bit_decode, mul_decode, bm_decode, bm_rel_decode),
(mov_imm_opr, ld_18bit_decode, exg_sex_decode),
(loop_primitive_decode, shift_decode, psh_pul_decode),
(bit_field_decode): Similarly.
(z_decode_signed_value, decode_signed_value): Similarly. Add arg
to return value, update callers.
(x_opr_decode_with_size): Check all reads, returning NULL on fail.
Don't segfault on NULL operand.
(decode_operation): Return OP_INVALID on first fail.
(decode_s12z): Check all reads, returning -1 on fail.
gas/
* testsuite/gas/s12z/truncated.d: Update expected output.
GDB Administrator [Sun, 22 Mar 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Martin Liska [Sat, 21 Mar 2020 07:09:02 +0000 (08:09 +0100)]
include: Sync lto-symtab.h and plugin-api.h with GCC
Fix comma at end of enumerator list seen with -std=c++98.
* plugin-api.h (enum ld_plugin_symbol_type): Remove
comma after last value of an enum.
* lto-symtab.h (enum gcc_plugin_symbol_type): Likewise.
GDB Administrator [Sat, 21 Mar 2020 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 20 Mar 2020 19:04:56 +0000 (13:04 -0600)]
Make dwarf2_evaluate_property parameter const
dwarf2_evaluate_property should not modify its "addr_stack"
parameter's contents. This patch makes this part of the API, by
marking it const.
gdb/ChangeLog
2020-03-20 Tom Tromey <tromey@adacore.com>
* dwarf2/loc.h (dwarf2_evaluate_property): Make "addr_stack"
const.
* dwarf2/loc.c (dwarf2_evaluate_property): Make "addr_stack"
const.
Tom de Vries [Fri, 20 Mar 2020 18:32:07 +0000 (19:32 +0100)]
[gdb/testsuite] Fix gdb.threads/omp-par-scope.exp XPASS
When running test-case gdb.threads/omp-par-scope.exp, I get this XPASS:
...
XPASS: gdb.threads/omp-par-scope.exp: nested_parallel: outer_threads: \
outer stop: get valueof "num"
...
for test:
...
set thread_num [get_valueof "" "num" "unknown"]
...
The intention of the test is to get the value of local variable num, which
has been set to:
...
int num = omp_get_thread_num ();
...
but the actually printed value is 'num':
...
(gdb) print num^M
$76 = num^M
...
This is due to the fact that num is missing in the locals, so instead we find
the enum member 'num' of enum expression_operator in glibc/intl/plural-exp.h.
Fix this by getting the value using a new proc get_local_valueof, which uses
the "info locals" commands to get the value.
Tested on x86_64-linux, with gcc 7.5.0 (where the test xfails) and gcc
10.0.1 (where the test passes).
Simon Marchi [Fri, 20 Mar 2020 15:57:49 +0000 (11:57 -0400)]
gdb: remove HAVE_DECL_PTRACE
I stumbled on this snippet in nat/gdb_ptrace.h:
/* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64
or whatever it's called these days, don't provide a prototype for
ptrace. Provide one to silence compiler warnings. */
#ifndef HAVE_DECL_PTRACE
extern PTRACE_TYPE_RET ptrace();
#endif
I believe this is unnecessary today and should be removed. First, the
comment only mentions OSes we don't support (and to be honest, I had
never even heard of).
But most importantly, in C++, a declaration with empty parenthesis
declares a function that accepts no arguments, unlike in C. So if this
declaration was really used, GDB wouldn't build, since all ptrace call
sites pass some arguments. Since we haven't heard anything about this
causing some build failures since we have transitioned to C++, I
conclude that it's not used.
This patch removes it as well as the corresponding configure check.
gdb/ChangeLog:
* ptrace.m4: Don't check for ptrace declaration.
* config.in: Re-generate.
* configure: Re-generate.
* nat/gdb_ptrace.h: Don't declare ptrace if HAVE_DECL_PTRACE is
not defined.
gdbserver/ChangeLog:
* config.in: Re-generate.
* configure: Re-generate.
gdbsupport/ChangeLog:
* config.in: Re-generate.
* configure: Re-generate.