Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Randolph Chung <randolph@tausq.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch/rfc] Try to get dummy calls working on hpux again
Date: Fri, 11 Jun 2004 17:30:00 -0000	[thread overview]
Message-ID: <40C9EC47.9020304@gnu.org> (raw)
In-Reply-To: <20040611161224.GE9466@tausq.org>

>>Ah! the comments should include this diagram, I think making this clear 
>>> (and the need to fudge __gcc_plt_call) is what's really needed.
> 
> 
> how about this?
> 
> +  /* On HPUX, functions in the main executable and in libraries can be located
> +     in different spaces.  In order for us to be able to select the right
> +     space for the function call, we need to go through an instruction seqeunce
> +     to select the right space for the target function, call it, and then
> +     restore the space on return.
> +
> +     There are two helper routines that can be used for this task -- if
> +     an application is linked with gcc, it will contain a __gcc_plt_call
> +     helper function.  __gcc_plt_call, when passed the entry point of an
> +     import stub, will do the necessary space setting/restoration for the
> +     target function.
> +
> +     For programs that are compiled/linked with the HP compiler, a similar
> +     function called __d_plt_call exists; __d_plt_call expects a PLABEL instead
> +     of an import stub as an argument.
> +
> +     To summarize, the call flow is:
> +       current function -> dummy frame -> __gcc_plt_call (import stub)
> +                        -> target function
> +     or
> +       current function -> dummy frame -> __d_plt_call (plabel)
> +                        -> target function

Yes, thanks!  Suggest wrapping this bit in

*NOINDENT*
...
*INDENT*

so that you're safe from gdb_indent.sh.

> +     In general the "funcaddr" argument passed to push_dummy_code is the actual
> +     entry point of the target function.  For __gcc_plt_call, we need to
> +     locate the import stub for the corresponding function.  Failing that,
> +     we construct a dummy "import stub" on the stack to pass as an argument.
> +     For __d_plt_call, we similarly synthesize a PLABEL on the stack to
> +     pass to the helper function.
> +
> +     An additional twist is that, in order for us to restore the space register
> +     to its starting state, we need __gcc_plt_call/__d_plt_call to return
> +     to the instruction where we started the call.  However, if we put
> +     the breakpoint there, gdb will complain because it will find two
> +     frames on the stack with the same (sp, pc) (with the dummy frame in
> +     between).  Currently, we set the return pointer to (pc - 4) of the
> +     current function.  FIXME: This is not an ideal solution; possibly if the
> +     current pc is at the beginning of a page, this will cause a page fault.
> +     Need to understand this better and figure out a better way to fix it.  */

with that addition, it's ok to commit.

>>> Yes.  Probably using the tramp-frame logic.
> 
> 
> tramp-frame doesn't handle frames that are "functions" (that have a
> name). I think we should make that an attribute of the tramp-frame
> (whether having a name is ok or not?)

I was thinking of the case where the stub was pushed onto the stack - 
that doesn't have a name.

Andrew



  reply	other threads:[~2004-06-11 17:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-10  6:12 Randolph Chung
2004-06-10 19:27 ` Andrew Cagney
2004-06-10 20:23   ` Randolph Chung
2004-06-10 20:42     ` Andrew Cagney
2004-06-10 22:12       ` Randolph Chung
2004-06-11 15:25         ` Andrew Cagney
2004-06-11 16:12           ` Randolph Chung
2004-06-11 17:30             ` Andrew Cagney [this message]
2004-07-11  6:53               ` Randolph Chung
2004-07-14 16:54                 ` Andrew Cagney

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=40C9EC47.9020304@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.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