binutils-gdb.git
4 years agoFix latent bug in dwarf2_find_containing_comp_unit
Tom Tromey [Fri, 21 Feb 2020 01:22:09 +0000 (18:22 -0700)]
Fix latent bug in dwarf2_find_containing_comp_unit

dwarf2_find_containing_comp_unit has this in its binary search:

      if (mid_cu->is_dwz > offset_in_dwz
  || (mid_cu->is_dwz == offset_in_dwz
      && mid_cu->sect_off + mid_cu->length >= sect_off))
high = mid;

The intent here is to determine whether SECT_OFF appears in or before
MID_CU.

I believe this has an off-by-one error, and that the check should use
">" rather than ">=".  If the two side are equal, then SECT_OFF
actually appears at the start of the next CU.

I've had this patch kicking around for ages but I forget how I found
the problem.

gdb/ChangeLog
2020-02-20  Tom Tromey  <tom@tromey.com>

* dwarf2/read.c (dwarf2_find_containing_comp_unit): Use ">", not
">=", in binary search.
(dwarf2_find_containing_comp_unit): New overload.
(run_test): New self-test.
(_initialize_dwarf2_read): Register new test.

4 years agoRISC-V: Support the read-only CSR checking.
Nelson Chu [Wed, 12 Feb 2020 10:18:51 +0000 (02:18 -0800)]
RISC-V: Support the read-only CSR checking.

CSRRW and CSRRWI always write CSR.  CSRRS, CSRRC, CSRRSI and CSRRCI write CSR
when RS1 isn't zero.  The CSR is read only if the [11:10] bits of CSR address
is 0x3.  The read-only CSR can not be written by the CSR instructions.

gas/
* config/tc-riscv.c (riscv_ip): New boolean insn_with_csr to indicate
we are assembling instruction with CSR.  Call riscv_csr_read_only_check
after parsing all arguments.
(enum csr_insn_type): New enum is used to classify the CSR instruction.
(riscv_csr_insn_type, riscv_csr_read_only_check): New functions.  These
are used to check if we write a read-only CSR by the CSR instruction.

* testsuite/gas/riscv/priv-reg-fail-read-only-01.s: New testcase.  Test
all CSR for the read-only CSR checking.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.d: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.s: New testcase.  Test
all CSR instructions for the read-only CSR checking.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.d: Likewise.
* testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.

4 years agoRISC-V: Disable the CSR checking by default.
Nelson Chu [Wed, 12 Feb 2020 10:18:50 +0000 (02:18 -0800)]
RISC-V: Disable the CSR checking by default.

Add new .option `csr-check/no-csr-check` and GAS option `-mcsr-check
/-mno-csr-check` to enbale/disable the CSR checking.  Disable the CSR
checking by default.

gas/
* config/tc-riscv.c: Add new .option and GAS options to enbale/disable
the CSR checking.  We disable the CSR checking by default.
(reg_lookup_internal): Check the `riscv_opts.csr_check`
before we doing the CSR checking.

* doc/c-riscv.texi: Add description for the new .option and assembler
options.

* testsuite/gas/riscv/priv-reg-fail-fext.d: Add `-mcsr-check` to enable
the CSR checking.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: Likewise.

4 years agoRISC-V: Support the ISA-dependent CSR checking.
Nelson Chu [Wed, 12 Feb 2020 10:18:49 +0000 (02:18 -0800)]
RISC-V: Support the ISA-dependent CSR checking.

According to the riscv privilege spec, some CSR are only valid when rv32 or
the specific extension is set.  We extend the DECLARE_CSR and DECLARE_CSR_ALIAS
to record more informaton we need, and then check whether the CSR is valid
according to these information.  We report warning message when the CSR is
invalid, so we have a choice between error and warning by --fatal-warnings
option.  Also, a --no-warn/-W option is used to turn the warnings off, if
people don't want the warnings.

gas/
* config/tc-riscv.c (enum riscv_csr_class): New enum.  Used to decide
whether or not this CSR is legal in the current ISA string.
(struct riscv_csr_extra): New structure to hold all extra information
of CSR.
(riscv_init_csr_hash): New function.  According to the DECLARE_CSR and
DECLARE_CSR_ALIAS, insert CSR extra information into csr_extra_hash.
Call hash_reg_name to insert CSR address into reg_names_hash.
(md_begin): Call riscv_init_csr_hashes for each DECLARE_CSR.
(reg_csr_lookup_internal, riscv_csr_class_check): New functions.
Decide whether the CSR is valid according to the csr_extra_hash.
(init_opcode_hash): Update 'if (hash_error != NULL)' as hash_error is
not a boolean.  This is same as riscv_init_csr_hash, so keep the
consistent usage.

* testsuite/gas/riscv/csr-dw-regnums.d: Add -march=rv32if option.
* testsuite/gas/riscv/priv-reg.d: Add f-ext by -march option.
* testsuite/gas/riscv/priv-reg-fail-fext.d: New testcase.  The source
file is `priv-reg.s`, and the ISA is rv32i without f-ext, so the
f-ext CSR are not allowed.
* testsuite/gas/riscv/priv-reg-fail-fext.l: Likewise.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: New testcase.  The
source file is `priv-reg.s`, and the ISA is rv64if, so the
rv32-only CSR are not allowed.
* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.

include/
* opcode/riscv-opc.h: Extend DECLARE_CSR and DECLARE_CSR_ALIAS to
record riscv_csr_class.

opcodes/
* riscv-dis.c (print_insn_args): Updated since the DECLARE_CSR is changed.

gdb/
* riscv-tdep.c: Updated since the DECLARE_CSR is changed.
* riscv-tdep.h: Likewise.
* features/riscv/rebuild-csr-xml.sh: Generate the 64bit-csr.xml without
rv32-only CSR.
* features/riscv/64bit-csr.xml: Regernated.

binutils/
* dwarf.c: Updated since the DECLARE_CSR is changed.

4 years agopdp11 reloc processing
Alan Modra [Thu, 20 Feb 2020 13:05:21 +0000 (23:35 +1030)]
pdp11 reloc processing

This allows pdp11 to handle 32-bit fixups that can be applied by gas,
and improves the error message emitted when the required reloc isn't
available.

* config/tc-pdp11.c (md_apply_fix): Handle BFD_RELOC_32.
(tc_gen_reloc): Only give a BAD_CASE assertion on pcrel relocs.

4 years agoPR25569, PDP11 ld -s clobbers last data byte
Alan Modra [Thu, 20 Feb 2020 11:23:44 +0000 (21:53 +1030)]
PR25569, PDP11 ld -s clobbers last data byte

This patch fixes an ancient wart in aout support, in that text and
data section sizes are rounded up for alignment rather that just the
corresponding header sizes.  Changing section sizes could conceivably
result in buffer overflows if section contents were held in memory.
Also, keeping the original section sizes allows this PR to be fixed
nicely.

bfd/
PR 25569
* aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
"text", "data" and "bss" section pointer vars.  Don't update
section size, just exec header sizes.
(adjust_sizes_and_vmas): Don't update text section size.  Set
initial exec header a_text.  Print exec headers sizes.
* pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
(adjust_sizes_and_vmas): Similarly.  Formatting.
(final_link): Correct final file extension.
gas/
PR 25569
* config/obj-aout.c (obj_aout_frob_file_before_fix): Don't loop
on section size adjustment, instead perform another write if
exec header size is larger than section size.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Feb 2020 00:01:08 +0000 (00:01 +0000)]
Automatic date update in version.in

4 years agoMake '{putchar,fputc}_unfiltered' use 'fputs_unfiltered'
Sergio Durigan Junior [Wed, 19 Feb 2020 21:40:48 +0000 (16:40 -0500)]
Make '{putchar,fputc}_unfiltered' use 'fputs_unfiltered'

There is currently a regression when using
'{putchar,fputc}_unfiltered' with 'puts_unfiltered' which was
introduced by one of the commits that reworked the unfiltered print
code.

The regression makes it impossible to use '{putchar,fputc}_unfiltered'
with 'puts_unfiltered', because the former writes directly to the
ui_file stream using 'stream->write', while the latter uses a buffered
mechanism (see 'wrap_buffer') and delays the printing.

