PATCH ARM: Delete the prologue cache code
Richard Earnshaw
rearnsha@arm.com
Sat Mar 22 14:34:00 GMT 2003
As threatened in an earlier email, this patch kills the arm-specific
prologue caching code. This code does not belong in a backend -- if it's
needed at all it should be done generically.
Doing this kills a lot of calls to deprecated features.
R.
2003-03-22 Richard Earnshaw <rearnsha@arm.com>
* arm-tdep.c (prologue_cache): Delete.
(check_prologue_cache, save_prologue_cache): Delete.
(arm_scan_prologue): Don't check or update the prologue_cache.
(arm_gdb_arch_init): Don't initialize it.
(_initialize_arm_tdep): Likewise.
-------------- next part --------------
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.107
diff -p -r1.107 arm-tdep.c
*** arm-tdep.c 13 Mar 2003 21:45:39 -0000 1.107
--- arm-tdep.c 22 Mar 2003 14:28:19 -0000
*************** thumb_scan_prologue (struct frame_info *
*** 642,701 ****
}
}
- /* Check if prologue for this frame's PC has already been scanned. If
- it has, copy the relevant information about that prologue and
- return non-zero. Otherwise do not copy anything and return zero.
-
- The information saved in the cache includes:
- * the frame register number;
- * the size of the stack frame;
- * the offsets of saved regs (relative to the old SP); and
- * the offset from the stack pointer to the frame pointer
-
- The cache contains only one entry, since this is adequate for the
- typical sequence of prologue scan requests we get. When performing
- a backtrace, GDB will usually ask to scan the same function twice
- 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 int
- check_prologue_cache (struct frame_info *fi)
- {
- int i;
-
- if (get_frame_pc (fi) == get_frame_pc (prologue_cache))
- {
- get_frame_extra_info (fi)->framereg = get_frame_extra_info (prologue_cache)->framereg;
- get_frame_extra_info (fi)->framesize = get_frame_extra_info (prologue_cache)->framesize;
- get_frame_extra_info (fi)->frameoffset = get_frame_extra_info (prologue_cache)->frameoffset;
- for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
- get_frame_saved_regs (fi)[i] = get_frame_saved_regs (prologue_cache)[i];
- return 1;
- }
- else
- return 0;
- }
-
-
- /* Copy the prologue information from fi to the prologue cache. */
-
- static void
- save_prologue_cache (struct frame_info *fi)
- {
- int i;
-
- deprecated_update_frame_pc_hack (prologue_cache, get_frame_pc (fi));
- get_frame_extra_info (prologue_cache)->framereg = get_frame_extra_info (fi)->framereg;
- get_frame_extra_info (prologue_cache)->framesize = get_frame_extra_info (fi)->framesize;
- get_frame_extra_info (prologue_cache)->frameoffset = get_frame_extra_info (fi)->frameoffset;
-
- for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
- get_frame_saved_regs (prologue_cache)[i] = get_frame_saved_regs (fi)[i];
- }
-
-
/* This function decodes an ARM function prologue to determine:
1) the size of the stack frame
2) which registers are saved on it
--- 642,647 ----
*************** arm_scan_prologue (struct frame_info *fi
*** 770,779 ****
LONGEST return_value;
CORE_ADDR prologue_start, prologue_end, current_pc;
- /* Check if this function is already in the cache of frame information. */
- if (check_prologue_cache (fi))
- return;
-
/* Assume there is no frame until proven otherwise. */
get_frame_extra_info (fi)->framereg = ARM_SP_REGNUM;
get_frame_extra_info (fi)->framesize = 0;
--- 716,721 ----
*************** arm_scan_prologue (struct frame_info *fi
*** 783,789 ****
if (arm_pc_is_thumb (get_frame_pc (fi)))
{
thumb_scan_prologue (fi);
- save_prologue_cache (fi);
return;
}
--- 725,730 ----
*************** arm_scan_prologue (struct frame_info *fi
*** 975,982 ****
get_frame_extra_info (fi)->frameoffset = fp_offset - sp_offset;
else
get_frame_extra_info (fi)->frameoffset = 0;
-
- save_prologue_cache (fi);
}
/* Find REGNUM on the stack. Otherwise, it's in an active register.
--- 916,921 ----
*************** arm_gdbarch_init (struct gdbarch_info in
*** 3020,3041 ****
"arm_gdbarch_init: bad byte order for float format");
}
- /* 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));
-
- /* 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. */
- {
- CORE_ADDR *saved_regs = xcalloc (1, (sizeof (CORE_ADDR)
- * (gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch))));
- deprecated_set_frame_saved_regs_hack (prologue_cache, saved_regs);
- }
-
return gdbarch;
}
--- 2959,2964 ----
*************** The valid values are:\n");
*** 3158,3167 ****
add_com ("othernames", class_obscure, arm_othernames,
"Switch to the next set of register names.");
-
- /* 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,
--- 3081,3086 ----
More information about the Gdb-patches
mailing list