From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14268 invoked by alias); 6 Dec 2004 04:15:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 14140 invoked from network); 6 Dec 2004 04:15:01 -0000 Received: from unknown (HELO arwen.tausq.org) (64.81.244.109) by sourceware.org with SMTP; 6 Dec 2004 04:15:01 -0000 Received: by arwen.tausq.org (Postfix, from userid 1000) id 84E3E111F48; Sun, 5 Dec 2004 20:14:58 -0800 (PST) Date: Mon, 06 Dec 2004 04:27:00 -0000 From: Randolph Chung To: gdb-patches@sources.redhat.com Subject: Re: [patch/rfa] allow unwinding "past main" for dummy frames Message-ID: <20041206041458.GF6359@tausq.org> Reply-To: Randolph Chung References: <20041206032726.GB6359@tausq.org> <20041206034013.GA31944@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041206034013.GA31944@nevyn.them.org> X-GPG: for GPG key, see http://www.tausq.org/gpg.txt User-Agent: Mutt/1.5.6+20040722i X-SW-Source: 2004-12/txt/msg00153.txt.bz2 > 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 #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, 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/