aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2018-05-03 00:37:07 +0100
committerPedro Alves <palves@redhat.com>2018-05-03 00:47:01 +0100
commitc1955e179201e76330a10c400bfa92cab2afbee0 (patch)
treea0b3134f992412024690bf9d96026a59b0b0e624 /gdb
parentb5c8fcb1b40a61be5015b02e8cf456a56c258b5d (diff)
downloadgdb-c1955e179201e76330a10c400bfa92cab2afbee0.zip
gdb-c1955e179201e76330a10c400bfa92cab2afbee0.tar.gz
gdb-c1955e179201e76330a10c400bfa92cab2afbee0.tar.bz2
More procfs.c simplification
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/i386-sol2-nat.c7
-rw-r--r--gdb/procfs.c6
-rw-r--r--gdb/procfs.h7
-rw-r--r--gdb/sparc-sol2-nat.c9
5 files changed, 15 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ae43d48..0d2624b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
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)
(procfs_insert_watchpoint, procfs_remove_watchpoint)
(procfs_region_ok_for_hw_watchpoint, procfs_stopped_data_address):
diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
index 359fc32..992ecb7 100644
--- a/gdb/i386-sol2-nat.c
+++ b/gdb/i386-sol2-nat.c
@@ -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);
}
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 0143f26..51c9ae8 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -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" =================== */
diff --git a/gdb/procfs.h b/gdb/procfs.h
index beeb876..e66c674 100644
--- a/gdb/procfs.h
+++ b/gdb/procfs.h
@@ -17,13 +17,6 @@
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. */
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index 482050d..2c0d561 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -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);
-}