If you do a quick & dirty hack on e.g. top.c:show_gdb_datadir:

  @@ -2088,6 +2088,13 @@ static void
   show_gdb_datadir (struct ui_file *file, int from_tty,
    struct cmd_list_element *c, const char *value)
   {
  +  putchar_unfiltered ('\n');
  +  puts_unfiltered ("TEST");
  +  putchar_unfiltered ('>');
  +  puts_unfiltered ("PUTS");
  +  putchar_unfiltered ('\n');

rebuild GDB and invoke the "show data-directory" command, you will
see:

  (gdb) show data-directory

  >
  TESTPUTSGDB's data directory is "/usr/local/share/gdb".

Note how the '>' was printed before the output, and "TEST" and "PUTS"
were printed together.

My first attempt to fix this was to always call 'flush_wrap_buffer' at
the end of 'fputs_maybe_filtered', since it seemed to me that the
function should always print what was requested.  But I wasn't sure
this was the right thing to do, so I talked to Tom on IRC and he gave
me another, simpler idea: make '{putchar,fputc}_unfiltered' call into
the already existing 'fputs_unfiltered' function.

This patch implements the idea.  I regtested it on the Buildbot, and
no regressions were detected.

gdb/ChangeLog:
2020-02-20  Sergio Durigan Junior  <sergiodj@redhat.com>
    Tom Tromey  <tom@tromey.com>

* utils.c (fputs_maybe_filtered): Call 'stream->puts' instead
of 'fputc_unfiltered'.
(putchar_unfiltered): Call 'fputc_unfiltered'.
(fputc_unfiltered): Call 'fputs_unfiltered'.

4 years ago[gdb/testsuite] Fix hello.go xpass
Tom de Vries [Thu, 20 Feb 2020 16:46:17 +0000 (17:46 +0100)]
[gdb/testsuite] Fix hello.go xpass

With gdb.go/hello.go, we run into an xpass:
...
Thread 1 "hello" hit Breakpoint 1, main.main () at hello.go:7^M
7       func main () {^M
(gdb) print st^M
$1 = 0x0 ""^M
(gdb) XPASS: gdb.go/hello.exp: starting string check
...

The xfail is setup as follows:
...
\# This used to print "", i.e., the local "st" initialized as "".
setup_xfail "*-*-*"

gdb_test "print st" \
    ".* = $hex \"\"" \
    "starting string check"
...

It's not clear what gccgo/gc PR this xfail refers to.

It's also not clear why the empty string is both:
- listed as reason for xfail, and
- used in the pass pattern.

Furthermore, there's a comment in the hello.go testcase:
...
  st := "Hello, world!" // this intentionally shadows the global "st"
...
while there's no global st variable present, only a variable myst:
...
var myst = "Shall we?"
...

Fix this by splitting up the test-case in two test-cases, hello.{go,exp} and
global-local-var-shadow.{go,exp}.

In hello.exp we no longer attempt to print st before its declaration.  In
hello.go we remove the myst variable as well the comment related to shadowing.

In global-local-var-shadow.go, we rename myst to st, such that the comment
related to shadowing is correct.  In global-local-var-shadow.exp we attempt to
print the value of st before the local definition, which should print the
value of the global definition, and xfail this with reference to GCC PR93844.

Tested on x86_64-linux, with gccgo 10.

gdb/testsuite/ChangeLog:

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

PR go/17018
* gdb.go/hello.exp: Copy ...
* gdb.go/global-local-var-shadow.exp: ... here.  New file.  Expect
print of st to print value of global definition. Add xfail for GCC
PR93844.
* gdb.go/hello.exp: Remove printing of st before definition.
* gdb.go/hello.go: Copy ...
* gdb.go/global-local-var-shadow.go: ... here. New test.  Rename myst
to st.
* gdb.go/hello.go: Remove myst.  Remove comment about shadowing.

4 years agogdbserver: finish turning the target ops vector into a class
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:04 +0000 (16:12 +0100)]
gdbserver: finish turning the target ops vector into a class

Now that 'process_stratum_target' has a single field left, namely 'pt'
of type 'process_target', and that all the requests to a
'process_stratum_target' are forwarded to 'pt', meld the
'process_target' class into 'process_stratum_target'.

This essentially means

1. All the references of the form 'the_target->pt' become 'the_target'.

2. All the uses of the name 'process_target' become
   'process_stratum_target'.

3. The platform-specific target op vectors (e.g. linux_target_ops) are
   removed and instances of their "process target" classes are used
   instead.

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

* target.h (struct process_stratum_target): Remove.
(class process_target): Rename to ...
(class process_stratum_target): ... this.
* linux-low.h (class linux_process_target): Derive from
'process_stratum_target'.
* linux-low.cc (linux_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
linux_process_target.
* lynx-low.h (class lynx_process_target): Derive from
'process_stratum_target'.
* lynx-low.cc (lynx_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
lynx_process_target.
* nto-low.h (class nto_process_target): Derive from
'process_stratum_target'.
* nto-low.cc (nto_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
nto_process_target.
* win32-low.h (class win32_process_target): Derive from
'process_stratum_target'.
* win32-low.cc (win32_target_ops): Remove.
(initialize_low): Set the_target to the singleton instance of
win32_process_target.

Replace 'the_target->pt' with 'the_target' in the uses below.

* hostio.cc (hostio_error)
(handle_setfs)
(handle_open)
(handle_unlink)
(handle_readlink)
* linux-aarch32-low.cc (arm_breakpoint_at)
* linux-aarch64-low.cc (aarch64_breakpoint_at)
* linux-arm-low.cc (arm_sigreturn_next_pc)
(arm_get_hwcap)
(arm_get_syscall_trapinfo)
* linux-cris-low.cc (cris_breakpoint_at)
* linux-crisv32-low.cc (cris_breakpoint_at)
* linux-low.cc (handle_extended_wait)
(linux_wait_1)
(linux_read_memory)
(linux_process_target::breakpoint_kind_from_pc)
(linux_get_auxv)
* linux-m32r-low.cc (m32r_breakpoint_at)
* linux-mips-low.cc (mips_breakpoint_at)
* linux-nios2-low.cc (nios2_breakpoint_at)
* linux-ppc-low.cc (ppc_breakpoint_at)
* linux-s390-low.cc (s390_get_hwcap)
* linux-sh-low.cc (sh_breakpoint_at)
* linux-sparc-low.cc (sparc_fill_gregset_to_stack)
(sparc_store_gregset_from_stack)
(sparc_breakpoint_at)
* linux-tic6x-low.cc (tic6x_breakpoint_at)
* linux-tile-low.cc (tile_breakpoint_at)
* linux-x86-low.cc (x86_breakpoint_at)
* linux-xtensa-low.cc (xtensa_breakpoint_at)
* mem-break.cc (bp_size)
(bp_opcode)
(insert_memory_breakpoint)
(set_raw_breakpoint_at)
(delete_raw_breakpoint)
(z_type_supported)
(uninsert_raw_breakpoint)
(reinsert_raw_breakpoint)
(validate_inserted_breakpoint)
* regcache.cc (regcache_read_pc)
(regcache_write_pc)
* remote-utils.cc (putpkt_binary_1)
(input_interrupt)
(getpkt)
(prepare_resume_reply)
* server.cc (handle_general_set)
(handle_detach)
(handle_qxfer_auxv)
(handle_qxfer_exec_file)
(handle_qxfer_libraries_svr4)
(handle_qxfer_osdata)
(handle_qxfer_siginfo)
(handle_qxfer_fdpic)
(handle_query)
(resume)
(handle_v_requests)
(queue_stop_reply_callback)
(captured_main)
* target.cc (prepare_to_access_memory)
(done_accessing_memory)
(read_inferior_memory)
(target_write_memory)
(target_stop_and_wait)
(target_wait)
(target_mourn_inferior)
(target_continue_no_signal)
(target_continue)
(target_supports_multi_process)
(kill_inferior)
* target.h
(target_create_inferior)
(target_post_create_inferior)
(myattach)
(target_supports_fork_events)
(target_supports_vfork_events)
(target_supports_exec_events)
(target_handle_new_gdb_connection)
(detach_inferior)
(mythread_alive)
(fetch_inferior_registers)
(store_inferior_registers)
(join_inferior)
(target_supports_non_stop)
(target_async)
(target_process_qsupported)
(target_supports_catch_syscall)
(target_get_ipa_tdesc_idx)
(target_supports_tracepoints)
(target_supports_fast_tracepoints)
(target_get_min_fast_tracepoint_insn_len)
(target_thread_stopped)
(target_pause_all)
(target_unpause_all)
(target_stabilize_threads)
(target_install_fast_tracepoint_jump_pad)
(target_emit_ops)
(target_supports_disable_randomization)
(target_supports_agent)
(target_enable_btrace)
(target_disable_btrace)
(target_read_btrace)
(target_read_btrace_conf)
(target_supports_range_stepping)
(target_supports_stopped_by_sw_breakpoint)
(target_stopped_by_sw_breakpoint)
(target_supports_stopped_by_hw_breakpoint)
(target_supports_hardware_single_step)
(target_stopped_by_hw_breakpoint)
(target_breakpoint_kind_from_pc)
(target_breakpoint_kind_from_current_state)
(target_supports_software_single_step)
(target_core_of_thread)
(target_thread_name)
(target_thread_handle)
* win32-low.cc (do_initial_child_stuff)

Rename target op default definitions listed below.

* target.cc (process_target::post_create_inferior): Rename as ...
(process_stratum_target::post_create_inferior): ... this.
(process_target::prepare_to_access_memory): Rename as ...
(process_stratum_target::prepare_to_access_memory): ... this.
(process_target::done_accessing_memory): Rename as ...
(process_stratum_target::done_accessing_memory): ... this.
(process_target::look_up_symbols): Rename as ...
(process_stratum_target::look_up_symbols): ... this.
(process_target::supports_read_auxv): Rename as ...
(process_stratum_target::supports_read_auxv): ... this.
(process_target::read_auxv): Rename as ...
(process_stratum_target::read_auxv): ... this.
(process_target::supports_z_point_type): Rename as ...
(process_stratum_target::supports_z_point_type): ... this.
(process_target::insert_point): Rename as ...
(process_stratum_target::insert_point): ... this.
(process_target::remove_point): Rename as ...
(process_stratum_target::remove_point): ... this.
(process_target::stopped_by_sw_breakpoint): Rename as ...
(process_stratum_target::stopped_by_sw_breakpoint): ... this.
(process_target::supports_stopped_by_sw_breakpoint): Rename as ...
(process_stratum_target::supports_stopped_by_sw_breakpoint): ... this.
(process_target::stopped_by_hw_breakpoint): Rename as ...
(process_stratum_target::stopped_by_hw_breakpoint): ... this.
(process_target::supports_stopped_by_hw_breakpoint): Rename as ...
(process_stratum_target::supports_stopped_by_hw_breakpoint): ... this.
(process_target::supports_hardware_single_step): Rename as ...
(process_stratum_target::supports_hardware_single_step): ... this.
(process_target::stopped_by_watchpoint): Rename as ...
(process_stratum_target::stopped_by_watchpoint): ... this.
(process_target::stopped_data_address): Rename as ...
(process_stratum_target::stopped_data_address): ... this.
(process_target::supports_read_offsets): Rename as ...
(process_stratum_target::supports_read_offsets): ... this.
(process_target::read_offsets): Rename as ...
(process_stratum_target::read_offsets): ... this.
(process_target::supports_get_tls_address): Rename as ...
(process_stratum_target::supports_get_tls_address): ... this.
(process_target::get_tls_address): Rename as ...
(process_stratum_target::get_tls_address): ... this.
(process_target::hostio_last_error): Rename as ...
(process_stratum_target::hostio_last_error): ... this.
(process_target::supports_qxfer_osdata): Rename as ...
(process_stratum_target::supports_qxfer_osdata): ... this.
(process_target::qxfer_osdata): Rename as ...
(process_stratum_target::qxfer_osdata): ... this.
(process_target::supports_qxfer_siginfo): Rename as ...
(process_stratum_target::supports_qxfer_siginfo): ... this.
(process_target::qxfer_siginfo): Rename as ...
(process_stratum_target::qxfer_siginfo): ... this.
(process_target::supports_non_stop): Rename as ...
(process_stratum_target::supports_non_stop): ... this.
(process_target::async): Rename as ...
(process_stratum_target::async): ... this.
(process_target::start_non_stop): Rename as ...
(process_stratum_target::start_non_stop): ... this.
(process_target::supports_multi_process): Rename as ...
(process_stratum_target::supports_multi_process): ... this.
(process_target::supports_fork_events): Rename as ...
(process_stratum_target::supports_fork_events): ... this.
(process_target::supports_vfork_events): Rename as ...
(process_stratum_target::supports_vfork_events): ... this.
(process_target::supports_exec_events): Rename as ...
(process_stratum_target::supports_exec_events): ... this.
(process_target::handle_new_gdb_connection): Rename as ...
(process_stratum_target::handle_new_gdb_connection): ... this.
(process_target::handle_monitor_command): Rename as ...
(process_stratum_target::handle_monitor_command): ... this.
(process_target::core_of_thread): Rename as ...
(process_stratum_target::core_of_thread): ... this.
(process_target::supports_read_loadmap): Rename as ...
(process_stratum_target::supports_read_loadmap): ... this.
(process_target::read_loadmap): Rename as ...
(process_stratum_target::read_loadmap): ... this.
(process_target::process_qsupported): Rename as ...
(process_stratum_target::process_qsupported): ... this.
(process_target::supports_tracepoints): Rename as ...
(process_stratum_target::supports_tracepoints): ... this.
(process_target::read_pc): Rename as ...
(process_stratum_target::read_pc): ... this.
(process_target::write_pc): Rename as ...
(process_stratum_target::write_pc): ... this.
(process_target::supports_thread_stopped): Rename as ...
(process_stratum_target::supports_thread_stopped): ... this.
(process_target::thread_stopped): Rename as ...
(process_stratum_target::thread_stopped): ... this.
(process_target::supports_get_tib_address): Rename as ...
(process_stratum_target::supports_get_tib_address): ... this.
(process_target::get_tib_address): Rename as ...
(process_stratum_target::get_tib_address): ... this.
(process_target::pause_all): Rename as ...
(process_stratum_target::pause_all): ... this.
(process_target::unpause_all): Rename as ...
(process_stratum_target::unpause_all): ... this.
(process_target::stabilize_threads): Rename as ...
(process_stratum_target::stabilize_threads): ... this.
(process_target::supports_fast_tracepoints): Rename as ...
(process_stratum_target::supports_fast_tracepoints): ... this.
(process_target::get_min_fast_tracepoint_insn_len): Rename as ...
(process_stratum_target::get_min_fast_tracepoint_insn_len): ... this.
(process_target::emit_ops): Rename as ...
(process_stratum_target::emit_ops): ... this.
(process_target::supports_disable_randomization): Rename as ...
(process_stratum_target::supports_disable_randomization): ... this.
(process_target::supports_qxfer_libraries_svr4): Rename as ...
(process_stratum_target::supports_qxfer_libraries_svr4): ... this.
(process_target::qxfer_libraries_svr4): Rename as ...
(process_stratum_target::qxfer_libraries_svr4): ... this.
(process_target::supports_agent): Rename as ...
(process_stratum_target::supports_agent): ... this.
(process_target::enable_btrace): Rename as ...
(process_stratum_target::enable_btrace): ... this.
(process_target::disable_btrace): Rename as ...
(process_stratum_target::disable_btrace): ... this.
(process_target::read_btrace): Rename as ...
(process_stratum_target::read_btrace): ... this.
(process_target::read_btrace_conf): Rename as ...
(process_stratum_target::read_btrace_conf): ... this.
(process_target::supports_range_stepping): Rename as ...
(process_stratum_target::supports_range_stepping): ... this.
(process_target::supports_pid_to_exec_file): Rename as ...
(process_stratum_target::supports_pid_to_exec_file): ... this.
(process_target::pid_to_exec_file): Rename as ...
(process_stratum_target::pid_to_exec_file): ... this.
(process_target::supports_multifs): Rename as ...
(process_stratum_target::supports_multifs): ... this.
(process_target::multifs_open): Rename as ...
(process_stratum_target::multifs_open): ... this.
(process_target::multifs_unlink): Rename as ...
(process_stratum_target::multifs_unlink): ... this.
(process_target::multifs_readlink): Rename as ...
(process_stratum_target::multifs_readlink): ... this.
(process_target::breakpoint_kind_from_pc): Rename as ...
(process_stratum_target::breakpoint_kind_from_pc): ... this.
(process_target::breakpoint_kind_from_current_state): Rename as ...
(process_stratum_target::breakpoint_kind_from_current_state): ... this.
(process_target::thread_name): Rename as ...
(process_stratum_target::thread_name): ... this.
(process_target::thread_handle): Rename as ...
(process_stratum_target::thread_handle): ... this.
(process_target::supports_software_single_step): Rename as ...
(process_stratum_target::supports_software_single_step): ... this.
(process_target::supports_catch_syscall): Rename as ...
(process_stratum_target::supports_catch_syscall): ... this.
(process_target::get_ipa_tdesc_idx): Rename as ...
(process_stratum_target::get_ipa_tdesc_idx): ... this.

4 years agogdbserver: simply copy the pointer in 'set_target_ops'
Pedro Alves [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: simply copy the pointer in 'set_target_ops'

The 'set_target_ops' function takes a target op vector and creates a
clone of it via XNEW and memcpy.  This is not necessary.  'the_target'
is a singleton, and the argument that is passed to 'set_target_ops' is
always the address of a global, static object.  Therefore, update the
implementation to simply copy the pointer.

gdbserver/ChangeLog:
2020-02-20  Pedro Alves  <palves@redhat.com>

* target.cc (set_target_ops): Simply copy the given target pointer
instead of creating a copy of the pointed object.

4 years agogdbserver: turn target op 'get_ipa_tdesc_idx' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: turn target op 'get_ipa_tdesc_idx' into a method

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

Turn process_stratum_target's get_ipa_tdesc_idx op into a method
of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_get_ipa_tdesc_idx): Update the macro.
* target.cc (process_target::get_ipa_tdesc_idx): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_get_ipa_tdesc_idx): Turn into ...
(linux_process_target::get_ipa_tdesc_idx): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_catch_syscall' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: turn target op 'supports_catch_syscall' into a method

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

Turn process_stratum_target's supports_catch_syscall op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_catch_syscall): Update the macro.
* target.cc (process_target::supports_catch_syscall): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_catch_syscall): Turn into ...
(linux_process_target::supports_catch_syscall): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_software_single_step' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:03 +0000 (16:12 +0100)]
gdbserver: turn target op 'supports_software_single_step' into a method

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

Turn process_stratum_target's supports_software_single_step op
into a method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_software_single_step): Update the macro.
* target.cc (process_target::supports_software_single_step): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_software_single_step): Turn into ...
(linux_process_target::supports_software_single_step): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'thread_name' and 'thread_handle' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:02 +0000 (16:12 +0100)]
gdbserver: turn target ops 'thread_name' and 'thread_handle' into methods

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

