* [PATCH] Remove REGISTER_BYTES
@ 2002-03-01 11:03 Keith Seitz
0 siblings, 0 replies; only message in thread
From: Keith Seitz @ 2002-03-01 11:03 UTC (permalink / raw)
To: Insight Maling List
Hi,
This patch removes the macro REGISTER_BYTES from our code. Although at one
time it was true that all NUM_REGS+NUM_PSEUDO_REGS were stored in
REGISTER_BYTES, this assumption no longer works. Gdb is cleaning up its
act, and we must, too.
Keith
ChangeLog
2002-03-01 Keith Seitz <keiths@redhat.com>
* generic/gdbtk-register.c (register_changed_p): Don't use REGISTER_BYTES.
There is no guarantee anymore that REGISTER_BYTES contains
NUM_REGS+NUM_PSEUDO_REGS registers.
(setup_architecture_data): Likewise.
Patch
Index: generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.6
diff -p -r1.6 gdbtk-register.c
*** generic/gdbtk-register.c 2002/02/07 05:05:06 1.6
--- generic/gdbtk-register.c 2002/03/01 19:00:33
***************
*** 28,35 ****
#include "gdbtk-cmds.h"
/* This contains the previous values of the registers, since the last call to
! gdb_changed_register_list. */
static char *old_regs = NULL;
static int get_pc_register (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
--- 28,37 ----
#include "gdbtk-cmds.h"
/* This contains the previous values of the registers, since the last call to
! gdb_changed_register_list.
+ It is an array of (NUM_REGS+NUM_PSEUDO_REGS)*MAX_REGISTER_RAW_SIZE bytes. */
+
static char *old_regs = NULL;
static int get_pc_register (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
*************** register_changed_p (int regnum, void *ar
*** 355,367 ****
if (read_relative_register_raw_bytes (regnum, raw_buffer))
return;
! if (memcmp (&old_regs[REGISTER_BYTE (regnum)], raw_buffer,
REGISTER_RAW_SIZE (regnum)) == 0)
return;
/* Found a changed register. Save new value and return its number. */
! memcpy (&old_regs[REGISTER_BYTE (regnum)], raw_buffer,
REGISTER_RAW_SIZE (regnum));
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (regnum));
--- 357,369 ----
if (read_relative_register_raw_bytes (regnum, raw_buffer))
return;
! if (memcmp (&old_regs[regnum * MAX_REGISTER_RAW_SIZE], raw_buffer,
REGISTER_RAW_SIZE (regnum)) == 0)
return;
/* Found a changed register. Save new value and return its number. */
! memcpy (&old_regs[regnum * MAX_REGISTER_RAW_SIZE], raw_buffer,
REGISTER_RAW_SIZE (regnum));
Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (regnum));
*************** register_changed_p (int regnum, void *ar
*** 370,380 ****
static void
setup_architecture_data ()
{
- /* don't trust REGISTER_BYTES to be zero. */
if (old_regs != NULL)
xfree (old_regs);
! old_regs = xmalloc (REGISTER_BYTES + 1);
! memset (old_regs, 0, REGISTER_BYTES + 1);
}
--- 372,381 ----
static void
setup_architecture_data ()
{
if (old_regs != NULL)
xfree (old_regs);
! old_regs = xmalloc ((NUM_REGS + NUM_PSEUDO_REGS) * MAX_REGISTER_RAW_SIZE + 1);
! memset (old_regs, 0, sizeof (old_regs));
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-03-01 19:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-01 11:03 [PATCH] Remove REGISTER_BYTES Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).