summaryrefslogtreecommitdiff
path: root/gdb/gdbtk/generic
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2007-06-05 00:36:29 +0000
committerKeith Seitz <keiths@redhat.com>2007-06-05 00:36:29 +0000
commitca27d3084eb95390d1fab4ba6ea75084ce4ee85a (patch)
treed784dff9a686029d723d0032940e27e8ddc96d13 /gdb/gdbtk/generic
parenta3b2b0d2d274f912488cbc621da1a315d5495f7d (diff)
downloadgdb-ca27d3084eb95390d1fab4ba6ea75084ce4ee85a.tar.gz
* 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.
Diffstat (limited to 'gdb/gdbtk/generic')
-rw-r--r--gdb/gdbtk/generic/gdbtk-cmds.c4
-rw-r--r--gdb/gdbtk/generic/gdbtk-register.c31
2 files changed, 22 insertions, 13 deletions
diff --git a/gdb/gdbtk/generic/gdbtk-cmds.c b/gdb/gdbtk/generic/gdbtk-cmds.c
index 898f39b22b1..ad05956c602 100644
--- a/gdb/gdbtk/generic/gdbtk-cmds.c
+++ b/gdb/gdbtk/generic/gdbtk-cmds.c
@@ -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 count)
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;
diff --git a/gdb/gdbtk/generic/gdbtk-register.c b/gdb/gdbtk/generic/gdbtk-register.c
index 6a0dd48b405..88cfe96758d 100644
--- a/gdb/gdbtk/generic/gdbtk-register.c
+++ b/gdb/gdbtk/generic/gdbtk-register.c
@@ -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, int objc, Tcl_Obj **objv,
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 *argp)
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, Tcl_Interp *interp,
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_Interp *interp,
{
struct reggroup *group;
char *groupname;
- int regnum;
+ int regnum, num;
if (objc != 1)
{
@@ -557,7 +564,9 @@ gdb_reggroup (ClientData clientData, Tcl_Interp *interp,
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));