Turn process_stratum_target's thread_name and thread_handle ops
into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(target_thread_name): Update the macro.
(target_thread_handle): Update the macro.
* target.cc (process_target::thread_name): Define.
(process_target::thread_handle): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_process_target::thread_name): Define.
(linux_process_target::thread_handle): Define.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn breakpoint kind-related target ops into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:02 +0000 (16:12 +0100)]
gdbserver: turn breakpoint kind-related target ops into methods

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

Turn process_stratum_target's breakpoint_kind_from_pc,
sw_breakpoint_from_kind, and breakpoint_kind_from_current_state
ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_breakpoint_kind_from_pc): Update the macro.
(target_breakpoint_kind_from_current_state): Update the macro.
(default_breakpoint_kind_from_pc): Remove declaration.
* target.cc (default_breakpoint_kind_from_pc): Turn into ...
(process_target::breakpoint_kind_from_pc): ... this.
(process_target::breakpoint_kind_from_current_state): Define.

Update the derived classes and callers below.

* mem-break.cc (bp_size): Update.
(bp_opcode): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_wait_1): Update.
(linux_breakpoint_kind_from_pc): Turn into ...
(linux_process_target::breakpoint_kind_from_pc): ... this.
(linux_sw_breakpoint_from_kind): Turn into ...
(linux_process_target::sw_breakpoint_from_kind): ... this.
(linux_breakpoint_kind_from_current_state): Turn into ...
(linux_process_target::breakpoint_kind_from_current_state): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_process_target::sw_breakpoint_from_kind): Define.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_sw_breakpoint_from_kind): Turn into ...
(nto_process_target::sw_breakpoint_from_kind): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_sw_breakpoint_from_kind): Turn into ...
(win32_process_target::sw_breakpoint_from_kind): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target ops 'multifs_{open, readlink, unlink}' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:02 +0000 (16:12 +0100)]
gdbserver: turn target ops 'multifs_{open, readlink, unlink}' into methods

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

Turn process_stratum_target's multifs_open, multifs_readlink,
multifs_unlink ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.  Also add
'supports_multifs'.
* target.cc: Include "fcntl.h", "unistd.h", "sys/types.h", and
"sys/stat.h".
(process_target::supports_multifs): Define.
(process_target::multifs_open): Define.
(process_target::multifs_readlink): Define.
(process_target::multifs_unlink): Define.

Update the derived classes and callers below.

* hostio.cc (handle_setfs): Update.
(handle_open): Update.
(handle_unlink): Update.
(handle_readlink): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_multifs): Define.
(linux_process_target::multifs_open): Define.
(linux_process_target::multifs_readlink): Define.
(linux_process_target::multifs_unlink): Define.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'pid_to_exec_file' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:02 +0000 (16:12 +0100)]
gdbserver: turn target op 'pid_to_exec_file' into a method

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

Turn process_stratum_target's pid_to_exec_file op into a method
of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_pid_to_exec_file'.
* target.cc (process_target::pid_to_exec_file): Define.
(process_target::supports_pid_to_exec_file): Define.

Update the derived classes and callers below.

* server.cc (handle_qxfer_exec_file): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_pid_to_exec_file): Define.
(linux_process_target::pid_to_exec_file): Define.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_range_stepping' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:01 +0000 (16:12 +0100)]
gdbserver: turn target op 'supports_range_stepping' into a method

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

Turn process_stratum_target's supports_range_stepping op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_range_stepping): Update the macro.
* target.cc (process_target::supports_range_stepping): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_range_stepping): Turn into ...
(linux_process_target::supports_range_stepping): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn btrace-related target ops into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:01 +0000 (16:12 +0100)]
gdbserver: turn btrace-related target ops into methods

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

Turn process_stratum_target's btrace-related ops (enable_btrace,
disable_btrace, read_btrace, read_btrace_conf) into methods of
process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(target_enable_btrace): Update.
(target_disable_btrace): Update.
(target_read_btrace): Update.
(target_read_btrace_conf): Update.
* target.cc (process_target::enable_btrace): Define.
(process_target::disable_btrace): Define.
(process_target::read_btrace): Define.
(process_target::read_btrace_conf): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_process_target:enable_btrace): Define as a wrapper around
linux_enable_btrace.
(linux_low_disable_btrace): Turn into ...
(linux_process_target::disable_btrace): ... this.
(linux_low_read_btrace): Turn into ...
(linux_process_target::read_btrace): ... this.
(linux_low_btrace_conf): Turn into ...
(linux_process_target::read_btrace_conf): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_agent' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:01 +0000 (16:12 +0100)]
gdbserver: turn target op 'supports_agent' into a method

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

Turn process_stratum_target's supports_agent op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_agent): Update the macro.
* target.cc (process_target::supports_agent): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_agent): Turn into ...
(linux_process_target::supports_agent): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'qxfer_libraries_svr4' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:01 +0000 (16:12 +0100)]
gdbserver: turn target op 'qxfer_libraries_svr4' into a method

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

Turn process_stratum_target's qxfer_libraries_svr4 op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_qxfer_libraries_svr4'.
* target.cc (process_target::qxfer_libraries_svr4): Define.
(process_target::supports_qxfer_libraries_svr4): Define.

Update the derived classes and callers below.

* server.cc (handle_qxfer_libraries_svr4): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_qxfer_libraries_svr4): Define.
(linux_qxfer_libraries_svr4): Turn into ...
(linux_process_target::qxfer_libraries_svr4): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_disable_randomization' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:01 +0000 (16:12 +0100)]
gdbserver: turn target op 'supports_disable_randomization' into a method

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

Turn process_stratum_target's supports_disable_randomization op
into a method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_disable_randomization): Update the macro.
* target.cc (process_target::supports_disable_randomization): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_disable_randomization): Turn into ...
(linux_process_target::supports_disable_randomization): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'emit_ops' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:00 +0000 (16:12 +0100)]
gdbserver: turn target op 'emit_ops' into a method

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

Turn process_stratum_target's emit_ops op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_emit_ops): Update the macro.
* target.cc (process_target::emit_ops): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_emit_ops): Turn into ...
(linux_process_target::emit_ops): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn fast tracepoint target ops into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:00 +0000 (16:12 +0100)]
gdbserver: turn fast tracepoint target ops into methods

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

Turn process_stratum_target's install_fast_tracepoint_jump_pad
and get_min_fast_tracepoint_insn_len ops into methods of
process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.  Also add
'supports_fast_tracepoints'.
(target_supports_fast_tracepoints): Update the macro.
(target_get_min_fast_tracepoint_insn_len): Update the macro.
(install_fast_tracepoint_jump_pad): Update and rename the macro
to ...
(target_install_fast_tracepoint_jump_pad): ... this.
* target.cc (process_target::supports_fast_tracepoints): Define.
(process_target::install_fast_tracepoint_jump_pad): Define.
(process_target::get_min_fast_tracepoint_insn_len): Define.

Update the derived classes and callers below.

* tracepoint.cc (install_fast_tracepoint): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_fast_tracepoints): Define.
(linux_install_fast_tracepoint_jump_pad): Turn into ...
(linux_process_target::install_fast_tracepoint_jump_pad): ... this.
(linux_get_min_fast_tracepoint_insn_len): Turn into ...
(linux_process_target::get_min_fast_tracepoint_insn_len): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'stabilize_threads' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:00 +0000 (16:12 +0100)]
gdbserver: turn target op 'stabilize_threads' into a method

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

Turn process_stratum_target's stabilize_threads op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_stabilize_threads): Update the macro.
* target.cc (process_target::stabilize_threads): Define.

Update the derived classes and callers below.

* server.cc (handle_status): Update.
* tracepoint.cc (cmd_qtdp): Update.
(cmd_qtstart): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_stabilize_threads): Turn into ...
(linux_process_target::stabilize_threads): ... this.
(linux_wait_1): Update.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'pause_all' and 'unpause_all' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:12:00 +0000 (16:12 +0100)]
gdbserver: turn target ops 'pause_all' and 'unpause_all' into methods

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

Turn process_stratum_target's pause_all and unpause_all ops
into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(pause_all): Update the macro and rename to...
(target_pause_all): ... this.
(unpause_all): Update the macro and rename to...
(target_unpause_all): ... this.
* target.cc (process_target::pause_all): Define.
(process_target::unpause_all): Define.

Update the derived classes and callers below.

* server.cc (handle_status): Update.
* tracepoint.cc (clear_installed_tracepoints): Update.
(cmd_qtdp): Update.
(cmd_qtstart): Update.
(stop_tracing): Update.
(cmd_qtstatus): Update.
(upload_fast_traceframes): Update.
(run_inferior_command): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_pause_all): Turn into ...
(linux_process_target::pause_all): ... this.
(linux_unpause_all): Turn into ...
(linux_process_target::unpause_all): ... this.
(linux_process_target::prepare_to_access_memory): Update.
(linux_process_target::done_accessing_memory): Update.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'get_tib_address' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:59 +0000 (16:11 +0100)]
gdbserver: turn target op 'get_tib_address' into a method

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

Turn process_stratum_target's get_tib_address op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_get_tib_address'.
* target.cc (process_target::get_tib_address): Define.
(process_target::supports_get_tib_address): Define.

Update the derived classes and callers below.

* server.cc (handle_query): Update.
* linux-low.cc (win32_target_ops): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_process_target::supports_get_tib_address): Define.
(win32_get_tib_address): Turn into ...
(win32_process_target::get_tib_address): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'thread_stopped' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:59 +0000 (16:11 +0100)]
gdbserver: turn target op 'thread_stopped' into a method

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

Turn process_stratum_target's thread_stopped op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_thread_stopped'.
(target_thread_stopped): Update the macro.
* target.cc (process_target::thread_stopped): Define.
(process_target::supports_thread_stopped): Define.
(prepare_to_access_memory): Update.

Update the derived classes and callers below.

* server.cc (queue_stop_reply_callback): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_thread_stopped): Define.
(linux_thread_stopped): Turn into ...
(linux_process_target::thread_stopped): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'read_pc' and 'write_pc' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:59 +0000 (16:11 +0100)]
gdbserver: turn target ops 'read_pc' and 'write_pc' into methods

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

Turn process_stratum_target's read_pc and write_pc ops into
methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
* target.cc (process_target::read_pc): Define.
(process_target::write_pc): Define.

Update the derived classes and callers below.

* regcache.cc (regcache_read_pc): Update.
(regcache_write_pc): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_read_pc): Turn into ...
(linux_process_target::read_pc): ... this.
(linux_write_pc): Turn into ...
(linux_process_target::write_pc): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_tracepoints' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:59 +0000 (16:11 +0100)]
gdbserver: turn target op 'supports_tracepoints' into a method

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

Turn process_stratum_target's supports_tracepoints op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_tracepoints): Update the macro.
* target.cc (process_target::supports_tracepoints): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_tracepoints): Turn into ...
(linux_process_target::supports_tracepoints): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'process_qsupported' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:58 +0000 (16:11 +0100)]
gdbserver: turn target op 'process_qsupported' into a method

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

Turn process_stratum_target's process_qsupported op into a method
of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_process_qsupported): Update the macro.
* target.cc (process_target::process_qsupported): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_process_qsupported): Turn into ...
(linux_process_target::process_qsupported): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'read_loadmap' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:58 +0000 (16:11 +0100)]
gdbserver: turn target op 'read_loadmap' into a method

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

Turn process_stratum_target's read_loadmap op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_read_loadmap'.
* target.cc (process_target::read_loadmap): Define.
(process_target::supports_read_loadmap): Define.

Update the derived classes and callers below.

* server.cc (handle_qxfer_fdpic): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_read_loadmap): Define.
(linux_read_loadmap): Turn into ...
(linux_process_target::read_loadmap): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'core_of_thread' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:58 +0000 (16:11 +0100)]
gdbserver: turn target op 'core_of_thread' into a method

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

Turn process_stratum_target's core_of_thread op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_core_of_thread): Update the macro.
* target.cc (process_target::core_of_thread): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_process_target::core_of_thread): Define.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'handle_monitor_command' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:58 +0000 (16:11 +0100)]
gdbserver: turn target op 'handle_monitor_command' into a method

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

Turn process_stratum_target's handle_monitor_command op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_handle_monitor_command): Update the macro.
* target.cc (process_target::handle_monitor_command): Define.

Update the derived classes and callers below.

* server.cc (handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::handle_monitor_command): Define.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'handle_new_gdb_connection' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:57 +0000 (16:11 +0100)]
gdbserver: turn target op 'handle_new_gdb_connection' into a method

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

Turn process_stratum_target's handle_new_gdb_connection op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_handle_new_gdb_connection): Update the macro.
* target.cc (process_target::handle_new_gdb_connection): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_handle_new_gdb_connection): Turn into ...
(linux_process_target::handle_new_gdb_connection): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'supports_{fork,vfork,exec}_events' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:57 +0000 (16:11 +0100)]
gdbserver: turn target ops 'supports_{fork,vfork,exec}_events' into methods

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

