This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Integer arguments passed to inferior's functions
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb at sourceware dot org
- Date: Sun, 30 Oct 2011 14:30:01 +0100
- Subject: Re: Integer arguments passed to inferior's functions
- References: <E1RKP2a-0004vk-RU@fencepost.gnu.org>
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