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]

Re: [SO obvious...] make struct_return work for hand_function_call


God, we've struggled with this for years... the answer is so obvious!

Er, struct return already works for hand call functions. Vis:


  /* NOTE: cagney/2002-09-10: Only when the stack has been correctly
     aligned (using frame_align()) do we can trust STRUCT_ADDR and
     fetch the return value direct from the stack.  This lack of trust
     comes about because legacy targets have a nasty habit of
     silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR.  For
     such targets, just hope that value_being_returned() can find the
     adjusted value.  */
  if (struct_return && gdbarch_frame_align_p (current_gdbarch))
    {
      struct value *retval = value_at (value_type, struct_addr, NULL);
      do_cleanups (retbuf_cleanup);
      return retval;
    }
  else
    {
      struct value *retval = value_being_returned (value_type, retbuf,
                                                   struct_return);
      do_cleanups (retbuf_cleanup);
      return retval;
    }

If your architecture provides frame_align(), and does not it will all work.

I think all those changes can be reverted.

Eli, this generalizes some special-purpose code that you wrote for HP,
which now becomes redundant and may be removed.

BTW, Elz is Elena.


Andrew



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