This is the mail archive of the
insight@sourceware.org
mailing list for the Insight project.
[PATCH] Update gdbarch NUM_REGS, NUM_PSEUDO_REGS, TARGET_BYTE_ORDER
- From: Keith Seitz <keiths at redhat dot com>
- To: insight <insight at sourceware dot org>
- Date: Mon, 04 Jun 2007 17:37:58 -0700
- Subject: [PATCH] Update gdbarch NUM_REGS, NUM_PSEUDO_REGS, TARGET_BYTE_ORDER
Hi,
I have committed the attached patch which tracks upstream GDB changes
w.r.t. these three macros.
This should have the repository building again.
Keith
ChangeLog
2007-06-04 Keith Seitz <keiths@redhat.com>
* generic/gdbtk-cmds.c (hex2bin): Use gdbarch_byte_order instead
of TARGET_BYTE_ORDER.
* generic/gdbtk-register.c (get_register): Likewise.
(map_arg_registers): Use gdbarch_num_regs and
gdbarch_num_pseduo_regs
instead of NUM_REGS and NUM_PSEUDO_REGS.
(setup_architecture_data): Likewise.
(gdb_regformat): Likewise.
(gdb_reggroup): Likewise.
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.95
diff -u -p -r1.95 gdbtk-cmds.c
--- generic/gdbtk-cmds.c 27 Apr 2007 15:39:50 -0000 1.95
+++ generic/gdbtk-cmds.c 5 Jun 2007 00:35:53 -0000
@@ -1,5 +1,5 @@
/* Tcl/Tk command definitions for Insight.
- Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
@@ -2259,7 +2259,7 @@ hex2bin (const char *hex, char *bin, int
int incr = 2;
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
{
/* need to read string in reverse */
hex += count - 2;
Index: generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.30
diff -u -p -r1.30 gdbtk-register.c
--- generic/gdbtk-register.c 13 Mar 2007 16:29:14 -0000 1.30
+++ generic/gdbtk-register.c 5 Jun 2007 00:35:53 -0000
@@ -1,5 +1,5 @@
/* Tcl/Tk command definitions for Insight - Registers
- Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
This file is part of GDB.
@@ -312,8 +312,8 @@ get_register (int regnum, void *arg)
ptr = buf + 2;
for (j = 0; j < register_size (current_gdbarch, regnum); j++)
{
- int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j
- : register_size (current_gdbarch, regnum) - 1 - j;
+ int idx = ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+ ? j : register_size (current_gdbarch, regnum) - 1 - j);
sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
ptr += 2;
}
@@ -382,7 +382,8 @@ map_arg_registers (Tcl_Interp *interp, i
case, some entries of REGISTER_NAME will change depending upon
the particular processor being debugged. */
- numregs = NUM_REGS + NUM_PSEUDO_REGS;
+ numregs = (gdbarch_num_regs (current_gdbarch)
+ + gdbarch_num_pseudo_regs (current_gdbarch));
if (objc == 0) /* No args, just do all the regs */
{
@@ -448,13 +449,17 @@ register_changed_p (int regnum, void *ar
static void
setup_architecture_data ()
{
+ int numregs;
+
xfree (old_regs);
xfree (regformat);
xfree (regtype);
- old_regs = xcalloc (1, (NUM_REGS + NUM_PSEUDO_REGS) * MAX_REGISTER_SIZE + 1);
- regformat = (int *)xcalloc ((NUM_REGS + NUM_PSEUDO_REGS) , sizeof(int));
- regtype = (struct type **)xcalloc ((NUM_REGS + NUM_PSEUDO_REGS), sizeof(struct type **));
+ numregs = (gdbarch_num_regs (current_gdbarch)
+ + gdbarch_num_pseudo_regs (current_gdbarch));
+ old_regs = xcalloc (1, numregs * MAX_REGISTER_SIZE + 1);
+ regformat = (int *)xcalloc (numregs, sizeof(int));
+ regtype = (struct type **)xcalloc (numregs, sizeof(struct type **));
}
/* gdb_regformat sets the format for a register */
@@ -466,7 +471,7 @@ static int
gdb_regformat (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj **objv)
{
- int fm, regno;
+ int fm, regno, numregs;
struct type *type;
if (objc != 3)
@@ -481,7 +486,9 @@ gdb_regformat (ClientData clientData, Tc
type = (struct type *)strtol (Tcl_GetStringFromObj (objv[1], NULL), NULL, 16);
fm = (int)*(Tcl_GetStringFromObj (objv[2], NULL));
- if (regno >= NUM_REGS + NUM_PSEUDO_REGS)
+ numregs = (gdbarch_num_regs (current_gdbarch)
+ + gdbarch_num_pseudo_regs (current_gdbarch));
+ if (regno >= numregs)
{
gdbtk_set_result (interp, "Register number %d too large", regno);
return TCL_ERROR;
@@ -531,7 +538,7 @@ gdb_reggroup (ClientData clientData, Tcl
{
struct reggroup *group;
char *groupname;
- int regnum;
+ int regnum, num;
if (objc != 1)
{
@@ -557,7 +564,9 @@ gdb_reggroup (ClientData clientData, Tcl
if (group == NULL)
return TCL_ERROR;
- for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
+ num = (gdbarch_num_regs (current_gdbarch)
+ + gdbarch_num_pseudo_regs (current_gdbarch));
+ for (regnum = 0; regnum < num; regnum++)
{
if (gdbarch_register_reggroup_p (current_gdbarch, regnum, group))
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (regnum));