From owner-freebsd-questions@FreeBSD.ORG Wed Jan 16 20:31:54 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 347F616A419 for ; Wed, 16 Jan 2008 20:31:54 +0000 (UTC) (envelope-from p26a@yahoo.com) Received: from web90410.mail.mud.yahoo.com (web90410.mail.mud.yahoo.com [216.252.100.162]) by mx1.freebsd.org (Postfix) with SMTP id F08C913C45A for ; Wed, 16 Jan 2008 20:31:53 +0000 (UTC) (envelope-from p26a@yahoo.com) Received: (qmail 60264 invoked by uid 60001); 16 Jan 2008 20:31:53 -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=UChcrDUk3D3hcjkNAJSc77vLtYzoQgfYVkStuUFxS7zRwwf3Q5lUCdHJ/VAn6xlPWKDQzY4tIbJl9K07eZ7qYI4qCLeVCuJIfrtsOnmTutDsB/RaTH+a5nUlahfddhCKFa3mTruefHy2Ih2plnK9J3kYvJTcg4sBaRw2r1DDSN4=; X-YMail-OSG: nRNY6acVM1klIWsis7zqB.YFpiWKRydC5LpcCub2egJ1en0lXIiyEDQ.D2C6hMsyrzPU1QZ8Wd7pZPM8KuTUuONEZ96yMHDIDSwr3FjRNSOgzQ_y1NU0s9TVbKA_ZCwR7sQX5w-- Received: from [64.235.97.59] by web90410.mail.mud.yahoo.com via HTTP; Wed, 16 Jan 2008 12:31:53 PST X-Mailer: YahooMailRC/818.31 YahooMailWebService/0.7.160 Date: Wed, 16 Jan 2008 12:31:53 -0800 (PST) From: Arun Paneri To: Chuck Swiger MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <461735.58767.qm@web90410.mail.mud.yahoo.com> Cc: FreeBSD User , freebsd-questions@freebsd.org 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 20:31:54 -0000 Thanks a ton. I got some idea to start with. 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 ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs