This is the mail archive of the gdb@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: [RFC] Supporting alternative ABIs


Corinna Vinschen <vinschen@redhat.com> writes:


- EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, USE_STRUCT_CONVENTION and
  gdbarch_push_dummy_code gdbarch methods would be changed to expect
  the type of the function, not the type of its return value.  They
  can use TYPE_TARGET_TYPE to get the return value type, but this will
  also give them access to the `calling_convention' for the function type.

- gdbarch_push_dummy_call and EXTRACT_STRUCT_VALUE_ADDRESS would
  receive the function's type as an additional argument, to give them
  access to the function's calling convention information.

- USE_STRUCT_CONVENTION and gdbarch_push_dummy_code would not require
  the `gcc_p' and `using_gcc' flags anymore since this information
  is now given in the function type node.  Due to the way,
  gdbarch_parse_dwarf2_calling_convention evaluates the `calling_convention'
  value, all inferior call-related gdbarch methods could simply trust its
  value.


I was working on the (32-bit) SPARC target today, and wished I had the
function type available, so I'm positive this would be a good move.

... so seconded.


Going through them:

USE_STRUCT_CONVENTION:
I'd rename the existing USE_STRUCT_CONVENTION to DEPRECATED_USE_STRUCT_CONVENTION and then introduce new arch method gdbarch_use_struct_convention (gdbarch, struct type *func) that defaults to the old.


push_dummy_call:
Similar. The struct_return parameter is now very redundant (the assertions "struct_return == new USE_STRUCT_CONVENTION (new function parameter)", and "(struct_return != 0) == (STRUCT_ADDR != 0)" should hold).


EXTRACT_STRUCT_VALUE_ADDRESS:
Is this one needed? Instead always use EXTRACT_RETURN_VALUE to obtain the return value. Renaming this to DEPRECATED_STRUCT_VALUE_ADDRESS_V2.


STORE_RETURN_VALUE:
Rename the existing to deprecated_store_return_value_v2? Anyway, looking at set_return_value(), I think the replacement's default implementation should incorporate both of:
  if (code == TYPE_CODE_STRUCT
      || code == TYPE_CODE_UNION)       /* FIXME, implement struct return.  */
    error ("GDB does not support specifying a struct or union return value.");

STORE_RETURN_VALUE (type, current_regcache, VALUE_CONTENTS (val));
some ABI's allow struct return, some don't. Generic code shouldn't be making the decision.

EXTRACT_RETURN_VALUE:
Rename the existing to deprecated_extract_return_value_v2? Looking at value_being_returned, and given the comment above on EXTRACT_STRUCT_VALUE_ADDRESS, I think the default method should contain much of the existing value_being_returned function.


Andrew



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