From a5b5da9258db39b9b15ae2796ab637c73ba20422 Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Thu, 2 Apr 2020 15:11:29 +0200 Subject: [PATCH] gdbserver/linux-low: turn 'process_qsupported' into a method gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur Remove the 'process_qsupported' linux target op and let a concrete linux target define the op by overriding the op declaration in process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) : Remove. * linux-low.cc (linux_process_target::process_qsupported): Remove. * linux-x86-low.cc (class x86_target) : Declare. (x86_linux_process_qsupported): Turn into... (x86_target::process_qsupported): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (the_low_target): Remove the op field. * linux-arm-low.cc (the_low_target): Ditto. * linux-bfin-low.cc (the_low_target): Ditto. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto. --- gdbserver/ChangeLog | 27 +++++++++++++++++++++++++++ gdbserver/linux-aarch64-low.cc | 1 - gdbserver/linux-arm-low.cc | 1 - gdbserver/linux-bfin-low.cc | 1 - gdbserver/linux-crisv32-low.cc | 1 - gdbserver/linux-low.cc | 7 ------- gdbserver/linux-low.h | 5 ----- gdbserver/linux-m32r-low.cc | 1 - gdbserver/linux-m68k-low.cc | 1 - gdbserver/linux-ppc-low.cc | 1 - gdbserver/linux-s390-low.cc | 1 - gdbserver/linux-sh-low.cc | 1 - gdbserver/linux-tic6x-low.cc | 1 - gdbserver/linux-tile-low.cc | 1 - gdbserver/linux-x86-low.cc | 19 +++++++++++-------- gdbserver/linux-xtensa-low.cc | 1 - 16 files changed, 38 insertions(+), 32 deletions(-) diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 8c5ca79f15..e42b3d8439 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,30 @@ +2020-04-02 Tankut Baris Aktemur + + Remove the 'process_qsupported' linux target op and let a concrete + linux target define the op by overriding the op declaration in + process_stratum_target. + + * linux-low.h (struct linux_target_ops): Remove the op. + (class linux_process_target) : Remove. + * linux-low.cc (linux_process_target::process_qsupported): Remove. + * linux-x86-low.cc (class x86_target) : Declare. + (x86_linux_process_qsupported): Turn into... + (x86_target::process_qsupported): ...this. + (the_low_target): Remove the op field. + * linux-aarch64-low.cc (the_low_target): Remove the op + field. + * linux-arm-low.cc (the_low_target): Ditto. + * linux-bfin-low.cc (the_low_target): Ditto. + * linux-crisv32-low.cc (the_low_target): Ditto. + * linux-m32r-low.cc (the_low_target): Ditto. + * linux-m68k-low.cc (the_low_target): Ditto. + * linux-ppc-low.cc (the_low_target): Ditto. + * linux-s390-low.cc (the_low_target): Ditto. + * linux-sh-low.cc (the_low_target): Ditto. + * linux-tic6x-low.cc (the_low_target): Ditto. + * linux-tile-low.cc (the_low_target): Ditto. + * linux-xtensa-low.cc (the_low_target): Ditto. + 2020-04-02 Tankut Baris Aktemur Turn the 'prepare_to_resume' linux target op into a method of diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc index a99b97929c..56bf027b88 100644 --- a/gdbserver/linux-aarch64-low.cc +++ b/gdbserver/linux-aarch64-low.cc @@ -3147,7 +3147,6 @@ aarch64_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ aarch64_supports_tracepoints, aarch64_get_thread_area, aarch64_install_fast_tracepoint_jump_pad, diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index f6429f0475..9e74b03df0 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -1117,7 +1117,6 @@ arm_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc index 3e3f39a1ba..aa8a16e1d1 100644 --- a/gdbserver/linux-bfin-low.cc +++ b/gdbserver/linux-bfin-low.cc @@ -171,7 +171,6 @@ bfin_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc index d262fae9a9..f0851cabed 100644 --- a/gdbserver/linux-crisv32-low.cc +++ b/gdbserver/linux-crisv32-low.cc @@ -468,7 +468,6 @@ crisv32_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 3105db6d01..e94118bd80 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -6425,13 +6425,6 @@ linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset, } #endif /* defined PT_GETDSBT || defined PTRACE_GETFDPIC */ -void -linux_process_target::process_qsupported (char **features, int count) -{ - if (the_low_target.process_qsupported != NULL) - the_low_target.process_qsupported (features, count); -} - bool linux_process_target::supports_catch_syscall () { diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index 49fbc5edce..bc45e3fbcb 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -131,9 +131,6 @@ struct lwp_info; struct linux_target_ops { - /* Hook to support target specific qSupported. */ - void (*process_qsupported) (char **, int count); - /* Returns true if the low target supports tracepoints. */ int (*supports_tracepoints) (void); @@ -299,8 +296,6 @@ public: unsigned char *myaddr, unsigned int len) override; #endif - void process_qsupported (char **features, int count) override; - bool supports_tracepoints () override; CORE_ADDR read_pc (regcache *regcache) override; diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc index bae0f25e18..3ba2b0ea5e 100644 --- a/gdbserver/linux-m32r-low.cc +++ b/gdbserver/linux-m32r-low.cc @@ -161,7 +161,6 @@ m32r_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc index cfb0a0ac2b..4f9b68b8ee 100644 --- a/gdbserver/linux-m68k-low.cc +++ b/gdbserver/linux-m68k-low.cc @@ -265,7 +265,6 @@ m68k_supports_hardware_single_step (void) } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index 22fda3306f..0c3d5eb989 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -3428,7 +3428,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ ppc_supports_tracepoints, ppc_get_thread_area, ppc_install_fast_tracepoint_jump_pad, diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc index e46375f59c..d3be399315 100644 --- a/gdbserver/linux-s390-low.cc +++ b/gdbserver/linux-s390-low.cc @@ -2845,7 +2845,6 @@ s390_emit_ops (void) } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ s390_supports_tracepoints, s390_get_thread_area, s390_install_fast_tracepoint_jump_pad, diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc index d2d0f0b095..ac6b1d7b1c 100644 --- a/gdbserver/linux-sh-low.cc +++ b/gdbserver/linux-sh-low.cc @@ -192,7 +192,6 @@ sh_target::low_arch_setup () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc index ddb84e7517..bf7099bf7f 100644 --- a/gdbserver/linux-tic6x-low.cc +++ b/gdbserver/linux-tic6x-low.cc @@ -423,7 +423,6 @@ tic6x_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc index 5268f40ccf..355657bf95 100644 --- a/gdbserver/linux-tile-low.cc +++ b/gdbserver/linux-tile-low.cc @@ -224,7 +224,6 @@ tile_supports_hardware_single_step (void) struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index f9459dc18c..bf5245e5b2 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -100,16 +100,14 @@ class x86_target : public linux_process_target { public: - /* Update all the target description of all processes; a new GDB - connected, and it may or not support xml target descriptions. */ - void update_xmltarget (); - const regs_info *get_regs_info () override; const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; bool supports_z_point_type (char z_type) override; + void process_qsupported (char **features, int count) override; + protected: void low_arch_setup () override; @@ -157,6 +155,12 @@ protected: void low_new_fork (process_info *parent, process_info *child) override; void low_prepare_to_resume (lwp_info *lwp) override; + +private: + + /* Update all the target description of all processes; a new GDB + connected, and it may or not support xml target descriptions. */ + void update_xmltarget (); }; /* The singleton target ops object. */ @@ -1001,8 +1005,8 @@ x86_target::update_xmltarget () /* Process qSupported query, "xmlRegisters=". Update the buffer size for PTRACE_GETREGSET. */ -static void -x86_linux_process_qsupported (char **features, int count) +void +x86_target::process_qsupported (char **features, int count) { int i; @@ -1033,7 +1037,7 @@ x86_linux_process_qsupported (char **features, int count) free (copy); } } - the_x86_target.update_xmltarget (); + update_xmltarget (); } /* Common for x86/x86-64. */ @@ -2963,7 +2967,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_linux_process_qsupported, x86_supports_tracepoints, x86_get_thread_area, x86_install_fast_tracepoint_jump_pad, diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc index a58a74b98d..b6d0889e99 100644 --- a/gdbserver/linux-xtensa-low.cc +++ b/gdbserver/linux-xtensa-low.cc @@ -329,7 +329,6 @@ xtensa_target::get_regs_info () } struct linux_target_ops the_low_target = { - NULL, /* process_qsupported */ NULL, /* supports_tracepoints */ NULL, /* get_thread_area */ NULL, /* install_fast_tracepoint_jump_pad */ -- 2.34.1