aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/linux-low.cc
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-02-17 16:11:56 +0100
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-02-20 17:35:09 +0100
commit5203ae1e870191ef058c1b4590f9b9fbf6b594ed (patch)
tree3e007efaed194549c0aa7c25797e200cb0ba348a /gdbserver/linux-low.cc
parent6eeb5c5531f0238d367a2f3f1520ae3e2401f7ea (diff)
downloadfsf-binutils-gdb-5203ae1e870191ef058c1b4590f9b9fbf6b594ed.zip
fsf-binutils-gdb-5203ae1e870191ef058c1b4590f9b9fbf6b594ed.tar.gz
fsf-binutils-gdb-5203ae1e870191ef058c1b4590f9b9fbf6b594ed.tar.bz2
gdbserver: turn target op 'read_offsets' into a method
gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's read_offsets op into a method of process_target. * target.h (struct process_stratum_target): Remove the target op. (class process_target): Add the target op. Also add 'supports_read_offsets'. * target.cc (process_target::read_offsets): Define. (process_target::supports_read_offsets): Define. Update the derived classes and callers below. * server.cc (handle_query): Update. * linux-low.cc (SUPPORTS_READ_OFFSETS): New #define directive. (linux_target_ops): Update. (linux_process_target::supports_read_offsets): Define. (linux_read_offsets): Turn into ... (linux_process_target::read_offsets): ... 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.
Diffstat (limited to 'gdbserver/linux-low.cc')
-rw-r--r--gdbserver/linux-low.cc40
1 files changed, 25 insertions, 15 deletions
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 5a5c637..34bbc0d 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -100,6 +100,14 @@
#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 +6067,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,9 +6117,11 @@ 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
+}
static int
linux_qxfer_osdata (const char *annex,
@@ -7375,13 +7392,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