Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: gdb-patches@sources.redhat.com
Subject: Re: [patch/rfa] allow unwinding "past main" for dummy frames
Date: Mon, 06 Dec 2004 04:27:00 -0000	[thread overview]
Message-ID: <20041206041458.GF6359@tausq.org> (raw)
In-Reply-To: <20041206034013.GA31944@nevyn.them.org>

> Could you explain to me how inside_main_func is returning true for a
> dummy frame?
> 
> The code is there for inside_entry_func because we used to use the
> actual entry point as a location for the dummy frame.

it's very twisted :)

this is what it says in hppa-hpux-tdep.c:

     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.

so, in a function called by gdb, we have the following frames on the
stack:

#0 callee
#1 __gcc_plt_call
#2 <dummy frame>
#3 current function when user called "callee" from gdb (main in this case)

so, what happens is that we call __gcc_plt_call using a stack trampoline
which tells __gcc_plt_call to return to "current function". after
__gcc_plt_call calls the callee function, it looks up the return address
("current function") and restores the space registers to the correct
value for that address. ergo, <dummy frame> actually has a frame pc that
belongs to "current function", and if that's main, dummy frame will
trigger the inside_main_func check.

does this make sense?

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


  reply	other threads:[~2004-12-06  4:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06  3:31 Randolph Chung
2004-12-06  3:45 ` Daniel Jacobowitz
2004-12-06  4:27   ` Randolph Chung [this message]
2004-12-06  4:59     ` Daniel Jacobowitz
2004-12-06  6:22       ` Randolph Chung
2004-12-06 15:35         ` Daniel Jacobowitz
2004-12-06 16:54           ` Randolph Chung
2004-12-08  3:27           ` Randolph Chung
2004-12-06 14:11       ` Randolph Chung

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=20041206041458.GF6359@tausq.org \
    --to=randolph@tausq.org \
    --cc=gdb-patches@sources.redhat.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