This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ARM frame fp is not always FP_REGNUM


read_relative_register_raw_bytes_for_frame() would optimize access to
FP_REGNUM by not re-reading it when the value of FP is already known.
However, because FP is not always available, sometimes the value of SP
is stored in the frame structure as the value of FP.  In this case,
reading the value of FP_REGNUM will get you SP instead of the actual
value of the FP register.  This patch fixes this bug.  Ok to install?

Index: gdb/ChangeLog
from  Alexandre Oliva  <aoliva@cygnus.com>

	* findvar.c (FP_REGNUM_IN_FRAME): New macro.
	(read_relative_register_raw_bytes_for_frame): Use it.
	* config/arm/tm-arm.h (FP_REGNUM_IN_FRAME): Override it.

Index: gdb/findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.13
diff -u -r1.13 findvar.c
--- gdb/findvar.c	2000/06/04 13:46:37	1.13
+++ gdb/findvar.c	2000/07/04 04:59:41
@@ -553,10 +553,15 @@
      struct frame_info *frame;
 {
   int optim;
-  if (regnum == FP_REGNUM && frame)
+
+#ifndef FP_REGNUM_IN_FRAME
+# define FP_REGNUM_IN_FRAME(frame) FP_REGNUM
+#endif
+
+  if (frame && regnum == FP_REGNUM_IN_FRAME (frame))
     {
       /* Put it back in target format. */
-      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM),
+      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM_IN_FRAME (frame)),
 		     (LONGEST) FRAME_FP (frame));
 
       return 0;
Index: gdb/config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.3
diff -u -r1.3 tm-arm.h
--- gdb/config/arm/tm-arm.h	2000/04/14 19:12:49	1.3
+++ gdb/config/arm/tm-arm.h	2000/07/04 04:59:41
@@ -350,6 +350,10 @@
   int frameoffset;		\
   int framereg;
 
+/* The register containing the frame pointer within a particular
+   frame.  */
+#define FP_REGNUM_IN_FRAME(frame) ((frame)->framereg)
+
 extern void arm_init_extra_frame_info (int fromleaf, struct frame_info * fi);
 #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
 	arm_init_extra_frame_info ((fromleaf), (fi))

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]