aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/netbsd-low.cc
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2020-09-23 04:26:37 +0200
committerKamil Rytarowski <n54@gmx.com>2020-10-02 00:39:20 +0200
commit15397b0e058a84afcc2b6f4af383514e32f99a3d (patch)
treee5c4cf8c479d501fa645bb58158b4ce3b7a28a12 /gdbserver/netbsd-low.cc
parente2a2a24a8e78427ff8667d625f5befbe88c328bb (diff)
downloadgdb-15397b0e058a84afcc2b6f4af383514e32f99a3d.zip
gdb-15397b0e058a84afcc2b6f4af383514e32f99a3d.tar.gz
gdb-15397b0e058a84afcc2b6f4af383514e32f99a3d.tar.bz2
Refactor the NetBSD amd64 gdbserver support
Replace the pre-C++ construct of netbsd_target_ops, netbsd_regset_info and netbsd_tdesc with C++ inheritance approach found in the Linux gdbserver code. Add netbsd_amd64_target, that inherits from the netbsd_process_target class and add proper singleton object for the_netbsd_target, initialized from netbsd_amd64_target. Call low_arch_setup () on post process creation, which sets machine specific properties of the traced process. Remove global singleton the_netbsd_target object from the generic gdbserver code. This refactoring introduces no functional change from the end-user point of view. gdbserver/ChangeLog: * netbsd-amd64-low.cc (netbsd_x86_64_arch_setup): Remove. (netbsd_target_regsets): Now const. (the_low_target): Remove. (class netbsd_amd64_target, the_netbsd_amd64_target) (the_netbsd_target): Add. * netbsd-low.cc (netbsd_process_target::post_create_inferior): Call low_arch_setup (). (netbsd_process_target::fetch_registers) (netbsd_process_target::store_registers, initialize_low): Update. (the_netbsd_target): Remove. * netbsd-low.h (netbsd_target_regsets, netbsd_target_ops) (the_low_target, netbsd_tdesc): Remove. (netbsd_process_target::get_regs_info) (netbsd_process_target::low_arch_setup): Add.
Diffstat (limited to 'gdbserver/netbsd-low.cc')
-rw-r--r--gdbserver/netbsd-low.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc
index 3eb2c0f..7bec55a 100644
--- a/gdbserver/netbsd-low.cc
+++ b/gdbserver/netbsd-low.cc
@@ -114,6 +114,8 @@ netbsd_process_target::post_create_inferior ()
{
pid_t pid = current_process ()->pid;
netbsd_nat::enable_proc_events (pid);
+
+ low_arch_setup ();
}
/* Implement the attach target_ops method. */
@@ -504,7 +506,7 @@ netbsd_process_target::thread_alive (ptid_t ptid)
void
netbsd_process_target::fetch_registers (struct regcache *regcache, int regno)
{
- struct netbsd_regset_info *regset = netbsd_target_regsets;
+ const netbsd_regset_info *regset = get_regs_info ();
ptid_t inferior_ptid = ptid_of (current_thread);
while (regset->size >= 0)
@@ -525,7 +527,7 @@ netbsd_process_target::fetch_registers (struct regcache *regcache, int regno)
void
netbsd_process_target::store_registers (struct regcache *regcache, int regno)
{
- struct netbsd_regset_info *regset = netbsd_target_regsets;
+ const netbsd_regset_info *regset = get_regs_info ();
ptid_t inferior_ptid = ptid_of (current_thread);
while (regset->size >= 0)
@@ -1317,13 +1319,8 @@ netbsd_process_target::supports_read_auxv ()
return true;
}
-/* The NetBSD target ops object. */
-
-static netbsd_process_target the_netbsd_target;
-
void
initialize_low ()
{
- set_target_ops (&the_netbsd_target);
- the_low_target.arch_setup ();
+ set_target_ops (the_netbsd_target);
}