This is the mail archive of the gdb@sourceware.org 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: Integer arguments passed to inferior's functions


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


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