gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:26 +0000 (15:11 +0200)
gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

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

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

Update the users below.

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

21 files changed:
gdbserver/ChangeLog
gdbserver/linux-aarch64-low.cc
gdbserver/linux-arm-low.cc
gdbserver/linux-bfin-low.cc
gdbserver/linux-cris-low.cc
gdbserver/linux-crisv32-low.cc
gdbserver/linux-low.cc
gdbserver/linux-low.h
gdbserver/linux-m32r-low.cc
gdbserver/linux-m68k-low.cc
gdbserver/linux-mips-low.cc
gdbserver/linux-nios2-low.cc
gdbserver/linux-ppc-low.cc
gdbserver/linux-riscv-low.cc
gdbserver/linux-s390-low.cc
gdbserver/linux-sh-low.cc
gdbserver/linux-sparc-low.cc
gdbserver/linux-tic6x-low.cc
gdbserver/linux-tile-low.cc
gdbserver/linux-x86-low.cc
gdbserver/linux-xtensa-low.cc

index f9a3df22d0256eb4e948e7b19f2cfecc31214185..4fc0609e48acf727240b88ac994c37bab421432f 100644 (file)
@@ -1,3 +1,50 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn the 'decr_pc_after_break' linux_target_ops field into
+       a method of linux_process_target.
+
+       * linux-low.h (struct linux_target_ops)
+       <decr_pc_after_break>: Remove.
+       (class linux_process_target) <low_decr_pc_after_break>: New method
+       declaration.
+       * linux-low.cc (linux_process_target::low_decr_pc_after_break):
+       New method implementation.
+
+       Update the users below.
+
+       (linux_process_target::save_stop_reason)
+       (linux_process_target::wait_1)
+       * linux-x86-low.cc (class x86_target) <low_decr_pc_after_break>:
+       New declaration.
+       (x86_target::low_decr_pc_after_break): New method implementation.
+       (the_low_target): Remove the field.
+       * linux-bfin-low.cc (class bfin_target) <low_decr_pc_after_break>:
+       New declaration.
+       (bfin_target::low_decr_pc_after_break): New method implementation.
+       (the_low_target): Remove the field.
+       * linux-m68k-low.cc (class m68k_target) <low_decr_pc_after_break>:
+       New declaration.
+       (m68k_target::low_decr_pc_after_break): New method implementation.
+       (the_low_target): Remove the field.
+       * linux-s390-low.cc (class s390_target) <low_decr_pc_after_break>:
+       New declaration.
+       (s390_target::low_decr_pc_after_break): New method implementation.
+       (the_low_target): Remove the field.
+       * linux-aarch64-low.cc (the_low_target): Remove the field.
+       * linux-arm-low.cc (the_low_target): Remove the field.
+       * linux-cris-low.cc (the_low_target): Remove the field.
+       * linux-crisv32-low.cc (the_low_target): Remove the field.
+       * linux-m32r-low.cc (the_low_target): Remove the field.
+       * linux-mips-low.cc (the_low_target): Remove the field.
+       * linux-nios2-low.cc (the_low_target): Remove the field.
+       * linux-ppc-low.cc (the_low_target): Remove the field.
+       * linux-riscv-low.cc (the_low_target): Remove the field.
+       * linux-sh-low.cc (the_low_target): Remove the field.
+       * linux-sparc-low.cc (the_low_target): Remove the field.
+       * linux-tic6x-low.cc (the_low_target): Remove the field.
+       * linux-tile-low.cc (the_low_target): Remove the field.
+       * linux-xtensa-low.cc (the_low_target): Remove the field.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Remove the 'supports_software_single_step' linux target op and let
index 11c3296eb6b90fe7306fc16a14ab0a223b910b1a..988aa939145c9d1ab80209466cf5f6ca223e3bdf 100644 (file)
@@ -3103,7 +3103,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  0,    /* decr_pc_after_break */
   aarch64_breakpoint_at,
   aarch64_supports_z_point_type,
   aarch64_insert_point,
index bd42feba1c4724bc20a421f2b52e840a66342bc5..18f427245c1d33baa54a4938e4a3d374ee36bebb 100644 (file)
@@ -1085,7 +1085,6 @@ arm_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   arm_breakpoint_at,
   arm_supports_z_point_type,
   arm_insert_point,
index 17948ed16f009c504836ba88cd7e05013b3f999a..23d0342c0dbcd8c6bc024f558c408cd99df9e087 100644 (file)
@@ -46,6 +46,8 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  int low_decr_pc_after_break () override;
 };
 
 /* The singleton target ops object.  */
@@ -70,6 +72,12 @@ bfin_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
   linux_set_pc_32bit (regcache, pc);
 }
 
+int
+bfin_target::low_decr_pc_after_break ()
+{
+  return 2;
+}
+
 /* Defined in auto-generated file reg-bfin.c.  */
 void init_registers_bfin (void);
 extern const struct target_desc *tdesc_bfin;
@@ -161,7 +169,6 @@ bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  2,
   bfin_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
index 99060de1765212f75a63a338b3073584e0c47d85..5fb40bf1c3644958a9a5857acb2e90844af7a3f3 100644 (file)
@@ -158,7 +158,6 @@ cris_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   cris_breakpoint_at,
 };
 
index c75e428885e4722cf1e6751d6f5ea10b7a2a59e0..b55a0176dde72d7414699dcb4186577ac9ac6dca 100644 (file)
@@ -455,7 +455,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   cris_breakpoint_at,
   cris_supports_z_point_type,
   cris_insert_point,
index 8eca077180e34dec12c1ec5bc13f3df7b3ecbaf2..fd225789347e46e46bb6b7f1788f971518ffbb49 100644 (file)
@@ -317,6 +317,12 @@ linux_process_target::low_get_next_pcs (regcache *regcache)
                          "implemented");
 }
 
+int
+linux_process_target::low_decr_pc_after_break ()
+{
+  return 0;
+}
+
 /* Returns true if this target can support fast tracepoints.  This
    does not mean that the in-process agent has been loaded in the
    inferior.  */
@@ -796,7 +802,7 @@ linux_process_target::save_stop_reason (lwp_info *lwp)
     return false;
 
   pc = get_pc (lwp);
-  sw_breakpoint_pc = pc - the_low_target.decr_pc_after_break;
+  sw_breakpoint_pc = pc - low_decr_pc_after_break ();
 
   /* breakpoint_at reads from the current thread.  */
   saved_thread = current_thread;
@@ -3694,7 +3700,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
   if (event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
       && !cs.swbreak_feature)
     {
-      int decr_pc = the_low_target.decr_pc_after_break;
+      int decr_pc = low_decr_pc_after_break ();
 
       if (decr_pc != 0)
        {
index 2202a6582254ec281fa23f835898765706483d0e..5867960ae599ca5caf4e6cef7fd965f740fa46f5 100644 (file)
@@ -131,7 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  int decr_pc_after_break;
   int (*breakpoint_at) (CORE_ADDR pc);
 
   /* Breakpoint and watchpoint related functions.  See target.h for
@@ -666,6 +665,9 @@ protected:
      Targets that override this method should also override
      'supports_software_single_step' to return true.  */
   virtual std::vector<CORE_ADDR> low_get_next_pcs (regcache *regcache);
+
+  /* How many bytes the PC should be decremented after a break.  */
+  virtual int low_decr_pc_after_break ();
 };
 
 extern linux_process_target *the_linux_target;
index 78e002dfb242808ef57eec61158f40c22abcfab8..1d23438687e0264930b8b3a1d4c2bf139d8d2da5 100644 (file)
@@ -160,7 +160,6 @@ m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   m32r_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
index 00851af5f0247e5a409bc578f199ecaaa45dc6db..33e0d7b1b8693e36d22455de3a0d12fd32f64b82 100644 (file)
@@ -42,6 +42,8 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  int low_decr_pc_after_break () override;
 };
 
 /* The singleton target ops object.  */
@@ -66,6 +68,12 @@ m68k_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
   linux_set_pc_32bit (regcache, pc);
 }
 
+int
+m68k_target::low_decr_pc_after_break ()
+{
+  return 2;
+}
+
 /* Defined in auto-generated file reg-m68k.c.  */
 void init_registers_m68k (void);
 extern const struct target_desc *tdesc_m68k;
@@ -255,7 +263,6 @@ m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  2,
   m68k_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
