]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: turn target op 'supports_z_point_type' into a method
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Mon, 17 Feb 2020 15:11:54 +0000 (16:11 +0100)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 20 Feb 2020 16:35:07 +0000 (17:35 +0100)
gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

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

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

Update the derived classes and callers below.

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

gdbserver/ChangeLog
gdbserver/linux-low.cc
gdbserver/linux-low.h
gdbserver/lynx-low.cc
gdbserver/mem-break.cc
gdbserver/nto-low.cc
gdbserver/nto-low.h
gdbserver/target.cc
gdbserver/target.h
gdbserver/win32-low.cc
gdbserver/win32-low.h

index 4f759afeeb779a6c9306104fdc8a18aa4fae6f61..7afc59ffff7da7b11b0dddf2b81f6232ce997a88 100644 (file)
@@ -1,3 +1,29 @@
+2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn process_stratum_target's supports_z_point_type op into a
+       method of process_target.
+
+       * target.h (struct process_stratum_target): Remove the target op.
+       (class process_target): Add the target op.
+       * target.cc (process_target::supports_z_point_type): Define.
+
+       Update the derived classes and callers below.
+
+       * mem-break.cc (z_type_supported): Update.
+       * linux-low.cc (linux_target_ops): Update.
+       (linux_supports_z_point_type): Turn into ...
+       (linux_process_target::supports_z_point_type): ... this.
+       * linux-low.h (class linux_process_target): Update.
+       * lynx-low.cc (lynx_target_ops): Update.
+       * nto-low.cc (nto_target_ops): Update.
+       (nto_supports_z_point_type): Turn into ...
+       (nto_process_target::supports_z_point_type): ... this.
+       * nto-low.h (class nto_process_target): Update.
+       * win32-low.cc (win32_target_ops): Update.
+       (win32_supports_z_point_type): Turn into ...
+       (win32_process_target::supports_z_point_type): ... this.
+       * win32-low.h (class win32_process_target): Update.
+
 2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn process_stratum_target's read_auxv op into a method of
index 47ac768d929153b416d870a71b6f8ee4342cb902..37e46a8ca22e21ec25f0189f2e99818c46fc4adf 100644 (file)
@@ -5957,8 +5957,8 @@ linux_process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr,
    pass on the function call if the target has registered a
    corresponding function.  */
 
-static int
-linux_supports_z_point_type (char z_type)
+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));
@@ -7376,7 +7376,6 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-  linux_supports_z_point_type,
   linux_insert_point,
   linux_remove_point,
   linux_stopped_by_sw_breakpoint,
index 0130c22ce2754b3bb5406629ed6ab4841ed99f41..052beb6c44c476b0935d60f29b5b074aae6802fd 100644 (file)
@@ -314,6 +314,8 @@ public:
 
   int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
                 unsigned int len) override;
+
+  bool supports_z_point_type (char z_type) override;
 };
 
 #define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
index bf73e81993e1888c0ec6cc9a853f1692834751ad..dd4584797c4bc85b274e1aa75fc98408060bbc1c 100644 (file)
@@ -729,7 +729,6 @@ static lynx_process_target the_lynx_target;
 /* The LynxOS target_ops vector.  */
 
 static process_stratum_target lynx_target_ops = {
-  NULL,  /* supports_z_point_type */
   NULL,  /* insert_point */
   NULL,  /* remove_point */
   NULL,  /* stopped_by_sw_breakpoint */
index 43a07c390d1b7a142753058975b023853e22d12f..b00e9fca35399fd7e6c6210710be093bebc10c84 100644 (file)
@@ -1005,8 +1005,7 @@ static int
 z_type_supported (char z_type)
 {
   return (z_type >= '0' && z_type <= '4'
-         && the_target->supports_z_point_type != NULL
-         && the_target->supports_z_point_type (z_type));
+         && the_target->pt->supports_z_point_type (z_type));
 }
 
 /* Create a new GDB breakpoint of type Z_TYPE at ADDR with kind KIND.
index d828fa7a60733ecab2988632be626f2d7970ed99..204d8066455e540f9bfec870529654af64b943c3 100644 (file)
@@ -789,8 +789,8 @@ nto_process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr,
   return nto_read_auxv_from_initial_stack (initial_stack, myaddr, len);
 }
 
-static int
-nto_supports_z_point_type (char z_type)
+bool
+nto_process_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
@@ -799,9 +799,9 @@ nto_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;
     }
 }
 
@@ -950,7 +950,6 @@ nto_sw_breakpoint_from_kind (int kind, int *size)
 static nto_process_target the_nto_target;
 
 static process_stratum_target nto_target_ops = {
-  nto_supports_z_point_type,
   nto_insert_point,
   nto_remove_point,
   NULL, /* stopped_by_sw_breakpoint */
