Integer arguments passed to inferior's functions

Jan Kratochvil jan.kratochvil@redhat.com
Sun Oct 30 13:51:00 GMT 2011


On Sun, 30 Oct 2011 07:38:44 +0100, Eli Zaretskii wrote:
> If I type
> 
>   (gdb) call foo(1)
> 
> what will be the type of the argument GDB will pass to `foo'?  Will
> GDB look up the function signature or will it use some default?.

Yes, it looks up the function signature, see the value_arg_coerce call in
call_function_by_hand.  It uses the passed parameter (typeof (1) -> int here)
if the parameter is after the known count of parameter types.


> If the former, what happens when the signature is unknown or unavailable?

The known parameters count is 0 in such case.


> If the latter, how is that default computed?

value_type of that value (1 here, therefore int).


> does it depend on the inferior's architecture, for instance?

After all these types are determined you are right the types are further
promoted depending on the arch, by gdbarch_push_dummy_call.


Thanks,
Jan



More information about the Gdb mailing list