Eliminate procfs.c:procfs_use_watchpoints
authorPedro Alves <palves@redhat.com>
Wed, 2 May 2018 23:37:07 +0000 (00:37 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 2 May 2018 23:37:07 +0000 (00:37 +0100)
Now that procfs.c is only ever used by Solaris, and, both x86 and
SPARC Solaris support watchpoints (*), we don't need the separate
procfs_use_watchpoints function.  Getting rid of it simplifies
C++ification of target_ops.

(*) and I assume that any other Solaris port would use the same kernel
debug API interfaces for watchpoints.  Otherwise, we can worry about
it if it ever happens.

gdb/ChangeLog:
2018-05-02  Pedro Alves  <palves@redhat.com>

* procfs.c (procfs_stopped_by_watchpoint)
(procfs_insert_watchpoint, procfs_remove_watchpoint)
(procfs_region_ok_for_hw_watchpoint, procfs_stopped_data_address):
Forward declare.
(procfs_use_watchpoints): Delete, move contents...
(procfs_target): ... here.
* procfs.h (procfs_use_watchpoints): Delete declaration.
* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
procfs_use_watchpoints.
* sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Don't call
procfs_use_watchpoints.

gdb/ChangeLog
gdb/i386-sol2-nat.c
gdb/procfs.c
gdb/procfs.h
gdb/sparc-sol2-nat.c

index f326c8e2d35642342bd979ed812dcd9142f9fd98..ae43d4802f58ff850fc98b8c659917b7e5473b2c 100644 (file)
@@ -1,3 +1,17 @@
+2018-05-02  Pedro Alves  <palves@redhat.com>
+
+       * procfs.c (procfs_stopped_by_watchpoint)
+       (procfs_insert_watchpoint, procfs_remove_watchpoint)
+       (procfs_region_ok_for_hw_watchpoint, procfs_stopped_data_address):
+       Forward declare.
+       (procfs_use_watchpoints): Delete, move contents...
+       (procfs_target): ... here.
+       * procfs.h (procfs_use_watchpoints): Delete declaration.
+       * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
+       procfs_use_watchpoints.
+       * sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Don't call
+       procfs_use_watchpoints.
+
 2018-05-02  Tom Tromey  <tom@tromey.com>
 
        PR python/20084:
index 679bb861eb989289fff78d77249f012da9abccbc..359fc3203d50b09fb3795dfdb0a2475c3ee38765 100644 (file)
@@ -138,8 +138,6 @@ _initialize_amd64_sol2_nat (void)
   /* Fill in the generic procfs methods.  */
   t = procfs_target ();
 
-  procfs_use_watchpoints (t);
-
 #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
   amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset;
   amd64_native_gregset32_num_regs =
index 3c747cd3e21eb97ebce6585e8a226ef0cb4b09fe..0143f2621cd987806cdebbab579f16748a27046b 100644 (file)
@@ -126,6 +126,22 @@ static int procfs_can_use_hw_breakpoint (struct target_ops *self,
 static void procfs_info_proc (struct target_ops *, const char *,
                              enum info_proc_what);
 
+static int procfs_stopped_by_watchpoint (struct target_ops *);
+
+static int procfs_insert_watchpoint (struct target_ops *,
+                                    CORE_ADDR, int,
+                                    enum target_hw_bp_type,
+                                    struct expression *);
+
+static int procfs_remove_watchpoint (struct target_ops *,
+                                    CORE_ADDR, int,
+                                    enum target_hw_bp_type,
+                                    struct expression *);
+
+static int procfs_region_ok_for_hw_watchpoint (struct target_ops *,
+                                              CORE_ADDR, int);
+static int procfs_stopped_data_address (struct target_ops *, CORE_ADDR *);
+
 #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
 /* When GDB is built as 64-bit application on Solaris, the auxv data
    is presented in 64-bit format.  We need to provide a custom parser
@@ -186,6 +202,13 @@ procfs_target (void)
   t->to_auxv_parse = procfs_auxv_parse;
 #endif
 
+  t->to_stopped_by_watchpoint = procfs_stopped_by_watchpoint;
+  t->to_insert_watchpoint = procfs_insert_watchpoint;
+  t->to_remove_watchpoint = procfs_remove_watchpoint;
+  t->to_region_ok_for_hw_watchpoint = procfs_region_ok_for_hw_watchpoint;
+  t->to_can_use_hw_breakpoint = procfs_can_use_hw_breakpoint;
+  t->to_stopped_data_address = procfs_stopped_data_address;
+
   t->to_magic = OPS_MAGIC;
 
   return t;
@@ -3385,17 +3408,6 @@ procfs_region_ok_for_hw_watchpoint (struct target_ops *self,
   return 1;
 }
 
-void
-procfs_use_watchpoints (struct target_ops *t)
-{
-  t->to_stopped_by_watchpoint = procfs_stopped_by_watchpoint;
-  t->to_insert_watchpoint = procfs_insert_watchpoint;
-  t->to_remove_watchpoint = procfs_remove_watchpoint;
-  t->to_region_ok_for_hw_watchpoint = procfs_region_ok_for_hw_watchpoint;
-  t->to_can_use_hw_breakpoint = procfs_can_use_hw_breakpoint;
-  t->to_stopped_data_address = procfs_stopped_data_address;
-}
-
 /* Memory Mappings Functions: */
 
 /* Call a callback function once for each mapping, passing it the
index 9419a700e0e6d753b54251997fca629e760cbab8..beeb876a73e736b1beb035d98ecc769a1fe1fe37 100644 (file)
@@ -24,12 +24,6 @@ struct target_ops;
 
 extern struct target_ops *procfs_target (void);
 
-/* Call this in the native _initialize routine that creates and
-   customizes the prototype target returned by procfs_target, if the
-   native debug interface supports procfs watchpoints.  */
-
-extern void procfs_use_watchpoints (struct target_ops *t);
-
 /* Return a ptid for which we guarantee we will be able to find a
    'live' procinfo.  */
 
index 2ec2cfb3b1e95285d1e71db0865ba81e59be2784..482050d008ec9bad644425539253d67495db3b10 100644 (file)
@@ -104,6 +104,5 @@ _initialize_sparc_sol2_nat (void)
   struct target_ops *t;
 
   t = procfs_target ();
-  procfs_use_watchpoints (t);
   add_target (t);
 }