[PATCH] Re: gdbarch.c problem building for cygwin

Mark Kettenis kettenis@wins.uva.nl
Sun Jun 11 18:47:00 GMT 2000


   Date: Mon, 12 Jun 2000 10:34:22 +1000
   From: Andrew Cagney <ac131313@cygnus.com>

   > The obvious solution is of course to change FIX_CALL_DUMMY for the
   > i386 :-).  I'll turn it into a proper function in i386-tdep.c, and
   > change config/i386/tm-i386.h accordingly.  That wouldn't fix
   > i[3456]86-*-sunos* but we've almost decided that that one is obsolete
   > :-).

   :-)

   I've checked in the attached.  It stops the dump when the function is
   void and things aren't multi-arch.

I nevertheless checked in the following patch, since it is a small in
the direction of multi-arching the i386.

Mark

2000-06-12  Mark Kettenis  <kettenis@gnu.org>

	* config/i386/tm-i386.h: Add forward declaration of `struct value'.
	(FIX_CALL_DUMMY): Redefined to call i386_fix_call_dummy.
	(i386_fix_call_dummy): Add prototype.
	* i386-tdep.c (i386_fix_call_dummy): New function based on the
	code from the old FIX_CALL_DUMMY macro.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.13
diff -u -p -r1.13 i386-tdep.c
--- i386-tdep.c	2000/06/08 00:52:56	1.13
+++ i386-tdep.c	2000/06/12 01:43:04
@@ -638,6 +638,26 @@ i386_push_dummy_frame ()
   write_register (SP_REGNUM, sp);
 }
 
+/* Insert the (relative) function address into the call sequence
+   stored at DYMMY.  */
+
+void
+i386_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+		     value_ptr *args, struct type *type, int gcc_p)
+{
+  int from, to, delta, loc;
+
+  loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH);
+  from = loc + 5;
+  to = (int)(fun);
+  delta = to - from;
+
+  *((char *)(dummy) + 1) = (delta & 0xff);
+  *((char *)(dummy) + 2) = ((delta >> 8) & 0xff);
+  *((char *)(dummy) + 3) = ((delta >> 16) & 0xff);
+  *((char *)(dummy) + 4) = ((delta >> 24) & 0xff);
+}
+
 void
 i386_pop_frame ()
 {
Index: config/i386/tm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-i386.h,v
retrieving revision 1.6
diff -u -p -r1.6 tm-i386.h
--- config/i386/tm-i386.h	2000/05/28 01:12:35	1.6
+++ config/i386/tm-i386.h	2000/06/12 01:43:04
@@ -21,9 +21,10 @@
 #ifndef TM_I386_H
 #define TM_I386_H 1
 
-/* Forward decl's for prototypes */
+/* Forward declarations for prototypes.  */
 struct frame_info;
 struct frame_saved_regs;
+struct value;
 struct type;
 
 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
@@ -408,19 +409,13 @@ extern void i386_pop_frame (void);
 /* Insert the specified number of args and function address
    into a call sequence of the above form stored at DUMMYNAME.  */
 
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)   \
-{ \
-	int from, to, delta, loc; \
-	loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
-	from = loc + 5; \
-	to = (int)(fun); \
-	delta = to - from; \
-	*((char *)(dummyname) + 1) = (delta & 0xff); \
-	*((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \
-	*((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \
-	*((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \
-}
+#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
+  i386_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
+extern void i386_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
+				 int nargs, struct value **args,
+				 struct type *type, int gcc_p);
 
+/* FIXME: kettenis/2000-06-12: These do not belong here.  */
 extern void print_387_control_word (unsigned int);
 extern void print_387_status_word (unsigned int);
 





More information about the Gdb-patches mailing list