index e135dd3b68ab21238b3bd8e75687422d288050ae..65bbf7e818cddd3e746ecf01db2df1fd3a97f720 100644 (file)
@@ -84,6 +84,8 @@ public:
 
   int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
                 unsigned int len) override;
+
+  bool supports_z_point_type (char z_type) override;
 };
 
 /* The inferior's target description.  This is a global because the
index 97e9d4ac5073717ddaacb16d75c768b702a2fecc..22339622e09902f6689a6578309ff6c9f7b5574d 100644 (file)
@@ -427,3 +427,9 @@ process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr,
 {
   gdb_assert_not_reached ("target op read_auxv not supported");
 }
+
+bool
+process_target::supports_z_point_type (char z_type)
+{
+  return false;
+}
index cd11da670ca9799d060594238661a1bcb65b21fe..3262371749e6e969fe94730af7b395e553837b54 100644 (file)
@@ -70,16 +70,6 @@ class process_target;
    shared code.  */
 struct process_stratum_target
 {
-  /* Returns true if GDB Z breakpoint type TYPE is supported, false
-     otherwise.  The type is coded as follows:
-       '0' - software-breakpoint
-       '1' - hardware-breakpoint
-       '2' - write watchpoint
-       '3' - read watchpoint
-       '4' - access watchpoint
-  */
-  int (*supports_z_point_type) (char z_type);
-
   /* Insert and remove a break or watchpoint.
      Returns 0 on success, -1 on failure and 1 on unsupported.  */
 
@@ -476,6 +466,16 @@ public:
      Read LEN bytes at OFFSET into a buffer at MYADDR.  */
   virtual int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
                         unsigned int len);
+
+  /* Returns true if GDB Z breakpoint type TYPE is supported, false
+     otherwise.  The type is coded as follows:
+       '0' - software-breakpoint
+       '1' - hardware-breakpoint
+       '2' - write watchpoint
+       '3' - read watchpoint
+       '4' - access watchpoint
+  */
+  virtual bool supports_z_point_type (char z_type);
 };
 
 extern process_stratum_target *the_target;
index 2d617d889ecf2d061fb8ce93896d853aef672cc0..024748e9282eb3fb4621ad4fa6a12073f5e9eecb 100644 (file)
@@ -254,8 +254,8 @@ child_delete_thread (DWORD pid, DWORD tid)
 /* These watchpoint related wrapper functions simply pass on the function call
    if the low target has registered a corresponding function.  */
 
-static int
-win32_supports_z_point_type (char z_type)
+bool
+win32_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));
@@ -1838,7 +1838,6 @@ win32_sw_breakpoint_from_kind (int kind, int *size)
 static win32_process_target the_win32_target;
 
 static process_stratum_target win32_target_ops = {
-  win32_supports_z_point_type,
   win32_insert_point,
   win32_remove_point,
   NULL, /* stopped_by_sw_breakpoint */
index 2cb38a1419563f36067af0ce66b6cd43a4981e9a..a095ed80ffea81213f8c6748dd7bbec5f51b85fa 100644 (file)
@@ -138,6 +138,8 @@ public:
                    int len) override;
 
   void request_interrupt () override;
+
+  bool supports_z_point_type (char z_type) override;
 };
 
 /* Retrieve the context for this thread, if not already retrieved.  */