This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
RFA: Prologue cache fix
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: RFA: Prologue cache fix
- From: Fernando Nasser <fnasser at redhat dot com>
- Date: Wed, 23 Feb 2000 16:13:50 +0000
- Organization: Red Hat, Inc. - Toronto
This patch fixes a problem that happens when gdb reconnects to a
target. Targets that have a prologue cache must invalidate its contents
or they can assume wrong things based on stale data.
The prologue cace code is too much target dependent, so I decided to
leave it in the target dependent code and just export tthe macro to
flush it on the targets where it is defined.
2000-02-23 Fernando Nasser <fnasser@totem.to.cygnus.com>
* blockframe.c (flush_cached_frames): Be sure to flush prologue
caches on the targets who have it.
* arm-tdep.c (check_prologue_cache): Check if cache contents are
valid.
(save_prologue_cache): Mark cache contents as valid.
(arm_flush_prologue_cache): New function. Marks prologuecache
contents as invalid.
* config/arm/tm-arm.h: Define FLUSH_PROLOGUE_CACHE.
2000-02-23 Fernando Nasser <fnasser@totem.to.cygnus.com>
* gdbint.texinfo: Add entry for target dependent macro
FLUSH_PROLOGUE_CACHE.
--
Fernando Nasser
Red Hat, Inc. - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.2
diff -c -p -r1.2 gdbint.texinfo
*** gdbint.texinfo 2000/02/22 19:22:25 1.2
--- gdbint.texinfo 2000/02/23 16:12:51
*************** Predicate for @var{EXTRACT_STRUCT_VALUE_
*** 1378,1383 ****
--- 1378,1387 ----
If defined, then the `info float' command will print information about
the processor's floating point unit.
+ @item FLUSH_PROLOGUE_CACHE
+ Define this if the target keeps a prologue cache. It will be invoked
to
+ invalidate that cache at appropriate times.
+
@item FP_REGNUM
If the virtual frame pointer is kept in a register, then define this
macro to be the number (greater than or equal to zero) of that
register.
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.1.1.11
diff -c -p -r1.1.1.11 blockframe.c
*** blockframe.c 1999/12/22 21:45:03 1.1.1.11
--- blockframe.c 2000/02/23 00:17:15
*************** flush_cached_frames ()
*** 269,274 ****
--- 269,277 ----
current_frame = NULL; /* Invalidate cache */
select_frame (NULL, -1);
+ #ifdef FLUSH_PROLOGUE_CACHE
+ FLUSH_PROLOGUE_CACHE ();
+ #endif
annotate_frames_invalid ();
}
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.3
diff -c -p -r1.3 arm-tdep.c
*** arm-tdep.c 2000/02/17 19:51:04 1.3
--- arm-tdep.c 2000/02/23 00:17:15
*************** thumb_scan_prologue (struct frame_info *
*** 593,605 ****
extra frame information). */
static struct frame_info prologue_cache;
static int
check_prologue_cache (struct frame_info *fi)
{
int i;
! if (fi->pc == prologue_cache.pc)
{
fi->framereg = prologue_cache.framereg;
fi->framesize = prologue_cache.framesize;
--- 593,607 ----
extra frame information). */
static struct frame_info prologue_cache;
+ static int prologue_cache_valid = 0; /* Indicate if contents are
valid. */
static int
check_prologue_cache (struct frame_info *fi)
{
int i;
! if ((prologue_cache_valid)
! && (fi->pc == prologue_cache.pc))
{
fi->framereg = prologue_cache.framereg;
fi->framesize = prologue_cache.framesize;
*************** save_prologue_cache (struct frame_info *
*** 627,634 ****
--- 629,645 ----
for (i = 0; i <= NUM_REGS; i++)
prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
+
+ prologue_cache_valid = 1;
}
+ /* Flush the prologue cache. */
+
+ void
+ arm_flush_prologue_cache ()
+ {
+ prologue_cache_valid = 0;
+ }
/* This function decodes an ARM function prologue to determine:
1) the size of the stack frame
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.1.1.9
diff -c -p -r1.1.1.9 tm-arm.h
*** tm-arm.h 2000/02/05 07:29:52 1.1.1.9
--- tm-arm.h 2000/02/23 00:17:16
*************** extern CORE_ADDR arm_skip_prologue (CORE
*** 61,66 ****
--- 61,70 ----
#define SKIP_PROLOGUE(pc) (arm_skip_prologue (pc))
+ extern void arm_flush_prologue_cache (void);
+
+ #define FLUSH_PROLOGUE_CACHE() (arm_flush_prologue_cache ())
+
/* Immediately after a function call, return the saved pc. Can't
always go through the frames for this because on some machines the
new frame is not set up until the new function executes some