index 710245c1610dda9d3ce729d1b90df1a822b30933..82e141f0250528fddb7ac3e06d13ccb4bb8d96f3 100644 (file)
@@ -966,7 +966,6 @@ mips_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   mips_breakpoint_at,
   mips_supports_z_point_type,
   mips_insert_point,
index 3cae8dac2859fb21a5ac11bc1ef33c47a04d50bf..2544b495e0f78d70cfcafb5638c28389fc7ee6a4 100644 (file)
@@ -277,7 +277,6 @@ nios2_target::get_regs_info ()
 
 struct linux_target_ops the_low_target =
 {
-  0,
   nios2_breakpoint_at,
 };
 
index af9dc0b2adfbb19730650657f4b7f6321d50a7bf..e488b7d3feac7787c8a6ac7a7869215a7faeb140 100644 (file)
@@ -3406,7 +3406,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   ppc_breakpoint_at,
   ppc_supports_z_point_type,
   ppc_insert_point,
index 9e96504687e08795436760b813892ca4df7d5810..9f3ea590fa70b147465d5e008b013b1e831b93cd 100644 (file)
@@ -309,7 +309,6 @@ riscv_breakpoint_at (CORE_ADDR pc)
 /* RISC-V/Linux target operations.  */
 struct linux_target_ops the_low_target =
 {
-  0,    /* decr_pc_after_break */
   riscv_breakpoint_at,
 };
 
index 4c4b877bb751116c2594cfc3f670807d3bdd1bce..f9444312121165747ddbe140808733157e7b7121 100644 (file)
@@ -74,6 +74,8 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  int low_decr_pc_after_break () override;
 };
 
 /* The singleton target ops object.  */
@@ -502,6 +504,12 @@ s390_target::low_set_pc (regcache *regcache, CORE_ADDR newpc)
     }
 }
 
+int
+s390_target::low_decr_pc_after_break ()
+{
+  return s390_breakpoint_len;
+}
+
 /* Determine the word size for the given PID, in bytes.  */
 
 #ifdef __s390x__
@@ -2826,7 +2834,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  s390_breakpoint_len,
   s390_breakpoint_at,
   s390_supports_z_point_type,
   NULL,
index 47242dafe946290eeb27c907a5650963fda1e1e9..77a4f105d1a6fed99ca74902099609fe06badfa4 100644 (file)
@@ -190,7 +190,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   sh_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
index f724cb88b717e0dcbe0f61df4082bef8988deb67..81eb36225e973e62ff2ac0562c99e62525efcdf5 100644 (file)
@@ -339,7 +339,6 @@ sparc_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   sparc_breakpoint_at,
   NULL,  /* supports_z_point_type */
   NULL, NULL, NULL, NULL,
index 347b79e6519c554a92a868030da635a815facd56..51453c6713c41c9e84aa7ee322a16c0677fe7bf6 100644 (file)
@@ -421,7 +421,6 @@ tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   tic6x_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
index 86191b9bb1ced59a0600b3ce7c996eb755391654..53d39c47f45a3abe1e355a0d1af1955599375a2f 100644 (file)
@@ -222,7 +222,6 @@ tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  0,
   tile_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
index 59c6b386d11ff4bfca30b58cecb5443d1b05a22d..eb36aced8b6e49f009a5faa0026aead3677bff3d 100644 (file)
@@ -121,6 +121,8 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  int low_decr_pc_after_break () override;
 };
 
 /* The singleton target ops object.  */
@@ -547,6 +549,13 @@ x86_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
       supply_register_by_name (regcache, "eip", &newpc);
     }
 }
+
+int
+x86_target::low_decr_pc_after_break ()
+{
+  return 1;
+}
+
 \f
 static const gdb_byte x86_breakpoint[] = { 0xCC };
 #define x86_breakpoint_len 1
@@ -2899,7 +2908,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  1,
   x86_breakpoint_at,
   x86_supports_z_point_type,
   x86_insert_point,
index 320ac92968d3d969632ac903ffe62c194cb6c288..606204b45e4f6fc1cc7d6a23ba847581436fe44e 100644 (file)
@@ -328,7 +328,6 @@ xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
   xtensa_breakpoint_at,
   NULL, /* supports_z_point_type */
   NULL, /* insert_point */
This page took 0.03999 seconds and 4 git commands to generate.