gdbserver/linux-low: turn process/thread addition/deletion ops into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-x86-low.cc
index eb36aced8b6e49f009a5faa0026aead3677bff3d..be68e005f00f368811751b11272fbe40d5f4f982 100644 (file)
@@ -108,6 +108,8 @@ public:
 
   const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
 
+  bool supports_z_point_type (char z_type) override;
+
 protected:
 
   void low_arch_setup () override;
@@ -123,6 +125,36 @@ protected:
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
 
   int low_decr_pc_after_break () override;
+
+  bool low_breakpoint_at (CORE_ADDR pc) override;
+
+  int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
+                       int size, raw_breakpoint *bp) override;
+
+  int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
+                       int size, raw_breakpoint *bp) override;
+
+  bool low_stopped_by_watchpoint () override;
+
+  CORE_ADDR low_stopped_data_address () override;
+
+  /* collect_ptrace_register/supply_ptrace_register are not needed in the
+     native i386 case (no registers smaller than an xfer unit), and are not
+     used in the biarch case (HAVE_LINUX_USRREGS is not defined).  */
+
+  /* Need to fix up i386 siginfo if host is amd64.  */
+  bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                         int direction) override;
+
+  arch_process_info *low_new_process () override;
+
+  void low_delete_process (arch_process_info *info) override;
+
+  void low_new_thread (lwp_info *) override;
+
+  void low_delete_thread (arch_lwp_info *) override;
+
+  void low_new_fork (process_info *parent, process_info *child) override;
 };
 
 /* The singleton target ops object.  */
@@ -560,16 +592,16 @@ x86_target::low_decr_pc_after_break ()
 static const gdb_byte x86_breakpoint[] = { 0xCC };
 #define x86_breakpoint_len 1
 
-static int
-x86_breakpoint_at (CORE_ADDR pc)
+bool
+x86_target::low_breakpoint_at (CORE_ADDR pc)
 {
   unsigned char c;
 
-  the_target->read_memory (pc, &c, 1);
+  read_memory (pc, &c, 1);
   if (c == 0xCC)
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 \f
 /* Low-level function vector.  */
@@ -585,8 +617,8 @@ struct x86_dr_low_type x86_dr_low =
 \f
 /* Breakpoint/Watchpoint support.  */
 
-static int
-x86_supports_z_point_type (char z_type)
+bool
+x86_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
@@ -594,15 +626,15 @@ x86_supports_z_point_type (char z_type)
     case Z_PACKET_HW_BP:
     case Z_PACKET_WRITE_WP:
     case Z_PACKET_ACCESS_WP:
-      return 1;
+      return true;
     default:
-      return 0;
+      return false;
     }
 }
 
-static int
-x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
-                 int size, struct raw_breakpoint *bp)
+int
+x86_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
+                             int size, raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
 
@@ -626,9 +658,9 @@ x86_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
     }
 }
 
-static int
-x86_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
-                 int size, struct raw_breakpoint *bp)
+int
+x86_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
+                             int size, raw_breakpoint *bp)
 {
   struct process_info *proc = current_process ();
 
@@ -651,15 +683,15 @@ x86_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
     }
 }
 
-static int
-x86_stopped_by_watchpoint (void)
+bool
+x86_target::low_stopped_by_watchpoint ()
 {
   struct process_info *proc = current_process ();
   return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state);
 }
 
-static CORE_ADDR
-x86_stopped_data_address (void)
+CORE_ADDR
+x86_target::low_stopped_data_address ()
 {
   struct process_info *proc = current_process ();
   CORE_ADDR addr;
@@ -671,8 +703,8 @@ x86_stopped_data_address (void)
 \f
 /* Called when a new process is created.  */
 
-static struct arch_process_info *
-x86_linux_new_process (void)
+arch_process_info *
+x86_target::low_new_process ()
 {
   struct arch_process_info *info = XCNEW (struct arch_process_info);
 
@@ -683,16 +715,30 @@ x86_linux_new_process (void)
 
 /* Called when a process is being deleted.  */
 
-static void
-x86_linux_delete_process (struct arch_process_info *info)
+void
+x86_target::low_delete_process (arch_process_info *info)
 {
   xfree (info);
 }
 
-/* Target routine for linux_new_fork.  */
+void
+x86_target::low_new_thread (lwp_info *lwp)
+{
+  /* This comes from nat/.  */
+  x86_linux_new_thread (lwp);
+}
 
-static void
-x86_linux_new_fork (struct process_info *parent, struct process_info *child)
+void
+x86_target::low_delete_thread (arch_lwp_info *alwp)
+{
+  /* This comes from nat/.  */
+  x86_linux_delete_thread (alwp);
+}
+
+/* Target routine for new_fork.  */
+
+void
+x86_target::low_new_fork (process_info *parent, process_info *child)
 {
   /* These are allocated by linux_add_process.  */
   gdb_assert (parent->priv != NULL
@@ -739,8 +785,8 @@ x86_debug_reg_state (pid_t pid)
    from INF to PTRACE.  If DIRECTION is 0, copy from PTRACE to
    INF.  */
 
-static int
-x86_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
+bool
+x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
 {
 #ifdef __x86_64__
   unsigned int machine;
@@ -757,7 +803,7 @@ x86_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
                                             FIXUP_X32);
 #endif
 
-  return 0;
+  return false;
 }
 \f
 static int use_xml;
@@ -2908,24 +2954,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_breakpoint_at,
-  x86_supports_z_point_type,
-  x86_insert_point,
-  x86_remove_point,
-  x86_stopped_by_watchpoint,
-  x86_stopped_data_address,
-  /* collect_ptrace_register/supply_ptrace_register are not needed in the
-     native i386 case (no registers smaller than an xfer unit), and are not
-     used in the biarch case (HAVE_LINUX_USRREGS is not defined).  */
-  NULL,
-  NULL,
-  /* need to fix up i386 siginfo if host is amd64 */
-  x86_siginfo_fixup,
-  x86_linux_new_process,
-  x86_linux_delete_process,
-  x86_linux_new_thread,
-  x86_linux_delete_thread,
-  x86_linux_new_fork,
   x86_linux_prepare_to_resume,
   x86_linux_process_qsupported,
   x86_supports_tracepoints,
This page took 0.025723 seconds and 4 git commands to generate.