coercing arguments to memory in call_function_by_hand

Branko Drevenšek branko.drevensek@gmail.com
Fri Dec 12 16:46:00 GMT 2014


Hi,

I'm implementing push_dummy_call for a target that requires struct&union 
arguments to be passed in registers if they are smaller than two 
registers (which works ok), but requires address of struct or union to 
be passed instead for if argument is larger that two registers.

Problem with this is that call_function_by_hand calls value_arg_coerce 
for all arguments of called function, which in fact decides which 
arguments it needs to coerce to target memory based on some rules, which 
don't take into account ABI requirements. This means big struct 
arguments for example are not coerced to target and appropriate pointer 
can not be passed.

I do another round of checks and ~duplicate code from 
value_coerce_to_target, but is there/should there be a better way? 
Should something be done about it (I can try to prepare a patch) or 
should I just keep duplicate the code and forget about it?

Having architecture specific value_must_coerce_to_target (or similar) 
would make this simpler.

BR.
Branko Drevensek




More information about the Gdb mailing list