Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2008 12:31:53 -0800 (PST)
From:      Arun Paneri <p26a@yahoo.com>
To:        Chuck Swiger <cswiger@mac.com>
Cc:        FreeBSD User <freebsd@stigascorp.com>, freebsd-questions@freebsd.org
Subject:   Re: Pls help: regarding gdb internals
Message-ID:  <461735.58767.qm@web90410.mail.mud.yahoo.com>

next in thread | raw e-mail | index | archive | help
Thanks a ton. I got some idea to start with.

Regards,

----- Original Message ----
From: Chuck Swiger <cswiger@mac.com>
To: Arun Paneri <p26a@yahoo.com>
Cc: FreeBSD User <freebsd@stigascorp.com>; 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?461735.58767.qm>