gdbserver: turn fast tracepoint target ops into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-low.cc
index 19d84c2d042d853b951f5baa709d97aa5eec8beb..ecd892b01ea2c76ccabbb33c823d0b089a281747 100644 (file)
@@ -1628,7 +1628,7 @@ linux_process_target::detach (process_info *process)
 #endif
 
   /* Stabilize threads (move out of jump pads).  */
-  stabilize_threads ();
+  target_stabilize_threads ();
 
   /* Detach from the clone lwps first.  If the thread group exits just
      while we're detaching, we must reap the clone lwps before we're
@@ -2934,8 +2934,8 @@ static ptid_t linux_wait_1 (ptid_t ptid,
    since for something else in the new run, the thread would now
    execute the wrong / random instructions.  */
 
-static void
-linux_stabilize_threads (void)
+void
+linux_process_target::stabilize_threads ()
 {
   thread_info *thread_stuck = find_thread (stuck_in_jump_pad_callback);
 
@@ -3721,7 +3721,7 @@ linux_wait_1 (ptid_t ptid,
 
       /* Stabilize threads (move out of jump pads).  */
       if (!non_stop)
-       stabilize_threads ();
+       target_stabilize_threads ();
     }
   else
     {
@@ -6408,6 +6408,12 @@ linux_process_target::handle_monitor_command (char *mon)
 #endif
 }
 
+int
+linux_process_target::core_of_thread (ptid_t ptid)
+{
+  return linux_common_core_of_thread (ptid);
+}
+
 static int
 linux_supports_disable_randomization (void)
 {
@@ -6477,9 +6483,15 @@ struct target_loadmap
 #  define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP
 # endif
 
-static int
-linux_read_loadmap (const char *annex, CORE_ADDR offset,
-                   unsigned char *myaddr, unsigned int len)
+bool
+linux_process_target::supports_read_loadmap ()
+{
+  return true;
+}
+
+int
+linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset,
+                                   unsigned char *myaddr, unsigned int len)
 {
   int pid = lwpid_of (current_thread);
   int addr = -1;
@@ -6509,12 +6521,10 @@ linux_read_loadmap (const char *annex, CORE_ADDR offset,
   memcpy (myaddr, (char *) data + offset, copy_length);
   return copy_length;
 }
-#else
-# define linux_read_loadmap NULL
 #endif /* defined PT_GETDSBT || defined PTRACE_GETFDPIC */
 
-static void
-linux_process_qsupported (char **features, int count)
+void
+linux_process_target::process_qsupported (char **features, int count)
 {
   if (the_low_target.process_qsupported != NULL)
     the_low_target.process_qsupported (features, count);
@@ -6536,17 +6546,17 @@ linux_get_ipa_tdesc_idx (void)
   return (*the_low_target.get_ipa_tdesc_idx) ();
 }
 
-static int
-linux_supports_tracepoints (void)
+bool
+linux_process_target::supports_tracepoints ()
 {
   if (*the_low_target.supports_tracepoints == NULL)
-    return 0;
+    return false;
 
   return (*the_low_target.supports_tracepoints) ();
 }
 
-static CORE_ADDR
-linux_read_pc (struct regcache *regcache)
+CORE_ADDR
+linux_process_target::read_pc (regcache *regcache)
 {
   if (the_low_target.get_pc == NULL)
     return 0;
@@ -6554,24 +6564,30 @@ linux_read_pc (struct regcache *regcache)
   return (*the_low_target.get_pc) (regcache);
 }
 
-static void
-linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
+void
+linux_process_target::write_pc (regcache *regcache, CORE_ADDR pc)
 {
   gdb_assert (the_low_target.set_pc != NULL);
 
   (*the_low_target.set_pc) (regcache, pc);
 }
 
-static int
-linux_thread_stopped (struct thread_info *thread)
+bool
+linux_process_target::supports_thread_stopped ()
+{
+  return true;
+}
+
+bool
+linux_process_target::thread_stopped (thread_info *thread)
 {
   return get_thread_lwp (thread)->stopped;
 }
 
 /* This exposes stop-all-threads functionality to other modules.  */
 
-static void
-linux_pause_all (int freeze)
+void
+linux_process_target::pause_all (bool freeze)
 {
   stop_all_lwps (freeze, NULL);
 }
@@ -6579,8 +6595,8 @@ linux_pause_all (int freeze)
 /* This exposes unstop-all-threads functionality to other gdbserver
    modules.  */
 
-static void
-linux_unpause_all (int unfreeze)
+void
+linux_process_target::unpause_all (bool unfreeze)
 {
   unstop_all_lwps (unfreeze, NULL);
 }
@@ -6591,7 +6607,7 @@ linux_process_target::prepare_to_access_memory ()
   /* Neither ptrace nor /proc/PID/mem allow accessing memory through a
      running LWP.  */
   if (non_stop)
-    linux_pause_all (1);
+    target_pause_all (true);
   return 0;
 }
 
@@ -6601,22 +6617,23 @@ linux_process_target::done_accessing_memory ()
   /* Neither ptrace nor /proc/PID/mem allow accessing memory through a
      running LWP.  */
   if (non_stop)
-    linux_unpause_all (1);
+    target_unpause_all (true);
 }
 
-static int
-linux_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
-                                       CORE_ADDR collector,
-                                       CORE_ADDR lockaddr,
-                                       ULONGEST orig_size,
-                                       CORE_ADDR *jump_entry,
-                                       CORE_ADDR *trampoline,
-                                       ULONGEST *trampoline_size,
-                                       unsigned char *jjump_pad_insn,
-                                       ULONGEST *jjump_pad_insn_size,
-                                       CORE_ADDR *adjusted_insn_addr,
-                                       CORE_ADDR *adjusted_insn_addr_end,
-                                       char *err)
+bool
+linux_process_target::supports_fast_tracepoints ()
+{
+  return the_low_target.install_fast_tracepoint_jump_pad != nullptr;
+}
+
+int
+linux_process_target::install_fast_tracepoint_jump_pad
+  (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+   CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+   CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+   unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+   CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+   char *err)
 {
   return (*the_low_target.install_fast_tracepoint_jump_pad)
     (tpoint, tpaddr, collector, lockaddr, orig_size,
@@ -6635,8 +6652,8 @@ linux_emit_ops (void)
     return NULL;
 }
 
-static int
-linux_get_min_fast_tracepoint_insn_len (void)
+int
+linux_process_target::get_min_fast_tracepoint_insn_len ()
 {
   return (*the_low_target.get_min_fast_tracepoint_insn_len) ();
 }
@@ -7439,21 +7456,8 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-  linux_common_core_of_thread,
-  linux_read_loadmap,
-  linux_process_qsupported,
-  linux_supports_tracepoints,
-  linux_read_pc,
-  linux_write_pc,
-  linux_thread_stopped,
-  NULL,
-  linux_pause_all,
-  linux_unpause_all,
-  linux_stabilize_threads,
-  linux_install_fast_tracepoint_jump_pad,
   linux_emit_ops,
   linux_supports_disable_randomization,
-  linux_get_min_fast_tracepoint_insn_len,
   linux_qxfer_libraries_svr4,
   linux_supports_agent,
 #ifdef HAVE_LINUX_BTRACE
This page took 0.027201 seconds and 4 git commands to generate.