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] mips gdbarch-ify struct_return, extract_struct_value_address


This time a straightforward replacement, checked in as obvious.
2002-08-20  Michael Snyder  <msnyder@redhat.com>

	* config/mips/tm-mips.h (STORE_STRUCT_RETURN): Delete.
	(EXTRACT_STRUCT_VALUE_ADDRESS): Delete.
	* mips-tdep.c (mips_store_struct_return): New function.
	(mips_extract_struct_value_address): New function.
	(mips_gdbarch_init): Set store_struct_return and
	extract_struct_value_address.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.110
diff -c -3 -p -r1.110 mips-tdep.c
*** mips-tdep.c	20 Aug 2002 16:11:49 -0000	1.110
--- mips-tdep.c	20 Aug 2002 19:22:54 -0000
*************** mips_n32n64_store_return_value (struct t
*** 4863,4868 ****
--- 4863,4883 ----
    mips_n32n64_xfer_return_value (type, current_regcache, NULL, valbuf);
  }
  
+ static void
+ mips_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+ {
+   /* Nothing to do -- push_arguments does all the work.  */
+ }
+ 
+ static CORE_ADDR
+ mips_extract_struct_value_address (struct regcache *ignore)
+ {
+   /* FIXME: This will only work at random.  The caller passes the
+      struct_return address in V0, but it is not preserved.  It may
+      still be there, or this may be a random value.  */
+   return read_register (V0_REGNUM);
+ }
+ 
  /* Exported procedure: Is PC in the signal trampoline code */
  
  static int
*************** mips_gdbarch_init (struct gdbarch_info i
*** 5934,5939 ****
--- 5949,5957 ----
    /* Hook in OS ABI-specific overrides, if they have been registered.  */
    gdbarch_init_osabi (info, gdbarch, osabi);
  
+   set_gdbarch_store_struct_return (gdbarch, mips_store_struct_return);
+   set_gdbarch_extract_struct_value_address (gdbarch, 
+ 					    mips_extract_struct_value_address);
    return gdbarch;
  }
  
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.36
diff -c -3 -p -r1.36 tm-mips.h
*** config/mips/tm-mips.h	18 Aug 2002 18:59:53 -0000	1.36
--- config/mips/tm-mips.h	20 Aug 2002 19:22:54 -0000
*************** extern void mips_register_convert_from_t
*** 170,193 ****
  #define REGISTER_CONVERT_FROM_TYPE(n, type, buffer)	\
    mips_register_convert_from_type ((n), (type), (buffer))
  
- /* Store the address of the place in which to copy the structure the
-    subroutine will return.  Handled by mips_push_arguments.  */
- 
- #define STORE_STRUCT_RETURN(addr, sp)
- /**/
- 
- /* Extract from an array REGBUF containing the (raw) register state
-    the address in which a function should return its structure value,
-    as a CORE_ADDR (or an expression that can be used as one).  */
- /* The address is passed in a0 upon entry to the function, but when
-    the function exits, the compiler has copied the value to v0.  This
-    convention is specified by the System V ABI, so I think we can rely
-    on it.  */
- 
- #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-   (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
- 		    REGISTER_RAW_SIZE (V0_REGNUM)))
- 
  
  /* Describe the pointer in each stack frame to the previous stack frame
     (its caller).  */
--- 170,175 ----


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