[PATCH 17/22] [GDBserver] Multi-process + multi-arch: GNU/Linux Aarch64

Pedro Alves
2013-05-29T16:29:29Z

This adjusts the GNU/Linux Aarch64 port to new interfaces.

Buit with a cross aarch64-linux-gnu toolchain. Otherwise not tested.

2012-05-29 Pedro Alves <palves@redhat.com>

* linux-aarch64-low.c (tdesc_aarch64): Declare.
(aarch64_arch_setup): Set the current process'es tdesc.
(target_regsets): Rename to ...
(aarch64_regsets): ... this.
(aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals.
(aarch64_regs_info): New function.
(the_low_target): Adjust.
(initialize_low_arch): New function.
---
gdb/gdbserver/linux-aarch64-low.c | 43 +++++++++++++++++++++++++++++++++----
1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index cdf9cfd..d5de687 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -32,6 +32,7 @@

/* Defined in auto-generated files. */
void init_registers_aarch64 (void);
+extern struct target_desc *tdesc_aarch64;

#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
@@ -1188,7 +1189,7 @@ aarch64_arch_setup (void)
struct iovec iov;
struct user_hwdebug_state dreg_state;

- init_registers_aarch64 ();
+ current_process ()->tdesc = tdesc_aarch64;

pid = lwpid_of (get_thread_lwp (current_inferior));
iov.iov_base = &dreg_state;
@@ -1235,7 +1236,7 @@ aarch64_arch_setup (void)
}
}

-struct regset_info target_regsets[] =
+static struct regset_info aarch64_regsets[] =
{
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
sizeof (struct user_pt_regs), GENERAL_REGS,
@@ -1247,12 +1248,36 @@ struct regset_info target_regsets[] =
{ 0, 0, 0, -1, -1, NULL, NULL }
};

+static struct regsets_info aarch64_regsets_info =
+ {
+ aarch64_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+ };
+
+static struct usrregs_info aarch64_usrregs_info =
+ {
+ AARCH64_NUM_REGS,
+ aarch64_regmap,
+ };
+
+static struct regs_info regs_info =
+ {
+ NULL, /* regset_bitmap */
+ &aarch64_usrregs_info,
+ &aarch64_regsets_info,
+ };
+
+static const struct regs_info *
+aarch64_regs_info (void)
+{
+ return &regs_info;
+}
+
struct linux_target_ops the_low_target =
{
aarch64_arch_setup,
- AARCH64_NUM_REGS,
- aarch64_regmap,
- NULL,
+ aarch64_regs_info,
aarch64_cannot_fetch_register,
aarch64_cannot_store_register,
NULL,
@@ -1274,3 +1299,11 @@ struct linux_target_ops the_low_target =
aarch64_linux_new_thread,
aarch64_linux_prepare_to_resume,
};
+
+void
+initialize_low_arch (void)
+{
+ init_registers_aarch64 ();
+
+ initialize_regsets_info (&aarch64_regsets_info);
+}