From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27132 invoked by alias); 29 Oct 2011 18:43:59 -0000 Received: (qmail 27124 invoked by uid 22791); 29 Oct 2011 18:43:58 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Oct 2011 18:43:37 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id p9TIhQl1026440; Sat, 29 Oct 2011 20:43:26 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id p9TIhPoK012445; Sat, 29 Oct 2011 20:43:25 +0200 (CEST) Date: Sat, 29 Oct 2011 18:48:00 -0000 Message-Id: <201110291843.p9TIhPoK012445@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: eliz@gnu.org CC: jan.kratochvil@redhat.com, gdb@sourceware.org In-reply-to: <83ipn78ym5.fsf@gnu.org> (message from Eli Zaretskii on Sat, 29 Oct 2011 20:02:42 +0200) Subject: Re: Specify frame by address References: <83k47n90xn.fsf@gnu.org> <20111029174638.GA27749@host1.jankratochvil.net> <83ipn78ym5.fsf@gnu.org> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00220.txt.bz2 > Date: Sat, 29 Oct 2011 20:02:42 +0200 > From: Eli Zaretskii > > > Date: Sat, 29 Oct 2011 19:46:38 +0200 > > From: Jan Kratochvil > > Cc: gdb@sourceware.org > > > > "address of the frame" is frame_id.stack_addr. For DWARF it is CFA > > (dwarf2_frame_cfa), which is for most arches just unwound SP (not PC!), that > > is SP as shown by GDB in the caller. > > Thanks. > > What is it for stabs? More generally, suppose I wanted to make the > manual more clear on this matter, what could I tell the user about > how to find out this address? The debug info format isn't really relevant. It's the architecture that matters. The address is typically the value of the stack pointer just before doing the function call, or the value of the stack pointer upon function entry. We try to make sure that all unwinders agree on the convention used, which is why for most architectures we use the same convention as used by GCC for calculating the DWARF CFA, such that the architecture-independent DWARF unwinder uses the same convention as the architecture-specific unwinders that are used if no DWARF debug info is available. The frame address is printed by the "info frame": Breakpoint 1, 0x000000000042b910 in main () (gdb) info frame Stack level 0, frame at 0x7f7ffffbc350: rip = 0x42b910 in main; saved rip 0x42b761 Arglist at 0x7f7ffffbc340, args: Locals at 0x7f7ffffbc340, Previous frame's sp is 0x7f7ffffbc350 Saved registers: rip at 0x7f7ffffbc348 So on amd64 the convention is that the frame address is the stack pointer before the function call was made. > > Such command really needs to iterate the frames and compare PC there. > > Right. I hoped that I could reference the frame by the PC address. That wouldn't work. Functions are sometimes called recursively, so diffrerent frames may end up with the same PC address.