binutils-gdb.git
4 years agoNOCF_PROTECTION_CFLAGS: Replace nopie with available
H.J. Lu [Thu, 2 Apr 2020 14:39:55 +0000 (07:39 -0700)]
NOCF_PROTECTION_CFLAGS: Replace nopie with available

* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): Replace
nopie with available.

4 years agold: Add NOCF_PROTECTION_CFLAGS to turn off -fcf-protection
H.J. Lu [Thu, 2 Apr 2020 14:03:08 +0000 (07:03 -0700)]
ld: Add NOCF_PROTECTION_CFLAGS to turn off -fcf-protection

GCC in Ubuntu 20.04 enables -fcf-protection by default, which leads to

FAIL: S-records
FAIL: S-records with constructors
FAIL: Build plt-main with -z bndplt
FAIL: Build plt-main with PIE and -z bndplt
FAIL: Build plt-main with -z bndplt -z now
FAIL: Build plt-main with PIE and -z bndplt -z now

on x86-64.  Add NOCF_PROTECTION_CFLAGS to pass -fcf-protection=none on
these tests.

* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): New.
Set to "-fcf-protection=none" if target compiler supports it.
* testsuite/ld-srec/srec.exp: Add $NOCF_PROTECTION_CFLAGS to
CC and CXX.
* testsuite/ld-x86-64/x86-64.exp: Add $NOCF_PROTECTION_CFLAGS
to PLT BND tests.

4 years agocoff-go32-exe: support variable-length stubs
Jan W. Jagersma [Thu, 2 Apr 2020 13:31:43 +0000 (14:31 +0100)]
coff-go32-exe: support variable-length stubs

