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]

[patch] Make PUSH_RETURN_ADDRESS a function with predicate ..


I've checked in the attached.  The change is a clone of 
INIT_EXTRA_FRAME_INFO.

enjoy,
Andrew
2001-11-05  Andrew Cagney  <ac131313@redhat.com>

	* gdbarch.sh (push_return_address): Change to a function with
	predicate.
	* gdbarch.h, gdbarch.c: Re-generate.
	* valops.c (hand_function_call): Replace #ifdef
	PUSH_RETURN_ADDRESS with run-time test of PUSH_RETURN_ADDRESS_P.
	
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.87
diff -p -r1.87 gdbarch.sh
*** gdbarch.sh	2001/11/06 11:02:12	1.87
--- gdbarch.sh	2001/11/06 17:56:43
*************** f:2:RETURN_VALUE_ON_STACK:int:return_val
*** 478,484 ****
  f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0
  f:1:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr::0:0
  f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
! f:1:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
  f:2:POP_FRAME:void:pop_frame:void:-:::0
  #
  f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
--- 478,484 ----
  f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0
  f:1:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr::0:0
  f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
! F:1:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
  f:2:POP_FRAME:void:pop_frame:void:-:::0
  #
  f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.39
diff -p -r1.39 valops.c
*** valops.c	2001/10/16 01:58:07	1.39
--- valops.c	2001/11/06 17:56:47
*************** You must use a pointer to function type 
*** 1570,1587 ****
  
    sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
  
! #ifdef PUSH_RETURN_ADDRESS	/* for targets that use no CALL_DUMMY */
!   /* There are a number of targets now which actually don't write any
!      CALL_DUMMY instructions into the target, but instead just save the
!      machine state, push the arguments, and jump directly to the callee
!      function.  Since this doesn't actually involve executing a JSR/BSR
!      instruction, the return address must be set up by hand, either by
!      pushing onto the stack or copying into a return-address register
!      as appropriate.  Formerly this has been done in PUSH_ARGUMENTS,
!      but that's overloading its functionality a bit, so I'm making it
!      explicit to do it here.  */
!   sp = PUSH_RETURN_ADDRESS (real_pc, sp);
! #endif /* PUSH_RETURN_ADDRESS */
  
    if (STACK_ALIGN_P () && !INNER_THAN (1, 2))
      {
--- 1570,1587 ----
  
    sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
  
!   if (PUSH_RETURN_ADDRESS_P ())
!     /* for targets that use no CALL_DUMMY */
!     /* There are a number of targets now which actually don't write
!        any CALL_DUMMY instructions into the target, but instead just
!        save the machine state, push the arguments, and jump directly
!        to the callee function.  Since this doesn't actually involve
!        executing a JSR/BSR instruction, the return address must be set
!        up by hand, either by pushing onto the stack or copying into a
!        return-address register as appropriate.  Formerly this has been
!        done in PUSH_ARGUMENTS, but that's overloading its
!        functionality a bit, so I'm making it explicit to do it here.  */
!     sp = PUSH_RETURN_ADDRESS (real_pc, sp);
  
    if (STACK_ALIGN_P () && !INNER_THAN (1, 2))
      {

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