From patchwork Tue Feb 11 09:02:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tankut Baris Aktemur X-Patchwork-Id: 37948 Received: (qmail 1596 invoked by alias); 11 Feb 2020 09:04:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 122515 invoked by uid 89); 11 Feb 2020 09:03:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 09:03:40 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 01:03:31 -0800 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 11 Feb 2020 01:03:29 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 01B93Si9002331; Tue, 11 Feb 2020 09:03:28 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 01B93S90010751; Tue, 11 Feb 2020 10:03:28 +0100 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 01B93Rtd010747; Tue, 11 Feb 2020 10:03:28 +0100 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 58/58] gdbserver: finish turning the target ops vector into a class Date: Tue, 11 Feb 2020 10:02:10 +0100 Message-Id: <10770a54e442c92aa3869813131ac84ecc6890da.1581410936.git.tankut.baris.aktemur@intel.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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-10 Tankut Baris Aktemur * 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.c (linux_target_ops): Remove. (initialize_low): Reset the_target to an instance of linux_process_target. * lynx-low.h (class lynx_process_target): Derive from 'process_stratum_target'. * lynx-low.c (lynx_target_ops): Remove. (initialize_low): Reset the_target to an instance of lynx_process_target. * nto-low.h (class nto_process_target): Derive from 'process_stratum_target'. * nto-low.c (nto_target_ops): Remove. (initialize_low): Reset the_target to an instance of nto_process_target. * win32-low.h (class win32_process_target): Derive from 'process_stratum_target'. * win32-low.c (win32_target_ops): Remove. (initialize_low): Reset the_target to an instance of win32_process_target. Replace 'the_target->pt' with 'the_target' in the uses below. * hostio.c (hostio_error): (handle_setfs): (handle_open): (handle_unlink): (handle_readlink): * linux-aarch32-low.c (arm_breakpoint_at): * linux-aarch64-low.c (aarch64_breakpoint_at): * linux-arm-low.c (arm_sigreturn_next_pc): (arm_get_hwcap): (arm_get_syscall_trapinfo): * linux-cris-low.c (cris_breakpoint_at): * linux-crisv32-low.c (cris_breakpoint_at): * linux-low.c (handle_extended_wait): (linux_wait_1): (linux_read_memory): (linux_process_target::breakpoint_kind_from_pc): (linux_get_auxv): * linux-m32r-low.c (m32r_breakpoint_at): * linux-mips-low.c (mips_breakpoint_at): * linux-nios2-low.c (nios2_breakpoint_at): * linux-ppc-low.c (ppc_get_pc): (ppc_set_pc): (ppc_get_auxv): (ppc_breakpoint_at): * linux-s390-low.c (s390_get_hwcap): * linux-sh-low.c (sh_breakpoint_at): * linux-sparc-low.c (sparc_fill_gregset_to_stack): (sparc_store_gregset_from_stack): (sparc_breakpoint_at): * linux-tic6x-low.c (tic6x_breakpoint_at): * linux-tile-low.c (tile_breakpoint_at): * linux-x86-low.c (x86_breakpoint_at): * linux-xtensa-low.c (xtensa_breakpoint_at): * mem-break.c (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.c (regcache_read_pc): (regcache_write_pc): * remote-utils.c (putpkt_binary_1): (input_interrupt): (getpkt): (prepare_resume_reply): * server.c (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.c (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.c (do_initial_child_stuff): Rename target op default definitions listed below. * target.c (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. --- gdbserver/hostio.c | 15 ++- gdbserver/linux-aarch32-low.c | 6 +- gdbserver/linux-aarch64-low.c | 4 +- gdbserver/linux-arm-low.c | 8 +- gdbserver/linux-cris-low.c | 4 +- gdbserver/linux-crisv32-low.c | 4 +- gdbserver/linux-low.c | 19 ++- gdbserver/linux-low.h | 2 +- gdbserver/linux-m32r-low.c | 4 +- gdbserver/linux-mips-low.c | 2 +- gdbserver/linux-nios2-low.c | 4 +- gdbserver/linux-ppc-low.c | 2 +- gdbserver/linux-sh-low.c | 2 +- gdbserver/linux-sparc-low.c | 6 +- gdbserver/linux-tic6x-low.c | 2 +- gdbserver/linux-tile-low.c | 2 +- gdbserver/linux-x86-low.c | 2 +- gdbserver/linux-xtensa-low.c | 4 +- gdbserver/lynx-low.c | 7 +- gdbserver/lynx-low.h | 2 +- gdbserver/mem-break.c | 22 ++-- gdbserver/nto-low.c | 7 +- gdbserver/nto-low.h | 2 +- gdbserver/regcache.c | 4 +- gdbserver/remote-utils.c | 12 +- gdbserver/server.c | 68 +++++------ gdbserver/target.c | 212 ++++++++++++++++++---------------- gdbserver/target.h | 118 +++++++++---------- gdbserver/win32-low.c | 9 +- gdbserver/win32-low.h | 2 +- 30 files changed, 268 insertions(+), 289 deletions(-) diff --git a/gdbserver/hostio.c b/gdbserver/hostio.c index 6223b24a887..0185a3ba038 100644 --- a/gdbserver/hostio.c +++ b/gdbserver/hostio.c @@ -196,7 +196,7 @@ require_valid_fd (int fd) static void hostio_error (char *own_buf) { - the_target->pt->hostio_last_error (own_buf); + the_target->hostio_last_error (own_buf); } static void @@ -272,7 +272,7 @@ handle_setfs (char *own_buf) then there's no point in GDB sending "vFile:setfs:" packets. We reply with an empty packet (i.e. we pretend we don't understand "vFile:setfs:") and that should stop GDB sending any more. */ - if (!the_target->pt->supports_multifs ()) + if (!the_target->supports_multifs ()) { own_buf[0] = '\0'; return; @@ -320,8 +320,7 @@ handle_open (char *own_buf) /* We do not need to convert MODE, since the fileio protocol uses the standard values. */ if (hostio_fs_pid != 0) - fd = the_target->pt->multifs_open (hostio_fs_pid, filename, - flags, mode); + fd = the_target->multifs_open (hostio_fs_pid, filename, flags, mode); else fd = open (filename, flags, mode); @@ -540,7 +539,7 @@ handle_unlink (char *own_buf) } if (hostio_fs_pid != 0) - ret = the_target->pt->multifs_unlink (hostio_fs_pid, filename); + ret = the_target->multifs_unlink (hostio_fs_pid, filename); else ret = unlink (filename); @@ -570,9 +569,9 @@ handle_readlink (char *own_buf, int *new_packet_len) } if (hostio_fs_pid != 0) - ret = the_target->pt->multifs_readlink (hostio_fs_pid, filename, - linkname, - sizeof (linkname) - 1); + ret = the_target->multifs_readlink (hostio_fs_pid, filename, + linkname, + sizeof (linkname) - 1); else ret = readlink (filename, linkname, sizeof (linkname) - 1); diff --git a/gdbserver/linux-aarch32-low.c b/gdbserver/linux-aarch32-low.c index 41e018ab528..1ca0bfa8210 100644 --- a/gdbserver/linux-aarch32-low.c +++ b/gdbserver/linux-aarch32-low.c @@ -192,13 +192,13 @@ arm_breakpoint_at (CORE_ADDR where) /* Thumb mode. */ unsigned short insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 2); + the_target->read_memory (where, (unsigned char *) &insn, 2); if (insn == thumb_breakpoint) return 1; if (insn == thumb2_breakpoint[0]) { - the_target->pt->read_memory (where + 2, (unsigned char *) &insn, 2); + the_target->read_memory (where + 2, (unsigned char *) &insn, 2); if (insn == thumb2_breakpoint[1]) return 1; } @@ -208,7 +208,7 @@ arm_breakpoint_at (CORE_ADDR where) /* ARM mode. */ unsigned long insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 4); + the_target->read_memory (where, (unsigned char *) &insn, 4); if (insn == arm_abi_breakpoint) return 1; diff --git a/gdbserver/linux-aarch64-low.c b/gdbserver/linux-aarch64-low.c index 97117f05780..6ce5452945e 100644 --- a/gdbserver/linux-aarch64-low.c +++ b/gdbserver/linux-aarch64-low.c @@ -192,8 +192,8 @@ aarch64_breakpoint_at (CORE_ADDR where) { gdb_byte insn[aarch64_breakpoint_len]; - the_target->pt->read_memory (where, (unsigned char *) &insn, - aarch64_breakpoint_len); + the_target->read_memory (where, (unsigned char *) &insn, + aarch64_breakpoint_len); if (memcmp (insn, aarch64_breakpoint, aarch64_breakpoint_len) == 0) return 1; diff --git a/gdbserver/linux-arm-low.c b/gdbserver/linux-arm-low.c index e7cc1196857..f60543eae94 100644 --- a/gdbserver/linux-arm-low.c +++ b/gdbserver/linux-arm-low.c @@ -779,15 +779,15 @@ arm_sigreturn_next_pc (struct regcache *regcache, int svc_number, gdb_assert (svc_number == __NR_sigreturn || svc_number == __NR_rt_sigreturn); collect_register_by_name (regcache, "sp", &sp); - the_target->pt->read_memory (sp, (unsigned char *) &sp_data, 4); + the_target->read_memory (sp, (unsigned char *) &sp_data, 4); pc_offset = arm_linux_sigreturn_next_pc_offset (sp, sp_data, svc_number, __NR_sigreturn == svc_number ? 1 : 0); - the_target->pt->read_memory (sp + pc_offset, (unsigned char *) &next_pc, 4); + the_target->read_memory (sp + pc_offset, (unsigned char *) &next_pc, 4); /* Set IS_THUMB according the CPSR saved on the stack. */ - the_target->pt->read_memory (sp + pc_offset + 4, (unsigned char *) &cpsr, 4); + the_target->read_memory (sp + pc_offset + 4, (unsigned char *) &cpsr, 4); *is_thumb = ((cpsr & CPSR_T) != 0); return next_pc; @@ -939,7 +939,7 @@ arm_get_syscall_trapinfo (struct regcache *regcache, int *sysno) collect_register_by_name (regcache, "pc", &pc); - if (the_target->pt->read_memory (pc - 4, (unsigned char *) &insn, 4)) + if (the_target->read_memory (pc - 4, (unsigned char *) &insn, 4)) *sysno = UNKNOWN_SYSCALL; else { diff --git a/gdbserver/linux-cris-low.c b/gdbserver/linux-cris-low.c index 6a4e8b1946a..81d84a1b5c8 100644 --- a/gdbserver/linux-cris-low.c +++ b/gdbserver/linux-cris-low.c @@ -76,8 +76,8 @@ cris_breakpoint_at (CORE_ADDR where) { unsigned short insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, - cris_breakpoint_len); + the_target->read_memory (where, (unsigned char *) &insn, + cris_breakpoint_len); if (insn == cris_breakpoint) return 1; diff --git a/gdbserver/linux-crisv32-low.c b/gdbserver/linux-crisv32-low.c index fe12624c3b6..06135efcfa2 100644 --- a/gdbserver/linux-crisv32-low.c +++ b/gdbserver/linux-crisv32-low.c @@ -72,8 +72,8 @@ cris_breakpoint_at (CORE_ADDR where) { unsigned short insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, - cris_breakpoint_len); + the_target->read_memory (where, (unsigned char *) &insn, + cris_breakpoint_len); if (insn == cris_breakpoint) return 1; diff --git a/gdbserver/linux-low.c b/gdbserver/linux-low.c index 87cf2fd8afb..93892aaf3af 100644 --- a/gdbserver/linux-low.c +++ b/gdbserver/linux-low.c @@ -703,7 +703,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat) syscalls_to_catch = std::move (proc->syscalls_to_catch); /* Delete the execing process and all its threads. */ - the_target->pt->mourn (proc); + the_target->mourn (proc); current_thread = NULL; /* Create a new process/lwp/thread. */ @@ -3218,8 +3218,8 @@ linux_wait_1 (ptid_t ptid, CORE_ADDR stop_pc = event_child->stop_pc; breakpoint_kind = - the_target->pt->breakpoint_kind_from_current_state (&stop_pc); - the_target->pt->sw_breakpoint_from_kind (breakpoint_kind, &increment_pc); + the_target->breakpoint_kind_from_current_state (&stop_pc); + the_target->sw_breakpoint_from_kind (breakpoint_kind, &increment_pc); if (debug_threads) { @@ -5712,7 +5712,7 @@ linux_process_target::store_registers (regcache *regcache, int regno) static int linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) { - return the_target->pt->read_memory (memaddr, myaddr, len); + return the_target->read_memory (memaddr, myaddr, len); } /* Copy LEN bytes from inferior's memory starting at MEMADDR @@ -7361,7 +7361,7 @@ linux_process_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr) if (the_low_target.breakpoint_kind_from_pc != NULL) return (*the_low_target.breakpoint_kind_from_pc) (pcptr); else - return process_target::breakpoint_kind_from_pc (pcptr); + return process_stratum_target::breakpoint_kind_from_pc (pcptr); } /* Implementation of the target_ops method "sw_breakpoint_from_kind". */ @@ -7461,7 +7461,7 @@ linux_get_auxv (int wordsize, CORE_ADDR match, CORE_ADDR *valp) gdb_assert (wordsize == 4 || wordsize == 8); - while (the_target->pt->read_auxv (offset, data, 2 * wordsize) == 2 * wordsize) + while (the_target->read_auxv (offset, data, 2 * wordsize) == 2 * wordsize) { if (wordsize == 4) { @@ -7508,10 +7508,6 @@ linux_get_hwcap2 (int wordsize) return hwcap2; } -/* The linux target ops object. */ - -static linux_process_target the_linux_target; - #ifdef HAVE_LINUX_REGSETS void initialize_regsets_info (struct regsets_info *info) @@ -7529,8 +7525,7 @@ initialize_low (void) struct sigaction sigchld_action; memset (&sigchld_action, 0, sizeof (sigchld_action)); - the_target.reset (new process_stratum_target); - the_target->pt = &the_linux_target; + the_target.reset (new linux_process_target); linux_ptrace_init_warnings (); linux_proc_init_warnings (); diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index b1960645939..cf961b54f9a 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -266,7 +266,7 @@ extern struct linux_target_ops the_low_target; /* Target ops definitions for a Linux target. */ -class linux_process_target : public process_target { +class linux_process_target : public process_stratum_target { public: int create_inferior (const char *program, diff --git a/gdbserver/linux-m32r-low.c b/gdbserver/linux-m32r-low.c index 8fe8389618f..74e0f3f74c6 100644 --- a/gdbserver/linux-m32r-low.c +++ b/gdbserver/linux-m32r-low.c @@ -70,8 +70,8 @@ m32r_breakpoint_at (CORE_ADDR where) { unsigned short insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, - m32r_breakpoint_len); + the_target->read_memory (where, (unsigned char *) &insn, + m32r_breakpoint_len); if (insn == m32r_breakpoint) return 1; diff --git a/gdbserver/linux-mips-low.c b/gdbserver/linux-mips-low.c index cb7eb53e3eb..3caab02e503 100644 --- a/gdbserver/linux-mips-low.c +++ b/gdbserver/linux-mips-low.c @@ -302,7 +302,7 @@ mips_breakpoint_at (CORE_ADDR where) { unsigned int insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 4); + the_target->read_memory (where, (unsigned char *) &insn, 4); if (insn == mips_breakpoint) return 1; diff --git a/gdbserver/linux-nios2-low.c b/gdbserver/linux-nios2-low.c index 6e5d3084dad..a8bb87a390e 100644 --- a/gdbserver/linux-nios2-low.c +++ b/gdbserver/linux-nios2-low.c @@ -131,12 +131,12 @@ nios2_breakpoint_at (CORE_ADDR where) /* For R2, first check for the 2-byte CDX trap.n breakpoint encoding. */ #if defined(__nios2_arch__) && __nios2_arch__ == 2 - the_target->pt->read_memory (where, (unsigned char *) &insn, 2); + the_target->read_memory (where, (unsigned char *) &insn, 2); if (insn == CDX_BREAKPOINT) return 1; #endif - the_target->pt->read_memory (where, (unsigned char *) &insn, 4); + the_target->read_memory (where, (unsigned char *) &insn, 4); if (insn == nios2_breakpoint) return 1; return 0; diff --git a/gdbserver/linux-ppc-low.c b/gdbserver/linux-ppc-low.c index 93b3511a2e1..fd6d0369c48 100644 --- a/gdbserver/linux-ppc-low.c +++ b/gdbserver/linux-ppc-low.c @@ -277,7 +277,7 @@ ppc_breakpoint_at (CORE_ADDR where) { unsigned int insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 4); + the_target->read_memory (where, (unsigned char *) &insn, 4); if (insn == ppc_breakpoint) return 1; /* If necessary, recognize more trap instructions here. GDB only uses diff --git a/gdbserver/linux-sh-low.c b/gdbserver/linux-sh-low.c index 06ce8118ebf..f55402c3d41 100644 --- a/gdbserver/linux-sh-low.c +++ b/gdbserver/linux-sh-low.c @@ -76,7 +76,7 @@ sh_breakpoint_at (CORE_ADDR where) { unsigned short insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 2); + the_target->read_memory (where, (unsigned char *) &insn, 2); if (insn == sh_breakpoint) return 1; diff --git a/gdbserver/linux-sparc-low.c b/gdbserver/linux-sparc-low.c index b0b6c96b3de..e6cb43209af 100644 --- a/gdbserver/linux-sparc-low.c +++ b/gdbserver/linux-sparc-low.c @@ -133,7 +133,7 @@ sparc_fill_gregset_to_stack (struct regcache *regcache, const void *buf) for (i = l0_regno; i <= i7_regno; i++) { collect_register (regcache, i, tmp_reg_buf); - the_target->pt->write_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); + the_target->write_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); addr += sizeof (tmp_reg_buf); } } @@ -184,7 +184,7 @@ sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf) for (i = l0_regno; i <= i7_regno; i++) { - the_target->pt->read_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); + the_target->read_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); supply_register (regcache, i, tmp_reg_buf); addr += sizeof (tmp_reg_buf); } @@ -242,7 +242,7 @@ sparc_breakpoint_at (CORE_ADDR where) { unsigned char insn[INSN_SIZE]; - the_target->pt->read_memory (where, (unsigned char *) insn, sizeof (insn)); + the_target->read_memory (where, (unsigned char *) insn, sizeof (insn)); if (memcmp (sparc_breakpoint, insn, sizeof (insn)) == 0) return 1; diff --git a/gdbserver/linux-tic6x-low.c b/gdbserver/linux-tic6x-low.c index b57f8c57710..ca7c983a8ac 100644 --- a/gdbserver/linux-tic6x-low.c +++ b/gdbserver/linux-tic6x-low.c @@ -241,7 +241,7 @@ tic6x_breakpoint_at (CORE_ADDR where) { unsigned int insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 4); + the_target->read_memory (where, (unsigned char *) &insn, 4); if (insn == tic6x_breakpoint) return 1; diff --git a/gdbserver/linux-tile-low.c b/gdbserver/linux-tile-low.c index baee93a5c24..1fe77a3fa57 100644 --- a/gdbserver/linux-tile-low.c +++ b/gdbserver/linux-tile-low.c @@ -85,7 +85,7 @@ tile_breakpoint_at (CORE_ADDR where) { uint64_t insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, 8); + the_target->read_memory (where, (unsigned char *) &insn, 8); if (insn == tile_breakpoint) return 1; diff --git a/gdbserver/linux-x86-low.c b/gdbserver/linux-x86-low.c index cb2d3f59580..96818b85a86 100644 --- a/gdbserver/linux-x86-low.c +++ b/gdbserver/linux-x86-low.c @@ -515,7 +515,7 @@ x86_breakpoint_at (CORE_ADDR pc) { unsigned char c; - the_target->pt->read_memory (pc, &c, 1); + the_target->read_memory (pc, &c, 1); if (c == 0xCC) return 1; diff --git a/gdbserver/linux-xtensa-low.c b/gdbserver/linux-xtensa-low.c index 31e7bad36b8..510c9bd8879 100644 --- a/gdbserver/linux-xtensa-low.c +++ b/gdbserver/linux-xtensa-low.c @@ -207,8 +207,8 @@ xtensa_breakpoint_at (CORE_ADDR where) { unsigned long insn; - the_target->pt->read_memory (where, (unsigned char *) &insn, - xtensa_breakpoint_len); + the_target->read_memory (where, (unsigned char *) &insn, + xtensa_breakpoint_len); return memcmp((char *) &insn, xtensa_breakpoint, xtensa_breakpoint_len) == 0; } diff --git a/gdbserver/lynx-low.c b/gdbserver/lynx-low.c index 1377ccaf4ae..a7a0a96a6eb 100644 --- a/gdbserver/lynx-low.c +++ b/gdbserver/lynx-low.c @@ -735,15 +735,10 @@ lynx_process_target::sw_breakpoint_from_kind (int kind, int *size) return nullptr; } -/* The LynxOS target ops object. */ - -static lynx_process_target the_lynx_target; - void initialize_low (void) { - the_target.reset (new process_stratum_target); - the_target->pt = &the_lynx_target; + the_target.reset (new lynx_process_target); the_low_target.arch_setup (); } diff --git a/gdbserver/lynx-low.h b/gdbserver/lynx-low.h index d4d265ca2f3..5a2c601e86e 100644 --- a/gdbserver/lynx-low.h +++ b/gdbserver/lynx-low.h @@ -54,7 +54,7 @@ extern struct lynx_target_ops the_low_target; /* Target ops definitions for a LynxOS target. */ -class lynx_process_target : public process_target { +class lynx_process_target : public process_stratum_target { public: int create_inferior (const char *program, diff --git a/gdbserver/mem-break.c b/gdbserver/mem-break.c index 3802d72a573..6b7af3a7d33 100644 --- a/gdbserver/mem-break.c +++ b/gdbserver/mem-break.c @@ -223,7 +223,7 @@ bp_size (struct raw_breakpoint *bp) { int size = 0; - the_target->pt->sw_breakpoint_from_kind (bp->kind, &size); + the_target->sw_breakpoint_from_kind (bp->kind, &size); return size; } @@ -234,7 +234,7 @@ bp_opcode (struct raw_breakpoint *bp) { int size = 0; - return the_target->pt->sw_breakpoint_from_kind (bp->kind, &size); + return the_target->sw_breakpoint_from_kind (bp->kind, &size); } /* See mem-break.h. */ @@ -380,8 +380,8 @@ insert_memory_breakpoint (struct raw_breakpoint *bp) { memcpy (bp->old_data, buf, bp_size (bp)); - err = the_target->pt->write_memory (bp->pc, bp_opcode (bp), - bp_size (bp)); + err = the_target->write_memory (bp->pc, bp_opcode (bp), + bp_size (bp)); if (err != 0) { if (debug_threads) @@ -460,7 +460,7 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind, if (!bp->inserted) { - *err = the_target->pt->insert_point (bp->raw_type, bp->pc, bp->kind, bp); + *err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp); if (*err != 0) { if (debug_threads) @@ -890,8 +890,8 @@ delete_raw_breakpoint (struct process_info *proc, struct raw_breakpoint *todel) *bp_link = bp->next; - ret = the_target->pt->remove_point (bp->raw_type, bp->pc, - bp->kind, bp); + ret = the_target->remove_point (bp->raw_type, bp->pc, + bp->kind, bp); if (ret != 0) { /* Something went wrong, relink the breakpoint. */ @@ -1005,7 +1005,7 @@ static int z_type_supported (char z_type) { return (z_type >= '0' && z_type <= '4' - && the_target->pt->supports_z_point_type (z_type)); + && the_target->supports_z_point_type (z_type)); } /* Create a new GDB breakpoint of type Z_TYPE at ADDR with kind KIND. @@ -1532,7 +1532,7 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp) bp->inserted = 0; - err = the_target->pt->remove_point (bp->raw_type, bp->pc, bp->kind, bp); + err = the_target->remove_point (bp->raw_type, bp->pc, bp->kind, bp); if (err != 0) { bp->inserted = 1; @@ -1621,7 +1621,7 @@ reinsert_raw_breakpoint (struct raw_breakpoint *bp) if (bp->inserted) return; - err = the_target->pt->insert_point (bp->raw_type, bp->pc, bp->kind, bp); + err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp); if (err == 0) bp->inserted = 1; else if (debug_threads) @@ -1856,7 +1856,7 @@ validate_inserted_breakpoint (struct raw_breakpoint *bp) gdb_assert (bp->raw_type == raw_bkpt_type_sw); buf = (unsigned char *) alloca (bp_size (bp)); - err = the_target->pt->read_memory (bp->pc, buf, bp_size (bp)); + err = the_target->read_memory (bp->pc, buf, bp_size (bp)); if (err || memcmp (buf, bp_opcode (bp), bp_size (bp)) != 0) { /* Tag it as gone. */ diff --git a/gdbserver/nto-low.c b/gdbserver/nto-low.c index bbcc5046659..072a74bc738 100644 --- a/gdbserver/nto-low.c +++ b/gdbserver/nto-low.c @@ -942,10 +942,6 @@ nto_process_target::sw_breakpoint_from_kind (int kind, int *size) return the_low_target.breakpoint; } -/* The QNX Neutrino target ops object. */ - -static nto_process_target the_nto_target; - /* Global function called by server.c. Initializes QNX Neutrino gdbserver. */ @@ -955,8 +951,7 @@ initialize_low (void) sigset_t set; TRACE ("%s\n", __func__); - the_target.reset (new process_stratum_target); - the_target->pt = &the_nto_target; + the_target.reset (new nto_process_target); /* We use SIGUSR1 to gain control after we block waiting for a process. We use sigwaitevent to wait. */ diff --git a/gdbserver/nto-low.h b/gdbserver/nto-low.h index be4634079ad..189b6713b37 100644 --- a/gdbserver/nto-low.h +++ b/gdbserver/nto-low.h @@ -44,7 +44,7 @@ extern struct nto_target_ops the_low_target; /* Target ops definitions for a QNX Neutrino target. */ -class nto_process_target : public process_target { +class nto_process_target : public process_stratum_target { public: int create_inferior (const char *program, diff --git a/gdbserver/regcache.c b/gdbserver/regcache.c index ec9d70d42fb..33d38879dc6 100644 --- a/gdbserver/regcache.c +++ b/gdbserver/regcache.c @@ -477,13 +477,13 @@ collect_register_by_name (struct regcache *regcache, CORE_ADDR regcache_read_pc (struct regcache *regcache) { - return the_target->pt->read_pc (regcache); + return the_target->read_pc (regcache); } void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc) { - the_target->pt->write_pc (regcache, pc); + the_target->write_pc (regcache, pc); } #endif diff --git a/gdbserver/remote-utils.c b/gdbserver/remote-utils.c index 14e89332db4..712ac963653 100644 --- a/gdbserver/remote-utils.c +++ b/gdbserver/remote-utils.c @@ -710,7 +710,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif) /* Check for an input interrupt while we're here. */ if (cc == '\003' && current_thread != NULL) - the_target->pt->request_interrupt (); + the_target->request_interrupt (); } while (cc != '+'); @@ -779,7 +779,7 @@ input_interrupt (int unused) return; } - the_target->pt->request_interrupt (); + the_target->request_interrupt (); } } @@ -986,7 +986,7 @@ getpkt (char *buf) check for an input interrupt. */ if (c == '\003') { - the_target->pt->request_interrupt (); + the_target->request_interrupt (); continue; } @@ -1076,7 +1076,7 @@ getpkt (char *buf) { /* Consume the interrupt character in the buffer. */ readchar (); - the_target->pt->request_interrupt (); + the_target->request_interrupt (); } return bp - buf; @@ -1214,7 +1214,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, regcache = get_thread_regcache (current_thread, 1); - if (the_target->pt->stopped_by_watchpoint ()) + if (the_target->stopped_by_watchpoint ()) { CORE_ADDR addr; int i; @@ -1222,7 +1222,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, memcpy (buf, "watch:", 6); buf += 6; - addr = the_target->pt->stopped_data_address (); + addr = the_target->stopped_data_address (); /* Convert each byte of the address into two hexadecimal chars. Note that we take sizeof (void *) instead of diff --git a/gdbserver/server.c b/gdbserver/server.c index 00456d8d7ed..a4cb1eb4181 100644 --- a/gdbserver/server.c +++ b/gdbserver/server.c @@ -740,7 +740,7 @@ handle_general_set (char *own_buf) } req_str = req ? "non-stop" : "all-stop"; - if (the_target->pt->start_non_stop (req == 1) != 0) + if (the_target->start_non_stop (req == 1) != 0) { fprintf (stderr, "Setting %s mode failed\n", req_str); write_enn (own_buf); @@ -1234,7 +1234,7 @@ handle_detach (char *own_buf) debug_printf ("Forcing non-stop mode\n"); non_stop = true; - the_target->pt->start_non_stop (true); + the_target->start_non_stop (true); } process->gdb_detached = 1; @@ -1442,13 +1442,13 @@ handle_qxfer_auxv (const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { - if (!the_target->pt->supports_read_auxv () || writebuf != NULL) + if (!the_target->supports_read_auxv () || writebuf != NULL) return -2; if (annex[0] != '\0' || current_thread == NULL) return -1; - return the_target->pt->read_auxv (offset, readbuf, len); + return the_target->read_auxv (offset, readbuf, len); } /* Handle qXfer:exec-file:read. */ @@ -1462,7 +1462,7 @@ handle_qxfer_exec_file (const char *annex, ULONGEST pid; int total_len; - if (!the_target->pt->supports_pid_to_exec_file () || writebuf != NULL) + if (!the_target->supports_pid_to_exec_file () || writebuf != NULL) return -2; if (annex[0] == '\0') @@ -1482,7 +1482,7 @@ handle_qxfer_exec_file (const char *annex, if (pid <= 0) return -1; - file = the_target->pt->pid_to_exec_file (pid); + file = the_target->pid_to_exec_file (pid); if (file == NULL) return -1; @@ -1575,11 +1575,11 @@ handle_qxfer_libraries_svr4 (const char *annex, return -2; if (current_thread == NULL - || !the_target->pt->supports_qxfer_libraries_svr4 ()) + || !the_target->supports_qxfer_libraries_svr4 ()) return -1; - return the_target->pt->qxfer_libraries_svr4 (annex, readbuf, writebuf, - offset, len); + return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf, + offset, len); } /* Handle qXfer:osadata:read. */ @@ -1589,10 +1589,10 @@ handle_qxfer_osdata (const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { - if (!the_target->pt->supports_qxfer_osdata () || writebuf != NULL) + if (!the_target->supports_qxfer_osdata () || writebuf != NULL) return -2; - return the_target->pt->qxfer_osdata (annex, readbuf, NULL, offset, len); + return the_target->qxfer_osdata (annex, readbuf, NULL, offset, len); } /* Handle qXfer:siginfo:read and qXfer:siginfo:write. */ @@ -1602,13 +1602,13 @@ handle_qxfer_siginfo (const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { - if (!the_target->pt->supports_qxfer_siginfo ()) + if (!the_target->supports_qxfer_siginfo ()) return -2; if (annex[0] != '\0' || current_thread == NULL) return -1; - return the_target->pt->qxfer_siginfo (annex, readbuf, writebuf, offset, len); + return the_target->qxfer_siginfo (annex, readbuf, writebuf, offset, len); } /* Handle qXfer:statictrace:read. */ @@ -1794,13 +1794,13 @@ static int handle_qxfer_fdpic (const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { - if (!the_target->pt->supports_read_loadmap ()) + if (!the_target->supports_read_loadmap ()) return -2; if (current_thread == NULL) return -1; - return the_target->pt->read_loadmap (annex, offset, readbuf, len); + return the_target->read_loadmap (annex, offset, readbuf, len); } /* Handle qXfer:btrace:read. */ @@ -2195,7 +2195,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) tracepoint_look_up_symbols (); if (current_thread != NULL) - the_target->pt->look_up_symbols (); + the_target->look_up_symbols (); current_thread = save_thread; @@ -2236,13 +2236,13 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) } } - if (the_target->pt->supports_read_offsets () + if (the_target->supports_read_offsets () && strcmp ("qOffsets", own_buf) == 0) { CORE_ADDR text, data; require_running_or_return (own_buf); - if (the_target->pt->read_offsets (&text, &data)) + if (the_target->read_offsets (&text, &data)) sprintf (own_buf, "Text=%lX;Data=%lX;Bss=%lX", (long)text, (long)data, (long)data); else @@ -2366,7 +2366,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (target_supports_catch_syscall ()) strcat (own_buf, ";QCatchSyscalls+"); - if (the_target->pt->supports_qxfer_libraries_svr4 ()) + if (the_target->supports_qxfer_libraries_svr4 ()) strcat (own_buf, ";qXfer:libraries-svr4:read+" ";augmented-libraries-svr4-read+"); else @@ -2376,13 +2376,13 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) strcat (own_buf, ";qXfer:libraries:read+"); } - if (the_target->pt->supports_read_auxv ()) + if (the_target->supports_read_auxv ()) strcat (own_buf, ";qXfer:auxv:read+"); - if (the_target->pt->supports_qxfer_siginfo ()) + if (the_target->supports_qxfer_siginfo ()) strcat (own_buf, ";qXfer:siginfo:read+;qXfer:siginfo:write+"); - if (the_target->pt->supports_read_loadmap ()) + if (the_target->supports_read_loadmap ()) strcat (own_buf, ";qXfer:fdpic:read+"); /* We always report qXfer:features:read, as targets may @@ -2394,7 +2394,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (cs.transport_is_reliable) strcat (own_buf, ";QStartNoAckMode+"); - if (the_target->pt->supports_qxfer_osdata ()) + if (the_target->supports_qxfer_osdata ()) strcat (own_buf, ";qXfer:osdata:read+"); if (target_supports_multi_process ()) @@ -2452,7 +2452,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (target_supports_stopped_by_hw_breakpoint ()) strcat (own_buf, ";hwbreak+"); - if (the_target->pt->supports_pid_to_exec_file ()) + if (the_target->supports_pid_to_exec_file ()) strcat (own_buf, ";qXfer:exec-file:read+"); strcat (own_buf, ";vContSupported+"); @@ -2469,7 +2469,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) } /* Thread-local storage support. */ - if (the_target->pt->supports_get_tls_address () + if (the_target->supports_get_tls_address () && startswith (own_buf, "qGetTLSAddr:")) { char *p = own_buf + 12; @@ -2515,8 +2515,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (thread == NULL) err = 2; else - err = the_target->pt->get_tls_address (thread, parts[0], parts[1], - &address); + err = the_target->get_tls_address (thread, parts[0], parts[1], + &address); } if (err == 0) @@ -2534,7 +2534,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) } /* Windows OS Thread Information Block address support. */ - if (the_target->pt->supports_get_tib_address () + if (the_target->supports_get_tib_address () && startswith (own_buf, "qGetTIBAddr:")) { const char *annex; @@ -2542,7 +2542,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) CORE_ADDR tlb; ptid_t ptid = read_ptid (own_buf + 12, &annex); - n = the_target->pt->get_tib_address (ptid, &tlb); + n = the_target->get_tib_address (ptid, &tlb); if (n == 1) { strcpy (own_buf, paddress(tlb)); @@ -2579,7 +2579,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) write_ok (own_buf); - if (the_target->pt->handle_monitor_command (mon) == 0) + if (the_target->handle_monitor_command (mon) == 0) /* Default processing. */ handle_monitor_command (mon, own_buf); @@ -2848,7 +2848,7 @@ resume (struct thread_resume *actions, size_t num_actions) enable_async_io (); } - the_target->pt->resume (actions, num_actions); + the_target->resume (actions, num_actions); if (non_stop) write_ok (cs.own_buf); @@ -3089,7 +3089,7 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len) { if (strcmp (own_buf, "vCtrlC") == 0) { - the_target->pt->request_interrupt (); + the_target->request_interrupt (); write_ok (own_buf); return; } @@ -3219,7 +3219,7 @@ queue_stop_reply_callback (thread_info *thread) { /* For now, assume targets that don't have this callback also don't manage the thread's last_status field. */ - if (!the_target->pt->supports_thread_stopped ()) + if (!the_target->supports_thread_stopped ()) { struct vstop_notif *new_notif = new struct vstop_notif; @@ -3886,7 +3886,7 @@ captured_main (int argc, char *argv[]) down without informing GDB. */ if (!non_stop) { - if (the_target->pt->start_non_stop (true)) + if (the_target->start_non_stop (true)) non_stop = 1; /* Detaching implicitly resumes all threads; diff --git a/gdbserver/target.c b/gdbserver/target.c index 048fd5ad6e9..e72935d7c55 100644 --- a/gdbserver/target.c +++ b/gdbserver/target.c @@ -62,7 +62,7 @@ prepare_to_access_memory (void) it. */ prev_general_thread = cs.general_thread; - int res = the_target->pt->prepare_to_access_memory (); + int res = the_target->prepare_to_access_memory (); if (res != 0) return res; @@ -70,7 +70,7 @@ prepare_to_access_memory (void) { if (mythread_alive (thread->id)) { - if (stopped == NULL && the_target->pt->supports_thread_stopped () + if (stopped == NULL && the_target->supports_thread_stopped () && target_thread_stopped (thread)) stopped = thread; @@ -114,7 +114,7 @@ done_accessing_memory (void) { client_state &cs = get_client_state (); - the_target->pt->done_accessing_memory (); + the_target->done_accessing_memory (); /* Restore the previous selected thread. */ cs.general_thread = prev_general_thread; @@ -125,7 +125,7 @@ int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) { int res; - res = the_target->pt->read_memory (memaddr, myaddr, len); + res = the_target->read_memory (memaddr, myaddr, len); check_mem_read (memaddr, myaddr, len); return res; } @@ -156,7 +156,7 @@ target_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, update it. */ gdb::byte_vector buffer (myaddr, myaddr + len); check_mem_write (memaddr, buffer.data (), myaddr, len); - return the_target->pt->write_memory (memaddr, buffer.data (), len); + return the_target->write_memory (memaddr, buffer.data (), len); } ptid_t @@ -210,7 +210,7 @@ target_stop_and_wait (ptid_t ptid) resume_info.thread = ptid; resume_info.kind = resume_stop; resume_info.sig = GDB_SIGNAL_0; - the_target->pt->resume (&resume_info, 1); + the_target->resume (&resume_info, 1); non_stop = true; mywait (ptid, &status, 0, 0); @@ -222,7 +222,7 @@ target_stop_and_wait (ptid_t ptid) ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status, int options) { - return the_target->pt->wait (ptid, status, options); + return the_target->wait (ptid, status, options); } /* See target/target.h. */ @@ -230,7 +230,7 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, int options) void target_mourn_inferior (ptid_t ptid) { - the_target->pt->mourn (find_process_pid (ptid.pid ())); + the_target->mourn (find_process_pid (ptid.pid ())); } /* See target/target.h. */ @@ -243,7 +243,7 @@ target_continue_no_signal (ptid_t ptid) resume_info.thread = ptid; resume_info.kind = resume_continue; resume_info.sig = GDB_SIGNAL_0; - the_target->pt->resume (&resume_info, 1); + the_target->resume (&resume_info, 1); } /* See target/target.h. */ @@ -256,7 +256,7 @@ target_continue (ptid_t ptid, enum gdb_signal signal) resume_info.thread = ptid; resume_info.kind = resume_continue; resume_info.sig = gdb_signal_to_host (signal); - the_target->pt->resume (&resume_info, 1); + the_target->resume (&resume_info, 1); } /* See target/target.h. */ @@ -264,7 +264,7 @@ target_continue (ptid_t ptid, enum gdb_signal signal) int target_supports_multi_process (void) { - return the_target->pt->supports_multi_process (); + return the_target->supports_multi_process (); } /* Convert pid to printable format. */ @@ -296,7 +296,7 @@ kill_inferior (process_info *proc) { gdb_agent_about_to_close (proc->pid); - return the_target->pt->kill (proc); + return the_target->kill (proc); } /* Define it. */ @@ -351,177 +351,183 @@ target_terminal::info (const char *arg, int from_tty) See target.h for definitions. */ void -process_target::post_create_inferior () +process_stratum_target::post_create_inferior () { /* Nop. */ } int -process_target::prepare_to_access_memory () +process_stratum_target::prepare_to_access_memory () { return 0; } void -process_target::done_accessing_memory () +process_stratum_target::done_accessing_memory () { /* Nop. */ } void -process_target::look_up_symbols () +process_stratum_target::look_up_symbols () { /* Nop. */ } bool -process_target::supports_read_auxv () +process_stratum_target::supports_read_auxv () { return false; } int -process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr, - unsigned int len) +process_stratum_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr, + unsigned int len) { gdb_assert_not_reached ("target op read_auxv not supported"); } bool -process_target::supports_z_point_type (char z_type) +process_stratum_target::supports_z_point_type (char z_type) { return false; } int -process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr, - int size, raw_breakpoint *bp) +process_stratum_target::insert_point (enum raw_bkpt_type type, + CORE_ADDR addr, + int size, raw_breakpoint *bp) { return 1; } int -process_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr, - int size, raw_breakpoint *bp) +process_stratum_target::remove_point (enum raw_bkpt_type type, + CORE_ADDR addr, + int size, raw_breakpoint *bp) { return 1; } bool -process_target::stopped_by_sw_breakpoint () +process_stratum_target::stopped_by_sw_breakpoint () { return false; } bool -process_target::supports_stopped_by_sw_breakpoint () +process_stratum_target::supports_stopped_by_sw_breakpoint () { return false; } bool -process_target::stopped_by_hw_breakpoint () +process_stratum_target::stopped_by_hw_breakpoint () { return false; } bool -process_target::supports_stopped_by_hw_breakpoint () +process_stratum_target::supports_stopped_by_hw_breakpoint () { return false; } bool -process_target::supports_hardware_single_step () +process_stratum_target::supports_hardware_single_step () { return false; } bool -process_target::stopped_by_watchpoint () +process_stratum_target::stopped_by_watchpoint () { return false; } CORE_ADDR -process_target::stopped_data_address () +process_stratum_target::stopped_data_address () { return 0; } bool -process_target::supports_read_offsets () +process_stratum_target::supports_read_offsets () { return false; } int -process_target::read_offsets (CORE_ADDR *text, CORE_ADDR *data) +process_stratum_target::read_offsets (CORE_ADDR *text, CORE_ADDR *data) { gdb_assert_not_reached ("target op read_offsets not supported"); } bool -process_target::supports_get_tls_address () +process_stratum_target::supports_get_tls_address () { return false; } int -process_target::get_tls_address (thread_info *thread, CORE_ADDR offset, - CORE_ADDR load_module, CORE_ADDR *address) +process_stratum_target::get_tls_address (thread_info *thread, + CORE_ADDR offset, + CORE_ADDR load_module, + CORE_ADDR *address) { gdb_assert_not_reached ("target op get_tls_address not supported"); } void -process_target::hostio_last_error (char *buf) +process_stratum_target::hostio_last_error (char *buf) { hostio_last_error_from_errno (buf); } bool -process_target::supports_qxfer_osdata () +process_stratum_target::supports_qxfer_osdata () { return false; } int -process_target::qxfer_osdata (const char *annex, unsigned char *readbuf, - unsigned const char *writebuf, - CORE_ADDR offset, int len) +process_stratum_target::qxfer_osdata (const char *annex, + unsigned char *readbuf, + unsigned const char *writebuf, + CORE_ADDR offset, int len) { gdb_assert_not_reached ("target op qxfer_osdata not supported"); } bool -process_target::supports_qxfer_siginfo () +process_stratum_target::supports_qxfer_siginfo () { return false; } int -process_target::qxfer_siginfo (const char *annex, unsigned char *readbuf, - unsigned const char *writebuf, - CORE_ADDR offset, int len) +process_stratum_target::qxfer_siginfo (const char *annex, + unsigned char *readbuf, + unsigned const char *writebuf, + CORE_ADDR offset, int len) { gdb_assert_not_reached ("target op qxfer_siginfo not supported"); } bool -process_target::supports_non_stop () +process_stratum_target::supports_non_stop () { return false; } bool -process_target::async (bool enable) +process_stratum_target::async (bool enable) { return false; } int -process_target::start_non_stop (bool enable) +process_stratum_target::start_non_stop (bool enable) { if (enable) return -1; @@ -530,134 +536,136 @@ process_target::start_non_stop (bool enable) } bool -process_target::supports_multi_process () +process_stratum_target::supports_multi_process () { return false; } bool -process_target::supports_fork_events () +process_stratum_target::supports_fork_events () { return false; } bool -process_target::supports_vfork_events () +process_stratum_target::supports_vfork_events () { return false; } bool -process_target::supports_exec_events () +process_stratum_target::supports_exec_events () { return false; } void -process_target::handle_new_gdb_connection () +process_stratum_target::handle_new_gdb_connection () { /* Nop. */ } int -process_target::handle_monitor_command (char *mon) +process_stratum_target::handle_monitor_command (char *mon) { return 0; } int -process_target::core_of_thread (ptid_t ptid) +process_stratum_target::core_of_thread (ptid_t ptid) { return -1; } bool -process_target::supports_read_loadmap () +process_stratum_target::supports_read_loadmap () { return false; } int -process_target::read_loadmap (const char *annex, CORE_ADDR offset, - unsigned char *myaddr, unsigned int len) +process_stratum_target::read_loadmap (const char *annex, + CORE_ADDR offset, + unsigned char *myaddr, + unsigned int len) { gdb_assert_not_reached ("target op read_loadmap not supported"); } void -process_target::process_qsupported (char **features, int count) +process_stratum_target::process_qsupported (char **features, int count) { /* Nop. */ } bool -process_target::supports_tracepoints () +process_stratum_target::supports_tracepoints () { return false; } CORE_ADDR -process_target::read_pc (regcache *regcache) +process_stratum_target::read_pc (regcache *regcache) { gdb_assert_not_reached ("regcache_read_pc: Unable to find PC"); } void -process_target::write_pc (regcache *regcache, CORE_ADDR pc) +process_stratum_target::write_pc (regcache *regcache, CORE_ADDR pc) { gdb_assert_not_reached ("regcache_write_pc: Unable to update PC"); } bool -process_target::supports_thread_stopped () +process_stratum_target::supports_thread_stopped () { return false; } bool -process_target::thread_stopped (thread_info *thread) +process_stratum_target::thread_stopped (thread_info *thread) { gdb_assert_not_reached ("target op thread_stopped not supported"); } bool -process_target::supports_get_tib_address () +process_stratum_target::supports_get_tib_address () { return false; } int -process_target::get_tib_address (ptid_t ptid, CORE_ADDR *address) +process_stratum_target::get_tib_address (ptid_t ptid, CORE_ADDR *address) { gdb_assert_not_reached ("target op get_tib_address not supported"); } void -process_target::pause_all (bool freeze) +process_stratum_target::pause_all (bool freeze) { /* Nop. */ } void -process_target::unpause_all (bool unfreeze) +process_stratum_target::unpause_all (bool unfreeze) { /* Nop. */ } void -process_target::stabilize_threads () +process_stratum_target::stabilize_threads () { /* Nop. */ } bool -process_target::supports_fast_tracepoints () +process_stratum_target::supports_fast_tracepoints () { return false; } int -process_target::install_fast_tracepoint_jump_pad ( +process_stratum_target::install_fast_tracepoint_jump_pad ( CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline, ULONGEST *trampoline_size, @@ -670,58 +678,58 @@ process_target::install_fast_tracepoint_jump_pad ( } int -process_target::get_min_fast_tracepoint_insn_len () +process_stratum_target::get_min_fast_tracepoint_insn_len () { return 0; } struct emit_ops * -process_target::emit_ops () +process_stratum_target::emit_ops () { return nullptr; } bool -process_target::supports_disable_randomization () +process_stratum_target::supports_disable_randomization () { return false; } bool -process_target::supports_qxfer_libraries_svr4 () +process_stratum_target::supports_qxfer_libraries_svr4 () { return false; } int -process_target::qxfer_libraries_svr4 (const char *annex, - unsigned char *readbuf, - unsigned const char *writebuf, - CORE_ADDR offset, int len) +process_stratum_target::qxfer_libraries_svr4 (const char *annex, + unsigned char *readbuf, + unsigned const char *writebuf, + CORE_ADDR offset, int len) { gdb_assert_not_reached ("target op qxfer_libraries_svr4 not supported"); } bool -process_target::supports_agent () +process_stratum_target::supports_agent () { return false; } btrace_target_info * -process_target::enable_btrace (ptid_t ptid, const btrace_config *conf) +process_stratum_target::enable_btrace (ptid_t ptid, const btrace_config *conf) { error (_("Target does not support branch tracing.")); } int -process_target::disable_btrace (btrace_target_info *tinfo) +process_stratum_target::disable_btrace (btrace_target_info *tinfo) { error (_("Target does not support branch tracing.")); } int -process_target::read_btrace (btrace_target_info *tinfo, +process_stratum_target::read_btrace (btrace_target_info *tinfo, buffer *buffer, enum btrace_read_type type) { @@ -729,58 +737,58 @@ process_target::read_btrace (btrace_target_info *tinfo, } int -process_target::read_btrace_conf (const btrace_target_info *tinfo, - buffer *buffer) +process_stratum_target::read_btrace_conf (const btrace_target_info *tinfo, + buffer *buffer) { error (_("Target does not support branch tracing.")); } bool -process_target::supports_range_stepping () +process_stratum_target::supports_range_stepping () { return false; } bool -process_target::supports_pid_to_exec_file () +process_stratum_target::supports_pid_to_exec_file () { return false; } char * -process_target::pid_to_exec_file (int pid) +process_stratum_target::pid_to_exec_file (int pid) { gdb_assert_not_reached ("target op pid_to_exec_file not supported"); } bool -process_target::supports_multifs () +process_stratum_target::supports_multifs () { return false; } int -process_target::multifs_open (int pid, const char *filename, - int flags, mode_t mode) +process_stratum_target::multifs_open (int pid, const char *filename, + int flags, mode_t mode) { return open (filename, flags, mode); } int -process_target::multifs_unlink (int pid, const char *filename) +process_stratum_target::multifs_unlink (int pid, const char *filename) { return unlink (filename); } ssize_t -process_target::multifs_readlink (int pid, const char *filename, - char *buf, size_t bufsiz) +process_stratum_target::multifs_readlink (int pid, const char *filename, + char *buf, size_t bufsiz) { return readlink (filename, buf, bufsiz); } int -process_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr) +process_stratum_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr) { /* The default behavior is to use the size of a breakpoint as the kind. */ @@ -790,38 +798,38 @@ process_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr) } int -process_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr) +process_stratum_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr) { return breakpoint_kind_from_pc (pcptr); } const char * -process_target::thread_name (ptid_t thread) +process_stratum_target::thread_name (ptid_t thread) { return nullptr; } bool -process_target::thread_handle (ptid_t ptid, gdb_byte **handle, - int *handle_len) +process_stratum_target::thread_handle (ptid_t ptid, gdb_byte **handle, + int *handle_len) { return false; } bool -process_target::supports_software_single_step () +process_stratum_target::supports_software_single_step () { return false; } bool -process_target::supports_catch_syscall () +process_stratum_target::supports_catch_syscall () { return false; } int -process_target::get_ipa_tdesc_idx () +process_stratum_target::get_ipa_tdesc_idx () { return 0; } diff --git a/gdbserver/target.h b/gdbserver/target.h index ac0ada0cd38..efdabaef580 100644 --- a/gdbserver/target.h +++ b/gdbserver/target.h @@ -63,21 +63,13 @@ struct thread_resume CORE_ADDR step_range_end; /* Exclusive */ }; -class process_target; - /* GDBserver doesn't have a concept of strata like GDB, but we call its target vector "process_stratum" anyway for the benefit of shared code. */ -struct process_stratum_target -{ - /* The object that will gradually replace this struct. */ - process_target *pt; -}; - -class process_target { +class process_stratum_target { public: - virtual ~process_target () = default; + virtual ~process_stratum_target () = default; /* Start a new process. @@ -509,78 +501,78 @@ public: extern std::unique_ptr the_target; #define target_create_inferior(program, program_args) \ - the_target->pt->create_inferior (program, program_args) + the_target->create_inferior (program, program_args) #define target_post_create_inferior() \ - the_target->pt->post_create_inferior () + the_target->post_create_inferior () #define myattach(pid) \ - the_target->pt->attach (pid) + the_target->attach (pid) int kill_inferior (process_info *proc); #define target_supports_fork_events() \ - the_target->pt->supports_fork_events () + the_target->supports_fork_events () #define target_supports_vfork_events() \ - the_target->pt->supports_vfork_events () + the_target->supports_vfork_events () #define target_supports_exec_events() \ - the_target->pt->supports_exec_events () + the_target->supports_exec_events () #define target_handle_new_gdb_connection() \ - the_target->pt->handle_new_gdb_connection () + the_target->handle_new_gdb_connection () #define detach_inferior(proc) \ - the_target->pt->detach (proc) + the_target->detach (proc) #define mythread_alive(pid) \ - the_target->pt->thread_alive (pid) + the_target->thread_alive (pid) #define fetch_inferior_registers(regcache, regno) \ - the_target->pt->fetch_registers (regcache, regno) + the_target->fetch_registers (regcache, regno) #define store_inferior_registers(regcache, regno) \ - the_target->pt->store_registers (regcache, regno) + the_target->store_registers (regcache, regno) #define join_inferior(pid) \ - the_target->pt->join (pid) + the_target->join (pid) #define target_supports_non_stop() \ - the_target->pt->supports_non_stop () + the_target->supports_non_stop () #define target_async(enable) \ - the_target->pt->async (enable) + the_target->async (enable) #define target_process_qsupported(features, count) \ - the_target->pt->process_qsupported (features, count) + the_target->process_qsupported (features, count) #define target_supports_catch_syscall() \ - the_target->pt->supports_catch_syscall () + the_target->supports_catch_syscall () #define target_get_ipa_tdesc_idx() \ - the_target->pt->get_ipa_tdesc_idx () + the_target->get_ipa_tdesc_idx () #define target_supports_tracepoints() \ - the_target->pt->supports_tracepoints () + the_target->supports_tracepoints () #define target_supports_fast_tracepoints() \ - the_target->pt->supports_fast_tracepoints () + the_target->supports_fast_tracepoints () #define target_get_min_fast_tracepoint_insn_len() \ - the_target->pt->get_min_fast_tracepoint_insn_len () + the_target->get_min_fast_tracepoint_insn_len () #define target_thread_stopped(thread) \ - the_target->pt->thread_stopped (thread) + the_target->thread_stopped (thread) #define target_pause_all(freeze) \ - the_target->pt->pause_all (freeze) + the_target->pause_all (freeze) #define target_unpause_all(unfreeze) \ - the_target->pt->unpause_all (unfreeze) + the_target->unpause_all (unfreeze) #define target_stabilize_threads() \ - the_target->pt->stabilize_threads () + the_target->stabilize_threads () #define target_install_fast_tracepoint_jump_pad(tpoint, tpaddr, \ collector, lockaddr, \ @@ -592,36 +584,36 @@ int kill_inferior (process_info *proc); adjusted_insn_addr, \ adjusted_insn_addr_end, \ err) \ - the_target->pt->install_fast_tracepoint_jump_pad (tpoint, tpaddr, \ - collector,lockaddr, \ - orig_size, jump_entry, \ - trampoline, \ - trampoline_size, \ - jjump_pad_insn, \ - jjump_pad_insn_size, \ - adjusted_insn_addr, \ - adjusted_insn_addr_end, \ - err) + the_target->install_fast_tracepoint_jump_pad (tpoint, tpaddr, \ + collector,lockaddr, \ + orig_size, jump_entry, \ + trampoline, \ + trampoline_size, \ + jjump_pad_insn, \ + jjump_pad_insn_size, \ + adjusted_insn_addr, \ + adjusted_insn_addr_end, \ + err) #define target_emit_ops() \ - the_target->pt->emit_ops () + the_target->emit_ops () #define target_supports_disable_randomization() \ - the_target->pt->supports_disable_randomization () + the_target->supports_disable_randomization () #define target_supports_agent() \ - the_target->pt->supports_agent () + the_target->supports_agent () static inline struct btrace_target_info * target_enable_btrace (ptid_t ptid, const struct btrace_config *conf) { - return the_target->pt->enable_btrace (ptid, conf); + return the_target->enable_btrace (ptid, conf); } static inline int target_disable_btrace (struct btrace_target_info *tinfo) { - return the_target->pt->disable_btrace (tinfo); + return the_target->disable_btrace (tinfo); } static inline int @@ -629,42 +621,42 @@ target_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer, enum btrace_read_type type) { - return the_target->pt->read_btrace (tinfo, buffer, type); + return the_target->read_btrace (tinfo, buffer, type); } static inline int target_read_btrace_conf (struct btrace_target_info *tinfo, struct buffer *buffer) { - return the_target->pt->read_btrace_conf (tinfo, buffer); + return the_target->read_btrace_conf (tinfo, buffer); } #define target_supports_range_stepping() \ - the_target->pt->supports_range_stepping () + the_target->supports_range_stepping () #define target_supports_stopped_by_sw_breakpoint() \ - the_target->pt->supports_stopped_by_sw_breakpoint () + the_target->supports_stopped_by_sw_breakpoint () #define target_stopped_by_sw_breakpoint() \ - the_target->pt->stopped_by_sw_breakpoint () + the_target->stopped_by_sw_breakpoint () #define target_supports_stopped_by_hw_breakpoint() \ - the_target->pt->supports_stopped_by_hw_breakpoint () + the_target->supports_stopped_by_hw_breakpoint () #define target_supports_hardware_single_step() \ - the_target->pt->supports_hardware_single_step () + the_target->supports_hardware_single_step () #define target_stopped_by_hw_breakpoint() \ - the_target->pt->stopped_by_hw_breakpoint () + the_target->stopped_by_hw_breakpoint () #define target_breakpoint_kind_from_pc(pcptr) \ - the_target->pt->breakpoint_kind_from_pc (pcptr) + the_target->breakpoint_kind_from_pc (pcptr) #define target_breakpoint_kind_from_current_state(pcptr) \ - the_target->pt->breakpoint_kind_from_current_state (pcptr) + the_target->breakpoint_kind_from_current_state (pcptr) #define target_supports_software_single_step() \ - the_target->pt->supports_software_single_step () + the_target->supports_software_single_step () ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options, int connected_wait); @@ -676,13 +668,13 @@ int prepare_to_access_memory (void); void done_accessing_memory (void); #define target_core_of_thread(ptid) \ - the_target->pt->core_of_thread (ptid) + the_target->core_of_thread (ptid) #define target_thread_name(ptid) \ - the_target->pt->thread_name (ptid) + the_target->thread_name (ptid) #define target_thread_handle(ptid, handle, handle_len) \ - the_target->pt->thread_handle (ptid, handle, handle_len) + the_target->thread_handle (ptid, handle, handle_len) int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len); diff --git a/gdbserver/win32-low.c b/gdbserver/win32-low.c index 5b4dd36f5d0..c112aceae87 100644 --- a/gdbserver/win32-low.c +++ b/gdbserver/win32-low.c @@ -378,7 +378,7 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached) { struct target_waitstatus status; - the_target->pt->wait (minus_one_ptid, &status, 0); + the_target->wait (minus_one_ptid, &status, 0); /* Note win32_wait doesn't return thread events. */ if (status.kind != TARGET_WAITKIND_LOADED) @@ -1843,15 +1843,10 @@ win32_process_target::sw_breakpoint_from_kind (int kind, int *size) return the_low_target.breakpoint; } -/* The win32 target ops object. */ - -static win32_process_target the_win32_target; - /* Initialize the Win32 backend. */ void initialize_low (void) { - the_target.reset (new process_stratum_target); - the_target->pt = &the_win32_target; + the_target.reset (new win32_process_target); the_low_target.arch_setup (); } diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index dc0bdcc714a..03d6dd1d569 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -103,7 +103,7 @@ extern struct win32_target_ops the_low_target; /* Target ops definitions for a Win32 target. */ -class win32_process_target : public process_target { +class win32_process_target : public process_stratum_target { public: int create_inferior (const char *program,