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 rfc] Rationalize FIX_CALL_DUMMY


Hello,

This one makes FIX_CALL_DUMMY optional. It doesn't try to address the problem of HP/PA's version having a different function signature to the version in the architecture vector (the former returns a PC address).

Long term, I think all the call dummy methods should be consolidated into a single push_dummy_return_point() method. That would write the dummy call's return code directly to the stack.

I'll commit in a day or so,
Andrew
2003-03-29  Andrew Cagney  <cagney at redhat dot com>

	* gdbarch.sh (FIX_CALL_DUMMY): Change to function with predicate,
	return the PC address.
	* gdbarch.h, gdbarch.c: Regenerate.
	* inferior.h (FIX_CALL_DUMMY): Delete macro.
	* valops.c (hand_function_call): Only call FIX_CALL_DUMMY when
	available.
	* frame.h (generic_fix_call_dummy): Delete declaration.
	* dummy-frame.h: Update comment.
	* dummy-frame.c (generic_fix_call_dummy): Delete function.
	* xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
	fix_call_dummy.
	* sh-tdep.c (sh_gdbarch_init): Ditto.
	* s390-tdep.c (s390_gdbarch_init): Ditto.
	* mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
	* mcore-tdep.c (mcore_gdbarch_init): Ditto.
	* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
	* ia64-tdep.c (ia64_gdbarch_init): Ditto.
	* i386-tdep.c (i386_gdbarch_init): Ditto.
	* h8300-tdep.c (h8300_gdbarch_init): Ditto.
	* frv-tdep.c (frv_gdbarch_init): Ditto.
	* d10v-tdep.c (d10v_gdbarch_init): Ditto.
	* cris-tdep.c (cris_gdbarch_init): Ditto.
	* avr-tdep.c (avr_gdbarch_init): Ditto.
	* arm-tdep.c (arm_gdbarch_init): Ditto.

Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.118
diff -u -r1.118 arm-tdep.c
--- arm-tdep.c	29 Mar 2003 17:08:00 -0000	1.118
+++ arm-tdep.c	30 Mar 2003 04:20:09 -0000
@@ -2940,8 +2940,6 @@
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_call_dummy_length (gdbarch, 0);
 
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
   set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
   set_gdbarch_push_return_address (gdbarch, arm_push_return_address);
   set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call);
Index: avr-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/avr-tdep.c,v
retrieving revision 1.35
diff -u -r1.35 avr-tdep.c
--- avr-tdep.c	26 Mar 2003 22:39:52 -0000	1.35
+++ avr-tdep.c	30 Mar 2003 04:20:10 -0000
@@ -1174,7 +1174,6 @@
   set_gdbarch_call_dummy_length (gdbarch, 0);
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_words (gdbarch, avr_call_dummy_words);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
 /*    set_gdbarch_believe_pcc_promotion (gdbarch, 1); // TRoth: should this be set? */
 
Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.58
diff -u -r1.58 cris-tdep.c
--- cris-tdep.c	26 Mar 2003 22:39:52 -0000	1.58
+++ cris-tdep.c	30 Mar 2003 04:20:15 -0000
@@ -4275,9 +4275,6 @@
   set_gdbarch_call_dummy_words (gdbarch, 0);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
   
-  /* No stack adjustment needed when peforming an inferior function call.  */
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
   set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
   
   /* No register requires conversion from raw format to virtual format.  */
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.93
diff -u -r1.93 d10v-tdep.c
--- d10v-tdep.c	29 Mar 2003 01:40:00 -0000	1.93
+++ d10v-tdep.c	30 Mar 2003 04:20:17 -0000
@@ -1683,7 +1683,6 @@
   set_gdbarch_call_dummy_words (gdbarch, d10v_call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (d10v_call_dummy_words));
   set_gdbarch_call_dummy_p (gdbarch, 1);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
   set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call);
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.13
diff -u -r1.13 dummy-frame.c
--- dummy-frame.c	17 Mar 2003 14:23:49 -0000	1.13
+++ dummy-frame.c	30 Mar 2003 04:20:18 -0000
@@ -294,17 +294,6 @@
   discard_innermost_dummy (&dummy_frame_stack);
 }
 
-/* Function: fix_call_dummy
-   Stub function.  Generic dummy frames typically do not need to fix
-   the frame being created */
-
-void
-generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
-			struct value **args, struct type *type, int gcc_p)
-{
-  return;
-}
-
 /* Given a call-dummy dummy-frame, return the registers.  Here the
    register value is taken from the local copy of the register buffer.  */
 
Index: dummy-frame.h
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.h,v
retrieving revision 1.8
diff -u -r1.8 dummy-frame.h
--- dummy-frame.h	24 Mar 2003 03:54:47 -0000	1.8
+++ dummy-frame.h	30 Mar 2003 04:20:25 -0000
@@ -41,8 +41,8 @@
    zero, and CALL_DUMMY_LOCATION to AT_ENTRY.  Then you must remember
    to define PUSH_RETURN_ADDRESS, because no call instruction will be
    being executed by the target.  Also DEPRECATED_FRAME_CHAIN_VALID as
-   generic_{file,func}_frame_chain_valid and FIX_CALL_DUMMY as
-   generic_fix_call_dummy.  */
+   generic_{file,func}_frame_chain_valid and do not set
+   FIX_CALL_DUMMY.  */
 
 /* If the PC falls in a dummy frame, return a dummy frame
    unwinder.  */
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.76
diff -u -r1.76 frame.h
--- frame.h	24 Mar 2003 03:54:47 -0000	1.76
+++ frame.h	30 Mar 2003 04:20:27 -0000
@@ -543,10 +543,6 @@
 
 extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp);
 
-extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
-				    int nargs, struct value **args,
-				    struct type *type, int gcc_p);
-
 void generic_unwind_get_saved_register (char *raw_buffer,
 				        int *optimizedp,
 				        CORE_ADDR *addrp,
Index: frv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/frv-tdep.c,v
retrieving revision 1.24
diff -u -r1.24 frv-tdep.c
--- frv-tdep.c	26 Mar 2003 22:39:52 -0000	1.24
+++ frv-tdep.c	30 Mar 2003 04:20:27 -0000
@@ -1113,7 +1113,6 @@
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_function_start_offset (gdbarch, 0);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.211
diff -u -r1.211 gdbarch.sh
--- gdbarch.sh	26 Mar 2003 22:39:52 -0000	1.211
+++ gdbarch.sh	30 Mar 2003 04:20:40 -0000
@@ -534,7 +534,7 @@
 v:2:CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
 v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0:0x%08lx
 V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
-f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0
+F::FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
 F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
 F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
 #
Index: h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.47
diff -u -r1.47 h8300-tdep.c
--- h8300-tdep.c	26 Mar 2003 22:39:52 -0000	1.47
+++ h8300-tdep.c	30 Mar 2003 04:20:40 -0000
@@ -1164,7 +1164,6 @@
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
 
   set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.123
diff -u -r1.123 i386-tdep.c
--- i386-tdep.c	26 Mar 2003 22:39:52 -0000	1.123
+++ i386-tdep.c	30 Mar 2003 04:20:44 -0000
@@ -1573,7 +1573,6 @@
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_words (gdbarch, NULL);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_register_convertible (gdbarch, i386_register_convertible);
   set_gdbarch_register_convert_to_virtual (gdbarch,
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.59
diff -u -r1.59 ia64-tdep.c
--- ia64-tdep.c	26 Mar 2003 22:39:52 -0000	1.59
+++ ia64-tdep.c	30 Mar 2003 04:20:51 -0000
@@ -2243,7 +2243,6 @@
   set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_function_start_offset (gdbarch, 0);
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.44
diff -u -r1.44 inferior.h
--- inferior.h	27 Mar 2003 15:29:44 -0000	1.44
+++ inferior.h	30 Mar 2003 04:20:51 -0000
@@ -450,10 +450,6 @@
 #define PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "PUSH_DUMMY_FRAME"), 0)
 #endif
 
-#if !defined FIX_CALL_DUMMY
-#define FIX_CALL_DUMMY(a1,a2,a3,a4,a5,a6,a7) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0)
-#endif
-
 #if !defined STORE_STRUCT_RETURN
 #define STORE_STRUCT_RETURN(a1,a2) (internal_error (__FILE__, __LINE__, "STORE_STRUCT_RETURN"), 0)
 #endif
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.57
diff -u -r1.57 m68hc11-tdep.c
--- m68hc11-tdep.c	26 Mar 2003 22:39:52 -0000	1.57
+++ m68hc11-tdep.c	30 Mar 2003 04:20:51 -0000
@@ -1390,7 +1390,6 @@
                                        sizeof (m68hc11_call_dummy_words));
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value);
   set_gdbarch_deprecated_push_arguments (gdbarch, m68hc11_push_arguments);
   set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address);
Index: mcore-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mcore-tdep.c,v
retrieving revision 1.48
diff -u -r1.48 mcore-tdep.c
--- mcore-tdep.c	26 Mar 2003 22:39:52 -0000	1.48
+++ mcore-tdep.c	30 Mar 2003 04:20:52 -0000
@@ -1122,7 +1122,6 @@
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
Index: mn10300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v
retrieving revision 1.63
diff -u -r1.63 mn10300-tdep.c
--- mn10300-tdep.c	26 Mar 2003 22:39:52 -0000	1.63
+++ mn10300-tdep.c	30 Mar 2003 04:20:54 -0000
@@ -1193,7 +1193,6 @@
   set_gdbarch_sizeof_call_dummy_words (gdbarch, 
                                        sizeof (mn10300_call_dummy_words));
   set_gdbarch_call_dummy_length (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
   set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments);
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.81
diff -u -r1.81 s390-tdep.c
--- s390-tdep.c	26 Mar 2003 22:39:52 -0000	1.81
+++ s390-tdep.c	30 Mar 2003 04:20:57 -0000
@@ -1870,7 +1870,6 @@
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_push_return_address (gdbarch, s390_push_return_address);
   set_gdbarch_sizeof_call_dummy_words (gdbarch,
                                        sizeof (s390_call_dummy_words));
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.107
diff -u -r1.107 sh-tdep.c
--- sh-tdep.c	26 Mar 2003 22:39:52 -0000	1.107
+++ sh-tdep.c	30 Mar 2003 04:21:04 -0000
@@ -4661,7 +4661,6 @@
   set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
   set_gdbarch_call_dummy_p (gdbarch, 1);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
 
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.100
diff -u -r1.100 valops.c
--- valops.c	27 Mar 2003 15:29:44 -0000	1.100
+++ valops.c	30 Mar 2003 04:21:07 -0000
@@ -1424,8 +1424,12 @@
   real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
 			    value_type, using_gcc);
 #else
-  FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
-		  value_type, using_gcc);
+  if (FIX_CALL_DUMMY_P ())
+    {
+      /* gdb_assert (CALL_DUMMY_LOCATION == ON_STACK) true?  */
+      FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type,
+		      using_gcc);
+    }
   real_pc = start_sp;
 #endif
 
Index: xstormy16-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/xstormy16-tdep.c,v
retrieving revision 1.37
diff -u -r1.37 xstormy16-tdep.c
--- xstormy16-tdep.c	26 Mar 2003 22:39:52 -0000	1.37
+++ xstormy16-tdep.c	30 Mar 2003 04:21:07 -0000
@@ -1101,7 +1101,6 @@
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
 
   set_gdbarch_char_signed (gdbarch, 0);

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