public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb@sourceware.org
Subject: Re: Integer arguments passed to inferior's functions
Date: Sun, 30 Oct 2011 13:51:00 -0000	[thread overview]
Message-ID: <20111030133001.GA10717@host1.jankratochvil.net> (raw)
In-Reply-To: <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

  reply	other threads:[~2011-10-30 13:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-30 10:07 Eli Zaretskii
2011-10-30 13:51 ` Jan Kratochvil [this message]
2011-10-30 18:22   ` Eli Zaretskii
2011-10-30 19:06     ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111030133001.GA10717@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).