From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17411 invoked by alias); 19 Feb 2009 05:29:59 -0000 Received: (qmail 17401 invoked by uid 22791); 19 Feb 2009 05:29:58 -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 wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.173) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Feb 2009 05:29:53 +0000 Received: by wf-out-1314.google.com with SMTP id 28so268142wfc.24 for ; Wed, 18 Feb 2009 21:29:51 -0800 (PST) Received: by 10.142.172.12 with SMTP id u12mr3176090wfe.288.1235021391271; Wed, 18 Feb 2009 21:29:51 -0800 (PST) Received: from ?10.0.1.197? (dhcp-004086.ics.uci.edu [128.195.4.86]) by mx.google.com with ESMTPS id 22sm679239wfg.23.2009.02.18.21.29.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 18 Feb 2009 21:29:50 -0800 (PST) Cc: Thiago Jung Bauermann , gdb@sourceware.org Message-Id: From: Nityananda To: Ramana Radhakrishnan In-Reply-To: <122179EB-05F1-440D-B0C7-86272338854D@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:29: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> <122179EB-05F1-440D-B0C7-86272338854D@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/msg00132.txt.bz2 Hi Everyone, One more question that i wanted to ask was: How can we find out when=20=20 we have reached the end of the local variable allocation on the stack?=20=20 Is there any other information which is going to be stored in the=20=20 stack frame other than the return address, saved stack frame pointer=20=20 and the local variables? So, is it true if we say that the end of the=20=20 current stack frame is reached when we finish all the local variable=20=20 allocation for that function? Registers from the caller are going to=20=20 be stored in the previous stack frame, right? Thanks and regards, Nityananda On Feb 18, 2009, at 9:17 PM, Nityananda wrote: > 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=20=20 > frame pointer for the local variables on the frame. Can you please=20=20 > tell me 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=20=20 >>>> the 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#ST= ACK >>>> >>>> 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 >>>> >>> >>> >