public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbserver: turn btrace-related target ops into methods
@ 2020-03-03  5:38 gdb-buildbot
  2020-03-03  5:26 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gdb-buildbot @ 2020-03-03  5:38 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 79597bdd56f380555ed7075b39a9280a17bd7e90 ***

commit 79597bdd56f380555ed7075b39a9280a17bd7e90
Author:     Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
AuthorDate: Mon Feb 17 16:12:01 2020 +0100
Commit:     Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
CommitDate: Thu Feb 20 17:35:17 2020 +0100

    gdbserver: turn btrace-related target ops into methods
    
    gdbserver/ChangeLog:
    2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
    
            Turn process_stratum_target's btrace-related ops (enable_btrace,
            disable_btrace, read_btrace, read_btrace_conf) into methods of
            process_target.
    
            * target.h (struct process_stratum_target): Remove the target ops.
            (class process_target): Add the target ops.
            (target_enable_btrace): Update.
            (target_disable_btrace): Update.
            (target_read_btrace): Update.
            (target_read_btrace_conf): Update.
            * target.cc (process_target::enable_btrace): Define.
            (process_target::disable_btrace): Define.
            (process_target::read_btrace): Define.
            (process_target::read_btrace_conf): Define.
    
            Update the derived classes and callers below.
    
            * linux-low.cc (linux_target_ops): Update.
            (linux_process_target:enable_btrace): Define as a wrapper around
            linux_enable_btrace.
            (linux_low_disable_btrace): Turn into ...
            (linux_process_target::disable_btrace): ... this.
            (linux_low_read_btrace): Turn into ...
            (linux_process_target::read_btrace): ... this.
            (linux_low_btrace_conf): Turn into ...
            (linux_process_target::read_btrace_conf): ... this.
            * linux-low.h (class linux_process_target): Update.
            * lynx-low.cc (lynx_target_ops): Update.
            * nto-low.cc (nto_target_ops): Update.
            * win32-low.cc (win32_target_ops): Update.

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 4b91c893fb..3898eca0d2 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,36 @@
+2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+	Turn process_stratum_target's btrace-related ops (enable_btrace,
+	disable_btrace, read_btrace, read_btrace_conf) into methods of
+	process_target.
+
+	* target.h (struct process_stratum_target): Remove the target ops.
+	(class process_target): Add the target ops.
+	(target_enable_btrace): Update.
+	(target_disable_btrace): Update.
+	(target_read_btrace): Update.
+	(target_read_btrace_conf): Update.
+	* target.cc (process_target::enable_btrace): Define.
+	(process_target::disable_btrace): Define.
+	(process_target::read_btrace): Define.
+	(process_target::read_btrace_conf): Define.
+
+	Update the derived classes and callers below.
+
+	* linux-low.cc (linux_target_ops): Update.
+	(linux_process_target:enable_btrace): Define as a wrapper around
+	linux_enable_btrace.
+	(linux_low_disable_btrace): Turn into ...
+	(linux_process_target::disable_btrace): ... this.
+	(linux_low_read_btrace): Turn into ...
+	(linux_process_target::read_btrace): ... this.
+	(linux_low_btrace_conf): Turn into ...
+	(linux_process_target::read_btrace_conf): ... this.
+	* linux-low.h (class linux_process_target): Update.
+	* lynx-low.cc (lynx_target_ops): Update.
+	* nto-low.cc (nto_target_ops): Update.
+	* win32-low.cc (win32_target_ops): Update.
+
 2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
 	Turn process_stratum_target's supports_agent op into a method of
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index df4c98d257..1cd5bfcd3c 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -7153,10 +7153,17 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
 
 #ifdef HAVE_LINUX_BTRACE
 
+btrace_target_info *
+linux_process_target::enable_btrace (ptid_t ptid,
+				     const btrace_config *conf)
+{
+  return linux_enable_btrace (ptid, conf);
+}
+
 /* See to_disable_btrace target method.  */
 
