This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

[PATCH] Bugfix in i386-tdep.c:i386_push_dummy_frame()T


[ My ISP has gotten its mail server in ORBZ once again.  Sigh.  Sorry
  for the delay. ]

The frame pointer wasn't saved correctly for call dummies.  Fixes a
few test failures on FreeBSD 4.4 with gcc version 3.0.4 20011229
(prerelease).

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386-tdep.c (i386_push_dummy_frame): Don't write back the
	modified frame pointer until the old frame pointer has been saved.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.48
diff -u -p -r1.48 i386-tdep.c
--- i386-tdep.c 2001/12/27 15:22:27 1.48
+++ i386-tdep.c 2001/12/29 19:37:13
@@ -769,18 +769,20 @@ void
 i386_push_dummy_frame (void)
 {
   CORE_ADDR sp = read_register (SP_REGNUM);
+  CORE_ADDR fp;
   int regnum;
   char regbuf[MAX_REGISTER_RAW_SIZE];
 
   sp = push_word (sp, read_register (PC_REGNUM));
   sp = push_word (sp, read_register (FP_REGNUM));
-  write_register (FP_REGNUM, sp);
+  fp = sp;
   for (regnum = 0; regnum < NUM_REGS; regnum++)
     {
       read_register_gen (regnum, regbuf);
       sp = push_bytes (sp, regbuf, REGISTER_RAW_SIZE (regnum));
     }
   write_register (SP_REGNUM, sp);
+  write_register (FP_REGNUM, fp);
 }
 
 /* Insert the (relative) function address into the call sequence


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