From patchwork Fri Mar 6 21:31:23 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: 38491 Received: (qmail 51432 invoked by alias); 6 Mar 2020 21:32:28 -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 51123 invoked by uid 89); 6 Mar 2020 21:32:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.5 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=sk:stopped X-HELO: mga05.intel.com Received: from mga05.intel.com (HELO mga05.intel.com) (192.55.52.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 21:32:21 +0000 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 13:32:19 -0800 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga006.fm.intel.com with ESMTP; 06 Mar 2020 13:32:19 -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 026LWIOh022467; Fri, 6 Mar 2020 21:32:18 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 026LWIDe020446; Fri, 6 Mar 2020 22:32:18 +0100 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 026LWId0020442; Fri, 6 Mar 2020 22:32:18 +0100 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 15/31] gdbserver/linux-low: turn 'supports_z_point_type' into a method Date: Fri, 6 Mar 2020 22:31:23 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes gdbserver/ChangeLog: 2020-03-06 Tankut Baris Aktemur Remove the 'supports_z_point_type' linux target op and let the concrete linux target define it by overriding the op declared in process_stratum_target. * linux-low.cc (linux_process_target::supports_z_point_type): Remove. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) : Remove. * linux-x86-low.cc (class x86_target) : Declare. (x86_supports_z_point_type): Turn into... (x86_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_supports_z_point_type): Turn into... (aarch64_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) : Declare. (arm_supports_z_point_type): Turn into... (arm_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-crisv32-low.cc (class crisv32_target) : Declare. (cris_supports_z_point_type): Turn into... (crisv32_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) : Declare. (mips_supports_z_point_type): Turn into... (mips_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (class ppc_target) : Declare. (ppc_supports_z_point_type): Turn into... (ppc_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-s390-low.cc (class s390_target) : Declare. (s390_supports_z_point_type): Turn into... (s390_target::supports_z_point_type): ...this. (the_low_target): Remove the op field. * linux-bfin-low.cc (the_low_target): Remove the op field. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-sparc-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto. --- gdbserver/linux-aarch64-low.cc | 13 +++++++------ gdbserver/linux-arm-low.cc | 11 ++++++----- gdbserver/linux-bfin-low.cc | 1 - gdbserver/linux-crisv32-low.cc | 11 ++++++----- gdbserver/linux-low.cc | 11 ----------- gdbserver/linux-low.h | 3 --- gdbserver/linux-m32r-low.cc | 1 - gdbserver/linux-m68k-low.cc | 1 - gdbserver/linux-mips-low.cc | 11 ++++++----- gdbserver/linux-ppc-low.cc | 11 ++++++----- gdbserver/linux-s390-low.cc | 13 +++++++------ gdbserver/linux-sh-low.cc | 1 - gdbserver/linux-sparc-low.cc | 1 - gdbserver/linux-tic6x-low.cc | 1 - gdbserver/linux-tile-low.cc | 1 - gdbserver/linux-x86-low.cc | 11 ++++++----- gdbserver/linux-xtensa-low.cc | 1 - 17 files changed, 44 insertions(+), 59 deletions(-) diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index a4b8ed37d53..d54dec4b86d 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -64,6 +64,8 @@ public: const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -289,10 +291,10 @@ aarch64_get_debug_reg_state (pid_t pid) return &proc->priv->arch_private->debug_reg_state; } -/* Implementation of linux_target_ops method "supports_z_point_type". */ +/* Implementation of target ops method "supports_z_point_type". */ -static int -aarch64_supports_z_point_type (char z_type) +bool +aarch64_target::supports_z_point_type (char z_type) { switch (z_type) { @@ -301,9 +303,9 @@ aarch64_supports_z_point_type (char z_type) case Z_PACKET_WRITE_WP: case Z_PACKET_READ_WP: case Z_PACKET_ACCESS_WP: - return 1; + return true; default: - return 0; + return false; } } @@ -3105,7 +3107,6 @@ aarch64_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - aarch64_supports_z_point_type, aarch64_insert_point, aarch64_remove_point, aarch64_stopped_by_watchpoint, diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index 8ad56d4899c..454ed5bc9be 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -72,6 +72,8 @@ public: bool supports_software_single_step () override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -558,8 +560,8 @@ update_registers_callback (thread_info *thread, int watch, int i) linux_stop_lwp (lwp); } -static int -arm_supports_z_point_type (char z_type) +bool +arm_target::supports_z_point_type (char z_type) { switch (z_type) { @@ -568,10 +570,10 @@ arm_supports_z_point_type (char z_type) case Z_PACKET_WRITE_WP: case Z_PACKET_READ_WP: case Z_PACKET_ACCESS_WP: - return 1; + return true; default: /* Leave the handling of sw breakpoints with the gdb client. */ - return 0; + return false; } } @@ -1095,7 +1097,6 @@ arm_target::get_regs_info () } struct linux_target_ops the_low_target = { - arm_supports_z_point_type, arm_insert_point, arm_remove_point, arm_stopped_by_watchpoint, diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc index 8d380b29d53..8887b2f2096 100644 --- a/gdbserver/linux-bfin-low.cc +++ b/gdbserver/linux-bfin-low.cc @@ -165,7 +165,6 @@ bfin_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */ diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index a7dc77942e3..0de90b94f82 100644 --- a/gdbserver/linux-crisv32-low.cc +++ b/gdbserver/linux-crisv32-low.cc @@ -32,6 +32,8 @@ public: const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -179,17 +181,17 @@ cris_write_data_breakpoint (struct regcache *regcache, } } -static int -cris_supports_z_point_type (char z_type) +bool +crisv32_target::supports_z_point_type (char z_type) { switch (z_type) { case Z_PACKET_WRITE_WP: case Z_PACKET_READ_WP: case Z_PACKET_ACCESS_WP: - return 1; + return true; default: - return 0; + return false; } } @@ -458,7 +460,6 @@ crisv32_target::get_regs_info () } struct linux_target_ops the_low_target = { - cris_supports_z_point_type, cris_insert_point, cris_remove_point, cris_stopped_by_watchpoint, diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 3172ed5c502..e4c38e75a33 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -5829,17 +5829,6 @@ linux_process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr, return n; } -/* These breakpoint and watchpoint related wrapper functions simply - pass on the function call if the target has registered a - corresponding function. */ - -bool -linux_process_target::supports_z_point_type (char z_type) -{ - return (the_low_target.supports_z_point_type != NULL - && the_low_target.supports_z_point_type (z_type)); -} - int linux_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size, raw_breakpoint *bp) diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 77cea4a235d..dd6dbbc6ba6 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -133,7 +133,6 @@ struct linux_target_ops { /* Breakpoint and watchpoint related functions. See target.h for comments. */ - int (*supports_z_point_type) (char z_type); int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp); int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr, @@ -281,8 +280,6 @@ class linux_process_target : public process_stratum_target int read_auxv (CORE_ADDR offset, unsigned char *myaddr, unsigned int len) override; - bool supports_z_point_type (char z_type) override; - int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size, raw_breakpoint *bp) override; diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index 0666dd2d093..280c4c49e8f 100644 --- a/gdbserver/linux-m32r-low.cc +++ b/gdbserver/linux-m32r-low.cc @@ -163,7 +163,6 @@ m32r_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */ diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index ca3024bdac8..0297b2f4067 100644 --- a/gdbserver/linux-m68k-low.cc +++ b/gdbserver/linux-m68k-low.cc @@ -259,7 +259,6 @@ m68k_supports_hardware_single_step (void) } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */ diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc index 82c0b2a1c07..0a5779276af 100644 --- a/gdbserver/linux-mips-low.cc +++ b/gdbserver/linux-mips-low.cc @@ -37,6 +37,8 @@ public: const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -494,17 +496,17 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp) } } -static int -mips_supports_z_point_type (char z_type) +bool +mips_target::supports_z_point_type (char z_type) { switch (z_type) { case Z_PACKET_WRITE_WP: case Z_PACKET_READ_WP: case Z_PACKET_ACCESS_WP: - return 1; + return true; default: - return 0; + return false; } } @@ -970,7 +972,6 @@ mips_target::get_regs_info () } struct linux_target_ops the_low_target = { - mips_supports_z_point_type, mips_insert_point, mips_remove_point, mips_stopped_by_watchpoint, diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index 39b2e3fcd37..1b3378fc16d 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -56,6 +56,8 @@ public: const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -331,18 +333,18 @@ ppc_target::low_breakpoint_at (CORE_ADDR where) Handling software breakpoint at server side, so tracepoints and breakpoints can be inserted at the same location. */ -static int -ppc_supports_z_point_type (char z_type) +bool +ppc_target::supports_z_point_type (char z_type) { switch (z_type) { case Z_PACKET_SW_BP: - return 1; + return true; case Z_PACKET_HW_BP: case Z_PACKET_WRITE_WP: case Z_PACKET_ACCESS_WP: default: - return 0; + return false; } } @@ -3410,7 +3412,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - ppc_supports_z_point_type, ppc_insert_point, ppc_remove_point, NULL, diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index e296e3cf08d..94f9182f159 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -66,6 +66,8 @@ public: const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -676,17 +678,17 @@ s390_target::low_breakpoint_at (CORE_ADDR pc) /* Breakpoint/Watchpoint support. */ -/* The "supports_z_point_type" linux_target_ops method. */ +/* The "supports_z_point_type" target ops method. */ -static int -s390_supports_z_point_type (char z_type) +bool +s390_target::supports_z_point_type (char z_type) { switch (z_type) { case Z_PACKET_SW_BP: - return 1; + return true; default: - return 0; + return false; } } @@ -2830,7 +2832,6 @@ s390_emit_ops (void) } struct linux_target_ops the_low_target = { - s390_supports_z_point_type, NULL, NULL, NULL, diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index 174bd9cfe4f..0c88655bd76 100644 --- a/gdbserver/linux-sh-low.cc +++ b/gdbserver/linux-sh-low.cc @@ -194,7 +194,6 @@ sh_target::low_arch_setup () } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */ diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc index 06c81702319..00e6fe028d5 100644 --- a/gdbserver/linux-sparc-low.cc +++ b/gdbserver/linux-sparc-low.cc @@ -343,7 +343,6 @@ sparc_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, NULL, NULL, NULL, NULL, NULL }; diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index a9d05c971fd..fcef1174a7c 100644 --- a/gdbserver/linux-tic6x-low.cc +++ b/gdbserver/linux-tic6x-low.cc @@ -425,7 +425,6 @@ tic6x_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */ diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index 68e76a356a3..f67a15d1e51 100644 --- a/gdbserver/linux-tile-low.cc +++ b/gdbserver/linux-tile-low.cc @@ -226,7 +226,6 @@ tile_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index f24e3912f37..a95bd7c2227 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -110,6 +110,8 @@ public: const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + bool supports_z_point_type (char z_type) override; + protected: void low_arch_setup () override; @@ -580,8 +582,8 @@ struct x86_dr_low_type x86_dr_low = /* Breakpoint/Watchpoint support. */ -static int -x86_supports_z_point_type (char z_type) +bool +x86_target::supports_z_point_type (char z_type) { switch (z_type) { @@ -589,9 +591,9 @@ x86_supports_z_point_type (char z_type) case Z_PACKET_HW_BP: case Z_PACKET_WRITE_WP: case Z_PACKET_ACCESS_WP: - return 1; + return true; default: - return 0; + return false; } } @@ -2903,7 +2905,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_supports_z_point_type, x86_insert_point, x86_remove_point, x86_stopped_by_watchpoint, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index ef0ac89a469..d580215b476 100644 --- a/gdbserver/linux-xtensa-low.cc +++ b/gdbserver/linux-xtensa-low.cc @@ -331,7 +331,6 @@ xtensa_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* supports_z_point_type */ NULL, /* insert_point */ NULL, /* remove_point */ NULL, /* stopped_by_watchpoint */