[PATCH 12/22] [GDBserver] Multi-process + multi-arch: GNU/Linux CRISv32

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

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

Completely untested.

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

* linux-cris-low.c (tdesc_crisv32): Declare.
(cris_arch_setup): New function.
(cris_regsets_info, cris_usrregs_info, regs_info): New globals.
(cris_regs_info): New function.
(the_low_target): Adjust.
(initialize_low_arch): New function.
---
gdb/gdbserver/linux-crisv32-low.c | 52 +++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index ca0e276..9003c2c 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -22,6 +22,7 @@

/* Defined in auto-generated file reg-crisv32.c. */
void init_registers_crisv32 (void);
+extern struct target_desc *tdesc_crisv32;

/* CRISv32 */
#define cris_num_regs 49
@@ -362,17 +363,50 @@ cris_store_gregset (struct regcache *regcache, const void *buf)
}
}

-struct regset_info target_regsets[] = {
+static void
+cris_arch_setup (void)
+{
+ current_process ()->tdesc = tdesc_crisv32;
+}
+
+typedef unsigned long elf_gregset_t[cris_num_regs];
+
+static struct regset_info cris_regsets[] = {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
{ 0, 0, 0, -1, -1, NULL, NULL }
};

+
+static struct regsets_info cris_regsets_info =
+ {
+ cris_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+ };
+
+static struct usrregs_info cris_usrregs_info =
+ {
+ cris_num_regs,
+ cris_regmap,
+ };
+
+static struct regs_info regs_info =
+ {
+ NULL, /* regset_bitmap */
+ &cris_usrregs_info,
+ &cris_regsets_info
+ };
+
+static const struct regs_info *
+cris_regs_info (void)
+{
+ return &regs_info;
+}
+
struct linux_target_ops the_low_target = {
- init_registers_crisv32,
- -1,
- NULL,
- NULL,
+ cris_arch_setup,
+ cris_regs_info,
NULL,
NULL,
NULL, /* fetch_register */
@@ -388,3 +422,11 @@ struct linux_target_ops the_low_target = {
cris_stopped_by_watchpoint,
cris_stopped_data_address,
};
+
+void
+initialize_low_arch (void)
+{
+ init_register_crisv32 ();
+
+ initialize_regsets_info (&cris_regsets_info);
+}