This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/wip] Go back to just saving [0..NUM_REGS)
- From: Andrew Cagney <ac131313 at ges dot redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 26 Aug 2002 16:13:44 -0400
- Subject: [patch/wip] Go back to just saving [0..NUM_REGS)
Just FYI,
I've tweaked my branch to just save the first [0 .. NUM_REGS). I think
the most common case will be like the i386 where all registers in the
range [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS) will be direct mapped to
raw registers.
Even if my guess is wrong, saving/restoring this sub range hopefully
does the least amount of damage when compared to other options :-)
enjoy,
Andrew
2002-08-26 Andrew Cagney <ac131313@redhat.com>
* arch-utils.c (next_raw_register): Rename next_cooked_register.
(default_next_cooked_register_to_save): Use.
(default_next_cooked_register_to_restore): Use.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.67.4.1
diff -u -r1.67.4.1 arch-utils.c
--- arch-utils.c 25 Aug 2002 20:26:13 -0000 1.67.4.1
+++ arch-utils.c 26 Aug 2002 20:09:35 -0000
@@ -494,27 +494,31 @@
}
static int
-next_cooked_register (struct gdbarch *gdbarch, int regnum)
+next_raw_register (struct gdbarch *gdbarch, int regnum)
{
if (regnum < 0)
return 0;
regnum++;
- if (regnum
- >= (gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch)))
+ if (regnum >= gdbarch_num_regs (gdbarch))
return -1;
return regnum;
}
+/* By default, iterate over just the raw register space. This should
+ be the most common case. A platform that, for some reason, needs
+ to save registers in the range [NUM_REGS
+ .. NUM_REGS+NUM_PSEUDO_REGS) can handle things locally. */
+
int
default_next_cooked_register_to_save (struct gdbarch *gdbarch, int regnum)
{
- return next_cooked_register (gdbarch, regnum);
+ return next_raw_register (gdbarch, regnum);
}
int
default_next_cooked_register_to_restore (struct gdbarch *gdbarch, int regnum)
{
- return next_cooked_register (gdbarch, regnum);
+ return next_raw_register (gdbarch, regnum);
}
/* Functions to manipulate the endianness of the target. */