This commit applies all changes made after running the gdb/copyright.py
script.
Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.
gdb/ChangeLog:
Update copyright year range in all GDB files.
The following patch caused some amd64-*-tdep files to fail to compile:
| commit de52b9607d
| Date: Tue Jun 26 16:33:27 2018 +0100
| Subject: x86_64-windows GDB crash due to fs_base/gs_base registers
This is because we added one additional "segments" argument to
function amd64_target_description and forgot to update all the callers.
This patch fixes the omissions.
gdb/ChangeLog:
* amd64-darwin-tdep.c (x86_darwin_init_abi_64): Add missing
parameter in call to amd64_target_description.
* amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise.
* amd64-fbsd-tdep.c (amd64fbsd_core_read_description)
(amd64fbsd_init_abi): Likewise.
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise.
* amd64-obsd-tdep.c (amd64obsd_init_abi): Likewise.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Likewise.
* amd64-fbsd-nat.c (amd64_fbsd_nat_target): Likewise.
The change to amd64-fbsd-nat.c was done "blind" (no access to system),
but is reasonably straightforward. The changes to the -tdep.c files
were verify by rebuilding GDB on x86_64-linux when configured with
--enable-targets=all.
As a first small step to getting rid of doublest.h, this patch removes the
include of "floatformat.h" in "doublest.h". This is actually not needed
for the file itself. A few source files now need to include "floatformat.h"
directly, since they got it indirectly via "doublest.h" and still need it.
In reviewing which files need it, I found a number of files that include
"floatformat.h" directly without actually needing it at all. Similarly,
a number of files include "doublest.h" without needing it. I've also
removed those unnecessary include statements.
gdb/ChangeLog:
2017-10-05 Ulrich Weigand <uweigand@de.ibm.com>
* doublest.h: Do not include "floatformat.h". Remove stale comments.
* gdbtypes.c: Include "floatformat.h".
* value.c: Likewise.
* m68k-tdep.c: Likewise.
* findvar.c: Do not include "floatformat.h".
* amd64-darwin-tdep.c: Likewise.
* arm-linux-tdep.c: Likewise.
* i386-darwin-tdep.c: Likewise.
* i387-tdep.c: Likewise.
* m68k-linux-tdep.c: Likewise.
* mep-tdep.c: Likewise.
* mips-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* s390-linux-tdep.c: Likewise.
* sparc-obsd-tdep.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* vax-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
* top.c: Do not include "doublest.h".
* aarch64-tdep.c: Likewise.
* alpha-tdep.c: Likewise.
* arm-linux-tdep.c: Likewise.
* m68k-linux-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.
This patch changes amd64-*-tdep.c files to use function
amd64_target_description to get the right target description rather than
use the variable tdesd_amd64.
gdb:
2017-09-04 Yao Qi <yao.qi@linaro.org>
* amd64-darwin-tdep.c: Include "x86-xstate.h".
(x86_darwin_init_abi_64): Call amd64_target_description.
* amd64-dicos-tdep.c: Likewise.
* amd64-fbsd-nat.c: Likewise.
* amd64-fbsd-tdep.c: Likewise.
* amd64-nbsd-tdep.c: Likewise.
* amd64-obsd-tdep.c: Likewise.
* amd64-sol2-tdep.c: Likewise.
* amd64-windows-tdep.c: Likewise.
* amd64-tdep.h (tdesc_amd64): Remove the declaration.
Ref: https://sourceware.org/ml/gdb-patches/2017-07/msg00162.html
Debugging x86-64 GNU/Linux programs currently crashes GDB in
tdesc_use_registers during gdbarch initialization:
Program received signal SIGSEGV, Segmentation fault.
0x0000000001093eaf in htab_remove_elt_with_hash (htab=0x2ef9fa0, element=0x26af960, hash=557151073) at src/libiberty/hashtab.c:728
728 if (*slot == HTAB_EMPTY_ENTRY)
(top-gdb) p slot
$1 = (void **) 0x0
(top-gdb) bt
#0 0x0000000001093eaf in htab_remove_elt_with_hash (htab=0x2ef9fa0, element=0x26af960, hash=557151073) at src/libiberty/hashtab.c:728
#1 0x0000000001093e79 in htab_remove_elt (htab=0x2ef9fa0, element=0x26af960) at src/libiberty/hashtab.c:714
#2 0x00000000009121b0 in tdesc_use_registers (gdbarch=0x3001240, target_desc=0x2659cb0, early_data=0x2881cb0)
at src/gdb/target-descriptions.c:1328
#3 0x000000000047c93e in i386_gdbarch_init (info=..., arches=0x0) at src/gdb/i386-tdep.c:8634
#4 0x0000000000818d5f in gdbarch_find_by_info (info=...) at src/gdb/gdbarch.c:5394
#5 0x00000000007198a8 in set_gdbarch_from_file (abfd=0x2f48250) at src/gdb/arch-utils.c:618
#6 0x00000000007f21cb in exec_file_attach (filename=0x7fffffffddb0 "/home/pedro/gdb/tests/threads", from_tty=1) at src/gdb/exec.c:380
#7 0x0000000000865c18 in catch_command_errors_const (command=0x7f1d83 <exec_file_attach(char const*, int)>, arg=0x7fffffffddb0 "/home/pedro/gdb/tests/threads",
from_tty=1) at src/gdb/main.c:403
#8 0x00000000008669cf in captured_main_1 (context=0x7fffffffd860) at src/gdb/main.c:1035
#9 0x0000000000866de2 in captured_main (data=0x7fffffffd860) at src/gdb/main.c:1142
#10 0x0000000000866e24 in gdb_main (args=0x7fffffffd860) at src/gdb/main.c:1160
#11 0x000000000041312d in main (argc=3, argv=0x7fffffffd968) at src/gdb/gdb.c:32
The direct cause of the crash is that we tried to remove an element
from the hash which supposedly exists, but does not. (htab_remove_elt
shouldn't really crash in this case, but that's secondary.)
The real problem is that early_data passed to tdesc_use_registers
includes regs from a target description that is not the target_desc,
which violates its assumptions. The registers in question are the
fs_base/gs_base registers, added by amd64_init_abi:
tdesc_numbered_register (feature, tdesc_data_segments,
AMD64_FSBASE_REGNUM, "fs_base");
tdesc_numbered_register (feature, tdesc_data_segments,
AMD64_GSBASE_REGNUM, "gs_base");
and that happens because amd64_linux_init_abi uses amd64_init_abi as
helper, but they don't coordinate on which fallback tdesc to use.
amd64_init_abi does:
if (! tdesc_has_registers (tdesc))
tdesc = tdesc_amd64;
and then adds the fs_base/gs_base registers of the "tdesc_amd64" tdesc
to the tdesc_arch_data.
After amd64_init_abi returns, amd64_linux_init_abi does:
if (! tdesc_has_registers (tdesc))
tdesc = tdesc_amd64_linux;
tdep->tdesc = tdesc;
and we end up tdesc_amd64_linux installed in tdep->tdesc.
The fix is to make sure that amd64_linux_init_abi and amd64_init_abi
agree on default tdesc, by adding a "default tdesc" parameter to
amd64_init_abi, instead of having amd64_init_abi hardcode a default.
With this, amd64_init_abi creates the fs_base/gs_base registers using
the tdesc_amd64_linux tdesc.
Tested on x86-64 GNU/Linux, -m64. I don't have an x32 setup handy.
Thanks to John Baldwin, Yao Qi and Simon Marchi for the investigation.
gdb/ChangeLog:
2017-07-13 Pedro Alves <palves@redhat.com>
* amd64-darwin-tdep.c (x86_darwin_init_abi_64): Pass tdesc_amd64
as default tdesc.
* amd64-dicos-tdep.c (amd64_dicos_init_abi):
* amd64-fbsd-tdep.c (amd64fbsd_init_abi):
* amd64-linux-tdep.c (amd64_linux_init_abi): Pass
tdesc_amd64_linux as default tdesc. Get final tdesc from the
tdep.
(amd64_x32_linux_init_abi): Pass tdesc_x32_linux as default tdesc.
Get final tdesc from the tdep.
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Pass tdesc_amd64 as
default tdesc.
* amd64-obsd-tdep.c (amd64obsd_init_abi): Likewise.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Likewise.
* amd64-tdep.c (amd64_init_abi): Add 'default_tdesc' parameter.
Use it as default tdesc.
(amd64_x32_init_abi): Add 'default_tdesc' parameter, and pass it
down to amd_init_abi. No longer handle fallback tdesc here.
* amd64-tdep.h (tdesc_x32): Declare.
(amd64_init_abi, amd64_x32_init_abi): Add 'default_tdesc'
parameter.
* amd64-windows-tdep.c (amd64_windows_init_abi): Pass tdesc_amd64
as default tdesc.
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.
gdb/ChangeLog:
Update copyright year range in all GDB files.
The major reason this header was needed, bfd_default_set_arch_mach,
has now moved to bfd.h.
gdb/
* amd64-darwin-tdep.c: Don't include libbfd.h.
* i386-darwin-tdep.c: Likewise.
* rs6000-nat.c: Likewise.
* rs6000-tdep.c: Likewise.
sim/aarch64/
* memory.c: Don't include libbfd.h.
sim/rl78/
* load.c: Don't include libbfd.h.
(rl78_load): Don't use private iovec seek or read.
sim/rx/
* load.c: Don't include libbfd.h.
(rx_load): Don't use private iovec seek or read.
gdb_assert.h is already included from darwin-nat.h, so no need to
include it again...
gdb/ChangeLog:
* amd64-darwin-tdep.c: Remove #include "gdb_assert.h".
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
Fix -Wmissing-prototypes build.
* alpha-tdep.c (alpha_deal_with_atomic_sequence): Make it static.
* amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): New prototype.
* amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Likewise.
* arm-symbian-tdep.c (arm_symbian_skip_trampoline_code): Make it static.
(_initialize_arm_symbian_tdep): New prototype.
* arm-wince-tdep.c (arm_wince_skip_main_prologue): Make it static.
* i386-darwin-tdep.c (_initialize_i386_darwin_tdep): New prototype.
* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Make it
static.
* lm32-tdep.c (_initialize_lm32_tdep): New prototype.
* microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): New
prototype.
* microblaze-tdep.c (microblaze_debug, microblaze_fetch_instruction)
(microblaze_skip_prologue, microblaze_frame_cache): Make them static.
* mips-linux-tdep.c (mips_linux_regset_from_core_section): Make it
static.
* moxie-tdep.c (moxie_process_record): Likewise.
* remote-mips.c (mips_can_use_watchpoint, mips_insert_watchpoint)
(mips_remove_watchpoint, mips_stopped_by_watchpoint): Make them static.
* rl78-tdep.c (rl78_breakpoint_from_pc): Make it static.
(_initialize_rl78_tdep): New prototype.
* rx-tdep.c (rx_breakpoint_from_pc): Make it static.
(_initialize_rx_tdep): New prototype.
* solib-darwin.c (darwin_in_dynsym_resolve_code): Make it static.
(_initialize_darwin_solib): New prototype.
* solib-spu.c: Include solib-spu.h.
(_initialize_spu_solib): New prototype.
* spu-multiarch.c (_initialize_spu_multiarch): New prototype.
* tic6x-tdep.c (tic6x_analyze_prologue, tic6x_skip_prologue)
(tic6x_breakpoint_from_pc, tic6x_frame_unwind_cache)
(tic6x_software_single_step): Make it static.
(_initialize_tic6x_tdep): New prototype.
* i386-darwin-tdep.c (amd64_darwin_thread_state_reg_offset)
(amd64_darwin_thread_state_num_regs)
(amd64_darwin_sigcontext_addr, x86_darwin_init_abi_64): Moved to
amd64-darwin-tdep.c
(_initialize_i386_darwin_tdep): Remove 64 bits parts.
(darwin_dwarf_signal_frame_p): Make public.
* amd64-darwin-tdep.c: New file with most chunks from
i386-darwin-tdep.c
* i386-darwin-tdep.h: Add a prototype for darwin_dwarf_signal_frame_p.
(amd64_darwin_thread_state_reg_offset)
(amd64_darwin_thread_state_num_regs): Moved to amd64-darwin-tdep.h
* amd64-darwin-tdep.h: New file.
* i386-darwin-nat.c: Only includes amd64-nat.h and amd64-darwin-tdep.h
if BFD64 is defined.
(i386_darwin_fetch_inferior_registers): Add #ifdef BFD64/#endif around
64 bits parts.
(i386_darwin_store_inferior_registers): Ditto.
(darwin_set_sstep): Ditto.
(darwin_complete_target): Ditto.
(amd64_darwin_sstep_at_sigreturn): Ditto.
* configure.tgt: Create a separate entry for x86_64-*-darwin.
Add 64 bits support for i386-*-darwin if --enable-64-bit-bfd.
* Makefile.in (ALLDEPFILES): Add amd64-darwin-tdep.c, darwin-nat.c,
i386-darwin-tdep.c i386-darwin-nat.c
(ALL_64_TARGET_OBS): Add amd64-darwin-tdep.o