Turn process_stratum_target's supports_fork_events,
supports_vfork_events, and supports_exec_events ops into methods
of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(target_supports_fork_events): Update the macro.
(target_supports_vfork_events): Update the macro.
(target_supports_exec_events): Update the macro.
* target.cc (process_target::supports_fork_events): Define.
(process_target::supports_vfork_events): Define.
(process_target::supports_exec_events): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_fork_events): Turn into ...
(linux_process_target::supports_fork_events): ... this.
(linux_supports_vfork_events): Turn into ...
(linux_process_target::supports_vfork_events): ... this.
(linux_supports_exec_events): Turn into ...
(linux_process_target::supports_exec_events): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'supports_multi_process' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:57 +0000 (16:11 +0100)]
gdbserver: turn target op 'supports_multi_process' into a method

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

Turn process_stratum_target's supports_multi_process op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
* target.cc (process_target::supports_multi_process): Define.
(target_supports_multi_process): Update.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_supports_multi_process): Turn into ...
(linux_process_target::supports_multi_process): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn non-stop and async target ops into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:57 +0000 (16:11 +0100)]
gdbserver: turn non-stop and async target ops into methods

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

Turn process_stratum_target's supports_non_stop, async, and
start_non_stop ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(target_supports_non_stop): Update the macro.
(target_async): Update the macro.
(start_non_stop): Remove declaration.
* target.cc (process_target::supports_non_stop): Define.
(process_target::async): Define.
(process_target::start_non_stop): Define.
(start_non_stop): Remove.

Update the derived classes and callers below.

* server.cc (handle_qxfer_siginfo): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_supports_non_stop): Turn into ...
(linux_process_target::supports_non_stop): ... this.
(linux_async): Turn into ...
(linux_process_target::async): ... this.
(linux_start_non_stop): Turn into ...
(linux_process_target::start_non_stop): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_supports_non_stop): Remove; rely on the default behavior
instead.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'qxfer_siginfo' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:57 +0000 (16:11 +0100)]
gdbserver: turn target op 'qxfer_siginfo' into a method

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

Turn process_stratum_target's qxfer_siginfo op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_qxfer_siginfo'.
* target.cc (process_target::qxfer_siginfo): Define.
(process_target::supports_qxfer_siginfo): Define.

Update the derived classes and callers below.

* server.cc (handle_qxfer_siginfo): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_qxfer_siginfo): Define.
(linux_xfer_siginfo): Turn into ...
(linux_process_target::qxfer_siginfo): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'qxfer_osdata' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:56 +0000 (16:11 +0100)]
gdbserver: turn target op 'qxfer_osdata' into a method

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

Turn process_stratum_target's qxfer_osdata op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_qxfer_osdata'.
* target.cc (process_target::qxfer_osdata): Define.
(process_target::supports_qxfer_osdata): Define.

Update the derived classes and callers below.

* server.cc (handle_qxfer_osdata): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_qxfer_osdata): Define.
(linux_qxfer_osdata): Turn into ...
(linux_process_target::qxfer_osdata): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'hostio_last_error' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:56 +0000 (16:11 +0100)]
gdbserver: turn target op 'hostio_last_error' into a method

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

Turn process_stratum_target's hostio_last_error op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
* target.cc: Add "hostio.h" to includes.
(process_target::hostio_last_error): Define.

Update the derived classes and callers below.

* hostio.cc (hostio_error): Update.
* linux-low.cc: Remove "hostio.h" from includes.
(linux_target_ops): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.h (class win32_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(wince_hostio_last_error): Turn into ...
(win32_process_target::hostio_last_error): ... this.

4 years agogdbserver: turn target op 'get_tls_address' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:56 +0000 (16:11 +0100)]
gdbserver: turn target op 'get_tls_address' into a method

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

Turn process_stratum_target's get_tls_address op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_get_tls_address'.
* target.cc (process_target::get_tls_address): Define.
(process_target::supports_get_tls_address): Define.

Update the derived classes and callers below.

* server.cc (handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_get_tls_address): Define.
(linux_process_target::get_tls_address): Define.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'read_offsets' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:56 +0000 (16:11 +0100)]
gdbserver: turn target op 'read_offsets' into a method

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

Turn process_stratum_target's read_offsets op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.  Also add
'supports_read_offsets'.
* target.cc (process_target::read_offsets): Define.
(process_target::supports_read_offsets): Define.

Update the derived classes and callers below.

* server.cc (handle_query): Update.
* linux-low.cc (SUPPORTS_READ_OFFSETS): New #define directive.
(linux_target_ops): Update.
(linux_process_target::supports_read_offsets): Define.
(linux_read_offsets): Turn into ...
(linux_process_target::read_offsets): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'stopped_by_watchpoint' and 'stopped_data_address' into...
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:55 +0000 (16:11 +0100)]
gdbserver: turn target ops 'stopped_by_watchpoint' and 'stopped_data_address' into methods

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

Turn process_stratum_target's stopped_by_watchpoint and
stopped_data_address ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
* target.cc (process_target::stopped_by_watchpoint): Define.
(process_target::stopped_data_address): Define.

Update the derived classes and callers below.

* remote-utils.cc (prepare_resume_reply): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_stopped_by_watchpoint): Turn into ...
(linux_process_target::stopped_by_watchpoint): ... this.
(linux_stopped_data_address): Turn into ...
(linux_process_target::stopped_data_address): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_stopped_by_watchpoint): Turn into ...
(nto_process_target::stopped_by_watchpoint): ... this.
(nto_stopped_data_address): Turn into ...
(nto_process_target::stopped_data_address): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_stopped_by_watchpoint): Turn into ...
(win32_process_target::stopped_by_watchpoint): ... this.
(win32_stopped_data_address): Turn into ...
(win32_process_target::stopped_data_address): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'supports_hardware_single_step' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:55 +0000 (16:11 +0100)]
gdbserver: turn target op 'supports_hardware_single_step' into a method

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

Turn process_stratum_target's supports_hardware_single_step op into
a method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_supports_hardware_single_step): Update the macro.
(target_can_do_hardware_single_step): Remove declaration.
* target.cc (process_target::supports_hardware_single_step): Define.
(target_can_do_hardware_single_step): Remove.

Update the derived classes and callers below.

* linux-low.h (class linux_process_target): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_supports_hardware_single_step): Turn into ...
(linux_process_target::supports_hardware_single_step): ... this.
* lynx-low.h (class lynx_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_process_target::supports_hardware_single_step): Define.
* nto-low.h (class nto_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_process_target::supports_hardware_single_step): Define.
* win32-low.h (class win32_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_process_target::supports_hardware_single_step): Define.

4 years agogdbserver: turn target op '{supports_}stopped_by_hw_breakpoint' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:55 +0000 (16:11 +0100)]
gdbserver: turn target op '{supports_}stopped_by_hw_breakpoint' into a method

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

Turn process_stratum_target's {supports_}stopped_by_hw_breakpoint
ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(target_stopped_by_hw_breakpoint): Update the macro.
(target_supports_stopped_by_hw_breakpoint): Update the macro.
* target.cc (process_target::stopped_by_hw_breakpoint): Define.
(process_target::supports_stopped_by_hw_breakpoint): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_stopped_by_hw_breakpoint): Turn into ...
(linux_process_target::stopped_by_hw_breakpoint): ... this.
(linux_supports_stopped_by_hw_breakpoint): Turn into ...
(linux_process_target::supports_stopped_by_hw_breakpoint): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op '{supports_}stopped_by_sw_breakpoint' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:55 +0000 (16:11 +0100)]
gdbserver: turn target op '{supports_}stopped_by_sw_breakpoint' into a method

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

Turn process_stratum_target's {supports_}stopped_by_sw_breakpoint
ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(target_stopped_by_sw_breakpoint): Update the macro.
(target_supports_stopped_by_sw_breakpoint): Update the macro.
* target.cc (process_target::stopped_by_sw_breakpoint): Define.
(process_target::supports_stopped_by_sw_breakpoint): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_stopped_by_sw_breakpoint): Turn into ...
(linux_process_target::stopped_by_sw_breakpoint): ... this.
(linux_supports_stopped_by_sw_breakpoint): Turn into ...
(linux_process_target::supports_stopped_by_sw_breakpoint): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'insert_point' and 'remove_point' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:54 +0000 (16:11 +0100)]
gdbserver: turn target ops 'insert_point' and 'remove_point' into methods

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

Turn process_stratum_target's insert_point and remove_point ops
into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
* target.cc (process_target::insert_point): Define.
(process_target::remove_point): Define.

Update the derived classes and callers below.

* mem-break.cc (set_raw_breakpoint_at): Update.
(delete_raw_breakpoint): Update.
(uninsert_raw_breakpoint): Update.
(reinsert_raw_breakpoint): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_insert_point): Turn into ...
(linux_process_target::insert_point): ... this.
(linux_remove_point): Turn into ...
(linux_process_target::remove_point): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_insert_point): Turn into ...
(nto_process_target::insert_point): ... this.
(nto_remove_point): Turn into ...
(nto_process_target::remove_point): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_insert_point): Turn into ...
(win32_process_target::insert_point): ... this.
(win32_remove_point): Turn into ...
(win32_process_target::remove_point): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'supports_z_point_type' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:54 +0000 (16:11 +0100)]
gdbserver: turn target op 'supports_z_point_type' into a method

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

Turn process_stratum_target's supports_z_point_type op into a
method of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
* target.cc (process_target::supports_z_point_type): Define.

Update the derived classes and callers below.

* mem-break.cc (z_type_supported): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_supports_z_point_type): Turn into ...
(linux_process_target::supports_z_point_type): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_supports_z_point_type): Turn into ...
(nto_process_target::supports_z_point_type): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_supports_z_point_type): Turn into ...
(win32_process_target::supports_z_point_type): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'read_auxv' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:54 +0000 (16:11 +0100)]
gdbserver: turn target op 'read_auxv' into a method

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

Turn process_stratum_target's read_auxv op into a method of
process_target.

* target.h (class process_stratum_target): Remove the target op.
(struct process_target): Add the target op.  Also add
'supports_read_auxv'.
* target.cc (process_target::read_auxv): Define.
(process_target::supports_read_auxv): Define.

Update the derived classes and callers below.

* server.cc (handle_qxfer_auxv): Update.
(handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_process_target::supports_read_auxv): Define.
(linux_read_auxv): Turn into ...
(linux_process_target::read_auxv): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_process_target::supports_read_auxv): Define.
(nto_read_auxv): Turn into ...
(nto_process_target::read_auxv): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'request_interrupt' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:54 +0000 (16:11 +0100)]
gdbserver: turn target op 'request_interrupt' into a method

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

Turn process_stratum_target's request_interrupt op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.

Update the derived classes and callers below.

* remote-utils.cc (putpkt_binary_1): Update.
(input_interrupt): Update.
(getpkt): Update.
* server.cc (handle_v_requests): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_request_interrupt): Turn into ...
(linux_process_target::request_interrupt): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_request_interrupt): Turn into ...
(lynx_process_target::request_interrupt): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_request_interrupt): Turn into ...
(nto_process_target::request_interrupt): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_request_interrupt): Turn into ...
(win32_process_target::request_interrupt): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'look_up_symbols' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:53 +0000 (16:11 +0100)]
gdbserver: turn target op 'look_up_symbols' into a method

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

Turn process_stratum_target's look_up_symbols op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
* target.cc (process_target::look_up_symbols): Define.

Update the derived classes and callers below.

* server.cc (handle_query): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_look_up_symbols): Turn into ...
(linux_process_target::look_up_symbols): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'read_memory' and 'write_memory' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:53 +0000 (16:11 +0100)]
gdbserver: turn target ops 'read_memory' and 'write_memory' into methods

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

Turn process_stratum_target's read_memory and write_memory
ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.

Update the derived classes and callers below.

* linux-aarch32-low.cc (arm_breakpoint_at): Update.
* linux-aarch64-low.cc (aarch64_breakpoint_at): Update.
* linux-arm-low.cc (arm_sigreturn_next_pc): Update.
(arm_get_syscall_trapinfo): Update.
* linux-cris-low.cc (cris_breakpoint_at): Update.
* linux-crisv32-low.cc (cris_breakpoint_at): Update.
* linux-m32r-low.cc (m32r_breakpoint_at): Update.
* linux-mips-low.cc (mips_breakpoint_at): Update.
* linux-nios2-low.cc (nios2_breakpoint_at): Update.
* linux-ppc-low.cc (ppc_breakpoint_at): Update.
* linux-sh-low.cc (sh_breakpoint_at): Update.
* linux-sparc-low.cc (sparc_fill_gregset_to_stack): Update.
(sparc_store_gregset_from_stack): Update.
(sparc_breakpoint_at): Update.
* linux-tic6x-low.cc (tic6x_breakpoint_at): Update.
* linux-tile-low.cc (tile_breakpoint_at): Update.
* linux-x86-low.cc (x86_breakpoint_at): Update.
* linux-xtensa-low.cc (xtensa_breakpoint_at): Update.
* mem-brea.cc (insert_memory_breakpoint): Update.
(validate_inserted_breakpoint): Update.
* target.cc (read_inferior_memory): Update.
(target_write_memory): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_read_memory): Make a wrapper around the read_memory target
op call.
(linux_process_target::read_memory): Rename from linux_read_memory.
(linux_write_memory): Turn into ...
(linux_process_target::write_memory): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_read_memory): Turn into ...
(lynx_process_target::read_memory): ... this.
(lynx_write_memory): Turn into ...
(lynx_process_target::write_memory): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_read_memory): Turn into ...
(nto_process_target::read_memory): ... this.
(nto_write_memory): Turn into ...
(nto_process_target::write_memory): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_read_inferior_memory): Turn into ...
(win32_process_target::read_memory): ... this.
(win32_write_inferior_memory): Turn into ...
(win32_process_target::write_memory): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn prepare_to_access_memory & done_accessing_memory into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:53 +0000 (16:11 +0100)]
gdbserver: turn prepare_to_access_memory & done_accessing_memory into methods

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

