This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Allocate arm's prologe_cache at run time
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 05 Jan 2003 08:34:44 -0500
- Subject: [commit] Allocate arm's prologe_cache at run time
Hello,
This modifies the ARM so that it allocates the prologue cache during
initialization (rather than using a static variable and assuming the
frame's internals).
committed as pretty obvious,
Andrew
2003-01-05 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c (prologue_cache): Change to a pointer.
(_initialize_arm_tdep): Allocate prologue_cache.
(check_prologue_cache): Update.
(save_prologue_cache): Update.
(arm_gdbarch_init): Update.
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.89
diff -u -r1.89 arm-tdep.c
--- arm-tdep.c 5 Jan 2003 01:39:54 -0000 1.89
+++ arm-tdep.c 5 Jan 2003 13:30:07 -0000
@@ -658,20 +658,20 @@
in a row (once to get the frame chain, and once to fill in the
extra frame information). */
-static struct frame_info prologue_cache;
+static struct frame_info *prologue_cache;
static int
check_prologue_cache (struct frame_info *fi)
{
int i;
- if (get_frame_pc (fi) == get_frame_pc (&prologue_cache))
+ if (get_frame_pc (fi) == get_frame_pc (prologue_cache))
{
- fi->extra_info->framereg = prologue_cache.extra_info->framereg;
- fi->extra_info->framesize = prologue_cache.extra_info->framesize;
- fi->extra_info->frameoffset = prologue_cache.extra_info->frameoffset;
+ fi->extra_info->framereg = prologue_cache->extra_info->framereg;
+ fi->extra_info->framesize = prologue_cache->extra_info->framesize;
+ fi->extra_info->frameoffset = prologue_cache->extra_info->frameoffset;
for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
- get_frame_saved_regs (fi)[i] = get_frame_saved_regs (&prologue_cache)[i];
+ get_frame_saved_regs (fi)[i] = get_frame_saved_regs (prologue_cache)[i];
return 1;
}
else
@@ -686,13 +686,13 @@
{
int i;
- deprecated_update_frame_pc_hack (&prologue_cache, get_frame_pc (fi));
- prologue_cache.extra_info->framereg = fi->extra_info->framereg;
- prologue_cache.extra_info->framesize = fi->extra_info->framesize;
- prologue_cache.extra_info->frameoffset = fi->extra_info->frameoffset;
+ deprecated_update_frame_pc_hack (prologue_cache, get_frame_pc (fi));
+ prologue_cache->extra_info->framereg = fi->extra_info->framereg;
+ prologue_cache->extra_info->framesize = fi->extra_info->framesize;
+ prologue_cache->extra_info->frameoffset = fi->extra_info->frameoffset;
for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
- get_frame_saved_regs (&prologue_cache)[i] = get_frame_saved_regs (fi)[i];
+ get_frame_saved_regs (prologue_cache)[i] = get_frame_saved_regs (fi)[i];
}
@@ -3024,13 +3024,13 @@
/* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still
references the old architecture vector, not the one we are
building here. */
- if (get_frame_saved_regs (&prologue_cache) != NULL)
- xfree (get_frame_saved_regs (&prologue_cache));
+ if (get_frame_saved_regs (prologue_cache) != NULL)
+ xfree (get_frame_saved_regs (prologue_cache));
/* We can't use NUM_REGS nor NUM_PSEUDO_REGS here, since that still
references the old architecture vector, not the one we are
building here. */
- prologue_cache.saved_regs = (CORE_ADDR *)
+ prologue_cache->saved_regs = (CORE_ADDR *)
xcalloc (1, (sizeof (CORE_ADDR)
* (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch))));
@@ -3158,10 +3158,9 @@
add_com ("othernames", class_obscure, arm_othernames,
"Switch to the next set of register names.");
- /* Fill in the prologue_cache fields. */
- prologue_cache.saved_regs = NULL;
- prologue_cache.extra_info = (struct frame_extra_info *)
- xcalloc (1, sizeof (struct frame_extra_info));
+ /* Allocate the prologue_cache. */
+ prologue_cache = deprecated_frame_xmalloc ();
+ deprecated_set_frame_extra_info_hack (prologue_cache, xcalloc (1, sizeof (struct frame_extra_info)));
/* Debugging flag. */
add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger,