From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11836 invoked by alias); 19 Feb 2009 05:17:45 -0000 Received: (qmail 11828 invoked by uid 22791); 19 Feb 2009 05:17:44 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from rv-out-0708.google.com (HELO rv-out-0708.google.com) (209.85.198.246) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Feb 2009 05:17:37 +0000 Received: by rv-out-0708.google.com with SMTP id c5so241906rvf.48 for ; Wed, 18 Feb 2009 21:17:35 -0800 (PST) Received: by 10.140.125.1 with SMTP id x1mr691248rvc.72.1235020655139; Wed, 18 Feb 2009 21:17:35 -0800 (PST) Received: from ?10.0.1.197? (dhcp-004086.ics.uci.edu [128.195.4.86]) by mx.google.com with ESMTPS id g22sm841602rvb.0.2009.02.18.21.17.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 18 Feb 2009 21:17:33 -0800 (PST) Cc: Thiago Jung Bauermann , gdb@sourceware.org Message-Id: <122179EB-05F1-440D-B0C7-86272338854D@gmail.com> From: Nityananda To: Ramana Radhakrishnan In-Reply-To: <67ea2eb0902070606k250e7c85nd00f508acf315386@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Help needed with browsing GDB code Date: Thu, 19 Feb 2009 05:17:00 -0000 References: <249DE25A-9555-4D36-8C59-56EF08F2E34A@gmail.com> <1233921666.14735.108.camel@localhost.localdomain> <8A4E42EC-54D4-449D-BAB5-C05F6DD97090@gmail.com> <67ea2eb0902070606k250e7c85nd00f508acf315386@mail.gmail.com> 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/msg00130.txt.bz2 Hi Everyone, Thanks for the information. Can you please help me out with more=20=20 questions? I am not sure how I can find the starting offset from the stack frame=20=20 pointer for the local variables on the frame. Can you please tell me=20=20 how I can find it in GDB code for the i386 architecture. Also how can i find the same information about the location of the=20=20 local variables when using fomit-frame-pointer compiler flag. Since=20=20 the frame pointers are no longer going to be in the stack frames. Thanks and regards, Nityananda On Feb 7, 2009, at 6:06 AM, Ramana Radhakrishnan wrote: > Hi Nityananda, > > > On Sat, Feb 7, 2009 at 1:52 AM, Nityananda =20=20 > wrote: >> HI Thiago, >> Thanks for the information. I am reading the code to deal with the=20=20 >> stack >> frame information without the debug information. Can you please=20=20 >> point me to >> the code with the debug information? You mentioned that it uses=20=20 >> DWARF2. > > Look at gdb/dwarf2-frame.c for DWARF2 frame reading . > >> So are the local variables always at the same offset of the frame=20=20 >> base address >> or there is a possibility of these addresses changing from one=20=20 >> 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,=20=20 >>> and >>> without. For the first case it's simple: the DWARF2 format=20=20 >>> includes the >>> frame base address as part of the unwind information, and=20=20 >>> 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=20=20 >>> OS >>> ABI for the given architecture. For example, for ppc64-linux, the=20=20 >>> stack >>> frame layout is given here: >>> >>> http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STA= CK >>> >>> 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 >>> >> >>