gdbserver: turn target op 'qxfer_siginfo' into a method
[deliverable/binutils-gdb.git] / gdbserver / linux-low.cc
index 5a5c6372823c31e7fcef8d7fc6f9e931396bcefa..552c73524aa305f3a100cb67f9a53705ed122e91 100644 (file)
@@ -45,7 +45,6 @@
 #include <sys/uio.h>
 #include "gdbsupport/filestuff.h"
 #include "tracepoint.h"
-#include "hostio.h"
 #include <inttypes.h>
 #include "gdbsupport/common-inferior.h"
 #include "nat/fork-inferior.h"
 #endif
 #endif
 
+#if (defined(__UCLIBC__)               \
+     && defined(HAS_NOMMU)             \
+     && defined(PT_TEXT_ADDR)          \
+     && defined(PT_DATA_ADDR)          \
+     && defined(PT_TEXT_END_ADDR))
+#define SUPPORTS_READ_OFFSETS
+#endif
+
 #ifdef HAVE_LINUX_BTRACE
 # include "nat/linux-btrace.h"
 # include "gdbsupport/btrace-common.h"
@@ -6059,21 +6066,28 @@ linux_process_target::stopped_data_address ()
   return lwp->stopped_data_address;
 }
 
-#if defined(__UCLIBC__) && defined(HAS_NOMMU)        \
-    && defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) \
-    && defined(PT_TEXT_END_ADDR)
-
 /* This is only used for targets that define PT_TEXT_ADDR,
    PT_DATA_ADDR and PT_TEXT_END_ADDR.  If those are not defined, supposedly
    the target has different ways of acquiring this information, like
    loadmaps.  */
 
+bool
+linux_process_target::supports_read_offsets ()
+{
+#ifdef SUPPORTS_READ_OFFSETS
+  return true;
+#else
+  return false;
+#endif
+}
+
 /* Under uClinux, programs are loaded at non-zero offsets, which we need
    to tell gdb about.  */
 
-static int
-linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
+int
+linux_process_target::read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
 {
+#ifdef SUPPORTS_READ_OFFSETS
   unsigned long text, text_end, data;
   int pid = lwpid_of (current_thread);
 
@@ -6102,14 +6116,46 @@ linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
 
       return 1;
     }
- return 0;
+  return 0;
+#else
+  gdb_assert_not_reached ("target op read_offsets not supported");
+#endif
 }
+
+bool
+linux_process_target::supports_get_tls_address ()
+{
+#ifdef USE_THREAD_DB
+  return true;
+#else
+  return false;
 #endif
+}
 
-static int
-linux_qxfer_osdata (const char *annex,
-                   unsigned char *readbuf, unsigned const char *writebuf,
-                   CORE_ADDR offset, int len)
+int
+linux_process_target::get_tls_address (thread_info *thread,
+                                      CORE_ADDR offset,
+                                      CORE_ADDR load_module,
+                                      CORE_ADDR *address)
+{
+#ifdef USE_THREAD_DB
+  return thread_db_get_tls_address (thread, offset, load_module, address);
+#else
+  return -1;
+#endif
+}
+
+bool
+linux_process_target::supports_qxfer_osdata ()
+{
+  return true;
+}
+
+int
+linux_process_target::qxfer_osdata (const char *annex,
+                                   unsigned char *readbuf,
+                                   unsigned const char *writebuf,
+                                   CORE_ADDR offset, int len)
 {
   return linux_common_xfer_osdata (annex, readbuf, offset, len);
 }
@@ -6136,9 +6182,17 @@ siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
     }
 }
 
-static int
-linux_xfer_siginfo (const char *annex, unsigned char *readbuf,
-                   unsigned const char *writebuf, CORE_ADDR offset, int len)
+bool
+linux_process_target::supports_qxfer_siginfo ()
+{
+  return true;
+}
+
+int
+linux_process_target::qxfer_siginfo (const char *annex,
+                                    unsigned char *readbuf,
+                                    unsigned const char *writebuf,
+                                    CORE_ADDR offset, int len)
 {
   int pid;
   siginfo_t siginfo;
@@ -7375,21 +7429,6 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-#if defined(__UCLIBC__) && defined(HAS_NOMMU)        \
-    && defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) \
-    && defined(PT_TEXT_END_ADDR)
-  linux_read_offsets,
-#else
-  NULL,
-#endif
-#ifdef USE_THREAD_DB
-  thread_db_get_tls_address,
-#else
-  NULL,
-#endif
-  hostio_last_error_from_errno,
-  linux_qxfer_osdata,
-  linux_xfer_siginfo,
   linux_supports_non_stop,
   linux_async,
   linux_start_non_stop,
This page took 0.026331 seconds and 4 git commands to generate.