]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
More procfs.c simplification
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:47:01 +0000 (00:47 +0100)
There are only two architectures using procfs.c (i386/SPARC), and none
of their corresponding nat files overrides any target method.  Move
the add_target calls to procfs.c directly.

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

* i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
procfs_target/add_target here.
* procfs.c (procfs_target): Make static.
(_initialize_procfs): Call add_target here.
* procfs.h (struct target_ops): Remove forward declaration.
(procfs_target): Remove declaration.
* sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Delete.

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

index ae43d4802f58ff850fc98b8c659917b7e5473b2c..0d2624bdb16d7e4f6212144c4e3966dc8d9c51d9 100644 (file)
@@ -1,3 +1,13 @@
+2018-05-02  Pedro Alves  <palves@redhat.com>
+
+       * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
+       procfs_target/add_target here.
+       * procfs.c (procfs_target): Make static.
+       (_initialize_procfs): Call add_target here.
+       * procfs.h (struct target_ops): Remove forward declaration.
+       (procfs_target): Remove declaration.
+       * sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Delete.
+
 2018-05-02  Pedro Alves  <palves@redhat.com>
 
        * procfs.c (procfs_stopped_by_watchpoint)
index 359fc3203d50b09fb3795dfdb0a2475c3ee38765..992ecb7ed1e7f6959117910120826f1259f88758 100644 (file)
@@ -133,11 +133,6 @@ fill_fpregset (const struct regcache *regcache,
 void
 _initialize_amd64_sol2_nat (void)
 {
-  struct target_ops *t;
-
-  /* Fill in the generic procfs methods.  */
-  t = procfs_target ();
-
 #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 =
@@ -146,6 +141,4 @@ _initialize_amd64_sol2_nat (void)
   amd64_native_gregset64_num_regs =
     ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
 #endif
-
-  add_target (t);
 }
index 0143f2621cd987806cdebbab579f16748a27046b..51c9ae8f00de158effd0a2bc89b83272c46be5c1 100644 (file)
@@ -171,7 +171,9 @@ procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
 }
 #endif
 
-struct target_ops *
+/* Create a procfs target.  */
+
+static struct target_ops *
 procfs_target (void)
 {
   struct target_ops *t = inf_child_target ();
@@ -3770,6 +3772,8 @@ _initialize_procfs (void)
           _("Cancel a trace of entries into the syscall."));
   add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd,
           _("Cancel a trace of exits from the syscall."));
+
+  add_target (procfs_target ());
 }
 
 /* =================== END, GDB  "MODULE" =================== */
index beeb876a73e736b1beb035d98ecc769a1fe1fe37..e66c674282c5a251e5ae1891c6ce2bc44a5aa736 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-struct target_ops;
-
-/* Create a prototype generic procfs target.  The client can override
-   it with local methods.  */
-
-extern struct target_ops *procfs_target (void);
-
 /* Return a ptid for which we guarantee we will be able to find a
    'live' procinfo.  */
 
index 482050d008ec9bad644425539253d67495db3b10..2c0d561f98dd5c3ad13906a38653dadf3db66205 100644 (file)
@@ -97,12 +97,3 @@ fill_fpregset (const struct regcache *regcache,
 {
   sparc_collect_fpregset (&sparc_sol2_fpregmap, regcache, regnum, fpregs);
 }
-
-void
-_initialize_sparc_sol2_nat (void)
-{
-  struct target_ops *t;
-
-  t = procfs_target ();
-  add_target (t);
-}