From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9310 invoked by alias); 12 Mar 2003 15:15:17 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 9300 invoked from network); 12 Mar 2003 15:15:16 -0000 Received: from unknown (HELO localhost.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 12 Mar 2003 15:15:16 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id EE5732B11; Wed, 12 Mar 2003 10:15:11 -0500 (EST) Message-ID: <3E6F4EFF.2010205@redhat.com> Date: Wed, 12 Mar 2003 15:15:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michal Ludvig Cc: GDB list Subject: Re: Frame unwind functions References: <3E6E2C79.5050409@suse.cz> <3E6E5D6C.5080702@redhat.com> <3E6EEBB4.5060505@suse.cz> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg00176.txt.bz2 > Andrew Cagney wrote: > Hi all, > since there are different unwind mechanisms in different branches of GDB I got a bit lost. I need to sort my thoughts to understand the principles. > > First my view of how things now work: > > To be honest, this a very good description of how GDB did work: special case on top of special case on top of .... > > Thanks for appreciation :-) > But I'm afraid you didn't understand me. AFAIK these special cases are still in there, but now they're hidden in appropriate unwind function sets. You were talking about the interface (frame_unwind_register, frame_unwind_id, ...) while I was talking about the internals of these methods for different frame types. That's what I'm interested in if I should implement these methods for different x86-64 frames - I'm examining what other types of frame unwinders do to know what my ones should do. Ah, ok. An architecutre could potentially have the following unwinders: - traditional (prologue based) - sigtramp The x86-64 GNU/Linux, appears to only have the second. In addition, there is the generic: - cfi unwinder. > - In the backtrace the function's arguments are printed as well. > - on i386 it's not a problem since they are on the stack > - on x86-64 we pass some of them in registers > - that's fine for the first frame (#0) - I know all registers and I > can use location lists to find current position of a given arg. > - for the second frame (#1) I could call > next_frame->unwind->reg(regnum) to get the register I need and > unwind it even more by calling this_frame->unwind->reg(regnum) to > get it's value at the beginning of the frame. > - but how about the next frames (#2,...)? I can always call > next_frame->unwind->reg(regnum) and if the next_frame wouldn't > know its "initial" value (ie. the value at the place of PC) it > would recursively call next_frame->next_frame->unwind->register() > untill it get's the value. > > > The above is the desired and correct behavior. This recursion is required for things to work (a stack is recursive by definition). > > What if a desired register's value isn't available anymore? How do I report it to the caller of my_frame->unwind->reg()? By setting an optimizedp parameter? Yes, at present setting optimized to non-zero is the best there is. I noticed that the cfi unwinder is already doing this. Andrew