From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25662 invoked by alias); 7 Feb 2009 14:06:35 -0000 Received: (qmail 25653 invoked by uid 22791); 7 Feb 2009 14:06:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-fx0-f18.google.com (HELO mail-fx0-f18.google.com) (209.85.220.18) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Feb 2009 14:06:30 +0000 Received: by fxm11 with SMTP id 11so1909628fxm.0 for ; Sat, 07 Feb 2009 06:06:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.181.60.13 with SMTP id n13mr1010559bkk.92.1234015587019; Sat, 07 Feb 2009 06:06:27 -0800 (PST) In-Reply-To: <8A4E42EC-54D4-449D-BAB5-C05F6DD97090@gmail.com> References: <249DE25A-9555-4D36-8C59-56EF08F2E34A@gmail.com> <1233921666.14735.108.camel@localhost.localdomain> <8A4E42EC-54D4-449D-BAB5-C05F6DD97090@gmail.com> Date: Sat, 07 Feb 2009 14:06:00 -0000 Message-ID: <67ea2eb0902070606k250e7c85nd00f508acf315386@mail.gmail.com> Subject: Re: Help needed with browsing GDB code From: Ramana Radhakrishnan To: Nityananda Cc: Thiago Jung Bauermann , gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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: 2009-02/txt/msg00069.txt.bz2 Hi Nityananda, On Sat, Feb 7, 2009 at 1:52 AM, Nityananda wrote: > HI Thiago, > Thanks for the information. I am reading the code to deal with the stack > frame information without the debug information. Can you please point me = to > the code with the debug information? You mentioned that it uses DWARF2. Look at gdb/dwarf2-frame.c for DWARF2 frame reading . >So are the local variables always at the same offset of the frame base add= ress > or there is a possibility of these addresses changing from one process to > another? Local variables will always be at the same offset from the frame base address for the same program unless you have self modifying code . Operating Systems 101 - A process can be multiple instantiations of the same program. HTH cheers Ramana > > Thank you very much in advance, > Nityananda > > On Feb 6, 2009, at 4:01 AM, Thiago Jung Bauermann wrote: > >> Hi Nityananda, >> >> El jue, 05-02-2009 a las 18:26 -0800, Nityananda escribi=F3: >>> >>> I am looking for how >>> GDB obtains the address of stack local variables. I am seeing some >>> code related to frame_info but do not know how it actually works. >> >> Well, there are two situations: with debug information available, and >> without. For the first case it's simple: the DWARF2 format includes the >> frame base address as part of the unwind information, and addresses of >> local variables in the debuginfo are relative to that base address. >> >> When there's no debuginfo available, GDB uses its knowledge of the OS >> ABI for the given architecture. For example, for ppc64-linux, the stack >> frame layout is given here: >> >> http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STACK >> >> And the code which uses that knowledge is in >> rs6000-tdep.c:rs6000_frame_cache. It's kinda hairy... >> -- >> []'s >> Thiago Jung Bauermann >> IBM Linux Technology Center >> > >