From owner-freebsd-questions@FreeBSD.ORG Wed Jan 16 21:24:15 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CE2C16A417 for ; Wed, 16 Jan 2008 21:24:15 +0000 (UTC) (envelope-from p26a@yahoo.com) Received: from web90409.mail.mud.yahoo.com (web90409.mail.mud.yahoo.com [216.252.100.161]) by mx1.freebsd.org (Postfix) with SMTP id 1FBA513C455 for ; Wed, 16 Jan 2008 21:24:14 +0000 (UTC) (envelope-from p26a@yahoo.com) Received: (qmail 63227 invoked by uid 60001); 16 Jan 2008 21:24:14 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Message-ID; b=ceLgA4rG7uoTd432Nevp8Y7b1mEYaXX2WtktdhUzVBgXBtHDSPqetJz+DQ6rmARUktS4LGf6YYBPFkuybtBbYGsgFlG3mflaZC/+O7hOUV6OvVEHidTF/c6Hk93DeWYxPl+ZiacUry0WuUrmCBw+H98Jf/SwNjCiAx8xAm0yMQA=; X-YMail-OSG: Av_yz8cVM1m2R2FnkSAAtnLxERsRlY47JaJm9Ve_aZ2QQeBQQXmRLDdHnTzJbzoQKIXADBkuc_4HtdSbUwAXwv95ja1efrokH6vlYafRnSixLei72EvQccSX4I.j0g-- Received: from [64.235.97.59] by web90409.mail.mud.yahoo.com via HTTP; Wed, 16 Jan 2008 13:24:14 PST X-Mailer: YahooMailRC/818.31 YahooMailWebService/0.7.160 Date: Wed, 16 Jan 2008 13:24:14 -0800 (PST) From: Arun Paneri To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <320867.62493.qm@web90409.mail.mud.yahoo.com> Cc: FreeBSD User , Aryeh Friedman Subject: Re: Pls help: regarding gdb internals X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2008 21:24:15 -0000 Thanks Aryeh & Chuck. Well, I am trying to solve issues related to GDB. Like, gdb prints wrong values of few parameteres eg "this" pointer, when we give "backtrace" or "x/10x $ebp" command in core of our company product. I think it reads wrong value from symbol table or stack frame. So i am trying to put a break point and see what exactly gdb reads for that perticuler frame when it shows a wrong data. But dont know where exactly it reads data from the symbol table or stack frame. If you have a specific idea regarding this pls give some more info. Regards. ----- Original Message ---- From: Chuck Swiger To: Arun Paneri Cc: FreeBSD User ; freebsd-questions@freebsd.org Sent: Wednesday, January 16, 2008 2:56:36 PM Subject: Re: Pls help: regarding gdb internals On Jan 16, 2008, at 10:58 AM, Arun Paneri wrote: > Can anyone write few lines about how does gdb internally works. I > went to "Gdb internals guide" but couldn't find much information > specifically which i am looking for. I'm not familiar with the document you mentioned, but the canonical documentation for GDB is available via "info gdb". > I want information like when we give command "$gdb test.exe" then > how internaly it works. Does it start reading symbols and start > making symbol table with this command? Binary objects such as executable programs, shared libraries, etc contain symbol tables; GDB does a quick load of this symbol data to identify all of the sources of symbols for the program, and then will look up the details when needed. > Does it start creating stack frames as we give command "run" or > before even that? The program being debugged does not exist as a process until you run it, so there isn't an address space or stack until then. When the target program is run, it creates it's own stack frames according to the local architecture's machine calling conventions. > I am basically interested to know about creation of frames and how > does gdb read them back when we give "backtrace" command? Well, the calling conventions are different for every particular CPU architecture; but if you want to see the code that GDB uses, start with: /usr/src/contrib/gdb/gdb/frame-base.c /usr/src/contrib/gdb/gdb/frame-base.h /usr/src/contrib/gdb/gdb/frame-unwind.c /usr/src/contrib/gdb/gdb/frame-unwind.h /usr/src/contrib/gdb/gdb/frame.c /usr/src/contrib/gdb/gdb/frame.h ...but I suspect that something like these two articles are closer to what you are looking for: http://en.wikipedia.org/wiki/Calling_convention http://en.wikipedia.org/wiki/X86_calling_conventions -- -Chuck ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping