Revert call to bfd_cache_close().
[deliverable/binutils-gdb.git] / gdb / i386-tdep.c
index 41632caaed821f239247f8c171fd3b40958bdb80..7477266f433ecabc7ed0633d1bab74f3e7e7fc34 100644 (file)
@@ -349,6 +349,43 @@ i386_get_frame_setup (CORE_ADDR pc)
   return (-1);
 }
 
+/* Return the chain-pointer for FRAME.  In the case of the i386, the
+   frame's nominal address is the address of a 4-byte word containing
+   the calling frame's address.  */
+
+CORE_ADDR
+i386_frame_chain (struct frame_info *frame)
+{
+  if (frame->signal_handler_caller)
+    return frame->frame;
+
+  if (! inside_entry_file (frame->pc))
+    return read_memory_unsigned_integer (frame->frame, 4);
+
+  return 0;
+}
+
+/* Determine whether the function invocation represented by FRAME does
+   not have a from on the stack associated with it.  If it does not,
+   return non-zero, otherwise return zero.  */
+
+int
+i386_frameless_function_invocation (struct frame_info *frame)
+{
+  if (frame->signal_handler_caller)
+    return 0;
+
+  return frameless_look_for_prologue (frame);
+}
+
+/* Immediately after a function call, return the saved pc.  */
+
+CORE_ADDR
+i386_saved_pc_after_call (struct frame_info *frame)
+{
+  return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
+}
+
 /* Return number of args passed to a frame.
    Can return -1, meaning no way to tell.  */
 
@@ -694,6 +731,30 @@ get_longjmp_target (CORE_ADDR *pc)
 #endif /* GET_LONGJMP_TARGET */
 \f
 
+CORE_ADDR
+i386_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+                    int struct_return, CORE_ADDR struct_addr)
+{
+  sp = default_push_arguments (nargs, args, sp, struct_return, struct_addr);
+  
+  if (struct_return)
+    {
+      char buf[4];
+
+      sp -= 4;
+      store_address (buf, 4, struct_addr);
+      write_memory (sp, buf, 4);
+    }
+
+  return sp;
+}
+
+void
+i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+  /* Do nothing.  Everything was already done by i386_push_arguments.  */
+}
+
 /* These registers are used for returning integers (and on some
    targets also for returning `struct' and `union' values when their
    size and alignment match an integer type).  */
@@ -709,7 +770,14 @@ i386_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   int len = TYPE_LENGTH (type);
 
-  if (TYPE_CODE_FLT == TYPE_CODE (type))
+  if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+      && TYPE_NFIELDS (type) == 1)
+    {
+      i386_extract_return_value (TYPE_FIELD_TYPE (type, 0), regbuf, valbuf);
+      return;
+    }
+
+  if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
       if (NUM_FREGS == 0)
        {
@@ -767,7 +835,14 @@ i386_store_return_value (struct type *type, char *valbuf)
 {
   int len = TYPE_LENGTH (type);
 
-  if (TYPE_CODE_FLT == TYPE_CODE (type))
+  if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+      && TYPE_NFIELDS (type) == 1)
+    {
+      i386_store_return_value (TYPE_FIELD_TYPE (type, 0), valbuf);
+      return;
+    }
+
+  if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
       if (NUM_FREGS == 0)
        {
@@ -817,6 +892,17 @@ i386_store_return_value (struct type *type, char *valbuf)
                        "Cannot store return value of %d bytes long.", len);
     }
 }
+
+/* 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.  */
+
+CORE_ADDR
+i386_extract_struct_value_address (char *regbuf)
+{
+  return extract_address (&regbuf[REGISTER_BYTE (LOW_RETURN_REGNUM)],
+                         REGISTER_RAW_SIZE (LOW_RETURN_REGNUM));
+}
 \f
 
 /* Convert data from raw format for register REGNUM in buffer FROM to
@@ -959,6 +1045,9 @@ set_disassembly_flavor (void)
 }
 \f
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_i386_tdep (void);
+
 void
 _initialize_i386_tdep (void)
 {
This page took 0.025459 seconds and 4 git commands to generate.