Turn process_stratum_target's prepare_to_access_memory and
done_accessing_memory ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
* target.cc (process_target::prepare_to_access_memory): Define.
(process_target::done_accessing_memory): Define.
(prepare_to_access_memory): Update.
(done_accessing_memory): Update.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_prepare_to_access_memory): Turn into ...
(linux_process_target::prepare_to_access_memory): ... this.
(linux_done_accessing_memory): Turn into ...
(linux_process_target::done_accessing_memory): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target ops 'fetch_registers' and 'store_registers' into methods
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:53 +0000 (16:11 +0100)]
gdbserver: turn target ops 'fetch_registers' and 'store_registers' into methods

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

Turn process_stratum_target's fetch_registers and store_registers
ops into methods of process_target.

* target.h (struct process_stratum_target): Remove the target ops.
(class process_target): Add the target ops.
(fetch_inferior_registers): Update the macro.
(store_inferior_registers): Update the macro.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_fetch_registers): Turn into ...
(linux_process_target::fetch_registers): ... this.
(linux_store_registers): Turn into ...
(linux_process_target::store_registers): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_fetch_registers): Turn into ...
(lynx_process_target::fetch_registers): ... this.
(lynx_store_registers): Turn into ...
(lynx_process_target::store_registers): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_fetch_registers): Turn into ...
(nto_process_target::fetch_registers): ... this.
(nto_store_registers): Turn into ...
(nto_process_target::store_registers): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_fetch_inferior_registers): Turn into ...
(win32_process_target::fetch_registers): ... this.
(win32_store_inferior_registers): Turn into ...
(win32_process_target::store_registers): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'wait' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:52 +0000 (16:11 +0100)]
gdbserver: turn target op 'wait' into a method

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

Turn process_stratum_target's wait op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.

Update the derived classes and callers below.

* target.cc (target_wait): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_wait): Turn into ...
(linux_process_target::wait): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_wait): Turn into ...
(lynx_process_target::wait): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_wait): Turn into ...
(nto_process_target::wait): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_wait): Turn into ...
(win32_process_target::wait): ... this.
(do_initial_child_stuff): Update.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'resume' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:52 +0000 (16:11 +0100)]
gdbserver: turn target op 'resume' into a method

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

Turn process_stratum_target's resume op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.

Update the derived classes and callers below.

* server.cc (resume): Update.
* target.cc (target_stop_and_wait): Update.
(target_continue_no_signal): Update.
(target_continue): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_resume): Turn into ...
(linux_process_target::resume): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_resume): Turn into ...
(lynx_process_target::resume): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_resume): Turn into ...
(nto_process_target::resume): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_resume): Turn into ...
(win32_process_target::resume): ... this.
(win32_process_target::detach): Update.
(do_initial_child_stuff): Update.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'thread_alive' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:52 +0000 (16:11 +0100)]
gdbserver: turn target op 'thread_alive' into a method

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

Turn process_stratum_target's thread_alive op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(mythread_alive): Update the macro.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_thread_alive): Turn into ...
(linux_process_target::thread_alive): ... this.
(wait_for_sigstop): Update.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_thread_alive): Turn into ...
(lynx_process_target::thread_alive): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_thread_alive): Turn into ...
(nto_process_target::thread_alive): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_thread_alive): Turn into ...
(win32_process_target::thread_alive): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'join' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:52 +0000 (16:11 +0100)]
gdbserver: turn target op 'join' into a method

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

Turn process_stratum_target's join op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(join_inferior): Update the macro.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_join): Turn into ...
(linux_process_target::join): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_join): Turn into ...
(lynx_process_target::join): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_process_target::join): Define.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_join): Turn into ...
(win32_process_target::join): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'mourn' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:51 +0000 (16:11 +0100)]
gdbserver: turn target op 'mourn' into a method

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

Turn process_stratum_target's mourn op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.

Update the derived classes and callers below.

* target.cc (target_mourn_inferior): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_mourn): Turn into ...
(linux_process_target::mourn): ... this.
(handle_extended_wait): Update.
(linux_process_target::kill): Update.
(linux_process_target::detach): Update.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_mourn): Turn into ...
(lynx_process_target::mourn): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_mourn): Turn into ...
(nto_process_target::mourn): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_mourn): Turn into ...
(win32_process_target::mourn): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'detach' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:51 +0000 (16:11 +0100)]
gdbserver: turn target op 'detach' into a method

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

Turn process_stratum_target's detach op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(detach_inferior): Update the macro.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_detach): Turn into ...
(linux_process_target::detach): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_detach): Turn into ...
(lynx_process_target::detach): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_detach): Turn into ...
(nto_process_target::detach): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_detach): Turn into ...
(win32_process_target::detach): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'kill' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:51 +0000 (16:11 +0100)]
gdbserver: turn target op 'kill' into a method

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

Turn process_stratum_target's kill op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.

Update the derived classes and callers below.

* target.cc (kill_inferior): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_kill): Turn into ...
(linux_process_target::kill): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_kill): Turn into ...
(lynx_process_target::kill): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_kill): Turn into ...
(nto_process_target::kill): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_kill): Turn into ...
(win32_process_target::kill): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'attach' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:51 +0000 (16:11 +0100)]
gdbserver: turn target op 'attach' into a method

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

Turn process_stratum_target's attach op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(myattach): Update the macro.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_attach): Turn into ...
(linux_process_target::attach): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_attach): Turn into ...
(lynx_process_target::attach): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_attach): Turn into ...
(nto_process_target::attach): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_attach): Turn into ...
(win32_process_target::attach): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: turn target op 'post_create_inferior' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:51 +0000 (16:11 +0100)]
gdbserver: turn target op 'post_create_inferior' into a method

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

Turn process_stratum_target's post_create_inferior op into a method
of process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(target_post_create_inferior): Update the macro.
* target.cc (process_target::post_create_inferior): Define.

Update the derived classes and callers below.

* linux-low.cc (linux_target_ops): Update.
(linux_post_create_inferior): Turn into ...
(linux_process_target::post_create_inferior): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
* nto-low.cc (nto_target_ops): Update.
* win32-low.cc (win32_target_ops): Update.

4 years agogdbserver: turn target op 'create_inferior' into a method
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:50 +0000 (16:11 +0100)]
gdbserver: turn target op 'create_inferior' into a method

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

Turn process_stratum_target's create_inferior op into a method of
process_target.

* target.h (struct process_stratum_target): Remove the target op.
(class process_target): Add the target op.
(create_inferior): Rename the macro to ...
(target_create_inferior): ... this.

Update the derived classes and callers below.

* server.cc (handle_v_run): Update.
(captured_main): Update.
(process_serial_event): Update.
* linux-low.cc (linux_target_ops): Update.
(linux_create_inferior): Turn into ...
(linux_process_target::create_inferior): ... this.
* linux-low.h (class linux_process_target): Update.
* lynx-low.cc (lynx_target_ops): Update.
(lynx_create_inferior): Turn into ...
(lynx_process_target::create_inferior): ... this.
* lynx-low.h (class lynx_process_target): Update.
* nto-low.cc (nto_target_ops): Update.
(nto_create_inferior): Turn into ...
(nto_process_target::create_inferior): ... this.
* nto-low.h (class nto_process_target): Update.
* win32-low.cc (win32_target_ops): Update.
(win32_create_inferior): Turn into ...
(win32_process_target::create_inferior): ... this.
* win32-low.h (class win32_process_target): Update.

4 years agogdbserver: start turning the target ops vector into a class
Tankut Baris Aktemur [Mon, 17 Feb 2020 15:11:50 +0000 (16:11 +0100)]
gdbserver: start turning the target ops vector into a class

This is the beginning of a series of patches where the goal is to turn
the target ops vector into a class and all the target op function
pointers into methods of this class.

Currently, the target ops is a struct of function pointers.  At the
end of the series, it becomes a class with methods, and the existing
low target definitions become subclasses.  That is, we end up with the
following class hierarchy:

  process_stratum_target
  ^
  |-- linux-low
  |-- lynx-low
  |-- nto-low
  |-- win32-low

process_stratum_target either defines the default behavior for the
target ops or leaves them as pure virtual for the subclasses to
override.

The transformation is done by first introducing a helper class, called
'process_target', that is initially empty.  An instance of this class
is added to the end of the current target ops vector.  This new field
is called 'pt'.  We will gradually carry target ops to the new class,
one by one, whereas the invocation of the target op will be converted
to a method call on 'pt'.

For instance, target op 'attach' is currently invoked as

  (*the_target->attach) (args)

After moving 'attach' as a method to 'process_target', it will be
invoked as

  the_target->pt->attach (args)

In this process, the concrete target vector definitions
(e.g. linux-low, win32-low, nto-low, etc.) are turned into derived
classes of 'process_target', so that they can either inherit the
default behavior of the target ops or can override the method.

We prefer to make this transition gradually rather than in a single
giant patch, to yield bite-size patches.  The goal is that after each
patch gdbserver will still be buildable and testable.

The general rule of thumb when converting a target op to a method is
this:

(1) If the function call is protected with a NULL-check with an
obvious default behavior, simply implement that default behavior in
the base class (e.g.: supports_non_stop).

(2) If there is no NULL-check guard, the method becomes pure
virtual, and the derived targets are required to implement the method
(e.g.: attach).

(3) If there is a NULL-check but no apparent default behavior, or if
the NULL-check is utilized to populate a feature support packet,
introduce a 'supports_XYZ' method (e.g.: pid_to_exec_file).

The overall strategy is to preserve the existing behavior as much as
possible.

When we're done moving all the target ops into 'process_target', the
target op vector will contain nothing but the field 'pt'.  At that
point, the auxiliary class 'process_target' will simply meld into
'process_stratum_target' and the method calls of the form
'the_target->pt->xyz' will be turned into 'the_target->xyz'.

The "linux-low" target has been built and reg-tested on X86_64 Linux
(Ubuntu).  The "win32-low" target has been built (but not tested) via
cross-compilation to a x86_64-w64-mingw32 target.  The "lynx-low" and
"nto-low" targets were neither built nor tested.

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

* target.h (class process_target): New class definition.
(struct process_stratum_target) <pt>: New field with type
'process_target*'.
* linux-low.h (class linux_process_target): Define as a derived
class of 'process_target'.
* linux-low.cc (linux_target_ops): Add a linux_process_target*
as the 'pt' field.
* lynx-low.h (class lynx_process_target): Define as a derived
class of 'process_target'.
* lynx-low.cc (lynx_target_ops): Add a lynx_process_target*
as the 'pt' field.
* nto-low.h (class nto_process_target): Define as a derived
class of 'process_target'.
* nto-low.cc (nto_target_ops): Add an nto_process_target*
as the 'pt' field.
* win32-low.h (class win32_process_target): Define as a derived
class of 'process_target'.
* win32-low.cc (win32_target_ops): Add a win32_process_target*
as the 'pt' field.

4 years agoStop the BFD library from automatically converting OS and PROC specific symbol sectio...
Nick Clifton [Thu, 20 Feb 2020 13:08:29 +0000 (13:08 +0000)]
Stop the BFD library from automatically converting OS and PROC specific symbol section indicies to SHN_ABS, and provide a hook for backends to decide how such indicies should be processed.

* elf-bfd.h (struct elf_backend_data): Add symbol_section_index
callback.
* elfxx-target.h (elf_backend_symbol_section_index): Provide
default definition.
(elfNN_bed): Initialise the symbol_section_index field.
* elf.c (swap_out_syms): Call symbol_section_index, if defined, on
OS and PROC specific section indicies.  Warn if converting other
reserved incidies to SHN_ABS.

4 years agogdb: Allow more control over where to find python libraries
Andrew Burgess [Fri, 17 Jan 2020 00:10:22 +0000 (00:10 +0000)]
gdb: Allow more control over where to find python libraries

The motivation behind this commit is to make it easier to bundle the
Python *.py library files with GDB when statically linking GDB against
libpython.  The Python files will be manually added into the GDB
installation tree, and GDB should be able to find them at run-time.
The installation tree will look like this:

  .
  |-- bin/
  |-- include/
  |-- lib/
  |   `-- python3.8/
  `-- share/

The benefit here is that the entire installation tree can be bundled
into a single archive and copied to another machine with a different
version of Python installed, and GDB will still work, including its
Python support.

In use the new configure options would be used something like this,
first build and install a static Python library:

  mkdir python
  cd python
  # Clone or download Python into a src/ directory.
  mkdir build
  export PYTHON_INSTALL_PATH=$PWD/install
  cd build
  ../src/configure --disable-shared --prefix=$PYTHON_INSTALL_PATH
  make
  make install

