gdbserver/linux-low: turn the 'decr_pc_after_break' field into a method
[deliverable/binutils-gdb.git] / gdbserver / linux-low.cc
index 730f23bb6f034311febbe7fe6eaad047fa4af81f..fd225789347e46e46bb6b7f1788f971518ffbb49 100644 (file)
@@ -292,15 +292,6 @@ can_hardware_single_step (void)
     return 0;
 }
 
-/* True if the low target can software single-step.  Such targets
-   implement the GET_NEXT_PCS callback.  */
-
-static int
-can_software_single_step (void)
-{
-  return (the_low_target.get_next_pcs != NULL);
-}
-
 bool
 linux_process_target::low_supports_breakpoints ()
 {
@@ -319,6 +310,19 @@ linux_process_target::low_set_pc (regcache *regcache, CORE_ADDR newpc)
   gdb_assert_not_reached ("linux target op low_set_pc is not implemented");
 }
 
+std::vector<CORE_ADDR>
+linux_process_target::low_get_next_pcs (regcache *regcache)
+{
+  gdb_assert_not_reached ("linux target op low_get_next_pcs is not "
+                         "implemented");
+}
+
+int
+linux_process_target::low_decr_pc_after_break ()
+{
+  return 0;
+}
+
 /* Returns true if this target can support fast tracepoints.  This
    does not mean that the in-process agent has been loaded in the
    inferior.  */
@@ -551,7 +555,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
          child_proc->attached = parent_proc->attached;
 
          if (event_lwp->bp_reinsert != 0
-             && can_software_single_step ()
+             && supports_software_single_step ()
              && event == PTRACE_EVENT_VFORK)
            {
              /* If we leave single-step breakpoints there, child will
@@ -596,7 +600,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
             In case of vfork, we'll reinsert them back once vforked
             child is done.  */
          if (event_lwp->bp_reinsert != 0
-             && can_software_single_step ())
+             && supports_software_single_step ())
            {
              /* The child process is forked and stopped, so it is safe
                 to access its memory without stopping all other threads
@@ -660,7 +664,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
     {
       event_lwp->waitstatus.kind = TARGET_WAITKIND_VFORK_DONE;
 
-      if (event_lwp->bp_reinsert != 0 && can_software_single_step ())
+      if (event_lwp->bp_reinsert != 0 && supports_software_single_step ())
        {
          reinsert_single_step_breakpoints (event_thr);
 
@@ -798,7 +802,7 @@ linux_process_target::save_stop_reason (lwp_info *lwp)
     return false;
 
   pc = get_pc (lwp);
-  sw_breakpoint_pc = pc - the_low_target.decr_pc_after_break;
+  sw_breakpoint_pc = pc - low_decr_pc_after_break ();
 
   /* breakpoint_at reads from the current thread.  */
   saved_thread = current_thread;
@@ -3508,7 +3512,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
          /* Remove the single-step breakpoints if any.  Note that
             there isn't single-step breakpoint if we finished stepping
             over.  */
-         if (can_software_single_step ()
+         if (supports_software_single_step ()
              && has_single_step_breakpoints (current_thread))
            {
              stop_all_lwps (0, event_child);
@@ -3555,7 +3559,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
   /* Alright, we're going to report a stop.  */
 
   /* Remove single-step breakpoints.  */
-  if (can_software_single_step ())
+  if (supports_software_single_step ())
     {
       /* Remove single-step breakpoints or not.  It it is true, stop all
         lwps, so that other threads won't hit the breakpoint in the
@@ -3696,7 +3700,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
   if (event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
       && !cs.swbreak_feature)
     {
-      int decr_pc = the_low_target.decr_pc_after_break;
+      int decr_pc = low_decr_pc_after_break ();
 
       if (decr_pc != 0)
        {
@@ -4116,7 +4120,7 @@ linux_process_target::install_software_single_step_breakpoints (lwp_info *lwp)
   scoped_restore save_current_thread = make_scoped_restore (&current_thread);
 
   current_thread = thread;
-  std::vector<CORE_ADDR> next_pcs = the_low_target.get_next_pcs (regcache);
+  std::vector<CORE_ADDR> next_pcs = low_get_next_pcs (regcache);
 
   for (CORE_ADDR pc : next_pcs)
     set_single_step_breakpoint (pc, current_ptid);
@@ -4131,7 +4135,7 @@ linux_process_target::single_step (lwp_info* lwp)
     {
       step = 1;
     }
-  else if (can_software_single_step ())
+  else if (supports_software_single_step ())
     {
       install_software_single_step_breakpoints (lwp);
       step = 0;
@@ -4610,7 +4614,7 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
 
   /* On software single step target, resume the inferior with signal
      rather than stepping over.  */
-  if (can_software_single_step ()
+  if (supports_software_single_step ()
       && lwp->pending_signals != NULL
       && lwp_signal_can_be_delivered (lwp))
     {
@@ -5042,7 +5046,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
       /* If resume_step is requested by GDB, install single-step
         breakpoints when the thread is about to be actually resumed if
         the single-step breakpoints weren't removed.  */
-      if (can_software_single_step ()
+      if (supports_software_single_step ()
          && !has_single_step_breakpoints (thread))
        install_software_single_step_breakpoints (lwp);
 
@@ -5910,12 +5914,6 @@ linux_process_target::supports_hardware_single_step ()
   return can_hardware_single_step ();
 }
 
-bool
-linux_process_target::supports_software_single_step ()
-{
-  return can_software_single_step ();
-}
-
 bool
 linux_process_target::stopped_by_watchpoint ()
 {
@@ -6299,7 +6297,7 @@ linux_process_target::supports_agent ()
 bool
 linux_process_target::supports_range_stepping ()
 {
-  if (can_software_single_step ())
+  if (supports_software_single_step ())
     return true;
   if (*the_low_target.supports_range_stepping == NULL)
     return false;
@@ -7230,16 +7228,6 @@ current_lwp_ptid (void)
   return ptid_of (current_thread);
 }
 
-/* Implementation of the target_ops method "sw_breakpoint_from_kind".  */
-
-const gdb_byte *
-linux_process_target::sw_breakpoint_from_kind (int kind, int *size)
-{
-  gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL);
-
-  return (*the_low_target.sw_breakpoint_from_kind) (kind, size);
-}
-
 const char *
 linux_process_target::thread_name (ptid_t thread)
 {
This page took 0.025742 seconds and 4 git commands to generate.