The stub size in GO32 executables has historically been fixed at 2048
bytes, due to hardcoded limitations in bfd.  Recent patches to djgpp by
Stas Sergeev (CC'd) have pushed the stub right up to this limit, so if
any further expansion is desired, this must first be patched in bfd.

This series includes three patches:  The first changes the meaning of
the bfd->origin field slightly, so that target code can use this to
specify an offset into the file where the actual bfd is located.
The second patch then uses this to enable support for variable-sized
stubs in the coff-go32-exe format.
The final patch is only a cleanup, it normalizes function and variable
names in coff-stgo32.c so that they all begin with the same prefix.

bfd * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
bfd->origin to file offset.
* bfdwin.c (bfd_get_file_window): Likewise.
* bfd.c: Clarify the use of the bfd->origin field.
* bfd-in2.h: Regenerate.
* coff-i386.c: Don't include go32exe.h. Allow overriding
coff_write_object_contents via COFF_WRITE_CONTENTS.
* coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
(go32exe_write_object_contents): New functions.
(go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
(COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
(create_go32_stub): Remove check for 2k size limit.  Read stub
from go32exe_temp_stub if present.
(go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
copy variable-length stub.
(go32_check_format): Read stub to go32exe_temp_stub, set
origin, return go32exe_cleanup.
(adjust_filehdr_in_post, adjust_filehdr_out_pre)
(adjust_filehdr_out_post, adjust_scnhdr_in_post)
(adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
(adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
Remove functions and their associated #defines.
* coffcode.h (coff_mkobject_hook): Remove stub copying code.
* libcoff-in.h: (struct coff_tdata): New field stub_size.
Rename field go32stub to stub.
* libcoff.h: Regenerate.
* coff-stgo32.c (go32_check_format): Rename to...
(go32exe_check_format): ...this.
(go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
(go32exe_copy_private_bfd_data): ...this.
(stub_bytes): Rename to...
(go32exe_default_stub): ...this.
(create_go32_stub): Rename to...
(go32exe_create_stub): ...this.
* coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
when possible.

include * coff/go32exe.h: Remove file.
* coff/internal.h (struct internal_filehdr): Remove field
go32stub.  Remove flag F_GO32STUB.

4 years agogdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)]
gdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'

All the linux target ops have been moved into linux_process_target
as methods.  The 'linux_target_ops' struct and its instantiations
are now obsolete.  Delete them.

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* linux-low.h (struct linux_target_ops): Remove.
(the_low_target): Remove.
* linux-x86-low.cc (the_low_target): Remove.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-ia64-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-riscv-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'get_ipa_tdesc_idx' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_ipa_tdesc_idx' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'get_ipa_tdesc_idx' linux target op and let a concrete
linux target define the op by overriding the declaration in
process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <get_ipa_tdesc_idx>: Remove.
* linux-low.cc (linux_process_target::get_ipa_tdesc_idx): Remove.
* linux-x86-low.cc (class x86_target) <get_ipa_tdesc_idx>: Declare.
(x86_get_ipa_tdesc_idx): Turn into...
(x86_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <get_ipa_tdesc_idx>: Declare.
(ppc_get_ipa_tdesc_idx): Turn into...
(ppc_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <get_ipa_tdesc_idx>: Declare.
(s390_get_ipa_tdesc_idx): Turn into...
(s390_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn 'get_syscall_trapinfo' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_syscall_trapinfo' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'get_syscall_trapinfo' linux target op into a method
of process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <get_syscall_trapinfo>
<gdb_catch_this_syscall>
<low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
* linux-low.cc (get_syscall_trapinfo): Turn into...
(linux_process_target::get_syscall_trapinfo): ...this.
(linux_process_target::low_get_syscall_trapinfo): Define.
(gdb_catch_this_syscall_p): Turn into...
(linux_process_target::gdb_catch_this_syscall): ...this.
(linux_process_target::low_supports_catch_syscall): Define.

Update the callers below.

(linux_process_target::wait_1)
(linux_process_target::supports_catch_syscall)

* linux-x86-low.cc (class x86_target) <low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(x86_target::low_supports_catch_syscall): Define.
(x86_get_syscall_trapinfo): Turn into...
(x86_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(aarch64_target::low_supports_catch_syscall): Define.
(aarch64_get_syscall_trapinfo): Turn into...
(aarch64_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(arm_target::low_supports_catch_syscall): Define.
(arm_get_syscall_trapinfo): Turn into...
(arm_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (the_low_target): Remove the op field.
* linux-s390-low.cc (the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn 'supports_hardware_single_step' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_hardware_single_step' into a method

All the linux low targets except arm define the
'supports_hardware_single_step' op to return true.  Hence, we override
the method to return true in linux_process_target, and remove the
definitions in all the linux low targets but arm.

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'supports_hardware_single_step' linux target op and
override the process_stratum_target's op definition in
linux_process_target to return true.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <finish_step_over>
<maybe_hw_step>: Declare.
* linux-low.cc (can_hardware_single_step): Remove.
(maybe_hw_step): Turn into...
(linux_process_target::maybe_hw_step): ...this.
(finish_step_over): Turn into...
(linux_process_target::finish_step_over): ...this.
(linux_process_target::supports_hardware_single_step): Update
to return true.

Update the callers below.

(linux_process_target::single_step)
(linux_process_target::resume_one_lwp_throw)

* linux-arm-low.cc (class arm_target)
<supports_hardware_single_step>: Declare.
(arm_supports_hardware_single_step): Turn into...
(arm_target::supports_hardware_single_step): ...this.
(the_low_target): Remove the op field.
* linux-x86-low.cc (x86_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (aarch64_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-s390-low.cc (s390_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-sh-low.cc (sh_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tile-low.cc (tile_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (xtensa_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn 'supports_range_stepping' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_range_stepping' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'supports_range_stepping' linux target op into a method
of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_supports_range_stepping>: Declare.
* linux-low.cc (linux_process_target::low_supports_range_stepping):
Define.
(linux_process_target::supports_range_stepping): Update the call
site.
* linux-x86-low.cc (class x86_target)
<low_supports_range_stepping>: Declare.
(x86_supports_range_stepping): Turn into...
(x86_target::low_supports_range_stepping): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_range_stepping>: Declare.
(aarch64_supports_range_stepping): Turn into...
(aarch64_target::low_supports_range_stepping): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'emit_ops' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'emit_ops' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'emit_ops' linux target ops and let the concrete
linux target define the op by overriding the declaration of
process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <emit_ops>: Remove.
* linux-low.cc (linux_process_target::emit_ops): Remove.
* linux-x86-low.cc (class x86_target) <emit_ops>: Declare.
(x86_emit_ops): Turn into...
(x86_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <emit_ops>: Declare.
(aarch64_emit_ops): Turn into...
(aarch64_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <emit_ops>: Declare.
(ppc_emit_ops): Turn into...
(ppc_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <emit_ops>: Declare.
(s390_emit_ops): Turn into...
(s390_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn fast tracepoint ops into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn fast tracepoint ops into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'install_fast_tracepoint_jump_pad' and
'get_min_fast_tracepoint_insn_len' linux target ops to let the
concrete linux target define the ops by overriding the declarations
of process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Remove.
* linux-low.cc (linux_process_target::supports_fast_tracepoints)
(linux_process_target::install_fast_tracepoint_jump_pad)
(linux_process_target::get_min_fast_tracepoint_insn_len): Remove.
* linux-x86-low.cc (class x86_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(x86_target::supports_fast_tracepoints): Define.
(x86_install_fast_tracepoint_jump_pad): Turn into...
(x86_target::install_fast_tracepoint_jump_pad): ...this.
(x86_get_min_fast_tracepoint_insn_len): Turn into...
(x86_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(aarch64_target::supports_fast_tracepoints): Define.
(aarch64_install_fast_tracepoint_jump_pad): Turn into...
(aarch64_target::install_fast_tracepoint_jump_pad): ...this.
(aarch64_get_min_fast_tracepoint_insn_len): Turn into...
(aarch64_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(ppc_target::supports_fast_tracepoints): Define.
(ppc_install_fast_tracepoint_jump_pad): Turn into...
(ppc_target::install_fast_tracepoint_jump_pad): ...this.
(ppc_get_min_fast_tracepoint_insn_len): Turn into...
(ppc_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(s390_target::supports_fast_tracepoints): Define.
(s390_install_fast_tracepoint_jump_pad): Turn into...
(s390_target::install_fast_tracepoint_jump_pad): ...this.
(s390_get_min_fast_tracepoint_insn_len): Turn into...
(s390_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'get_thread_area' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_thread_area' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'get_thread_area' linux target op into a method of
process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <stuck_in_jump_pad>
<linux_fast_tracepoint_collecting>
<low_get_thread_area>: Declare.
* linux-low.cc (supports_fast_tracepoints): Remove.
(linux_fast_tracepoint_collecting): Turn into...
(linux_process_target::linux_fast_tracepoint_collecting): ...this.
(linux_process_target::low_get_thread_area): Define.
(stuck_in_jump_pad_callback): Turn into...
(linux_process_target::stuck_in_jump_pad): ...this.

Update the caller below.

(linux_process_target::stabilize_threads)

* linux-x86-low.cc (class x86_target) <low_get_thread_area>:
Declare.
(x86_get_thread_area): Turn into...
(x86_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <low_get_thread_area>:
Declare.
(aarch64_get_thread_area): Turn into...
(aarch64_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <low_get_thread_area>:
Declare.
(ppc_get_thread_area): Turn into...
(ppc_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <low_get_thread_area>:
Declare.
(s390_get_thread_area): Turn into...
(s390_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'supports_tracepoints' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_tracepoints' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remote the 'supports_tracepoints' linux target op and let the
concrete linux target define it by overriding the op declared in
process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <supports_tracepoints>: Remove.
* linux-low.cc (linux_process_target::supports_tracepoints): Remove.
* linux-x86-low.cc (class x86_target) <supports_tracepoints>:
Declare.
(x86_supports_tracepoints): Turn into...
(x86_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<supports_tracepoints>: Declare.
(aarch64_supports_tracepoints): Turn into...
(aarch64_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <supports_tracepoints>:
Declare.
(ppc_supports_tracepoints): Turn into...
(ppc_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <supports_tracepoints>:
Declare.
(s390_supports_tracepoints): Turn into...
(s390_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'process_qsupported' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'process_qsupported' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'process_qsupported' linux target op and let a concrete
linux target define the op by overriding the op declaration in
process_stratum_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <process_qsupported>: Remove.
* linux-low.cc (linux_process_target::process_qsupported): Remove.
* linux-x86-low.cc (class x86_target) <process_qsupported>: Declare.
(x86_linux_process_qsupported): Turn into...
(x86_target::process_qsupported): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (the_low_target): Remove the op
field.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'prepare_to_resume' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'prepare_to_resume' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'prepare_to_resume' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_prepare_to_resume>: Declare.
* linux-low.cc (linux_process_target::low_prepare_to_resume):
Define.

Update the callers below:

(linux_process_target::resume_one_lwp_throw)
(linux_process_target::low_prepare_to_resume)

* linux-x86-low.cc (class x86_target) <low_prepare_to_resume>:
Declare.
(x86_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_prepare_to_resume>: Declare.
(aarch64_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_prepare_to_resume>:
Declare.
(arm_prepare_to_resume): Turn into...
(arm_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_prepare_to_resume>:
Declare.
(mips_linux_prepare_to_resume): Turn into...
(mips_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn process/thread addition/deletion ops into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)]
gdbserver/linux-low: turn process/thread addition/deletion ops into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'new_process', 'delete_process', 'new_thread',
'delete_thread', and 'new_fork' linux target ops into methods
of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <add_linux_process>
<add_lwp>
<delete_lwp>
<attach_lwp>
<detach_one_lwp>
<check_zombie_leaders>
<filter_exit_event>
<low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
* linux-low.cc (delete_lwp): Turn into...
(linux_process_target::delete_lwp): ...this.
(linux_process_target::low_delete_thread): Define.
(linux_add_process): Turn into...
(linux_process_target::add_linux_process): ...this.
(linux_process_target::low_new_process): Define.
(linux_process_target::low_delete_process): Define.
(linux_process_target::low_new_fork): Define.
(add_lwp): Turn into...
(linux_process_target::add_lwp): ...this.
(linux_process_target::low_new_thread): Define.
(linux_attach_lwp): Turn into...
(linux_process_target::attach_lwp): ...this.
(linux_detach_one_lwp): Turn into...
(linux_process_target::detach_one_lwp): ...this.
(linux_detach_lwp_callback): Remove and inline...
(linux_process_target::detach): ...here.
(check_zombie_leaders): Turn into...
(linux_process_target::check_zombie_leaders): ...this.
(filter_exit_event): Turn into...
(linux_process_target::filter_exit_event): ...this.

Update the callers below.

(linux_process_target::handle_extended_wait)
(linux_process_target::create_inferior)
(attach_proc_task_lwp_callback)
(linux_process_target::attach)
(linux_process_target::detach)
(linux_process_target::mourn)
* thread-db.cc (attach_thread)

* linux-x86-low.cc (class x86_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(x86_linux_new_process): Turn into...
(x86_target::low_new_process): ...this.
(x86_linux_delete_process): Turn into...
(x86_target::low_delete_process): ...this.
(x86_target::low_new_thread): Define.
(x86_target::low_delete_thread): Define.
(x86_linux_new_fork): Turn into...
(x86_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(aarch64_linux_new_process): Turn into...
(aarch64_target::low_new_process): ...this.
(aarch64_linux_delete_process): Turn into...
(aarch64_target::low_delete_process): ...this.
(aarch64_target::low_new_thread): Define.
(aarch64_target::low_delete_thread): Define.
(aarch64_linux_new_fork): Turn into...
(aarch64_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(arm_new_process): Turn into...
(arm_target::low_new_process): ...this.
(arm_delete_process): Turn into...
(arm_target::low_delete_process): ...this.
(arm_new_thread): Turn into...
(arm_target::low_new_thread): ...this.
(arm_delete_thread): Turn into...
(arm_target::low_delete_thread): ...this.
(arm_new_fork): Turn into...
(arm_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target) <low_new_process>
<low_delete_process>
<low_new_thread>
<low_delete_thread>
<low_new_fork>: Declare.
(mips_linux_new_process): Turn into...
(mips_target::low_new_process): ...this.
(mips_linux_delete_process): Turn into...
(mips_target::low_delete_process): ...this.
(mips_linux_new_thread): Turn into...
(mips_target::low_new_thread): ...this.
(mips_linux_delete_thread): Turn into...
(mips_target::low_delete_thread): ...this.
(mips_linux_new_fork): Turn into...
(mips_target::low_new_fork): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Remove the op fields.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'siginfo_fixup' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'siginfo_fixup' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'siginfo_fixup' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <siginfo_fixup>
<low_siginfo_fixup>: Declare.
* linux-low.cc (siginfo_fixup): Turn into...
(linux_process_target::siginfo_fixup): ...this.
(linux_process_target::low_siginfo_fixup): Define.
* linux-x86-low.cc (class x86_target) <low_siginfo_fixup>: Declare.
(x86_siginfo_fixup): Turn into...
(x86_target::low_siginfo_fixup): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target):
<low_siginfo_fixup>: Declare.
(aarch64_linux_siginfo_fixup): Turn into...
(aarch64_target::low_siginfo_fixup): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn '{collect, supply}_ptrace_register' into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:28 +0000 (15:11 +0200)]
gdbserver/linux-low: turn '{collect, supply}_ptrace_register' into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'collect_ptrace_register' and 'supply_ptrace_register'
linux target ops into methods of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <low_collect_ptrace_register>
<low_store_ptrace_register>: Declare.
* linux-low.cc (linux_process_target::low_collect_ptrace_register)
(linux_process_target::low_supply_ptrace_register): Define.

Update the callers below.

(linux_process_target::fetch_register)
(linux_process_target::store_register)

* linux-x86-low.cc (the_low_target): Remove the op fields.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (class mips_target)
<low_collect_ptrace_register>
<low_supply_ptrace_register>: Declare.
(mips_collect_ptrace_register): Turn into ...
(mips_target::low_collect_ptrace_register): ...this.
(mips_supply_ptrace_register): Turn into...
(mips_target::low_supply_ptrace_register): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_collect_ptrace_register>
<low_supply_ptrace_register>: Declare.
(ppc_collect_ptrace_register): Turn into ...
(ppc_target::low_collect_ptrace_register): ...this.
(ppc_supply_ptrace_register): Turn into ...
(ppc_target::low_supply_ptrace_register): ...this.
(ppc_fill_gregset): Update for the calls to
low_collect_ptrace_register.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_collect_ptrace_register>
<low_supply_ptrace_register>: Declare.
(s390_collect_ptrace_register): Turn into ...
(s390_target::low_collect_ptrace_register): ...this.
(s390_supply_ptrace_register): Turn into ...
(s390_target::low_supply_ptrace_register): ...this.
(s390_fill_gregset): Update for the calls to
low_collect_ptrace_register.
(the_low_target): Remove the op fields.

4 years agogdbserver/linux-low: turn watchpoint ops into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)]
gdbserver/linux-low: turn watchpoint ops into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'stopped_by_watchpoint' and 'stopped_data_address' linux
target ops into methods of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <check_stopped_by_watchpoint>
<low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
* linux-low.cc (check_stopped_by_watchpoint): Turn into...
(linux_process_target::check_stopped_by_watchpoint): ...this.
(linux_process_target::low_stopped_by_watchpoint): Define.
(linux_process_target::low_stopped_data_address): Define.
* linux-x86-low.cc (class x86_target) <low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(x86_stopped_by_watchpoint): Turn into...
(x86_target::low_stopped_by_watchpoint): ...this.
(x86_stopped_data_address): Turn into...
(x86_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(aarch64_stopped_by_watchpoint): Turn into...
(aarch64_target::low_stopped_by_watchpoint): ...this.
(aarch64_stopped_data_address): Turn into...
(aarch64_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target) <low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(arm_stopped_by_watchpoint): Turn into...
(arm_target::low_stopped_by_watchpoint): ...this.
(arm_stopped_data_address): Turn into...
(arm_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(cris_stopped_by_watchpoint): Turn into...
(crisv32_target::low_stopped_by_watchpoint): ...this.
(cris_stopped_data_address): Turn into...
(crisv32_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target) <low_stopped_by_watchpoint>
<low_stopped_data_address>: Declare.
(mips_stopped_by_watchpoint): Turn into...
(mips_target::low_stopped_by_watchpoint): ...this.
(mips_stopped_data_address): Turn into...
(mips_target::low_stopped_data_address): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Remove the op fields.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'insert_point' and 'remove_point' into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'insert_point' and 'remove_point' into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'insert_point' and 'remove_point' linux target ops into
methods of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <low_insert_point>
<low_remove_point>: Declare.
* linux-low.cc (linux_process_target::low_insert_point)
(linux_process_target::low_remove_point): Define.
(linux_process_target::insert_point)
(linux_process_target::remove_point): Update for calls to
low_insert_point and low_remove_point.
* linux-x86-low.cc (class x86_target) <low_insert_point>
<low_remove_point>: Declare.
(x86_insert_point): Turn into...
(x86_target::low_insert_point): ...this.
(x86_remove_point): Turn into...
(x86_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target) <low_insert_point>
<low_remove_point>: Declare.
(aarch64_insert_point): Turn into...
(aarch64_target::low_insert_point): ...this.
(aarch64_remove_point): Turn into...
(aarch64_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target) <low_insert_point>
<low_remove_point>: Declare.
(arm_insert_point): Turn into...
(arm_target::low_insert_point): ...this.
(arm_remove_point): Turn into...
(arm_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target) <low_insert_point>
<low_remove_point>: Declare.
(crisv32_insert_point): Turn into...
(crisv32_target::low_insert_point): ...this.
(crisv32_remove_point): Turn into...
(crisv32_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target) <low_insert_point>
<low_remove_point>: Declare.
(mips_insert_point): Turn into...
(mips_target::low_insert_point): ...this.
(mips_remove_point): Turn into...
(mips_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target) <low_insert_point>
<low_remove_point>: Declare.
(ppc_insert_point): Turn into...
(ppc_target::low_insert_point): ...this.
(ppc_remove_point): Turn into...
(ppc_target::low_remove_point): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Remove the op fields.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'supports_z_point_type' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_z_point_type' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'supports_z_point_type' linux target op and let the
concrete linux target define it by overriding the op declared in
process_stratum_target.

* linux-low.cc (linux_process_target::supports_z_point_type):
Remove.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <supports_z_point_type>: Remove.
* linux-x86-low.cc (class x86_target) <supports_z_point_type>:
Declare.
(x86_supports_z_point_type): Turn into...
(x86_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<supports_z_point_type>: Declare.
(aarch64_supports_z_point_type): Turn into...
(aarch64_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <supports_z_point_type>:
Declare.
(arm_supports_z_point_type): Turn into...
(arm_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<supports_z_point_type>: Declare.
(cris_supports_z_point_type): Turn into...
(crisv32_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <supports_z_point_type>:
Declare.
(mips_supports_z_point_type): Turn into...
(mips_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <supports_z_point_type>:
Declare.
(ppc_supports_z_point_type): Turn into...
(ppc_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <supports_z_point_type>:
Declare.
(s390_supports_z_point_type): Turn into...
(s390_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

4 years agogdbserver/linux-low: turn 'breakpoint_at' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'breakpoint_at' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'breakpoint_at' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_breakpoint_at>: Declare.

Update the callers below:

* linux-low.cc (linux_process_target::save_stop_reason)
(linux_process_target::thread_still_has_status_pending)
(linux_process_target::wait_1)

* linux-x86-low.cc (class x86_target)
<low_breakpoint_at>: Declare.
(x86_breakpoint_at): Turn into...
(x86_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_breakpoint_at>: Declare.
(aarch64_breakpoint_at): Turn into...
(aarch64_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target)
<low_breakpoint_at>: Declare.
(arm_target::low_breakpoint_at): Define.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target)
<low_breakpoint_at>: Declare.
(bfin_breakpoint_at): Turn into...
(bfin_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target)
<low_breakpoint_at>: Declare.
(cris_breakpoint_at): Turn into...
(cris_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<low_breakpoint_at>: Declare.
(crisv32_breakpoint_at): Turn into...
(crisv32_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target)
<low_breakpoint_at>: Declare.
(ia64_target::low_breakpoint_at): Define.
* linux-m32r-low.cc (class m32r_target)
<low_breakpoint_at>: Declare.
(m32r_breakpoint_at): Turn into...
(m32r_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target)
<low_breakpoint_at>: Declare.
(m68k_breakpoint_at): Turn into...
(m68k_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target)
<low_breakpoint_at>: Declare.
(mips_breakpoint_at): Turn into...
(mips_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-nios2-low.cc (class nios2_target)
<low_breakpoint_at>: Declare.
(nios2_breakpoint_at): Turn into...
(nios2_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target)
<low_breakpoint_at>: Declare.
(ppc_breakpoint_at): Turn into...
(ppc_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target)
<low_breakpoint_at>: Declare.
(riscv_breakpoint_at): Turn into...
(riscv_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target)
<low_breakpoint_at>: Declare.
(s390_breakpoint_at): Turn into...
(s390_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-sh-low.cc (class sh_target)
<low_breakpoint_at>: Declare.
(sh_breakpoint_at): Turn into...
(sh_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target)
<low_breakpoint_at>: Declare.
(sparc_breakpoint_at): Turn into...
(sparc_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target)
<low_breakpoint_at>: Declare.
(tic6x_breakpoint_at): Turn into...
(tic6x_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target)
<low_breakpoint_at>: Declare.
(tile_breakpoint_at): Turn into...
(tile_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target)
<low_breakpoint_at>: Declare.
(xtensa_breakpoint_at): Turn into...
(xtensa_target::low_breakpoint_at): ...this.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn the 'decr_pc_after_break' field into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)]
gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'decr_pc_after_break' linux_target_ops field into
a method of linux_process_target.

* linux-low.h (struct linux_target_ops)
<decr_pc_after_break>: Remove.
(class linux_process_target) <low_decr_pc_after_break>: New method
declaration.
* linux-low.cc (linux_process_target::low_decr_pc_after_break):
New method implementation.

Update the users below.

(linux_process_target::save_stop_reason)
(linux_process_target::wait_1)
* linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>:
New declaration.
(x86_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>:
New declaration.
(bfin_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>:
New declaration.
(m68k_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>:
New declaration.
(s390_target::low_decr_pc_after_break): New method implementation.
(the_low_target): Remove the field.
* linux-aarch64-low.cc (the_low_target): Remove the field.
* linux-arm-low.cc (the_low_target): Remove the field.
* linux-cris-low.cc (the_low_target): Remove the field.
* linux-crisv32-low.cc (the_low_target): Remove the field.
* linux-m32r-low.cc (the_low_target): Remove the field.
* linux-mips-low.cc (the_low_target): Remove the field.
* linux-nios2-low.cc (the_low_target): Remove the field.
* linux-ppc-low.cc (the_low_target): Remove the field.
* linux-riscv-low.cc (the_low_target): Remove the field.
* linux-sh-low.cc (the_low_target): Remove the field.
* linux-sparc-low.cc (the_low_target): Remove the field.
* linux-tic6x-low.cc (the_low_target): Remove the field.
* linux-tile-low.cc (the_low_target): Remove the field.
* linux-xtensa-low.cc (the_low_target): Remove the field.

4 years agogdbserver/linux-low: turn 'supports_software_single_step' and 'get_next_pcs' into...
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_software_single_step' and 'get_next_pcs' into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'supports_software_single_step' linux target op and let
the concrete linux target define it by overriding the op in
process_stratum_target.
Turn the 'get_next_pcs' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <supports_software_single_step>:
Remove.
<low_get_next_pcs>: Declare.
* linux-low.cc (can_software_single_step): Remove.
(linux_process_target::low_get_next_pcs): Define.
(linux_process_target::supports_software_single_step): Remove.

Update the callers below.

(linux_process_target::handle_extended_wait)
(linux_process_target::wait_1)
(linux_process_target::install_software_single_step_breakpoints)
(linux_process_target::single_step)
(linux_process_target::thread_needs_step_over)
(linux_process_target::proceed_one_lwp)
(linux_process_target::supports_range_stepping)

* linux-x86-low.cc (the_low_target): Remove the op field.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-riscv-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (class arm_target) <low_get_next_pcs>
<supports_software_single_step>: Declare.
(arm_target::supports_software_single_step): Define.
(arm_gdbserver_get_next_pcs): Turn into...
(arm_target::low_get_next_pcs): ...this.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn 'sw_breakpoint_from_kind' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:25 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'sw_breakpoint_from_kind' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'sw_breakpoint_from_kind' linux target op, and let
the concrete linux target define it by overriding the op
in process_stratum_target.

* linux-low.cc (linux_process_target::sw_breakpoint_from_kind):
Remove.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <sw_breakpoint_from_kind>: Remove.
* linux-x86-low.cc (class x86_target) <sw_breakpoint_from_kind>:
Declare.
(x86_sw_breakpoint_from_kind): Turn into...
(x86_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<sw_breakpoint_from_kind>: Declare.
(aarch64_sw_breakpoint_from_kind): Turn into...
(aarch64_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <sw_breakpoint_from_kind>:
Declare.
(arm_target::sw_breakpoint_from_kind): Define.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target) <sw_breakpoint_from_kind>:
Declare.
(bfin_sw_breakpoint_from_kind): Turn into...
(bfin_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target) <sw_breakpoint_from_kind>:
Declare.
(cris_sw_breakpoint_from_kind): Turn into...
(cris_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<sw_breakpoint_from_kind>: Declare.
(cris_sw_breakpoint_from_kind): Turn into...
(crisv32_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <sw_breakpoint_from_kind>:
Declare.
(ia64_target::sw_breakpoint_from_kind): Define.
* linux-m32r-low.cc (class m32r_target) <sw_breakpoint_from_kind>:
Declare.
(m32r_sw_breakpoint_from_kind): Turn into...
(m32r_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target) <sw_breakpoint_from_kind>:
Declare.
(m68k_sw_breakpoint_from_kind): Turn into...
(m68k_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <sw_breakpoint_from_kind>:
Declare.
(mips_sw_breakpoint_from_kind): Turn into...
(mips_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-nios2-low.cc (class nios2_target) <sw_breakpoint_from_kind>:
Declare.
(nios2_sw_breakpoint_from_kind): Turn into...
(nios2_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <sw_breakpoint_from_kind>:
Declare.
(ppc_sw_breakpoint_from_kind): Turn into...
(ppc_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <sw_breakpoint_from_kind>:
Declare.
(riscv_sw_breakpoint_from_kind): Turn into...
(riscv_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <sw_breakpoint_from_kind>:
Declare.
(s390_sw_breakpoint_from_kind): Turn into...
(s390_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-sh-low.cc (class sh_target) <sw_breakpoint_from_kind>:
Declare.
(sh_sw_breakpoint_from_kind): Turn into...
(sh_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target) <sw_breakpoint_from_kind>:
Declare.
(sparc_sw_breakpoint_from_kind): Turn into...
(sparc_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target) <sw_breakpoint_from_kind>:
Declare.
(tic6x_sw_breakpoint_from_kind): Turn into...
(tic6x_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target) <sw_breakpoint_from_kind>:
Declare.
(tile_sw_breakpoint_from_kind): Turn into...
(tile_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target)
<sw_breakpoint_from_kind>: Declare.
(xtensa_sw_breakpoint_from_kind): Turn into...
(xtensa_target::sw_breakpoint_from_kind): ...this.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn 'breakpoint_kind_from_{pc, current_state}' into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:25 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'breakpoint_kind_from_{pc, current_state}' into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'breakpoint_kind_from_pc' and
'breakpoint_kind_from_current_state' linux target ops, and let the
concrete linux target define them by overriding the ops of
process_stratum_target.

* linux-low.cc (linux_process_target::breakpoint_kind_from_pc):
Remove.
(linux_process_target::breakpoint_kind_from_current_state): Remove.
* linux-low.h (struct linux_target_ops): Remove ops.
(class linux_process_target) <breakpoint_kind_from_pc>: Remove.
<breakpoint_kind_from_current_state>: Remove.
* linux-x86-low.cc (the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
* linux-aarch64-low.cc (class aarch64_target)
<breakpoint_kind_from_pc>
<breakpoint_kind_from_current_state>: Declare.
(aarch64_breakpoint_kind_from_pc): Turn into...
(aarch64_target::breakpoint_kind_from_pc): ...this.
(aarch64_breakpoint_kind_from_current_state): Turn into...
(aarch64_target::breakpoint_kind_from_current_state): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target):
<breakpoint_kind_from_pc>
<breakpoint_kind_from_current_state>: Declare.
(arm_target::breakpoint_kind_from_pc): Define.
(arm_target::breakpoint_kind_from_current_state): Define.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target):
<breakpoint_kind_from_pc>: Declare.
(riscv_breakpoint_kind_from_pc): Turn into...
(riscv_target::breakpoint_kind_from_pc): ...this.
(the_low_target): Remove the op fields.

4 years agogdbserver/linux-low: turn 'get_pc' and 'set_pc' into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_pc' and 'set_pc' into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'get_pc' and 'set_pc' linux target ops into methods
of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
* linux-low.cc (supports_breakpoints): Turn into...
(linux_process_target::low_supports_breakpoints): ...this.
(linux_process_target::low_get_pc): Define.
(linux_process_target::low_set_pc): Define.

Update the callers below.

(linux_process_target::get_pc)
(linux_process_target::save_stop_reason)
(linux_process_target::maybe_move_out_of_jump_pad)
(linux_process_target::wait_1)
(linux_process_target::resume_one_lwp_throw)
(linux_process_target::resume)
(linux_process_target::proceed_all_lwps)
(linux_process_target::read_pc)
(linux_process_target::write_pc)

* linux-x86-low.cc (class linux_process_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(x86_target::low_supports_breakpoints): Define.
(x86_get_pc): Turn into...
(x86_target::low_get_pc): ...this.
(x86_set_pc): Turn into...
(x86_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(arm_target::low_supports_breakpoints)
(arm_target::low_get_pc)
(arm_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (class bfin_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(bfin_target::low_supports_breakpoints)
(bfin_target::low_get_pc)
(bfin_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-cris-low.cc (class cris_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(cris_target::low_supports_breakpoints)
(cris_target::low_get_pc)
(cris_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(crisv32_target::low_supports_breakpoints)
(crisv32_target::low_get_pc)
(crisv32_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-m32r-low.cc (class m32r_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(m32r_target::low_supports_breakpoints)
(m32r_target::low_get_pc)
(m32r_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-m68k-low.cc (class m68k_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(m68k_target::low_supports_breakpoints)
(m68k_target::low_get_pc)
(m68k_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-nios2-low.cc (class nios2_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(nios2_target::low_supports_breakpoints)
(nios2_target::low_get_pc)
(nios2_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-sh-low.cc (class sh_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(sh_target::low_supports_breakpoints)
(sh_target::low_get_pc)
(sh_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-xtensa-low.cc (class xtensa_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(xtensa_target::low_supports_breakpoints)
(xtensa_target::low_get_pc)
(xtensa_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-sparc-low.cc (class sparc_target)
<low_supports_breakpoints>
<low_get_pc>: Declare.
(sparc_target::low_supports_breakpoints)
(sparc_target::low_get_pc): Define.
(the_low_target): Remove the op fields.
* linux-tile-low.cc (class tile_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(tile_target::low_supports_breakpoints)
(tile_target::low_get_pc)
(tile_target::low_set_pc): Define.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(aarch64_target::low_supports_breakpoints): Define.
(aarch64_get_pc): Turn into...
(aarch64_target::low_get_pc): ...this.
(aarch64_set_pc): Turn into...
(aarch64_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(mips_target::low_supports_breakpoints): Define.
(mips_get_pc): Turn into...
(mips_target::low_get_pc): ...this.
(mips_set_pc): Turn into...
(mips_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(ppc_target::low_supports_breakpoints): Define.
(ppc_get_pc): Turn into...
(ppc_target::low_get_pc): ...this.
(ppc_set_pc): Turn into...
(ppc_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(riscv_target::low_supports_breakpoints): Define.
(riscv_get_pc): Turn into...
(riscv_target::low_get_pc): ...this.
(riscv_set_pc): Turn into...
(riscv_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(s390_target::low_supports_breakpoints): Define.
(s390_get_pc): Turn into...
(s390_target::low_get_pc): ...this.
(s390_set_pc): Turn into...
(s390_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.
* linux-tic6x-low.cc (class tic6x_target)
<low_supports_breakpoints>
<low_get_pc>
<low_set_pc>: Declare.
(tic6x_target::low_supports_breakpoints): Define.
(tic6x_get_pc): Turn into...
(tic6x_target::low_get_pc): ...this.
(tic6x_set_pc): Turn into...
(tic6x_target::low_set_pc): ...this.
(the_low_target): Remove the op fields.

4 years agogdbserver/linux-low: turn some more static functions into private methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn some more static functions into private methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn some more static methods in linux-low into private methods
of linux_process_target.

* linux-low.cc (get_pc): Turn into...
(linux_process_target::get_pc): ...this.
(save_stop_reason): Turn into...
(linux_process_target::save_stop_reason): ...this.
(thread_still_has_status_pending_p): Turn into...
(linux_process_target::thread_still_has_status_pending): ...this.
(status_pending_p_callback): Turn into...
(linux_process_target::status_pending_p_callback): ...this.
(resume_stopped_resumed_lwps): Turn into...
(linux_process_target::resume_stopped_resumed_lwps): ...this.
(install_software_single_step_breakpoints): Turn into...
(linux_process_target::install_software_single_step_breakpoints):
...this.
(single_step): Turn into...
(linux_process_target::single_step): ...this.
(linux_resume_one_lwp_throw): Turn into...
(linux_process_target::resume_one_lwp_throw): ...this.
(linux_resume_one_lwp): Turn into...
(linux_process_target::resume_one_lwp): ...this.
(resume_status_pending_p): Turn into...
(linux_process_target::resume_status_pending): ...this.
(need_step_over_p): Turn into...
(linux_process_target::thread_needs_step_over): ...this.
(linux_resume_one_thread): Turn into...
(linux_process_target::resume_one_thread): ...this.
(proceed_one_lwp): Turn into...
(linux_process_target::proceed_one_lwp): ...this.
(unsuspend_and_proceed_one_lwp): Turn into...
(linux_process_target::unsuspend_and_proceed_one_lwp): ...this.

Update the calls/references to the above functions below.

(linux_process_target::handle_extended_wait)
(linux_process_target::filter_event)
(linux_process_target::wait_for_event_filtered)
(linux_process_target::wait_1)
(linux_process_target::move_out_of_jump_pad)
(linux_process_target::start_step_over)
(linux_process_target::resume)
(linux_process_target::proceed_all_lwps)
(regsets_store_inferior_registers)
(linux_process_target::store_register)

* linux-low.h (class linux_process_target)
<get_pc>
<save_stop_reason>
<thread_still_has_status_pending>
<status_pending_p_callback>
<resume_stopped_resumed_lwps>
<install_software_single_step_breakpoints>
<single_step>
<resume_one_lwp_throw>
<resume_one_lwp>
<resume_status_pending>
<thread_needs_step_over>
<resume_one_thread>
<proceed_one_lwp>
<unsuspend_and_proceed_one_lwp>: Declare.

4 years agogdbserver/linux-low: turn 'fetch_register' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'fetch_register' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'fetch_register' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops) <fetch_register>: Remove.
(class linux_process_target) <low_fetch_register>: Declare.
* linux-x86-low.cc (the_low_target)
* linux-aarch64-low.cc (the_low_target)
* linux-arm-low.cc (the_low_target)
* linux-bfin-low.cc (the_low_target)
* linux-cris-low.cc (the_low_target)
* linux-crisv32-low.cc (the_low_target)
* linux-m32r-low.cc (the_low_target)
* linux-m68k-low.cc (the_low_target)
* linux-nios2-low.cc (the_low_target)
* linux-ppc-low.cc (the_low_target)
* linux-s390-low.cc (the_low_target)
* linux-sh-low.cc (the_low_target)
* linux-sparc-low.cc (the_low_target)
* linux-tic6x-low.cc (the_low_target)
* linux-tile-low.cc (the_low_target)
* linux-xtensa-low.cc (the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <low_fetch_register>:
Declare.
(ia64_fetch_register): Turn into...
(ia64_target::low_fetch_register): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_fetch_register>:
Declare.
(mips_fetch_register): Turn into...
(mips_target::low_fetch_register): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <low_fetch_register>:
Declare.
(riscv_fetch_register): Turn into...
(riscv_target::low_fetch_register): ...this.
(the_low_target): Remove the op field.

Update the callers below.

* linux-low.cc (linux_process_target::fetch_registers)
(linux_process_target::low_fetch_register)

4 years agogdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'cannot_fetch_register' and 'cannot_store_register'
linux target ops into methods of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the low target ops.
(class linux_process_target) <fetch_register>
<store_register>
<usr_fetch_inferior_registers>
<usr_store_inferior_registers>
<low_cannot_fetch_register>
<low_cannot_fetch_register> Declare.
* linux-low.cc (fetch_register): Turn into...
(linux_process_target::fetch_register): ...this.
(store_register): Turn into ...
(linux_process_target::store_register): ...this.
(usr_fetch_inferior_registers): Turn into...
(linux_process_target::usr_fetch_inferior_registers): ...this.
(usr_store_inferior_registers): Turn into...
(linux_process_target::usr_store_inferior_registers): ...this.
* linux-x86-low.cc (class x86_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(x86_cannot_store_register): Turn into...
(x86_target::low_cannot_store_register): ...this.
(x86_cannot_fetch_register): Turn into...
(x86_target::low_cannot_fetch_register): ...this.
(the_low_target): Remove the target op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(aarch64_target::low_cannot_fetch_register)
(aarch64_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(arm_cannot_fetch_register): Turn into...
(arm_target::low_cannot_fetch_register): ...this.
(arm_cannot_store_register): Turn into...
(arm_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (class bfin_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(bfin_cannot_fetch_register): Turn into...
(bfin_target::low_cannot_fetch_register): ...this.
(bfin_cannot_store_register): Turn into...
(bfin_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-cris-low.cc (class cris_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(cris_cannot_fetch_register): Turn into...
(cris_target::low_cannot_fetch_register): ...this.
(cris_cannot_store_register): Turn into...
(cris_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(crisv32_target::low_cannot_fetch_register)
(crisv32_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-ia64-low.cc (class ia64_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(ia64_cannot_fetch_register): Turn into...
(ia64_target::low_cannot_fetch_register): ...this.
(ia64_cannot_store_register): Turn into...
(ia64_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-m32r-low.cc (class m32r_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(m32r_cannot_fetch_register): Turn into...
(m32r_target::low_cannot_fetch_register): ...this.
(m32r_cannot_store_register): Turn into...
(m32r_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-m68k-low.cc (class m68k_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(m68k_cannot_fetch_register): Turn into...
(m68k_target::low_cannot_fetch_register): ...this.
(m68k_cannot_store_register): Turn into...
(m68k_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(mips_cannot_fetch_register): Turn into...
(mips_target::low_cannot_fetch_register): ...this.
(mips_cannot_store_register): Turn into...
(mips_target::low_cannot_store_register): ...this.
(get_usrregs_info): Inline at the call sites in
low_cannot_fetch_register and low_cannot_store_register,
and remove.
(the_low_target): Remove the op fields.
* linux-nios2-low.cc (class nios2_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(nios2_cannot_fetch_register): Turn into...
(nios2_target::low_cannot_fetch_register): ...this.
(nios2_cannot_store_register): Turn into...
(nios2_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(ppc_cannot_fetch_register): Turn into...
(ppc_target::low_cannot_fetch_register): ...this.
(ppc_cannot_store_register): Turn into...
(ppc_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(riscv_target::low_cannot_fetch_register)
(riscv_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(s390_cannot_fetch_register): Turn into...
(s390_target::low_cannot_fetch_register): ...this.
(s390_cannot_store_register): Turn into...
(s390_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-sh-low.cc (class sh_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(sh_cannot_fetch_register): Turn into...
(sh_target::low_cannot_fetch_register): ...this.
(sh_cannot_store_register): Turn into...
(sh_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-sparc-low.cc (class sparc_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(sparc_cannot_fetch_register): Turn into...
(sparc_target::low_cannot_fetch_register): ...this.
(sparc_cannot_store_register): Turn into...
(sparc_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-tic6x-low.cc (class tic6x_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(tic6x_cannot_fetch_register): Turn into...
(tic6x_target::low_cannot_fetch_register): ...this.
(tic6x_cannot_store_register): Turn into...
(tic6x_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-tile-low.cc (class tile_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(tile_cannot_fetch_register): Turn into...
(tile_target::low_cannot_fetch_register): ...this.
(tile_cannot_store_register): Turn into...
(tile_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-xtensa-low.cc (class xtensa_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(xtensa_target::low_cannot_fetch_register)
(xtensa_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.

4 years agogdbserver/linux-low: turn 'regs_info' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:23 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'regs_info' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'regs_info' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops) <regs_info>: Remove.
(class linux_process_target) <get_regs_info>: Define.

Update the callers below.

* linux-low.cc (linux_process_target::fetch_registers)
(linux_process_target::store_registers)
* proc-service.cc (gregset_info)

* linux-x86-low.cc (class x86_target) <get_regs_info>: Declare.
(x86_linux_regs_info): Turn into ...
(x86_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <get_regs_info>:
Declare.
(aarch64_regs_info): Turn into ...
(aarch64_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <get_regs_info>: Declare.
(arm_regs_info): Turn into ...
(arm_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target) <get_regs_info>: Declare.
(bfin_regs_info): Turn into ...
(bfin_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target) <get_regs_info>: Declare.
(cris_regs_info): Turn into ...
(cris_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target) <get_regs_info>:
Declare.
(crisv32_regs_info): Turn into ...
(crisv32_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <get_regs_info>: Declare.
(ia64_regs_info): Turn into ...
(ia64_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (class m32r_target) <get_regs_info>: Declare.
(m32r_regs_info): Turn into ...
(m32r_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target) <get_regs_info>: Declare.
(m68k_regs_info): Turn into ...
(m68k_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <get_regs_info>: Declare.
(mips_regs_info): Turn into ...
(mips_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
(get_usrregs_info): Update the call to the op.
* linux-nios2-low.cc (class nios2_target) <get_regs_info>: Declare.
(nios2_regs_info): Turn into ...
(nios2_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <get_regs_info>: Declare.
(ppc_regs_info): Turn into ...
(ppc_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <get_regs_info>: Declare.
(riscv_regs_info): Turn into ...
(riscv_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <get_regs_info>: Declare.
(s390_regs_info): Turn into ...
(s390_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
(s390_collect_ptrace_register)
(s390_supply_ptrace_register)
(s390_fill_gregset): Update the call to the op.
* linux-sh-low.cc (class sh_target) <get_regs_info>: Declare.
(sh_regs_info): Turn into ...
(sh_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target) <get_regs_info>: Declare.
(sparc_regs_info): Turn into ...
(sparc_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target) <get_regs_info>: Declare.
(tic6x_regs_info): Turn into ...
(tic6x_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target) <get_regs_info>: Declare.
(tile_regs_info): Turn into ...
(tile_target::get_regs_info): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target) <get_regs_info>:
Declare.
(xtensa_regs_info): Turn into ...
(xtensa_target::get_regs_info): ...this.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: turn 'arch_setup' into a method
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:23 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'arch_setup' into a method

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'arch_setup' linux target op into a method of
linux_process_target.

* linux-low.h (struct linux_target_ops) <arch_setup>: Delete.
(class linux_process_target) <arch_setup_thread>
<low_arch_setup>: New declarations.
* linux-low.cc (linux_arch_setup): Delete.
(linux_arch_setup_thread): Turn into...
(linux_process_target::arch_setup_thread): ... this.

Update the callers below.

(linux_process_target::handle_extended_wait)
(linux_process_target::post_create_inferior)
(linux_process_target::filter_event)

* linux-x86-low.cc (class x86_target) <low_arch_setup>: New
declaration.
(x86_linux_update_xmltarget): Turn into...
(x86_target::update_xmltarget): ...this.
(x86_linux_process_qsupported): Update the call to
x86_linux_update_xmltarget.
(x86_arch_setup): Turn into ...
(x86_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <low_arch_setup>: New
declaration.
(aarch64_arch_setup): Turn into ...
(aarch64_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_arch_setup>: New
declaration.
(arm_arch_setup): Turn into ...
(arm_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (class bfin_target) <low_arch_setup>: New
declaration.
(bfin_arch_setup): Turn into ...
(bfin_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-cris-low.cc (class cris_target) <low_arch_setup>: New
declaration.
(cris_arch_setup): Turn into ...
(cris_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target) <low_arch_setup>: New
declaration.
(crisv32_arch_setup): Turn into ...
(crisv32_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-ia64-low.cc (class ia64_target) <low_arch_setup>: New
declaration.
(ia64_arch_setup): Turn into ...
(ia64_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (class m32r_target) <low_arch_setup>: New
declaration.
(m32r_arch_setup): Turn into ...
(m32r_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (class m68k_target) <low_arch_setup>: New
declaration.
(m68k_arch_setup): Turn into ...
(m68k_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_arch_setup>: New
declaration.
(mips_arch_setup): Turn into ...
(mips_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-nios2-low.cc (class nios2_target) <low_arch_setup>: New
declaration.
(nios2_arch_setup): Turn into ...
(nios2_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <low_arch_setup>: New
declaration.
(ppc_arch_setup): Turn into ...
(ppc_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-riscv-low.cc (class riscv_target) <low_arch_setup>: New
declaration.
(riscv_arch_setup): Turn into ...
(riscv_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <low_arch_setup>: New
declaration.
(s390_arch_setup): Turn into ...
(s390_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-sh-low.cc (class sh_target) <low_arch_setup>: New
declaration.
(sh_arch_setup): Turn into ...
(sh_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-sparc-low.cc (class sparc_target) <low_arch_setup>: New
declaration.
(sparc_arch_setup): Turn into ...
(sparc_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (class tic6x_target) <low_arch_setup>: New
declaration.
(tic6x_arch_setup): Turn into ...
(tic6x_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-tile-low.cc (class tile_target) <low_arch_setup>: New
declaration.
(tile_arch_setup): Turn into ...
(tile_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (class xtensa_target) <low_arch_setup>: New
declaration.
(xtensa_arch_setup): Turn into ...
(xtensa_target::low_arch_setup): ...this.
(the_low_target): Remove the op field.

4 years agogdbserver/linux-low: start turning linux target ops into methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:23 +0000 (15:11 +0200)]
gdbserver/linux-low: start turning linux target ops into methods

This is the beginning of a series of patches that convert the linux
low targets into classes derived from linux_process_target.  At the
end of the series we obtain a class hierarchy that looks like this:

process_stratum_target
^
|
|-- linux_process_target
    ^
    |
    |-- x86_target (defined in linux-x86-low)
    |-- aarch64_target (defined in linux-aarch64-low)
    |-- ppc_target (defined in linux-ppc-low)
    |-- ...

In several cases, linux_process_target simply forwards a target op
request to a corresponding linux_target_ops function.  For these
cases, the definition in linux_process_target will be removed and the
definition will be left to the deriving linux low target class; using
inheritance provides a nice and natural, object-oriented
simplification in these cases.

The series converts linux_target_ops into protected methods of
linux_process_target one by one.  Throughout the series, based on the
needs, static functions defined in linux-low.cc are converted to
private methods of linux_process_target as well.  This is done either
as separate patches or as integrated into a patch that convert a
particular linux_target_op into a method.

The series ends with the patch titled "gdbserver/linux-low: delete
'linux_target_ops' and 'the_low_target'".

Built and regression-tested on x86_64-linux.  The following linux low
targets have been built (but not tested) via cross-compilation:
aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc.  The other
targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa)
were neither built nor tested.

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* linux-low.h (the_linux_target): New extern declaration.
* linux-low.cc (initialize_low): Use 'the_linux_target' to set
'the_target'.
(the_linux_target): Remove.
* linux-x86-low.cc (class x86_target): New class.
(the_x86_target): New static object.
(the_linux_target): Define as pointer to the_x86_target.
* linux-aarch64-low.cc (class aarch64_target): New class.
(the_aarch64_target): New static object.
(the_linux_target): Define as pointer to the_aarch64_target.
* linux-arm-low.cc (class arm_target): New class.
(the_arm_target): New static object.
(the_linux_target): Define as pointer to the_arm_target.
* linux-bfin-low.cc (class bfin_target): New class.
(the_bfin_target): New static object.
(the_linux_target): Define as pointer to the_bfin_target.
* linux-cris-low.cc (class cris_target): New class.
(the_cris_target): New static object.
(the_linux_target): Define as pointer to the_cris_target.
* linux-crisv32-low.cc (class crisv32_target): New class.
(the_crisv32_target): New static object.
(the_linux_target): Define as pointer to the_crisv32_target.
* linux-ia64-low.cc (class ia64_target): New class.
(the_ia64_target): New static object.
(the_linux_target): Define as pointer to the_ia64_target.
* linux-m32r-low.cc (class m32r_target): New class.
(the_m32r_target): New static object.
(the_linux_target): Define as pointer to the_m32r_target.
* linux-m68k-low.cc (class m68k_target): New class.
(the_m68k_target): New static object.
(the_linux_target): Define as pointer to the_m68k_target.
* linux-mips-low.cc (class mips_target): New class.
(the_mips_target): New static object.
(the_linux_target): Define as pointer to the_mips_target.
* linux-nios2-low.cc (class nios2_target): New class.
(the_nios2_target): New static object.
(the_linux_target): Define as pointer to the_nios2_target.
* linux-ppc-low.cc (class ppc_target): New class.
(the_ppc_target): New static object.
(the_linux_target): Define as pointer to the_ppc_target.
* linux-riscv-low.cc (class riscv_target): New class.
(the_riscv_target): New static object.
(the_linux_target): Define as pointer to the_riscv_target.
* linux-s390-low.cc (class s390_target): New class.
(the_s390_target): New static object.
(the_linux_target): Define as pointer to the_s390_target.
* linux-sh-low.cc (class sh_target): New class.
(the_sh_target): New static object.
(the_linux_target): Define as pointer to the_sh_target.
* linux-sparc-low.cc (class sparc_target): New class.
(the_sparc_target): New static object.
(the_linux_target): Define as pointer to the_sparc_target.
* linux-tic6x-low.cc (class tic6x_target): New class.
(the_tic6x_target): New static object.
(the_linux_target): Define as pointer to the_tic6x_target.
* linux-tile-low.cc (class tile_target): New class.
(the_tile_target): New static object.
(the_linux_target): Define as pointer to the_tile_target.
* linux-xtensa-low.cc (class xtensa_target): New class.
(the_xtensa_target): New static object.
(the_linux_target): Define as pointer to the_xtensa_target.

4 years agogdbserver/linux-low: turn some static functions into private methods
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:22 +0000 (15:11 +0200)]
gdbserver/linux-low: turn some static functions into private methods

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn some static functions in linux-low.cc into private methods of
linux_process_target.

* linux-low.cc (handle_extended_wait): Turn into ...
(linux_process_target::handle_extended_wait): ...this.  Call
'mourn' on 'this' object instead of 'the_target'.
(maybe_move_out_of_jump_pad): Turn into...
(linux_process_target::maybe_move_out_of_jump_pad): ...this.
(linux_low_filter_event): Turn into...
(linux_process_target::filter_event): ...this.
(linux_wait_for_event_filtered): Turn into...
(linux_process_target::wait_for_event_filtered): ...this.
(linux_wait_for_event): Turn into...
(linux_process_target::wait_for_event): ...this.
(linux_wait_1): Turn into...
(linux_process_target::wait_1): ...this.
(wait_for_sigstop): Turn into...
(linux_process_target::wait_for_sigstop): ...this.
(move_out_of_jump_pad_callback): Turn into...
(linux_process_target::move_out_of_jump_pad): ...this.
(stop_all_lwps): Turn into...
(linux_process_target::stop_all_lwps): ...this.
(start_step_over): Turn into...
(linux_process_target::start_step_over): ...this.
(complete_ongoing_step_over): Turn into...
(linux_process_target::complete_ongoing_step_over): ...this.
(proceed_all_lwps): Turn into...
(linux_process_target::proceed_all_lwps): ...this.
(unstop_all_lwps): Turn into...
(linux_process_target::unstop_all_lwps): ...this.

* linux-low.h (class linux_process_target)
<handle_extended_wait>
<maybe_move_out_of_jump_pad>
filter_event>
<wait_for_event_filtered>
<wait_for_event>
<wait_1>
<wait_for_sigstop>
<move_out_of_jump_pad>
<stop_all_lwps>
<start_step_over>
<complete_ongoing_step_over>
<proceed_all_lwps>
<unstop_all_lwps>: Declare.

Update the callers below.

* linux-low.cc (linux_process_target::attach): Update.
(linux_process_target::stabilize_threads): Ditto.
(linux_process_target::wait): Ditto.

4 years agogdbserver: make linux target op 'cannot_store_register' a predicate function
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:22 +0000 (15:11 +0200)]
gdbserver: make linux target op 'cannot_store_register' a predicate function

The comment for the linux target op 'cannot_store_register' states the
following:

  /* Returns 0 if we can store the register, 1 if we can not
     store the register, and 2 if failure to store the register
     is acceptable.  */

There is only one low target, linux-ppc-low, that potentially returns
2.  There are two places that call the 'cannot_store_register' target
op in linux-low.cc.  None of these locations distinguish a '2' from a
'1'.  Hence, to simplify the definition, make the function a predicate
that returns either 0 or 1.  This is also consistent with the
companion function, 'cannot_fetch_register'.

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* linux-low.h (struct linux_target_ops): Update the comment for
'cannot_store_register' to return 0 or 1.
* linux-ppc-low.cc (ppc_cannot_store_register): Return 1 instead
of 2.

4 years agoAdd support for intel SERIALIZE instruction
LiliCui [Fri, 6 Mar 2020 06:38:15 +0000 (14:38 +0800)]
Add support for intel SERIALIZE instruction

gas/

* config/tc-i386.c (cpu_arch): Add .serialize.
(cpu_noarch): Likewise.
* doc/c-i386.texi: Document serialize.
* testsuite/gas/i386/i386.exp: Run serialize tests
* testsuite/gas/i386/serialize.d: Likewise.
* testsuite/gas/i386/x86-64-serialize.d: Likewise.
* testsuite/gas/i386/serialize.s: Likewise.

opcodes/

* i386-dis.c (prefix_table): New instructions serialize.
* i386-gen.c (cpu_flag_init): Add CPU_SERIALIZE_FLAGS,
CPU_ANY_SERIALIZE_FLAGS.
(cpu_flags): Add CpuSERIALIZE.
* i386-opc.h (enum): Add CpuSERIALIZE.
(i386_cpu_flags): Add cpuserialize.
* i386-opc.tbl: Add SERIALIZE insns.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.

4 years agolinux-x86.exp: Compile with -I../bfd
H.J. Lu [Thu, 2 Apr 2020 11:44:01 +0000 (04:44 -0700)]
linux-x86.exp: Compile with -I../bfd

Compile with -I../bfd to include <bfd_stdint.h> in PR ld/25749 tests.

* testsuite/ld-elf/linux-x86.exp (check_pr25749a): Compile with
-I../bfd.
(check_pr25749b): Likewise.

4 years agold: Disable ifunc tests on Solaris
Rainer Orth [Thu, 2 Apr 2020 08:52:57 +0000 (10:52 +0200)]
ld: Disable ifunc tests on Solaris

A couple of ld ifunc tests currently FAIL on 64-bit Solaris/x86:

FAIL: ld-ifunc/ifunc-10-x86-64
FAIL: ld-ifunc/ifunc-11-x86-64
FAIL: ld-ifunc/ifunc-12-x86-64
FAIL: ld-ifunc/ifunc-13-x86-64
FAIL: ld-ifunc/ifunc-14a-x86-64
FAIL: ld-ifunc/ifunc-14b-x86-64
FAIL: ld-ifunc/ifunc-14c-x86-64
FAIL: ld-ifunc/ifunc-14d-x86-64
FAIL: ld-ifunc/ifunc-14e-x86-64
FAIL: ld-ifunc/ifunc-14f-x86-64
FAIL: ld-ifunc/ifunc-15-x86-64
FAIL: ld-ifunc/ifunc-17a-x86-64
FAIL: ld-ifunc/ifunc-17b-x86-64
FAIL: ld-ifunc/ifunc-2-local-x86-64-now
FAIL: ld-ifunc/ifunc-2-local-x86-64
FAIL: ld-ifunc/ifunc-2-x86-64-now
FAIL: ld-ifunc/ifunc-2-x86-64
FAIL: ld-ifunc/ifunc-20-x86-64
FAIL: ld-ifunc/pr17154-x86-64-now
FAIL: ld-ifunc/pr17154-x86-64

For one, the actual error is weird:

./ld-new: target elf64-x86-64 not found
failed with: <./ld-new: target elf64-x86-64 not found>, no expected output
FAIL: ld-ifunc/ifunc-10-x86-64

although ld -V does report the elf_x86_64 emulation as supported:

$ ./ld/ld-new -V
GNU ld (GNU Binutils) 2.34.50.20200328
  Supported emulations:
   elf_x86_64_sol2
   elf_x86_64
[...]

When using ld -m elf_x86_64_sol2 instead, one of the testcases links
successfully.

However, there's no point in pursuing this: Solaris does not support
ifunc, as can be seen in <sys/elf.h>:

/*
 * GNU/Linux specific symbol type not used by Solaris
 */
#define STT_GNU_IFUNC   10

and never will, given that it has symbol capabilities as solution to
effectively the same problem:

http://www.linker-aliens.org/blogs/rie/entry/symbol_capabilitie/

Therefore this patch disables ifunc testing on Solaris completely by
removing Solaris from binutils/testsuite/lib/binutils-common.exp
(supports_gnu_osabi).  The ifunc part is justified above.  SHF_GNU_MBIND is
in the OS-specific range and conflicts with

#define SHF_SUNW_REALLOC        0x01000000      /* internal: krtld realloc */

While the comment suggests this might be relocatable without too much
problems, the description of mbind (no formal spec AFAICS, just the
comment in the binutils patch submission) strongly suggests that this
isn't relevant to Solaris at all.

Indirectly, clearing supports_gnu_osabi on Solaris disables
supports_gnu_unique.  Again, Solaris <sys/elf.h> has

/*
 * GNU/Linux specific binding not used by Solaris
 */
#define STB_GNU_UNIQUE  10

so this seems the right thing to do.

Afterwards, one can remove the explicit mentions of *-*-solaris2* in
quite a number of (but not all) the ld-ifunc dump file notarget lists.

There's one fallout, though: two gas tests now XPASS because they are
xfail'ed for !supports_gnu_osabi:

XPASS: mbind sections 12
XPASS: mbind section contents 16
XPASS: mbind sections 16
XPASS: mbind section contents 16

To fix that, I've changed

#xfail: ![supports_gnu_osabi]

to notarget.

Tested on x86_64-pc-solaris2.11, i386-pc-solaris2.11,
x86_64-pc-linux-gnu, and i686-pc-linux-gnu.

ld:
* testsuite/ld-ifunc/ifunc-10-i386.d: Remove *-*-solaris2* from
notarget.
* ifunc-11-i386.d: Likewise.
* ifunc-12-i386.d: Likewise.
* ifunc-13-i386.d: Likewise.
* ifunc-14a-i386.d: Likewise.
* ifunc-14b-i386.d: Likewise.
* ifunc-14c-i386.d: Likewise.
* ifunc-14d-i386.d: Likewise.
* ifunc-14e-i386.d: Likewise.
* ifunc-14f-i386.d: Likewise.
* ifunc-15-i386.d: Likewise.
* ifunc-16-i386-now.d: Likewise.
* ifunc-16-i386.d: Likewise.
* ifunc-17a-i386.d: Likewise.
* ifunc-17b-i386.d: Likewise.
* ifunc-18a-i386.d: Likewise.
* ifunc-18b-i386.d: Likewise.
* ifunc-19a-i386.d: Likewise.
* ifunc-19b-i386.d: Likewise.
* ifunc-2-i386-now.d: Likewise.
* ifunc-2-i386.d: Likewise.
* ifunc-2-local-i386-now.d: Likewise.
* ifunc-2-local-i386.d: Likewise.
* ifunc-20-i386.d: Likewise.
* ifunc-21-i386.d: Likewise.
* ifunc-22-i386.d: Likewise.
* ifunc-5a-i386.d: Likewise.
* ifunc-5a-local-i386.d: Likewise.
* ifunc-5b-i386.d: Likewise.
* ifunc-5b-local-i386.d: Likewise.
* ifunc-5r-local-i386.d: Likewise.
* ifunc-6a-i386.d: Likewise.
* ifunc-6b-i386.d: Likewise.
* ifunc-7a-i386.d: Likewise.
* ifunc-7b-i386.d: Likewise.
* ifunc-8-i386.d: Likewise.
* ifunc-9-i386.d: Likewise.
* pr17154-i386-now.d: Likewise.
* pr17154-i386.d: Likewise.

* ifunc-23a-x86.d: Remove notarget.
* ifunc-24a-x86.d: Likewise.
* ifunc-25a-x86.d: Likewise.

gas:
* testsuite/gas/elf/section12a.d: Use notarget instead of xfail.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section16a.d: Likewise.
* testsuite/gas/elf/section16b.d: Likewise.

binutils:
* testsuite/lib/binutils-common.exp (supports_gnu_osabi): Don't
enable on *-*-solaris*.

4 years ago[PATCH gas/m68k] Fix a register range check
Gunther Nikl [Thu, 2 Apr 2020 07:57:45 +0000 (08:57 +0100)]
[PATCH gas/m68k] Fix a register range check

       * config/tc-m68k.c (m68k_ip): Fix range check for index register
       with a suppressed address register.

4 years ago[gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp
Tom de Vries [Thu, 2 Apr 2020 07:46:00 +0000 (09:46 +0200)]
[gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp

While running test-case gdb.multi/multi-target.exp, I observed a silent
timeout related to "monitor exit".

By making the timeout explicit in an expect clause in gdbserver_gdb_exit:
...
+  timeout {
+    warning "Timed out waiting for EOF in server after $monitor_exit"
+  }
...
we get in the log:
...
monitor exit^M
"monitor" command not supported by this target.^M
(gdb) WARNING: Timed out waiting for EOF in server after monitor exit
...

What happens is the following:
- the inferior 5 is selected
- a breakpoint is set in inferior 1
- the breakpoint triggers and we switch to inferior 1
- setup is called by test_continue, which calls clean_restart, which calls
  gdbserver_gdb_exit (due to load_lib gdbserver-support.exp)
- gdbserver_gdb_exit issues "monitor exit"
- gdb responds with "not supported by this target" because inferior 1 is
  native

Fix this by keeping a list of server_spawn_id, and cleaning those up before
calling gdbserver_gdb_exit.

This reduces testing time from 1m22s to 32s.

gdb/testsuite/ChangeLog:

2020-04-02  Tom de Vries  <tdevries@suse.de>

* lib/gdbserver-support.exp (gdbserver_exit): Factor out of ...
(gdbserver_gdb_exit): ... here.  Add timeout warning.
* gdb.multi/multi-target.exp (server_spawn_ids): New global var.
(connect_target_extended_remote): Append new server_spawn_id to
server_spawn_ids.
(cleanup): New proc.
(setup, <toplevel>): Call cleanup.

4 years agoReplace "use use" in a warning message with "use".
Nick Clifton [Thu, 2 Apr 2020 07:38:48 +0000 (08:38 +0100)]
Replace "use use" in a warning message with "use".

PR ld/25747
* ldfile.c (ldfile_open_file): Fix typo in warning message.

4 years ago[gdb/ada] Fix -readnow FAILs
Tom de Vries [Thu, 2 Apr 2020 06:58:38 +0000 (08:58 +0200)]
[gdb/ada] Fix -readnow FAILs

When running test-case gdb.ada/access_to_packed_array we have:
...
(gdb) print pack.a^M
$1 = (0 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)^M
...
but with target board readnow.exp, we have instead:
...
(gdb) print pack.a^M
'pack.a' has unknown type; cast it to its declared type^M
...

The symbol is normally found by the map_matching_symbols call in
ada-lang.c:add_nonlocal_symbols:
...
  for (objfile *objfile : current_program_space->objfiles ())
    {
      data.objfile = objfile;

      objfile->sf->qf->map_matching_symbols (objfile, lookup_name,
     domain, global, callback,
     (is_wild_match
      ? NULL : compare_names));
...
which maps onto psym_map_matching_symbols.

Function psym_map_matching_symbols iterates over all the partial symtabs,
and:
- if not expanded, searches in the partial symtab:
  - if not found, continues to the next
  - if found, expands into full symtab
- searches in the full symtab

However, with -readnow the call maps onto dw2_map_matching_symbols instead,
which is unimplemented, and consequently no symbol is found.

Fix this by detecting -readnow in dw2_map_matching_symbols, and handling that
appropriately given that partial symtabs are not present, and full symtabs
are: iterate over all the symtabs and search them.

Tested on x86_64-linux, with native and target board -readnow.

This removes 217 FAILs with board -readnow.

gdb/ChangeLog:

2020-04-02  Tom de Vries  <tdevries@suse.de>

PR ada/24671
* dwarf2/read.c (dw2_map_matching_symbols): Handle -readnow.

4 years ago[gdb] Use partial symbol table to find language for main
Tom de Vries [Thu, 2 Apr 2020 06:47:49 +0000 (08:47 +0200)]
[gdb] Use partial symbol table to find language for main

When language is set to auto, part of loading an executable is to update the
language accordingly.  This is implemented by set_initial_language.

The implementation of set_initial_language works as follows:
- check if any objfile in the progspace has name_of_main/language_of_main
  set, and if so, use the first one found. [ This is what you get f.i. when
  using dwarf with DW_AT_main_subprogram. ]
- otherwise, check for known names in the minimal symbols, and either:
- use the associated language if any (f.i. for ada), or
- lookup the symbol in the symtab for the name and use the symbol language
  (f.i. for c/c++).

The symbol lookup can be slow though.

In the case of the cc1 binary from PR23710 comment 1, getting to the initial
prompt takes ~8s:
...
$ time.sh gdb cc1 -batch -ex "show language"
The current source language is "auto; currently c++".
maxmem: 1272260
real: 8.05
user: 7.73
system: 0.38
...
but if we skip guessing the initial language by setting it instead, it takes
only ~4s:
...
$ time.sh gdb -iex "set language c++" cc1 -batch -ex "show language"
The current source language is "c++".
maxmem: 498272
real: 3.99
user: 3.90
system: 0.15
...

In both cases, we load the partial symbols for the executable, but in the
first case only we also do a lookup of main, which causes the corresponding
partial symtab to be expanded into a full symtab.

Ideally, we'd like to get the language of the symbol without triggering
expansion into a full symtab, and get the speedup without having to set the
language manually.

There's a related fixme in the header comment of set_initial_language:
...
/* Set the initial language.

   FIXME: A better solution would be to record the language in the
   psymtab when reading partial symbols, and then use it (if known) to
   set the language.  This would be a win for formats that encode the
   language in an easily discoverable place, such as DWARF.  For
   stabs, we can jump through hoops looking for specially named
   symbols or try to intuit the language from the specific type of
   stabs we find, but we can't do that until later when we read in
   full symbols.  */

void
set_initial_language (void)
...

Since we're already tracking the language of partial symbols, use this to set
the language for the main symbol.

Note that this search in partial symbol tables is not guaranteed to yield the
same result as the lookup_symbol_in_language call currently done in
set_initial_language.

Build and reg-tested on x86_64-linux.

gdb/ChangeLog:

2020-04-02  Tom de Vries  <tdevries@suse.de>

* dwarf2/read.c (dwarf2_gdb_index_functions,
dwarf2_debug_names_functions): Init lookup_global_symbol_language with
NULL.
* psymtab.c (psym_lookup_global_symbol_language): New function.
(psym_functions): Init psym_lookup_global_symbol_language with
psym_lookup_global_symbol_language.
* symfile-debug.c (debug_sym_quick_functions): Init
lookup_global_symbol_language with NULL.
* symfile.c (set_initial_language): Remove fixme comment.
* symfile.h (struct quick_symbol_functions): Add
lookup_global_symbol_language.
* symtab.c (find_quick_global_symbol_language): New function.
(find_main_name): Use find_quick_global_symbol_language.

gdb/testsuite/ChangeLog:

2020-04-02  Tom de Vries  <tdevries@suse.de>

* gdb.base/main-psymtab.exp: New file.

4 years ago[gdb/testsuite] Accept new complex print style in mixed-lang-stack.exp
Tom de Vries [Thu, 2 Apr 2020 06:38:47 +0000 (08:38 +0200)]
[gdb/testsuite] Accept new complex print style in mixed-lang-stack.exp

Since commit 981c08ce72 "Change how complex types are printed in C", we see
these FAILs:
...
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=auto: info args in frame #6
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c: info args in frame #6
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c: info args in frame #7
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c++: info args in frame #6
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c++: info args in frame #7
...

The problem is that printing of complex types has changed from:
...
d = 4 + 5 * I
...
to:
...
d = 4 + 5i
...
but the test-case still checks for the old printing style.

Fix this by updating the test-case to check for the new style.

gdb/testsuite/ChangeLog:

2020-04-02  Tom de Vries  <tdevries@suse.de>

* gdb.fortran/mixed-lang-stack.exp: Accept new complex printing style.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Apr 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: fix style issues in is_linked_with_cygwin_dll
Simon Marchi [Wed, 1 Apr 2020 21:41:31 +0000 (17:41 -0400)]
gdb: fix style issues in is_linked_with_cygwin_dll

gdb/ChangeLog:

* windows-tdep.c (is_linked_with_cygwin_dll): Fix style.

4 years agoFix an undefined behavior in record_line
Bernd Edlinger [Thu, 12 Mar 2020 10:52:34 +0000 (11:52 +0100)]
Fix an undefined behavior in record_line

Additionally do not completely remove symbols
at the same PC than the end marker, instead
make them non-is-stmt breakpoints.

2020-04-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* buildsym.c (record_line): Fix undefined behavior and preserve
lines at eof.

4 years agoFix the resizing condition of the line table
Bernd Edlinger [Thu, 12 Mar 2020 10:52:34 +0000 (11:52 +0100)]
Fix the resizing condition of the line table

That was wasting one element.

2020-04-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* buildsym.c (record_line): Fix the resizing condition.

4 years agox86: Only allow S + A relocations against absolute symbol
H.J. Lu [Wed, 1 Apr 2020 21:31:47 +0000 (14:31 -0700)]
x86: Only allow S + A relocations against absolute symbol

Since value of non-preemptible absolute symbol (SHN_ABS) won't change,
only relocations, which can be resolved as absolute value + addend, and
GOTPCREL relocations, where absolute value + addend is stored in the GOT
slot, against non-preemptible absolute symbol are allowed in PIE and
shared library.

Also convert load relocation to R_386_32, R_X86_64_32S or R_X86_64_32 for
relocation against non-preemptible absolute symbol.  Don't convert to
R_X86_64_32S nor R_X86_64_32 for non-preemptible absolute symbol if they
overflow.

bfd/

PR ld/25749
PR ld/25754
* elf32-i386.c (elf_i386_convert_load_reloc): Convert load
relocation to R_386_32 for relocation against non-preemptible
absolute symbol.
(elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p.  Don't
allocate dynamic relocation for non-preemptible absolute symbol.
(elf_i386_relocate_section): Pass sec to
GENERATE_DYNAMIC_RELOCATION_P.
* elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved.
(elf_x86_64_convert_load_reloc): Covert load relocation to
R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible
absolute symbol.  Don't convert to R_X86_64_32S nor R_X86_64_32
for non-preemptible absolute symbol if they overflow.
(elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p.  Set
tls_type for GOT slot to GOT_ABS for non-preemptible absolute
symbol.  Don't allocate dynamic relocation for non-preemptible
absolute symbol.
(elf_x86_64_relocate_section): Don't generate relative relocation
for GOTPCREL relocations aganst local absolute symbol.  Pass sec
to GENERATE_DYNAMIC_RELOCATION_P.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation
against non-preemptible absolute symbol.
(_bfd_elf_x86_valid_reloc_p): New function.
(_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for
GOT_ABS GOT slot.
* elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC
argument.  Don't generate dynamic relocation against
non-preemptible absolute symbol.
(ABS_SYMBOL_P): New.
(GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation
against non-preemptible absolute symbol.
(GOT_ABS): New.
(R_X86_64_converted_reloc_bit): New.  Moved from elf64-x86-64.c.
(_bfd_elf_x86_valid_reloc_p): New.

ld/

PR ld/25749
PR ld/25754
* testsuite/ld-elf/linux-x86.exp: Run ld/25749 tests.
* testsuite/ld-elf/pr25749-1.c: New file.
* testsuite/ld-elf/pr25749-1a.c: Likewise.
* testsuite/ld-elf/pr25749-1b.c: Likewise.
* testsuite/ld-elf/pr25749-1b.err: Likewise.
* testsuite/ld-elf/pr25749-1c.c: Likewise.
* testsuite/ld-elf/pr25749-1d.c: Likewise.
* testsuite/ld-elf/pr25749-2.c: Likewise.
* testsuite/ld-elf/pr25749-2a.s: Likewise.
* testsuite/ld-elf/pr25749-2b.s: Likewise.
* testsuite/ld-elf/pr25749.rd: Likewise.
* testsuite/ld-elf/pr25754-1a.c: Likewise.
* testsuite/ld-elf/pr25754-1b.s: Likewise.
* testsuite/ld-elf/pr25754-2a.c: Likewise.
* testsuite/ld-elf/pr25754-2b.err: Likewise.
* testsuite/ld-elf/pr25754-2b.s: Likewise.
* testsuite/ld-elf/pr25754-3a.c: Likewise.
* testsuite/ld-elf/pr25754-3b.s: Likewise.
* testsuite/ld-elf/pr25754-4a.c: Likewise.
* testsuite/ld-elf/pr25754-4b.s: Likewise.
* testsuite/ld-elf/pr25754-4c.s: Likewise.
* testsuite/ld-elf/pr25754-5a.c: Likewise.
* testsuite/ld-elf/pr25754-5b.s: Likewise.
* testsuite/ld-elf/pr25754-5c.s: Likewise.
* testsuite/ld-elf/pr25754-6a.c: Likewise.
* testsuite/ld-elf/pr25754-6b.s: Likewise.
* testsuite/ld-x86-64/pr19609-6a.d: Don't expect linker error.

4 years agoFix value_literal_complex comment
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Fix value_literal_complex comment

Christian pointed out that the value_literal_complex was still a bit
weird; this patch rewrites it and moves it to value.h.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* value.h (value_literal_complex): Add comment.
* valops.c (value_literal_complex): Refer to value.h.

4 years agoAdd _Complex type support to C parser
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Add _Complex type support to C parser

This changes the C parser to add support for complex types in casts.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* c-exp.y (FLOAT_KEYWORD, COMPLEX): New tokens.
(scalar_type): New rule, from typebase.
(typebase): Use scalar_type.  Recognize complex types.
(field_name): Handle FLOAT_KEYWORD.
(ident_tokens): Add _Complex and __complex__.

gdb/testsuite/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* gdb.base/complex-parts.exp: Add type tests.

4 years agoImplement complex arithmetic
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Implement complex arithmetic

This adds support for complex arithmetic to gdb.  Now something like
"print 23 + 7i" will work.

Addition, subtraction, multiplication, division, and equality testing
are supported binary operations.

Unary +, negation, and complement are supported.  Following GCC, the ~
operator computes the complex conjugate.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

PR exp/25299:
* valarith.c (promotion_type, complex_binop): New functions.
(scalar_binop): Handle complex numbers.  Use promotion_type.
(value_pos, value_neg, value_complement): Handle complex numbers.

gdb/testsuite/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* gdb.base/complex-parts.exp: Add arithmetic tests.

4 years agoChange the C parser to allow complex constants
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Change the C parser to allow complex constants

This changes the C parser to allow complex constants.  Now something
like "print 23i" will work.

There are no tests in this patch; they come later.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* c-exp.y (COMPLEX_INT, COMPLEX_FLOAT): New tokens.
(exp) <COMPLEX_INT, COMPLEX_FLOAT>: New rules.
(parse_number): Handle complex numbers.

4 years agoChange how complex types are printed in C
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Change how complex types are printed in C

GCC accepts the "i" suffix for complex numbers.  I think this is nicer
to read than the current output, so this patch changes the C code to
print complex numbers this way.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* c-valprint.c (c_decorations): Change complex suffix to "i".

gdb/testsuite/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* gdb.compile/compile.exp: Update.
* gdb.compile/compile-cplus.exp: Update.
* gdb.base/varargs.exp: Update.
* gdb.base/floatn.exp: Update.
* gdb.base/endianity.exp: Update.
* gdb.base/callfuncs.exp (do_function_calls): Update.
* gdb.base/funcargs.exp (complex_args, complex_integral_args)
(complex_float_integral_args): Update.
* gdb.base/complex.exp: Update.
* gdb.base/complex-parts.exp: Update.

4 years agoAdd accessors for members of complex numbers
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Add accessors for members of complex numbers

This introduces two new functions that make it simpler to access the
components of a complex number.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* valprint.c (generic_value_print_complex): Use accessors.
* value.h (value_real_part, value_imaginary_part): Declare.
* valops.c (value_real_part, value_imaginary_part): New
functions.
* value.c (creal_internal_fn, cimag_internal_fn): Use accessors.

4 years agoChange how complex types are created
Tom Tromey [Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)]
Change how complex types are created

This patch changes how complex types are created.  init_complex_type
and arch_complex_type are unified, and complex types are reused, by
attaching them to the underlying scalar type.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* stabsread.c (rs6000_builtin_type, read_sun_floating_type)
(read_range_type): Update.
* mdebugread.c (basic_type): Update.
* go-lang.c (build_go_types): Use init_complex_type.
* gdbtypes.h (struct main_type) <complex_type>: New member.
(init_complex_type): Update.
(arch_complex_type): Don't declare.
* gdbtypes.c (init_complex_type): Remove "objfile" parameter.
Make name if none given.  Use alloc_type_copy.  Look for cached
complex type.
(arch_complex_type): Remove.
(gdbtypes_post_init): Use init_complex_type.
* f-lang.c (build_fortran_types): Use init_complex_type.
* dwarf2/read.c (read_base_type): Update.
* d-lang.c (build_d_types): Use init_complex_type.
* ctfread.c (read_base_type): Update.

4 years agoMove Rust union tests to new file
Tom Tromey [Wed, 1 Apr 2020 20:02:08 +0000 (14:02 -0600)]
Move Rust union tests to new file

I wanted to run the gdb.rust tests against older versions of the Rust
compiler, to ensure that changes I am making don't break debugging
when using older compilers.

However, this did not work because simple.rs now uses unchecked
unions, which were only added in Rust 1.19.

This patch splits the union code into its own file, so that simple.exp
can continue to work.  I tested this with selected rust versions back
to 1.12.

gdb/testsuite/ChangeLog
2020-04-01  Tom Tromey  <tromey@adacore.com>

* gdb.rust/union.rs: New file.
* gdb.rust/union.exp: New file.
* gdb.rust/simple.rs (Union, Union2): Move to union.rs.
(main): Update.
* gdb.rust/simple.exp: Move union tests to union.exp.

4 years agoRemove local variable from simple.rs test case
Tom Tromey [Wed, 1 Apr 2020 20:02:08 +0000 (14:02 -0600)]
Remove local variable from simple.rs test case

This removes the "y0" variable from simple.rs:main.  This variable
isn't needed by the test case, and it uses a form of initialization
that was added in rust 1.17.  Removing this makes it simpler to run
the gdb.rust tests against older versions of rustc.

gdb/testsuite/ChangeLog
2020-04-01  Tom Tromey  <tromey@adacore.com>

* gdb.rust/simple.rs (main): Remove "y0".

4 years agogdb/infrun: stop all threads if there exists a non-stop target
Tankut Baris Aktemur [Wed, 1 Apr 2020 19:33:06 +0000 (21:33 +0200)]
gdb/infrun: stop all threads if there exists a non-stop target

Stop all threads not only if the current target is non-stop, but also
if there exists a non-stop target.

The multi-target patch (5b6d1e4fa4f "Multi-target support") made the
following change to gdb/inf-child.c:

void
 inf_child_target::maybe_unpush_target ()
 {
-  if (!inf_child_explicitly_opened && !have_inferiors ())
+  if (!inf_child_explicitly_opened)
     unpush_target (this);
 }

If we are in all-stop mode with multiple inferiors, and an exit event
is received from an inferior, target_mourn_inferior() gets to this
point and without the have_inferiors() check, the target is unpushed.
This leads to having exec_ops as the top target.

Here is a test scenario.  Two executables, ./a.out returns
immediately; ./sleepy just sleeps.

  $ gdb ./sleepy
  (gdb) start
  ...
  (gdb) add-inferior -exec ./a.out
  ...
  (gdb) inferior 2
  [Switching to inferior 2..
  (gdb) start
  ...
  (gdb) set schedule-multiple on
  (gdb) set debug infrun 1
  (gdb) continue

At this point, the exit event is received from ./a.out.  Normally,
this would lead to stop_all_threads() to also stop ./sleepy, but this
doesn't happen, because target_is_non_stop_p() returns false.  And it
returns false because the top target is no longer the process target;
it is the exec_ops.

This patch modifies 'stop_waiting' to call 'stop_all_threads' if there
exists a non-stop target, not just when the current top target is
non-stop.

Tested on X86_64 Linux.

gdb/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* infrun.c (stop_all_threads): Update assertion, plus when
stopping threads, take into account that we might be trying
to stop an all-stop target.
(stop_waiting): Call 'stop_all_threads' if there exists a
non-stop target.

gdb/testsuite/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* gdb.multi/stop-all-on-exit.c: New test.
* gdb.multi/stop-all-on-exit.exp: New file.

4 years agogdb: define convenience function 'exists_non_stop_target'
Tankut Baris Aktemur [Wed, 1 Apr 2020 19:33:05 +0000 (21:33 +0200)]
gdb: define convenience function 'exists_non_stop_target'

Define a predicate function that returns true if there exists an
inferior with a non-stop target.

gdb/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* target.h (exists_non_stop_target): New function declaration.
* target.c (exists_non_stop_target): New function.

4 years agoArm: Skip Thumb2 PLT tests on NaCL.
Tamar Christina [Wed, 1 Apr 2020 17:31:22 +0000 (18:31 +0100)]
Arm: Skip Thumb2 PLT tests on NaCL.

NaCL does not support dynamic linking and so these tests should be
skipped under it.

ld/ChangeLog:

PR ld/16017
* testsuite/ld-arm/arm-elf.exp (thumb-plt, thumb-plt-got): Skip for NaCL.

4 years agoAllow pointer arithmetic with integer references
Hannes Domani [Tue, 31 Mar 2020 12:49:06 +0000 (14:49 +0200)]
Allow pointer arithmetic with integer references

Considering these variables:
int i = 3;
int &iref = i;

It's not possible to do any pointer arithmetic with iref:
(gdb) p &i+iref
Argument to arithmetic operation not a number or boolean.

So this adds checks for references to integers in pointer arithmetic.

gdb/ChangeLog:

2020-04-01  Hannes Domani  <ssbssa@yahoo.de>

PR gdb/24789
* eval.c (is_integral_or_integral_reference): New function.
(evaluate_subexp_standard): Allow integer references in
pointer arithmetic.

gdb/testsuite/ChangeLog:

2020-04-01  Hannes Domani  <ssbssa@yahoo.de>

PR gdb/24789
* gdb.cp/misc.cc: Add integer reference variable.
* gdb.cp/misc.exp: Add test.

4 years agoExtend the linker's error message for missing libraries if there is an almost match.
Nick Clifton [Wed, 1 Apr 2020 16:25:28 +0000 (17:25 +0100)]
Extend the linker's error message for missing libraries if there is an almost match.

PR ld/25747
* ldfile.c (ldfile_open_file): If a search for a library fails,
but there is a file that would match if it had a "lib" prefix to
its name, then tell the user.

4 years agogdb/remote: do not check for null_ptid in stop reply
Tankut Baris Aktemur [Wed, 1 Apr 2020 14:57:39 +0000 (16:57 +0200)]
gdb/remote: do not check for null_ptid in stop reply

A gdbserver does not report a ptid in a 'W' or 'X' packet if multi-process
extensions are not supported or turned off.  See

https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#multiprocess-extensions
https://sourceware.org/gdb/current/onlinedocs/gdb/Stop-Reply-Packets.html#Stop-Reply-Packets

GDB's remote packet parser checks for whether a stop-reply packet
contains a ptid if the target is non-stop, and issues an error if no
ptid is included:

  if (target_is_non_stop_p () && event->ptid == null_ptid)
    error (_("No process or thread specified in stop reply: %s"), buf);

This leads to the following error when the non-stop
mode is turned on but multi-process extensions are off:

  $ gdb
  (gdb) set non-stop on
  (gdb) set remote multiprocess-feature-packet off
  (gdb) target remote | gdbserver - ./foo
  Remote debugging using | gdbserver - ./foo
  stdin/stdout redirected
  Process ./foo created; pid = 3712
  ...
  (gdb) continue
  Continuing.
  ...
  No process or thread specified in stop reply: W2a
  (gdb)

Because the check is done for stop reply packets in general, a similar
situation occurs if the 'T' or 'Tthread' packet is disabled in
gdbserver (i.e.  via --disable-packet=T).  E.g:

  $ gdb
  (gdb) set non-stop on
  (gdb) target remote | gdbserver --disable-packet=Tthread - ./foo
  ...
  No process or thread specified in stop reply: T0506:0000000000000000;07:10e2ffffff7f0000;10:9060ddf7ff7f0000;

or

  $ gdb
  (gdb) set non-stop on
  (gdb) target remote | gdbserver --disable-packet=T - ./foo
  ...
  No process or thread specified in stop reply: S05

The commit

  commit cada5fc921e39a1945c422eea055c8b326d8d353
  Date:   Wed Mar 11 12:30:13 2020 +0000

      gdb: Handle W and X remote packets without giving a warning

and its predecessor

  commit 24ed6739b699f329c2c45aedee5f8c7d2f54e493
  Date:   Thu Jan 30 14:35:40 2020 +0000

      gdb/remote: Restore support for 'S' stop reply packet

added warnings for when GDB has to make a guess for a missing ptid in
case of multiple threads/inferiors.  These warnings should suffice.
So, the simple solution is to remove the check completely.

Regression-tested on X86_64 Linux.

gdb/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* remote.c (remote_target::remote_parse_stop_reply): Remove the
check for no ptid in the stop reply when the target is non-stop.

gdb/testsuite/ChangeLog:
2020-04-01  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* gdb.server/stop-reply-no-thread.exp: Enhance the test
scenario to cover execution until the end and also the case
when no packet is disabled when starting gdbserver.

4 years agoAvoid copying in lookup_name_info
Tom Tromey [Wed, 1 Apr 2020 13:47:13 +0000 (07:47 -0600)]
Avoid copying in lookup_name_info

lookup_name_info always copies the name that is passed in.  However,
normally a copy is not needed.  This patch changes this class to avoid
copying.  This required changing the "name" method to return something
else; I chose a gdb::string_view, to avoid excessive calls to strlen
in the code using the lookup_name_info.  However, as this class does
not allow an arbitrary string_view, I've also added a c_str method
that guarantees a \0-terminated result -- a pedantic difference but
one that respects the string_view contract, IMO.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tromey@adacore.com>

* symtab.h (class lookup_name_info) <lookup_name_info>: Change
"name" parameter to rvalue reference.  Initialize m_name_holder.
<lookup_name_info>: New overloads.
<name>: Return gdb::string_view.
<c_str>: New method.
<make_ignore_params>: Update.
<search_name_hash>: Update.
<language_lookup_name>: Return const char *.
<m_name>: Change type.
* symtab.c (demangle_for_lookup_info::demangle_for_lookup_info)
(demangle_for_lookup_info::demangle_for_lookup_info): Update.
(lookup_name_info::match_any): Update.
* psymtab.c (match_partial_symbol, lookup_partial_symbol):
Update.
* minsyms.c (linkage_name_str): Update.
* language.c (default_symbol_name_matcher): Update.
* dwarf2/read.c (mapped_index_base::find_name_components_bounds):
Update.
* ada-lang.c (ada_fold_name): Change parameter to string_view.
(ada_lookup_name_info::ada_lookup_name_info): Update.
(literal_symbol_name_matcher): Update.

4 years agoAvoid some copying in psymtab.c
Tom Tromey [Wed, 1 Apr 2020 13:47:13 +0000 (07:47 -0600)]
Avoid some copying in psymtab.c

I noticed that psymtab.c was always copying the search string in
psymtab_search_name, even when it wasn't necessary.  This patch
removes this function in favor of using the make_ignore_params feature
of lookup_name_info.

Once I had done that, I noticed that lookup_partial_symbol was
creating a lookup_name_info.  However, this function called in loops,
causing even more excess allocation.  This patch further fixes this by
hosting the creation of the lookup_name_info into the callers.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tromey@adacore.com>

* psymtab.c (psymtab_search_name): Remove function.
(psym_lookup_symbol): Create search name and lookup name here.
(lookup_partial_symbol): Remove "name" parameter; add
lookup_name.
(psym_expand_symtabs_for_function): Update.

4 years agoUpdated Serbian translation for the gprof subdirectory
Nick Clifton [Wed, 1 Apr 2020 13:37:02 +0000 (14:37 +0100)]
Updated Serbian translation for the gprof subdirectory

4 years agox86: Force relocation against local absolute symbol
H.J. Lu [Wed, 1 Apr 2020 12:40:45 +0000 (05:40 -0700)]
x86: Force relocation against local absolute symbol

Define TC_FORCE_RELOCATION_ABS to force relocation against local
absolute symbol.

PR gas/25756
* config/tc-i386.h (TC_FORCE_RELOCATION_ABS): New.
* testsuite/gas/i386/localpic.s: Add a test for relocation
against local absolute symbol.
* testsuite/gas/i386/x86-64-localpic.s: Likewise.
* testsuite/gas/i386/localpic.d: Updated.
* testsuite/gas/i386/x86-64-localpic.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-localpic.d: Likewise.

4 years agogas: Fix some x86_64 testcases for Solaris not using R_X86_64_PLT32 [PR25732]
Rainer Orth [Wed, 1 Apr 2020 12:10:34 +0000 (14:10 +0200)]
gas: Fix some x86_64 testcases for Solaris not using R_X86_64_PLT32 [PR25732]

As reported in PR gas/25732, some testcases currently FAIL on
Solaris/x86:

FAIL: x86-64 branch 2
FAIL: x86-64 branch 3
FAIL: x86-64 MPX branch
FAIL: x86-64 branch with BND prefix
FAIL: x86-64 jump

Since https://sourceware.org/ml/binutils/2019-03/msg00163.html, gas
doesn't emit R_X86_64_PLT32 as branch marker on Solaris.  Since the
testsuite lacks a way to preprocess dump files, adjusted copies of the
affected dumps are now used on Solaris.  Unfortunately, those dumps
weren't adapted when the original testcases were changed or other
testcases started to differ between non-Solaris and Solaris targets.

The following patch fixes that, re-syncing the affected dump files or
creating new Solaris-specific ones.

Tested on i386-pc-solaris2.11, x86_64-pc-solaris2.11,
x86_64-pc-linux-gnu, and i686-pc-linux-gnu.

PR gas/25732
* testsuite/gas/i386/solaris/x86-64-branch-2.d: New file.
* testsuite/gas/i386/solaris/x86-64-branch-3.d: New file.
* testsuite/gas/i386/solaris/x86-64-jump.d: Incorporate changes to
testsuite/gas/i386/x86-64-jump.d.
* gas/testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d:
Incorporate changes to
gas/testsuite/gas/i386/x86-64-mpx-branch-1.d.
* testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d : Incorporate
changes to testsuite/gas/i386/x86-64-mpx-branch-2.d.
* testsuite/gas/i386/x86-64-branch-2.d: Skip on *-*-solaris*.
* testsuite/gas/i386/x86-64-branch-3.d: Likewise.

4 years agoArm: Fix LSB of GOT for Thumb2 only PLT.
Tamar Christina [Wed, 1 Apr 2020 09:47:18 +0000 (10:47 +0100)]
Arm: Fix LSB of GOT for Thumb2 only PLT.

When you have a Thumb only PLT then the address in the GOT for PLT0 needs to
have the Thumb bit set since the instruction used in PLTn to get there is
`ldr.w pc` which is an inter-working instruction:

the PLT sequence in question is

00000120 <foo@plt>:
 120: f240 0c98  movw ip, #152 ; 0x98
 124: f2c0 0c01  movt ip, #1
 128: 44fc       add ip, pc
 12a: f8dc f000  ldr.w pc, [ip]
 12e: e7fc       b.n 12a <foo@plt+0xa>

Disassembly of section .text:

00000130 <bar>:
 130: b580       push {r7, lr}
 132: af00       add r7, sp, #0
 134: f7ff fff4  bl 120 <foo@plt>

and previously the linker would generate

Hex dump of section '.got':
 ...
  0x000101b8 40010100 00000000 00000000 10010000 @...............

Which would make it jump and transition out of thumb mode and crash since you
only have thumb mode on such cores.

Now it correctly generates

Hex dump of section '.got':
 ...
  0x000101b8 40010100 00000000 00000000 11010000 @...............

Thanks to Amol for testing patch and to rgujju for reporting it.

bfd/ChangeLog:

PR ld/16017
* elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0
address in the GOT if in thumb only mode.

ld/ChangeLog:

PR ld/16017
* testsuite/ld-arm/arm-elf.exp (thumb-plt-got): New.
* testsuite/ld-arm/thumb-plt-got.d: New test.

4 years agoArm: Fix thumb2 PLT branch offsets.
Tamar Christina [Wed, 1 Apr 2020 09:40:07 +0000 (10:40 +0100)]
Arm: Fix thumb2 PLT branch offsets.

When I previously changed these offsets I had incorrectly used an offset of -2
for this Thumb2 PLT.  Unfortunately because we had no tests for this PLT I had
missed that the result was incorrect.

This patch fixes the offset to PC .-4 so that it correctly addresses the
previous instruction and adds a test for this PLT stub.

bfd/ChangeLog:

* elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset.

ld/ChangeLog:

* testsuite/ld-arm/arm-elf.exp (thumb-plt): New.
* testsuite/ld-arm/thumb-plt.d: New test.
* testsuite/ld-arm/thumb-plt.s: New test.

4 years agoinclude: Sync plugin-api.h with GCC
Martin Liska [Wed, 1 Apr 2020 09:36:11 +0000 (02:36 -0700)]
include: Sync plugin-api.h with GCC

Fix typo in a macro usage.

PR lto/94249
* plugin-api.h: Fix a typo.

4 years agold/testsuite/ld-scripts/defined4.d: Don't xfail mmix-*-*.
Hans-Peter Nilsson [Wed, 1 Apr 2020 02:10:18 +0000 (04:10 +0200)]
ld/testsuite/ld-scripts/defined4.d: Don't xfail mmix-*-*.

A recent fix for the mmo input reader caused symbol-to-type mapping
(which is heuristic for the mmo format) to change (as in "corrected"),
and this test-case now passes.

Before that change, the comment was actually wrong: the symbol type
was mistakenly set to as B for uninitialized data, not T for text
section.

4 years agommo.c: Fix ld testsuite regression "objcopy executable (pr25662)".
Hans-Peter Nilsson [Wed, 1 Apr 2020 02:03:46 +0000 (04:03 +0200)]
mmo.c: Fix ld testsuite regression "objcopy executable (pr25662)".

* mmo.c (mmo_scan): Create .text section only when needed, not
from the start.

For the test-case at hand, the .data section is created and output
first by the linker, but the mmo input-reader mmo_scan always creates
a .text section.  Since sections are output in the order in which
they're created, it's output first, breaking the assumption that
obcopy without options (or with -p) creates output identical to its
input.  The point of creating it at the top of mmo_scan is a trivial
default assignment for the current section variable "sec".  Instead we
now defer the default, creating it only when needed and sec is NULL.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Apr 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoPR 25611, PR 25614: GAS: Remove a double inclusion of "bignum.h"
Maciej W. Rozycki [Tue, 31 Mar 2020 22:01:36 +0000 (23:01 +0100)]
PR 25611, PR 25614: GAS: Remove a double inclusion of "bignum.h"

Correct an issue with commit 5496f3c635dc ("Add support for generating
DWARF-5 format directory and file name tables from the assembler.") and
remove a duplicate direct inclusion of "bignum.h" from dwarf2dbg.c that
causes a GAS compilation error:

In file included from .../gas/dwarf2dbg.c:33:
.../gas/bignum.h:42: error: redefinition of typedef 'LITTLENUM_TYPE'
.../gas/bignum.h:42: error: previous declaration of 'LITTLENUM_TYPE' was here
make[4]: *** [dwarf2dbg.o] Error 1

with some GCC versions, as this header has been already included via
"as.h" and then "flonum.h".

gas/
PR 25611
PR 25614
* dwarf2dbg.c: Do not include "bignum.h".

4 years agoFix py-tui.c build problem
Tom Tromey [Tue, 31 Mar 2020 20:07:04 +0000 (14:07 -0600)]
Fix py-tui.c build problem

py-tui.c can fail to build if the ncurses development headers are not
installed, but if Python was built against ncurses.  In this case, the
Python headers will define HAVE_NCURSES_H, confusing gdb_curses.h.

This patch fixes the problem by moving this include inside
"#ifdef TUI".

gdb/ChangeLog
2020-03-31  Joel Jones  <joelkevinjones@gmail.com>

PR tui/25597:
* python/py-tui.c: Include gdb_curses.h inside of #ifdef TUI.

4 years agoDon't pass NULL to memcpy in gdb
Tom Tromey [Tue, 31 Mar 2020 13:29:53 +0000 (07:29 -0600)]
Don't pass NULL to memcpy in gdb

I compiled gdb with -fsanitize=undefined and ran the test suite.

A couple of reports came from passing NULL to memcpy, e.g.:

[...]btrace-common.cc:176:13: runtime error: null pointer passed as argument 2, which is declared to never be null

While it would be better to fix this in the standard, in the meantime
it seems easy to avoid this error.

gdb/ChangeLog
2020-03-31  Tom Tromey  <tromey@adacore.com>

* dwarf2/abbrev.c (abbrev_table::read): Conditionally call
memcpy.

gdbsupport/ChangeLog
2020-03-31  Tom Tromey  <tromey@adacore.com>

* btrace-common.cc (btrace_data_append): Conditionally call
memcpy.

4 years ago[gdb/testsuite] Fix c-linkage-name.exp with -flto
Tom de Vries [Tue, 31 Mar 2020 10:17:27 +0000 (12:17 +0200)]
[gdb/testsuite] Fix c-linkage-name.exp with -flto

When running test-case gdb.base/c-linkage-name.exp with target board
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects, I run into:
...
PASS: 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
...

The test-case tries to print a symbol before and after symtab expansion.

And it tries to ensure (since commit 13c3a74afb) that the symtab containing
the symbol is not yet expanded when doing the 'before' print, by placing the
symbol in a different CU (c-linkage-name-2.c) from the one containing main
(c-linkage-name.c), such that when we load the exec and expand the symtab
containing main, the symtab containing the symbol isn't.

The generated debug info for the test-case when using mentioned target board
however is structured like this:
...
 <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <d8>   DW_AT_name        : <artificial>
 <1><f4>: Abbrev Number: 2 (DW_TAG_imported_unit)
    <f5>   DW_AT_import      : <0x16b>  [Abbrev Number: 1]
 <1><f9>: Abbrev Number: 2 (DW_TAG_imported_unit)
    <fa>   DW_AT_import      : <0x19c>  [Abbrev Number: 1]
 <1><fe>: Abbrev Number: 3 (DW_TAG_subprogram)
    <ff>   DW_AT_abstract_origin: <0x17d>
 <1><115>: Abbrev Number: 4 (DW_TAG_variable)
    <116>   DW_AT_abstract_origin: <0x1ce>
 <0><16b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <171>   DW_AT_name        : c-linkage-name.c
 <1><17d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <17e>   DW_AT_name        : main
 <0><19c>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <1a2>   DW_AT_name        : c-linkage-name-2.c
 <1><1ce>: Abbrev Number: 5 (DW_TAG_variable)
    <1cf>   DW_AT_name        : mundane
    <1d6>   DW_AT_linkage_name: symada__cS
...

So, the CU named <artificial> contains both the concrete main and the concrete
symbol, which explains the FAIL.

The first test should fail, but passes for two reasons.

First of all, due to PR symtab/25700, we have two regular partial symtabs
c-linkage-name-2.c instead of one, and one of them is expanded, the other one
not:
...
  { psymtab c-linkage-name-2.c ((struct partial_symtab *) 0x38d6f60)
    readin yes
  { psymtab c-linkage-name-2.c ((struct partial_symtab *) 0x38d6fe0)
    readin no
...

And then there's the include symtab, which is also not expanded:
...
  { psymtab c-linkage-name-2.c ((struct partial_symtab *) 0x38143e0)
    readin no
...

Fix the FAIL by explicitly setting the language before load, changing the
language setting from auto/c to manual/c, such that the symtab containing main
is no longer expanded.

And make the symtab expansion testing more robust by using the output of
"maint info symtabs" instead of "maint info psymtabs".

Tested on x86_64-linux, using native and target boards cc-with-gdb-index.exp,
cc-with-debug-names.exp, readnow.exp and
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects.

gdb/testsuite/ChangeLog:

2020-03-31  Tom de Vries  <tdevries@suse.de>

* gdb.base/c-linkage-name.exp: Fix test-case comment.  Set language to
c.  Use "maint info symtabs" to check symtab expansion.

4 years agoalpha-coff: unitialised read
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.

4 years agoalpha-vms: sanity checks for image_write
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.

4 years agotekhex: Uninitialised read
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.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 31 Mar 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoRISC-V: Update CSR to privileged spec 1.11.
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.

4 years agoChange ada_which_variant_applies to value API
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.

4 years agoFix objcopy's --preserve-dates command line option so that it will work with PE forma...
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.

4 years ago[PowerPC] Fix debug register issues in ppc-linux-nat
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.

4 years ago[PowerPC] Move up some register access routines
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.

4 years agoAdd low_new_clone method to linux_nat_target.
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.

4 years ago[gdb/testsuite] Fix c-linkage-name.exp with {cc-with-gdb-index,readnow}.exp
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.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 30 Mar 2020 00:00:05 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoPR25745, powerpc64-ld overflows string buffer in --stats mode
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.

4 years agogdb: rename partial symtab expand functions of debug info readers using legacy_psymtab
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.

4 years agogdb: rename partial_symtab::read_dependencies to expand_dependencies
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.

4 years agogdb: remove discard_psymtab function
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.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 29 Mar 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoFix comment in dwarf2/attribute.h
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.

4 years agoFix formatting of read_attribute_reprocess
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.

4 years agold: Set COMMONPAGESIZE for i386 Solaris
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.

4 years agoRe: Adjust objcopy_test
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.

4 years agoAdjust objcopy_test
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.