-static int
-linux_low_disable_btrace (struct btrace_target_info *tinfo)
+int
+linux_process_target::disable_btrace (btrace_target_info *tinfo)
 {
   enum btrace_error err;
 
@@ -7215,9 +7222,10 @@ linux_low_encode_raw (struct buffer *buffer, const gdb_byte *data,
 
 /* See to_read_btrace target method.  */
 
-static int
-linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer,
-		       enum btrace_read_type type)
+int
+linux_process_target::read_btrace (btrace_target_info *tinfo,
+				   buffer *buffer,
+				   enum btrace_read_type type)
 {
   struct btrace_data btrace;
   enum btrace_error err;
@@ -7274,9 +7282,9 @@ linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer,
 
 /* See to_btrace_conf target method.  */
 
-static int
-linux_low_btrace_conf (const struct btrace_target_info *tinfo,
-		       struct buffer *buffer)
+int
+linux_process_target::read_btrace_conf (const btrace_target_info *tinfo,
+					buffer *buffer)
 {
   const struct btrace_config *conf;
 
@@ -7463,17 +7471,6 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-#ifdef HAVE_LINUX_BTRACE
-  linux_enable_btrace,
-  linux_low_disable_btrace,
-  linux_low_read_btrace,
-  linux_low_btrace_conf,
-#else
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-#endif
   linux_supports_range_stepping,
   linux_proc_pid_to_exec_file,
   linux_mntns_open_cloexec,
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index 0f0f3e0b86..8c33dccc67 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -433,6 +433,19 @@ public:
 			    CORE_ADDR offset, int len) override;
 
   bool supports_agent () override;
+
+#ifdef HAVE_LINUX_BTRACE
+  btrace_target_info *enable_btrace (ptid_t ptid,
+				     const btrace_config *conf) override;
+
+  int disable_btrace (btrace_target_info *tinfo) override;
+
+  int read_btrace (btrace_target_info *tinfo, buffer *buf,
+		   enum btrace_read_type type) override;
+
+  int read_btrace_conf (const btrace_target_info *tinfo,
+			buffer *buf) override;
+#endif
 };
 
 #define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
diff --git a/gdbserver/lynx-low.cc b/gdbserver/lynx-low.cc
index 031166ed12..a890b660bb 100644
--- a/gdbserver/lynx-low.cc
+++ b/gdbserver/lynx-low.cc
@@ -735,10 +735,6 @@ static lynx_process_target the_lynx_target;
 /* The LynxOS target_ops vector.  */
 
 static process_stratum_target lynx_target_ops = {
-  NULL,  /* enable_btrace */
-  NULL,  /* disable_btrace */
-  NULL,  /* read_btrace */
-  NULL,  /* read_btrace_conf */
   NULL,  /* supports_range_stepping */
   NULL,  /* pid_to_exec_file */
   NULL,  /* multifs_open */
diff --git a/gdbserver/nto-low.cc b/gdbserver/nto-low.cc
index 27fe3ca413..ef79105877 100644
--- a/gdbserver/nto-low.cc
+++ b/gdbserver/nto-low.cc
@@ -947,10 +947,6 @@ nto_sw_breakpoint_from_kind (int kind, int *size)
 static nto_process_target the_nto_target;
 
 static process_stratum_target nto_target_ops = {
-  NULL, /* enable_btrace */
-  NULL, /* disable_btrace */
-  NULL, /* read_btrace */
-  NULL, /* read_btrace_conf */
   NULL, /* supports_range_stepping */
   NULL, /* pid_to_exec_file */
   NULL, /* multifs_open */
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index 2bbd8b4d7a..e2ce7ff086 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -726,3 +726,30 @@ process_target::supports_agent ()
 {
   return false;
 }
+
+btrace_target_info *
+process_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)
+{
+  error (_("Target does not support branch tracing."));
+}
+
+int
+process_target::read_btrace (btrace_target_info *tinfo,
+			     buffer *buffer,
+			     enum btrace_read_type type)
+{
+  error (_("Target does not support branch tracing."));
+}
+
+int
+process_target::read_btrace_conf (const btrace_target_info *tinfo,
+				  buffer *buffer)
+{
+  error (_("Target does not support branch tracing."));
+}
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 8a1c12260f..9d7c599b1e 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -70,26 +70,6 @@ class process_target;
    shared code.  */
 struct process_stratum_target
 {
-  /* Enable branch tracing for PTID based on CONF and allocate a branch trace
-     target information struct for reading and for disabling branch trace.  */
-  struct btrace_target_info *(*enable_btrace)
-    (ptid_t ptid, const struct btrace_config *conf);
-
-  /* Disable branch tracing.
-     Returns zero on success, non-zero otherwise.  */
-  int (*disable_btrace) (struct btrace_target_info *tinfo);
-
-  /* Read branch trace data into buffer.
-     Return 0 on success; print an error message into BUFFER and return -1,
-     otherwise.  */
-  int (*read_btrace) (struct btrace_target_info *, struct buffer *,
-		      enum btrace_read_type type);
-
-  /* Read the branch trace configuration into BUFFER.
-     Return 0 on success; print an error message into BUFFER and return -1
-     otherwise.  */
-  int (*read_btrace_conf) (const struct btrace_target_info *, struct buffer *);
-
   /* Return true if target supports range stepping.  */
   int (*supports_range_stepping) (void);
 
@@ -497,6 +477,27 @@ public:
 
   /* Return true if target supports debugging agent.  */
   virtual bool supports_agent ();
+
+  /* Enable branch tracing for PTID based on CONF and allocate a branch trace
+     target information struct for reading and for disabling branch trace.  */
+  virtual btrace_target_info *enable_btrace (ptid_t ptid,
+					     const btrace_config *conf);
+
+  /* Disable branch tracing.
+     Returns zero on success, non-zero otherwise.  */
+  virtual int disable_btrace (btrace_target_info *tinfo);
+
+  /* Read branch trace data into buffer.
+     Return 0 on success; print an error message into BUFFER and return -1,
+     otherwise.  */
+  virtual int read_btrace (btrace_target_info *tinfo, buffer *buf,
+			   enum btrace_read_type type);
+
+  /* Read the branch trace configuration into BUFFER.
+     Return 0 on success; print an error message into BUFFER and return -1
+     otherwise.  */
+  virtual int read_btrace_conf (const btrace_target_info *tinfo,
+				buffer *buf);
 };
 
 extern process_stratum_target *the_target;
@@ -612,19 +613,13 @@ int kill_inferior (process_info *proc);
 static inline struct btrace_target_info *
 target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
 {
-  if (the_target->enable_btrace == nullptr)
-    error (_("Target does not support branch tracing."));
-
-  return (*the_target->enable_btrace) (ptid, conf);
+  return the_target->pt->enable_btrace (ptid, conf);
 }
 
 static inline int
 target_disable_btrace (struct btrace_target_info *tinfo)
 {
-  if (the_target->disable_btrace == nullptr)
-    error (_("Target does not support branch tracing."));
-
-  return (*the_target->disable_btrace) (tinfo);
+  return the_target->pt->disable_btrace (tinfo);
 }
 
 static inline int
@@ -632,20 +627,14 @@ target_read_btrace (struct btrace_target_info *tinfo,
 		    struct buffer *buffer,
 		    enum btrace_read_type type)
 {
-  if (the_target->read_btrace == nullptr)
-    error (_("Target does not support branch tracing."));
-
-  return (*the_target->read_btrace) (tinfo, buffer, type);
+  return the_target->pt->read_btrace (tinfo, buffer, type);
 }
 
 static inline int
 target_read_btrace_conf (struct btrace_target_info *tinfo,
 			 struct buffer *buffer)
 {
-  if (the_target->read_btrace_conf == nullptr)
-    error (_("Target does not support branch tracing."));
-
-  return (*the_target->read_btrace_conf) (tinfo, buffer);
+  return the_target->pt->read_btrace_conf (tinfo, buffer);
 }
 
 #define target_supports_range_stepping() \
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 84b6ea3e28..7fdc90feff 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -1858,10 +1858,6 @@ win32_sw_breakpoint_from_kind (int kind, int *size)
 static win32_process_target the_win32_target;
 
 static process_stratum_target win32_target_ops = {
-  NULL, /* enable_btrace */
-  NULL, /* disable_btrace */
-  NULL, /* read_btrace */
-  NULL, /* read_btrace_conf */
   NULL, /* supports_range_stepping */
   NULL, /* pid_to_exec_file */
   NULL, /* multifs_open */


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-04  8:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03  5:38 [binutils-gdb] gdbserver: turn btrace-related target ops into methods gdb-buildbot
2020-03-03  5:26 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
2020-03-03  7:49 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-03-03 15:09 ` Failures on Fedora-i686, " gdb-buildbot
2020-03-03 15:18 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-03-03 15:34 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-03-03 16:07 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-03-03 16:12 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-03-03 16:43 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-04  9:23 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).