[PATCH 18/22] [GDBserver] Multi-process + multi-arch: GNU/Linux TILE-Gx

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

This adjusts the GNU/Linux TILE-Gx port to new interfaces.

Built with a cross tilegx-unknown-linux-gnu toolchain. Otherwise not
tested.

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

* linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare
globals.
(target_regsets): Rename to ...
(tile_regsets): ... this.
(tile_regsets_info, tile_usrregs_info, regs_info): New globals.
(tile_regs_info): New function.
(tile_arch_setup): Set the current process'es tdesc.
(the_low_target): Adjust.
(initialize_low_arch): New function.
---
gdb/gdbserver/linux-tile-low.c | 47 +++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index f242675..38e2887 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -25,8 +25,10 @@

/* Defined in auto-generated file reg-tilegx.c. */
void init_registers_tilegx (void);
+extern struct target_desc *tdesc_tilegx;
/* Defined in auto-generated file reg-tilegx32.c. */
void init_registers_tilegx32 (void);
+extern struct target_desc *tdesc_tilegx32;

#define tile_num_regs 65

@@ -119,13 +121,39 @@ tile_store_gregset (struct regcache *regcache, const void *buf)
supply_register (regcache, i, ((uint_reg_t *) buf) + tile_regmap[i]);
}

-struct regset_info target_regsets[] =
+static struct regset_info tile_regsets[] =
{
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, tile_num_regs * 4,
GENERAL_REGS, tile_fill_gregset, tile_store_gregset },
{ 0, 0, 0, -1, -1, NULL, NULL }
};

+static struct regsets_info tile_regsets_info =
+ {
+ tile_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+ };
+
+static struct usrregs_info tile_usrregs_info =
+ {
+ tile_num_regs,
+ tile_regmap,
+ };
+
+static struct regs_info regs_info =
+ {
+ NULL, /* regset_bitmap */
+ &tile_usrregs_info,
+ &tile_regsets_info,
+ };
+
+static const struct regs_info *
+tile_regs_info (void)
+{
+ return &regs_info;
+}
+
static void
tile_arch_setup (void)
{
@@ -138,18 +166,16 @@ tile_arch_setup (void)
error (_("Can't debug 64-bit process with 32-bit GDBserver"));

if (!is_elf64)
- init_registers_tilegx32();
+ current_process ()->tdesc = tdesc_tilegx32;
else
- init_registers_tilegx();
+ current_process ()->tdesc = tdesc_tilegx;
}

struct linux_target_ops the_low_target =
{
tile_arch_setup,
- tile_num_regs,
- tile_regmap,
- NULL,
+ tile_regs_info,
tile_cannot_fetch_register,
tile_cannot_store_register,
NULL,
@@ -161,3 +187,12 @@ struct linux_target_ops the_low_target =
0,
tile_breakpoint_at,
};
+
+void
+initialize_low_arch (void)
+{
+ init_registers_tilegx32();
+ init_registers_tilegx();
+
+ initialize_regsets_info (&tile_regsets_info);
+}