Now build and install GDB:

  mkdir binutils-gdb
  cd binutils-gdb
  # Clone or download GDB into a src/ directory.
  mkdir build
  export GDB_INSTALL_DIR=$PWD/install
  cd build
  ../src/configure \
      --prefix=$GDB_INSTALL_DIR \
      --with-python=$PYTHON_INSTALL_PATH/bin/python3 \
      --with-python-libdir=$GDB_INSTALL_DIR/lib
  make all-gdb
  make install-gdb

Finally, copy the Python libraries into the GDB install:

  cp -r $PYTHON_INSTALL_DIR/lib/python3.8/ $GDB_INSTALL_DIR/lib

After this the Python src, build, and install directories are no
longer needed and can be deleted.

If the new --with-python-libdir option is not used then the existing
behaviour is left unchanged, GDB will look for the Python libraries in
the lib/ directory within the python path.  The concatenation of the
python prefix and the string 'lib/' is now done at configure time,
rather than at run time in GDB as it was previous, however, this was
never something that the user had dynamic control over, so there's no
loss of functionality.

gdb/ChangeLog:

* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Add --with-python-libdir option.
* main.c: Use WITH_PYTHON_LIBDIR.

4 years ago[gdb/testsuite] Handle missing gccgo
Tom de Vries [Thu, 20 Feb 2020 05:31:24 +0000 (06:31 +0100)]
[gdb/testsuite] Handle missing gccgo

Without gccgo installed I see in stdout/stderr:
...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/print.exp ...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/handcall.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/max-depth.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/integers.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/unsafe.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/package.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/types.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/chan.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/strings.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/basic-types.exp ...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/hello.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.go/methods.exp ...
gdb compile failed, default_target_compile: Can't find gccgo.
...

Fix this by introducing a gdb_caching_proc support_go_compile, and using it in
the complaining test-cases.

Tested on x86_64-linux, with and without gccgo installed.

gdb/testsuite/ChangeLog:

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

* lib/gdb.exp (support_go_compile): New gdb_caching_proc.
(gdb_simple_compile): Handle compile_flags go by using .go extension
for source file.
* gdb.go/chan.exp: Use support_go_compile.
* gdb.go/handcall.exp: Same.
* gdb.go/hello.exp: Same.
* gdb.go/integers.exp: Same.
* gdb.go/max-depth.exp: Same.
* gdb.go/methods.exp: Same.
* gdb.go/package.exp: Same.
* gdb.go/strings.exp: Same.
* gdb.go/types.exp: Same.
* gdb.go/unsafe.exp: Same.

4 years agoRegen with blessed automake-1.15.1
Alan Modra [Thu, 20 Feb 2020 02:30:41 +0000 (13:00 +1030)]
Regen with blessed automake-1.15.1

This doesn't change anything except comments.

* aclocal.m4: Regenerate.

4 years agoRISC-V: Add description for -march-attr/-mno-arch-attr options in gas doc.
Nelson Chu [Thu, 6 Feb 2020 03:14:21 +0000 (19:14 -0800)]
RISC-V: Add description for -march-attr/-mno-arch-attr options in gas doc.

gas/
* doc/c-riscv.texi: Add the doc entries for -march-attr/
-mno-arch-attr command line options.

4 years agoTwo compute_and_set_names simplifications
Tom Tromey [Thu, 20 Feb 2020 00:16:51 +0000 (17:16 -0700)]
Two compute_and_set_names simplifications

This patch simplifies compute_and_set_names in a couple of ways.

First, it changes one spot to use obstack_strndup, which is
equivalent, but more concise.

Second, the function ends with two calls to symbol_set_demangled_name.
This can be simplified to a single call.

gdb/ChangeLog
2020-02-19  Tom Tromey  <tom@tromey.com>

* symtab.c (general_symbol_info::compute_and_set_names): Use
obstack_strndup.  Simplify call to symbol_set_demangled_name.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Feb 2020 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoRISC-V: Convert the ADD/ADDI to the compressed MV/LI if RS1 is zero.
Jim Wilson [Wed, 19 Feb 2020 22:51:07 +0000 (14:51 -0800)]
RISC-V: Convert the ADD/ADDI to the compressed MV/LI if RS1 is zero.

2020-02-19  Nelson Chu  <nelson.chu@sifive.com>
gas/
* testsuite/gas/riscv/c-add-addi.d: New testcase.
* testsuite/gas/riscv/c-add-addi.s: Likewise.
opcodes/
* riscv-opc.c (riscv_opcodes): Convert add/addi to the compressed
c.mv/c.li if rs1 is zero.

Change-Id: Id939b5e6db80d267a832545f3ffef7b9ba881f7d

4 years ago2020-02-19 Jordan Rupprecht <rupprecht@google.com>
Eric Christopher [Wed, 19 Feb 2020 21:55:25 +0000 (13:55 -0800)]
2020-02-19  Jordan Rupprecht  <rupprecht@google.com>

* objdump.c (show_line): call bfd_demangle when using do_demangle.

4 years ago[gdb/testsuite] Fix xpass in gdb.python/lib-types.exp
Tom de Vries [Wed, 19 Feb 2020 21:57:19 +0000 (22:57 +0100)]
[gdb/testsuite] Fix xpass in gdb.python/lib-types.exp

When running gdb.python/lib-types.exp, we have an xpass:
...
(gdb) python print (str (typedef_const_typedef_class1_ref_obj.type))^M
typedef_const_typedef_class1_ref^M
(gdb) XPASS: gdb.python/lib-types.exp: \
  python print (str (typedef_const_typedef_class1_ref_obj.type)) \
  (PRMS gcc/55641)
...

When running the same with gcc 4.8, we have an xfail instead:
...
(gdb) python print (str (typedef_const_typedef_class1_ref_obj.type))^M
const typedef_const_typedef_class1_ref^M
(gdb) XFAIL: gdb.python/lib-types.exp: \
  python print (str (typedef_const_typedef_class1_ref_obj.type)) \
  (PRMS gcc/55641)
...

Fix the xpass by xfailing only for the gcc 4.8 pattern.

Tested on x86_64-linux, with:
- gcc 7.5.0
- gcc 4.8.5
- clang 5.0.2

gdb/testsuite/ChangeLog:

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

* gdb.python/lib-types.exp: Make xfail more strict.

4 years ago[gdb/testsuite] Fix funcall_ref.exp xpass
Tom de Vries [Wed, 19 Feb 2020 21:33:42 +0000 (22:33 +0100)]
[gdb/testsuite] Fix funcall_ref.exp xpass

When running gdb.ada/funcall_ref.exp I run into two XPASSes:
...
(gdb) p get ("Hello world!")^M
$1 = (n => 12, s => "Hello world!")^M
(gdb) XPASS: gdb.ada/funcall_ref.exp: p get ("Hello world!")
ptype get ("Hello world!")^M
type = <ref> record^M
    n: natural;^M
    s: access array (1 .. n) of character;^M
end record^M
(gdb) XPASS: gdb.ada/funcall_ref.exp: ptype get ("Hello world!")
...

The xfails are documented in funcall_ref.exp:
...
 # Currently, GCC describes such functions as returning pointers (instead of
 # references).
 setup_xfail *-*-*
...

Using gnatmake 4.8, we can reproduce the XFAILs:
...
(gdb) p get ("Hello world!")^M
$1 = (access foo.bar) 0x6147b0 <system.secondary_stack.chunk+48>^M
(gdb) XFAIL: gdb.ada/funcall_ref.exp: p get ("Hello world!")
ptype get ("Hello world!")^M
type = access record^M
    n: natural;^M
    s: access array (1 .. n) of character;^M
end record^M
(gdb) XFAIL: gdb.ada/funcall_ref.exp: ptype get ("Hello world!")
...

Fix the XPASSes by:
- removing the xfail setup
- switching the order of the two tests
- detecting the "access record" type and declaring the first test unsupported,
  and skipping the second test

Tested on x86_64-linux, both with gnatmake 4.8.5 and gnatmake 7.5.0.

gdb/testsuite/ChangeLog:

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

* gdb.ada/funcall_ref.exp: Replace xfail setup by unsupported check.

4 years agogdb: dwarf2/read.c: remove unused objfile parameters/variables
Simon Marchi [Wed, 19 Feb 2020 21:04:52 +0000 (16:04 -0500)]
gdb: dwarf2/read.c: remove unused objfile parameters/variables

This is a simple cleanup.  These functions used to use the objfile's
obstack for allocation in the hash tables, but they don't anymore.
Remove the unnecessary objfile parameters, which in turn allows removing
some local variables.

gdb/ChangeLog:

* dwarf2/read.c (allocate_signatured_type_table,
allocate_dwo_unit_table, allocate_type_unit_groups_table,
allocate_dwo_file_hash_table, allocate_dwp_loaded_cutus_table):
Remove objfile parameter, update all callers.

4 years agorust/25535 Apply embedded offset to enum variant calculation
Doug Evans [Wed, 19 Feb 2020 20:54:59 +0000 (13:54 -0700)]
rust/25535 Apply embedded offset to enum variant calculation

