From: Joel Brobecker <brobecker@act-europe.fr>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: Michael Snyder <msnyder@cygnus.com>, gdb-patches@sources.redhat.com
Subject: Re: Pb when calling a nested function in the inferior
Date: Tue, 31 Jul 2001 00:24:00 -0000 [thread overview]
Message-ID: <20010731092456.B31388@act-europe.fr> (raw)
In-Reply-To: <1010730224909.ZM5581@ocotillo.lan>
> Have you verified that the mechanisms used by gcc and by Ada95 for
> passing the static chain are the same?
Yes. Actually, the code was exactly the same.
> 1) In the version of gcc that I'm using the symbol that's associated
> with get_value() is get_value.0. You could look for such symbols
> and refuse to allow them to be called as inferior functions.
this suggestion has my preference, being more general than the
suggestion below. Let me check it out.
> 2) You could scan the prologue and look for a sequence of instructions
> which looks like a save of the static chain. E.g, in your example,
> I see:
>
> 0x804842c <get_value.0>: push %ebp
> 0x804842d <get_value.0+1>: mov %esp,%ebp
> 0x804842f <get_value.0+3>: sub $0x4,%esp
> 0x8048432 <get_value.0+6>: mov %ecx,0xfffffffc(%ebp)
> 0x8048435 <get_value.0+9>: mov 0xfffffffc(%ebp),%ecx
> 0x8048438 <get_value.0+12>: mov %ecx,%ecx
> 0x804843a <get_value.0+14>: mov 0xfffffffc(%ecx),%eax
> 0x804843d <get_value.0+17>: mov %eax,%eax
> 0x804843f <get_value.0+19>: leave
> 0x8048440 <get_value.0+20>: ret
>
> It appears to me that ``mov %ecx,0xfffffffc(%ebp)'' is
> responsible for saving the static chain pointer. If you could
> detect this, you could print your error or warning. (You'd
> want to make sure that no other instruction with a destination
> of %ecx appears before this instruction in the prologue though;
> if it does, it means it's doing something else.)
>
> BTW, GDB isn't particularly graceful in its handling of the ``get_value.0''
> symbol. E.g, observe what happens when I do ``x/i get_value.0'':
>
> (gdb) x/i get_value.0
> No symbol "get_value" in current context.
That's curious. With my version of gdb, I don't get the same result
(using GNU gdb 2001-07-30-cvs (MI_OUT)):
(gdb) x/10i get_value.0
A parse error in expression, near `'.
(gdb) x/4i get_value
0x8048468 <get_value>: push %ebp
0x8048469 <get_value+1>: mov %esp,%ebp
0x804846b <get_value+3>: sub $0x4,%esp
0x804846e <get_value+6>: mov %ecx,0xfffffffc(%ebp)
--
Joel
next prev parent reply other threads:[~2001-07-31 0:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-30 5:47 Joel Brobecker
2001-07-30 10:32 ` Michael Snyder
2001-07-30 11:31 ` Kevin Buettner
2001-07-30 14:24 ` Joel Brobecker
2001-07-30 15:41 ` Andrew Cagney
2001-07-30 15:49 ` Kevin Buettner
2001-07-31 0:24 ` Joel Brobecker [this message]
2001-07-31 1:20 ` Kevin Buettner
2001-07-31 1:36 ` Joel Brobecker
2001-07-31 1:29 ` Kevin Buettner
2001-08-23 3:40 ` Joel Brobecker
-- strict thread matches above, loose matches on Subject: below --
2001-03-05 18:58 [PATCH RFA] procfs.c related changes for AIX 5 Kevin Buettner
2001-03-06 1:11 ` Eli Zaretskii
2001-03-06 1:29 ` Kevin Buettner
2001-03-06 1:41 ` Eli Zaretskii
[not found] ` <3AAEC861.2756C62A@cygnus.com>
[not found] ` <msnyder@cygnus.com>
2001-03-26 18:24 ` Kevin Buettner
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=20010731092456.B31388@act-europe.fr \
--to=brobecker@act-europe.fr \
--cc=gdb-patches@sources.redhat.com \
--cc=kevinb@cygnus.com \
--cc=msnyder@cygnus.com \
/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