Hopefully straightforward (and I didn't miss anything ...).

gdb/ChangeLog
2020-02-19  Doug Evans  <dje@google.com>

PR rust/25535
* rust-lang.c (rust_print_enum): Apply embedded_offset to
rust_enum_variant calculation.

gdb/testsuite/ChangeLog
2020-02-19  Doug Evans  <dje@google.com>

PR rust/25535
* gdb.rust/simple.exp: Add test.
* gdb.rust/simple.rs: Add test.

4 years ago[gdb/testsuite] Fix corefile-buildid.exp with check-read1
Tom de Vries [Wed, 19 Feb 2020 20:33:39 +0000 (21:33 +0100)]
[gdb/testsuite] Fix corefile-buildid.exp with check-read1

When running gdb.base/corefile-buildid.exp using check-read1, I run into:
...
FAIL: gdb.base/corefile-buildid.exp: shared: info files (timeout)
FAIL: gdb.base/corefile-buildid.exp: symlink shared: info files (timeout)
FAIL: gdb.base/corefile-buildid.exp: shared sepdebug: info files (timeout)
FAIL: gdb.base/corefile-buildid.exp: symlink shared sepdebug: info files \
  (timeout)
...

This is caused by attempting to match the output of an "info files" command
using a single gdb_test in check_exec_file.

Fix this by doing line-by-line matching in check_exec_file.

Tested on x86_64-linux, using make targets check and check-read1.

gdb/testsuite/ChangeLog:

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

* gdb.base/corefile-buildid.exp (check_exec_file): Match info files
output line-by-line.

4 years agoFix declaration of mips_pc_is_mips
Tom Tromey [Wed, 19 Feb 2020 19:18:09 +0000 (12:18 -0700)]
Fix declaration of mips_pc_is_mips

A build where CORE_ADDR is not the same as bfd_vma pointed out that
mips_pc_is_mips is declared using bfd_vma as the parameter type, but
defined using CORE_ADDR.  This patch fixes the declaration.

gdb/ChangeLog
2020-02-19  Tom Tromey  <tromey@adacore.com>

* mips-tdep.h (mips_pc_is_mips): Parameter type is CORE_ADDR.

4 years agoUse obstack_strdup in ada-lang.c
Tom Tromey [Wed, 19 Feb 2020 18:06:33 +0000 (11:06 -0700)]
Use obstack_strdup in ada-lang.c

I happened across a spot that was still using obstack_alloc and
strcpy, rather than obstack_strdup.  This patch makes the obvious fix.

gdb/ChangeLog
2020-02-19  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (cache_symbol): Use obstack_strdup.

4 years agoMerge changes from GCC for the config/ directory
Andrew Burgess [Wed, 5 Feb 2020 11:50:07 +0000 (11:50 +0000)]
Merge changes from GCC for the config/ directory

GCC's config/ChangeLog since the last time this merge was done
(in the binutils-gdb commit 0b4d000cc4e8e77c823) is included at the
end of this commit message.

It is worth noting that the binutils-gdb commit 301a9420d947da1458
added the file config/debuginfod.m4 which is not present in GCC's
config/ directory.  This file is preserved, unmodified, after this
commit.

In order to regenerate all of the configure files, I configured with
--enable-maintainer-mode, and built the 'all' target.  I then did the
same thing on a source tree without this patch, and only committed
those files that changed when this patch was added.

GCC's config/ChangeLog entries:

  2020-02-12  Sandra Loosemore  <sandra@codesourcery.com>

   PR libstdc++/79193
   PR libstdc++/88999

   * no-executables.m4: Use a non-empty program to test for linker
   support.

  2020-02-01  Andrew Burgess  <andrew.burgess@embecosm.com>

   * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Update shell syntax.

  2020-01-27  Andrew Burgess  <andrew.burgess@embecosm.com>

   * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Add new
   --with-libXXX-type=... option.  Use this to guide the selection of
   either a shared library or a static library.

  2020-01-24  Maciej W. Rozycki  <macro@wdc.com>

   * toolexeclibdir.m4: New file.

  2019-09-10  Christophe Lyon  <christophe.lyon@st.com>

   * futex.m4: Handle *-uclinux*.
   * tls.m4 (GCC_CHECK_TLS): Likewise.

  2019-09-06  Florian Weimer  <fweimer@redhat.com>

   * futex.m4 (GCC_LINUX_FUTEX): Include <unistd.h> for the syscall
   function.

  2019-07-08  Richard Sandiford  <richard.sandiford@arm.com>

   * bootstrap-Og.mk: New file.

  2019-06-25  Kwok Cheung Yeung  <kcy@codesourcery.com>
              Andrew Stubbs  <ams@codesourcery.com>

   * gthr.m4 (GCC_AC_THREAD_HEADER): Add case for gcn.

  2019-05-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

   * ax_count_cpus.m4: New file.

  2019-05-02  Richard Biener  <rguenther@suse.de>

   PR bootstrap/85574
   * bootstrap-lto.mk (extra-compare): Set to gcc/lto1$(exeext).

  2019-04-16  Martin Liska  <mliska@suse.cz>

   * bootstrap-lto-lean.mk: Filter out -flto in STAGEtrain_CFLAGS.

  2019-04-09  Martin Liska  <mliska@suse.cz>

   * bootstrap-lto-lean.mk: New file.

  2019-03-02  Johannes Pfau  <johannespfau@gmail.com>

   * mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.

  2018-10-31  Joseph Myers  <joseph@codesourcery.com>

   PR bootstrap/82856
   * math.m4, tls.m4: Use AC_LANG_SOURCE.

   Merge from binutils-gdb:
   2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

   * override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

config/ChangeLog:

* ax_count_cpus.m4: New file, backported from GCC.
* bootstrap-Og.mk: New file, backported from GCC.
* bootstrap-lto-lean.mk: New file, backported from GCC.
* bootstrap-lto.mk: Changes backported from GCC.
* futex.m4: Changes backported from GCC.
* gthr.m4: Changes backported from GCC.
* lib-link.m4: Changes backported from GCC.
* mh-mingw: Changes backported from GCC.
* no-executables.m4: Changes backported from GCC.
* tls.m4: Changes backported from GCC.
* toolexeclibdir.m4: New file, backported from GCC.

binutils/ChangeLog:

* configure: Regenerate.

gdb/ChangeLog:

* configure: Regenerate.

gdbserver/ChangeLog:

* configure: Regenerate.

gdbsupport/ChangeLog:

* configure: Regenerate.

intl/ChangeLog:

* configure: Regenerate.

libiberty/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog.bin-gdb:

* configure: Regenerate.

4 years agoVarious fixes for the Z80 support.
Sergey Belyashov [Wed, 19 Feb 2020 17:46:10 +0000 (17:46 +0000)]
Various fixes for the Z80 support.

PR 25537
ld * emultempl/z80.em: Remove machine compatability checking.

PR 25517
* testsuite/ld-z80/arch_ez80_adl.d: Update command line.
* testsuite/ld-z80/arch_ez80_z80.d: Likewise.
* testsuite/ld-z80/arch_r800.d: Likewise.
* testsuite/ld-z80/arch_z180.d: Likewise.
* testsuite/ld-z80/arch_z80n.d: Likewise.
* testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise.
* testsuite/ld-z80/comb_arch_z180_z80.d: Likewise.
* testsuite/ld-z80/comb_arch_z80_ez80.d: Likewise.
* testsuite/ld-z80/comb_arch_z80_z180.d: Likewise.
* testsuite/ld-z80/comb_arch_z80_z80n.d: Likewise.
* testsuite/ld-z80/relocs_b_ez80.d: Likewise.
* testsuite/ld-z80/relocs_b_z80.d: Likewise.
* testsuite/ld-z80/relocs_f_ez80.d: Likewise.
* testsuite/ld-z80/relocs_f_z80.d: Likewise.
* testsuite/ld-z80/relocs_f_z80n.d: Likewise.

bfd
* cpu-z80.c: Add machine type compatibility checking.

gas
* config/tc-z80.c (md_parse_option): Do not use an underscore
prefix for local labels in SDCC compatability mode.
(z80_start_line_hook): Remove SDCC dollar label support.
* testsuite/gas/z80/sdcc.d: Update expected disassembly.
* testsuite/gas/z80/sdcc.s: Likewise.

* config/tc-z80.c: Add -march option.
* doc/as.texi: Update Z80 documentation.
* doc/c-z80.texi: Likewise.
* testsuite/gas/z80/ez80_adl_all.d: Update command line.
* testsuite/gas/z80/ez80_adl_suf.d: Likewise.
* testsuite/gas/z80/ez80_pref_dis.d: Likewise.
* testsuite/gas/z80/ez80_z80_all.d: Likewise.
* testsuite/gas/z80/ez80_z80_suf.d: Likewise.
* testsuite/gas/z80/gbz80_all.d: Likewise.
* testsuite/gas/z80/r800_extra.d: Likewise.
* testsuite/gas/z80/r800_ii8.d: Likewise.
* testsuite/gas/z80/r800_z80_doc.d: Likewise.
* testsuite/gas/z80/sdcc.d: Likewise.
* testsuite/gas/z80/z180.d: Likewise.
* testsuite/gas/z80/z180_z80_doc.d: Likewise.
* testsuite/gas/z80/z80_doc.d: Likewise.
* testsuite/gas/z80/z80_ii8.d: Likewise.
* testsuite/gas/z80/z80_in_f_c.d: Likewise.
* testsuite/gas/z80/z80_op_ii_ld.d: Likewise.
* testsuite/gas/z80/z80_out_c_0.d: Likewise.
* testsuite/gas/z80/z80_sli.d: Likewise.
* testsuite/gas/z80/z80n_all.d: Likewise.
* testsuite/gas/z80/z80n_reloc.d: Likewise.

4 years agoRemove useless NULL check in python.c
Tom Tromey [Wed, 19 Feb 2020 14:50:21 +0000 (07:50 -0700)]
Remove useless NULL check in python.c

I noticed that do_start_initialization, in python.c, checks the result
of xmalloc.  However, xmalloc cannot fail, so this check is useless.
This patch also changes the code to use XNEWVEC.

gdb/ChangeLog
2020-02-19  Tom Tromey  <tromey@adacore.com>

* python/python.c (do_start_initialization): Use XNEWVEC.  Remove
NULL check.

4 years agox86: Mark cvtpi2ps and cvtpi2pd as MMX
H.J. Lu [Wed, 19 Feb 2020 12:54:45 +0000 (04:54 -0800)]
x86: Mark cvtpi2ps and cvtpi2pd as MMX

* config/tc-i386.c (output_insn): Mark cvtpi2ps and cvtpi2pd
with GNU_PROPERTY_X86_FEATURE_2_MMX.
* testsuite/gas/i386/i386.exp: Run property-3 and
x86-64-property-3.
* testsuite/gas/i386/property-3.d: New file.
* testsuite/gas/i386/property-3.s: Likewise.
* testsuite/gas/i386/x86-64-property-3.d: Likewise.

4 years ago[gdb/testsuite] Fix c++/14186 kpass in cpexprs.exp
Tom de Vries [Wed, 19 Feb 2020 12:41:10 +0000 (13:41 +0100)]
[gdb/testsuite] Fix c++/14186 kpass in cpexprs.exp

With gdb.cp/cpexprs.exp, we see:
...
KPASS: gdb.cp/cpexprs.exp: p CV::m(int) const (PRMS c++/14186)
KPASS: gdb.cp/cpexprs.exp: p CV::m(int) volatile (PRMS c++/14186)
KPASS: gdb.cp/cpexprs.exp: p CV::m(int) const volatile (PRMS c++/14186)
...

The tests have been KPASSing since Sept 4 2017, due to commit 3693fdb3c8
'Make "p S::method() const::static_var" work too'.

Fix this by removing the corresponding kfail.

gdb/testsuite/ChangeLog:

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

* gdb.cp/cpexprs.exp: Remove c++/14186 kfail.

4 years agoplugin: Call dlclose before return in try_load_plugin
H.J. Lu [Wed, 19 Feb 2020 11:29:51 +0000 (03:29 -0800)]
plugin: Call dlclose before return in try_load_plugin

Since plugin can be used only once in try_load_plugin, call dlclose
before return.

PR binutils/25355
* plugin.c (plugin_list_entry): Remove handle.
(try_load_plugin): Call dlclose before return.

4 years ago[gdb/testsuite] Be quiet about missing prelink in solib-overlap.exp
Tom de Vries [Wed, 19 Feb 2020 07:24:44 +0000 (08:24 +0100)]
[gdb/testsuite] Be quiet about missing prelink in solib-overlap.exp

When running gdb.base/solib-overlap.exp, I get:
...
Running src/gdb/testsuite/gdb.base/solib-overlap.exp ...
sh: prelink: command not found

                === gdb Summary ===

nr of untested testcases         1
...

The verbose output on stdout/stderr is due to using system to execute
prelink, which also means that the output is not captured in gdb.log and
gdb.sum.

Fix this by using exec instead of system.

Tested on x86_64-linux, with:
- no prelink installed, and
- a fake prelink installed, using "cp /usr/bin/echo ~/bin/prelink".

gdb/testsuite/ChangeLog:

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

* gdb.base/solib-overlap.exp: Use exec instead of system to execute
prelink.

4 years ago[gdb/testsuite] Ignore pass in gdb_caching_proc
Tom de Vries [Wed, 19 Feb 2020 06:05:13 +0000 (07:05 +0100)]
[gdb/testsuite] Ignore pass in gdb_caching_proc

Before commit d4295de4f3 "[gdb/testsuite] Handle missing gnatmake in
gnat_runtime_has_debug_info", calling the gdb_caching_proc
gnat_runtime_has_debug_info could generate a pass because of using
gdb_compile_ada.

This has been fixed in that commit by using a factored out variant
gdb_compile_ada_1, which does not call pass.

Additionally, fix cases like this in more generic way: by ignoring pass calls
during execution of a gdb_caching_proc.

Build and reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* lib/cache.exp (ignore_pass, gdb_do_cache_wrap): New proc.
(gdb_do_cache): Use gdb_do_cache_wrap.
* gdb.base/gdb-caching-proc.exp (test_proc): Use gdb_do_cache_wrap.

4 years agofile size check in _bfd_alloc_and_read
Alan Modra [Wed, 19 Feb 2020 02:52:39 +0000 (13:22 +1030)]
file size check in _bfd_alloc_and_read

* coffgen.c (_bfd_coff_get_external_symbols): Remove file size check.
* elf.c (bfd_elf_get_str_section): Likewise.
(_bfd_elf_slurp_version_tables): Likewise.
* libbfd-in.h (_bfd_constant_p): Define.
(_bfd_alloc_and_read, _bfd_malloc_and_read): Check read size against
file size before allocating memory.
* libbfd.h: Regenerate.

4 years ago_bfd_alloc_and_read
Alan Modra [Wed, 19 Feb 2020 02:46:01 +0000 (13:16 +1030)]
_bfd_alloc_and_read

This patch provides two new inline functions that are then used in
places that allocate memory, read from file, and then deallocate on a
read failure.

* libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
* aoutx.h (aout_get_external_symbols): Replace calls to
bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
(slurp_reloc_table): Likewise.
* archive.c (do_slurp_bsd_armap): Likewise.
(do_slurp_coff_armap): Likewise.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
* coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
* coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
* coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
(_bfd_coff_get_external_symbols): Likewise.
* ecoff.c (ecoff_slurp_symbolic_header),
(_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
(_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
(ecoff_indirect_link_order): Likewise.
* elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
(_bfd_elf_slurp_version_tables): Likewise.
* elf32-m32c.c (m32c_elf_relax_section): Likewise.
* elf32-rl78.c (rl78_elf_relax_section): Likewise.
* elf32-rx.c (elf32_rx_relax_section): Likewise.
* elf64-alpha.c (READ): Likewise.
* elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
* elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
* elfcode.h (elf_slurp_symbol_table),
(elf_slurp_reloc_table_from_section): Likewise.
* elflink.c (elf_link_add_object_symbols),
(elf_link_check_versioned_symbol): Likewise.
* elfxx-mips.c (READ): Likewise.
* i386lynx.c (slurp_reloc_table): Likewise.
* lynx-core.c (lynx_core_file_p): Likewise.
* mach-o.c (bfd_mach_o_canonicalize_relocs),
(bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
(bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
* pdp11.c (aout_get_external_symbols, slurp_reloc_table
* pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
(bfd_pef_parse_symbols): Likewise.
* peicode.h (pe_ILF_object_p, pe_bfd_object_p
* som.c (setup_sections, som_slurp_string_table),
(som_slurp_reloc_table, som_bfd_count_ar_symbols),
(som_bfd_fill_in_ar_symbols): Likewise.
* vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
(evax_bfd_print_image): Likewise.
* vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
* wasm-module.c (wasm_scan): Likewise.
* xcofflink.c (xcoff_link_add_symbols): Likewise.
* xsym.c (bfd_sym_read_name_table),
(bfd_sym_print_type_information_table_entry): Likewise.
* libbfd.h: Regenerate.

4 years agoMiscellaneous memory alloc related fixes
Alan Modra [Wed, 19 Feb 2020 02:45:20 +0000 (13:15 +1030)]
Miscellaneous memory alloc related fixes

Some minor tidies.  Allocating memory for internal relocs and symbols
after reading external relocs is slightly better with fuzzed files.
You can at least do something about silly sizes that way.

* aoutx.h (slurp_reloc_table): Allocate reloc_cache after
reading external relocs.
* ecoff.c (ecoff_slurp_reloc_table): Likewise.
* archive.c (_bfd_write_archive_contents): Don't twiddle bfd_error
after bfd_bread.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Remove unnecessary
bfd_release.
* elf32-m32c.c (m32c_offset_for_reloc): Make shndx_buf a bfd_byte*.
(m32c_elf_relax_section): Likewise.
* elf32-rl78.c (rl78_offset_for_reloc): Likewise.
(rl78_elf_relax_section): Likewise.
* elf32-rx.c (rx_offset_for_reloc): Likewise.
(elf32_rx_relax_section): Likewise.
* mach-o.c (bfd_mach_o_alloc_and_read): Move earlier with better
parameter types and use..
(bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib),
(bfd_mach_o_read_fvmlib, bfd_mach_o_read_str): ..in these functions.
* peicode.h (pe_bfd_object_p): Don't zero the part of opthdr
being read from file, just the extra.
* som.c (som_slurp_symbol_table): Allocate internal symbol buffer
after reading external syms.  Free on failure.

4 years ago_bfd_mul_overflow
Alan Modra [Wed, 19 Feb 2020 02:45:06 +0000 (13:15 +1030)]
_bfd_mul_overflow

This patch removes the bfd_alloc2 series of memory allocation functions,
replacing them with __builtin_mul_overflow followed by bfd_alloc.  Why
do that?  Well, a followup patch will implement _bfd_alloc_and_read
and I don't want to implement alloc2 variants as well.

* coffcode.h (buy_and_read, coff_slurp_line_table),
(coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
corresponding bfd_alloc call.  Adjust variables to suit.
* coffgen.c (_bfd_coff_get_external_symbols): Likewise.
* ecoff.c (_bfd_ecoff_slurp_symbolic_info),
(_bfd_ecoff_slurp_symbol_table, READ): Likewise.
* elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
(swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
* elf32-m32c.c (m32c_elf_relax_section): Likewise.
* elf32-rl78.c (rl78_elf_relax_section): Likewise.
* elf32-rx.c (elf32_rx_relax_section): Likewise.
* elf64-alpha.c (READ): Likewise.
* elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
(elf_slurp_symbol_table, elf_slurp_reloc_table),
(bfd_from_remote_memory): Likewise.
* elfcore.h (core_find_build_id): Likewise.
* elfxx-mips.c (READ): Likewise.
* mach-o.c (bfd_mach_o_mangle_sections),
(bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
(bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
(bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
* som.c (setup_sections, som_prep_for_fixups)
(som_build_and_write_symbol_table, som_slurp_symbol_table),
(som_slurp_reloc_table, som_bfd_count_ar_symbols),
(som_bfd_fill_in_ar_symbols, som_slurp_armap),
(som_bfd_ar_write_symbol_stuff): Likewise.
* vms-alpha.c (vector_grow1): Likewise.
* vms-lib.c (vms_add_index): Likewise.
* wasm-module.c (wasm_scan_name_function_section): Likewise.
* libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
* opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
* libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
(bfd_alloc2, bfd_zalloc2): Delete.
(_bfd_mul_overflow): Define.
* libbfd.h: Regenerate.

4 years agoalloc2 used unnecessarily
Alan Modra [Wed, 19 Feb 2020 02:44:45 +0000 (13:14 +1030)]
alloc2 used unnecessarily

The bfd_alloc2 series of functions were invented to handle cases where
nmemb * size can overflow.  This patch changes some places where the
calculation can't overflow.

* elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
bfd_zalloc2.
(assign_section_numbers): Likewise.
(elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
(_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
bfd_malloc2, size_t amt, and unsigned tls_count.
(rewrite_elf_program_header): Use bfd_malloc and size_t amt.
* elflink.c (elf_create_symbuf): Use bfd_malloc.
(elf_output_implib): Use bfd_alloc.

4 years agobfd_get_size cache
Alan Modra [Wed, 19 Feb 2020 02:44:28 +0000 (13:14 +1030)]
bfd_get_size cache

We have calls to bfd_get_size when swapping in ELF section headers.
Since object files can have a large number of sections, it's worth
caching the file size rather than making lots of stat system calls.

* bfd.c (struct bfd): Move format and direction to other
bitfields.  Add "size".
* bfdio.c (bfd_get_size): Cache size when not writing file.
* opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
returning zero, ie. unknown.
(bfd_get_alt_debug_link_info): Likewise.
* bfd-in2.h: Regenerate.

4 years agobfd_get_file_size calls
Alan Modra [Wed, 19 Feb 2020 02:44:05 +0000 (13:14 +1030)]
bfd_get_file_size calls

bfd_get_file_size can return 0, meaning the file size is unknown.

* coffgen.c (_bfd_coff_get_external_symbols): Don't call
bfd_get_file_size twice.
(_bfd_coff_read_string_table): Allow for bfd_get_file_size
zero, ie. unknown, return.
* elf-attrs.c (_bfd_elf_parse_attributes): Likewise.
* elfcode.h (elf_swap_shdr_in): Likewise.
(elf_object_p): Don't call bfd_get_file_size twice and correct
file size check.

4 years agoCheck return status of memory alloc functions
Alan Modra [Wed, 19 Feb 2020 02:42:52 +0000 (13:12 +1030)]
Check return status of memory alloc functions

This fixes a number of places that call a memory allocation function
without checking for a NULL return before using.

* mach-o.c (bfd_mach_o_flatten_sections): Return a bfd_boolean,
FALSE if memory alloc fails.  Adjust calls.
* som.c (som_prep_for_fixups): Likewise.
* vms-alpha.c (alpha_vms_add_fixup_lp, alpha_vms_add_fixup_ca),
(alpha_vms_add_fixup_qr, alpha_vms_add_fixup_lr),
(alpha_vms_add_lw_reloc, alpha_vms_add_qw_reloc): Likewise.
* som.c (som_build_and_write_symbol_table): Return via error_return
on seek failure.
* vms-alpha.c (VEC_APPEND): Adjust for vector_grow1 changes.
(VEC_APPEND_EL): Delete.
(vector_grow1): Return pointer to element.  Catch overflow.
Return NULL on memory allocation failure.
(alpha_vms_add_fixup_lp): Replace VEC_APPEND_EL with VEC_APPEND.
(alpha_vms_add_fixup_ca): Likewise.
(alpha_vms_link_add_object_symbols): Check VEC_APPEND result
before using.
* elf.c (bfd_section_from_shdr): Check bfd_zalloc2 result.

4 years agobfd_size_type to size_t
Alan Modra [Wed, 19 Feb 2020 02:42:00 +0000 (13:12 +1030)]
bfd_size_type to size_t

bfd_size_type was invented a long time ago in the K&R days.  Many
places in binutils ought to be using size_t instead (and there are
lots of places that use long or unsigned long that really ought to use
size_t too).  Note that you can't change everything over to size_t: A
32-bit host needs a larger type than size_t to support reading and
processing of 64-bit ELF object files.  This patch just tidies some
of the more obvious uses of bfd_size_type that could be size_t.  There
no doubt are more lurking in the source.  Incidentally, practically
all functions used for output of object files can use size_t and don't
need to worry about overflow of size expressions.  If you have
something like
  symcount * sizeof (void *)
when symcount is counting symbols already in memory then you know that
this expression can't overflow since the size of a symbol in memory is
larger by far than that of a pointer.

* aix386-core.c (aix386_core_file_p): Use size_t for "amt".
* aout-target.h (object_p): Likewise.
* aout-tic30.c (tic30_aout_object_p): Likewise.
* aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
(emit_stringtab, write_syms, link_hash_table_create),
(aout_link_write_other_symbol): Likewise.
* archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
(bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
(_bfd_compute_and_write_armap): Likewise.
* archures.c (bfd_arch_list): Likewise.
* bfd.c (bfd_record_phdr): Likewise.
* binary.c (binary_canonicalize_symtab): Likewise.
* cisco-core.c (cisco_core_file_validate): Likewise.
* coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
(find_arm_glue, record_arm_to_thumb_glue),
(record_thumb_to_arm_glue): Likewise.
* coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
(ppc_allocate_toc_section): Likewise.
* coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
* coff-sh.c (sh_relax_section): Likewise.
* coff64-rs6000.c (xcoff64_archive_p): Likewise.
* coffcode.h (handle_COMDAT, coff_new_section_hook),
(coff_set_alignment_hook, coff_mkobject),
(coff_compute_section_file_positions): Likewise.
* coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
(coff_find_nearest_line_with_names),
( bfd_coff_set_symbol_class): Likewise.
* cofflink.c (_bfd_coff_link_hash_table_create),
(_bfd_coff_link_input_bfd): Likewise.
* dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
* dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
(build_line_info_table, sort_line_sequences),
(line_info_add_include_dir, line_info_add_file_name),
(decode_line_info, scan_unit_for_symbols, parse_comp_unit),
(place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
* ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
(_bfd_ecoff_find_nearest_line),
(_bfd_ecoff_bfd_link_hash_table_create): Likewise.
* ecofflink.c (bfd_ecoff_debug_init): Likewise.
* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
* elf-m10300.c (mn10300_elf_relax_section),
(elf32_mn10300_link_hash_table_create): Likewise.
* elf-strtab.c (_bfd_elf_strtab_init): Likewise.
* elf.c (make_mapping, copy_elf_program_header): Likewise.
* elf32-arm.c (elf32_arm_link_hash_table_create),
(elf32_arm_setup_section_lists, elf32_arm_check_relocs),
(elf32_arm_new_section_hook): Likewise.
* elf32-avr.c (elf_avr_new_section_hook),
(elf32_avr_link_hash_table_create, get_local_syms),
(elf32_avr_setup_section_lists): Likewise.
* elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
(bfin_link_hash_table_create): Likewise.
* elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
* elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
* elf32-csky.c (csky_elf_link_hash_table_create),
(csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
* elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
* elf32-hppa.c (elf32_hppa_link_hash_table_create),
(elf32_hppa_setup_section_lists, get_local_syms): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
* elf32-m32r.c (m32r_elf_link_hash_table_create),
(m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
(elf32_m68hc11_setup_section_lists),
(elf32_m68hc11_size_stubs): Likewise.
* elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
* elf32-metag.c (elf_metag_link_hash_table_create),
(elf_metag_setup_section_lists): Likewise.
* elf32-microblaze.c (microblaze_elf_link_hash_table_create),
(microblaze_elf_check_relocs): Likewise.
* elf32-nds32.c (nds32_elf_link_hash_table_create),
(nds32_elf_check_relocs): Likewise.
* elf32-nios2.c (nios2_elf32_setup_section_lists),
(get_local_syms, nios2_elf32_check_relocs),
(nios2_elf32_link_hash_table_create): Likewise.
* elf32-or1k.c (or1k_elf_link_hash_table_create),
(or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
* elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
* elf32-s390.c (elf_s390_link_hash_table_create),
(elf_s390_check_relocs): Likewise.
* elf32-score.c (score_elf_create_got_section),
(s3_elf32_score_new_section_hook),
(elf32_score_link_hash_table_create): Likewise.
* elf32-score7.c (score_elf_create_got_section),
(s7_elf32_score_new_section_hook): Likewise.
* elf32-sh.c (sh_elf_link_hash_table_create),
(sh_elf_check_relocs): Likewise.
* elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
(elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
* elf32-tilepro.c (tilepro_elf_link_hash_table_create),
(tilepro_elf_check_relocs): Likewise.
* elf32-v850.c (remember_hi16s_reloc): Likewise.
* elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
* elf32-xtensa.c (elf_xtensa_link_hash_table_create),
(elf_xtensa_new_section_hook): Likewise.
* elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
(get_got_entry, elf64_alpha_check_relocs): Likewise.
* elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
* elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
* elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
* elf64-ppc.c (ppc64_elf_new_section_hook),
(ppc64_elf_link_hash_table_create, update_local_sym_info),
(update_plt_info, ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_link_hash_table_create),
(elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elflink.c (bfd_elf_link_record_local_dynamic_symbol),
(_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
(elf_link_add_archive_symbols, compute_bucket_count),
(bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
(bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
(bfd_elf_final_link): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
(elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
(elfNN_aarch64_new_section_hook): Likewise.
* elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
* elfnn-riscv.c (riscv_elf_link_hash_table_create),
(riscv_elf_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_new_section_hook),
(_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
(_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
(_bfd_mips_elf_link_hash_table_create): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
(_bfd_sparc_elf_check_relocs),
(_bfd_sparc_elf_new_section_hook): Likewise.
* elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
(tilegx_elf_check_relocs): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
* format.c (bfd_check_format_matches): Likewise.
* hash.c (_bfd_stringtab_init): Likewise.
* ihex.c (ihex_scan): Likewise.
* irix-core.c (irix_core_core_file_p): Likewise.
* linker.c (bfd_wrapped_link_hash_lookup),
(_bfd_generic_link_hash_table_create),
(_bfd_generic_reloc_link_order): Likewise.
* lynx-core.c (lynx_core_file_p): Likewise.
* netbsd-core.c (netbsd_core_file_p): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
(link_hash_table_create, aout_link_write_other_symbol): Likewise.
* peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
* peicode.h (pe_mkobject): Likewise.
* ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
* sco5-core.c (read_uarea): Likewise.
* som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
(som_write_fixups, som_write_space_strings, som_write_symbol_strings),
(som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
(som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
(bfd_som_attach_aux_hdr, som_write_armap): Likewise.
* srec.c (srec_scan): Likewise.
* syms.c (_bfd_generic_make_empty_symbol): Likewise.
* targets.c (bfd_target_list): Likewise.
* tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
* trad-core.c (trad_unix_core_file_p): Likewise.
* vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
(vms_new_section_hook): Likewise.
* wasm-module.c (wasm_make_empty_symbol): Likewise.
* xcofflink.c (xcoff_get_section_contents),
(_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
(xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
(bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.