From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Matt Schalit Cc: gdb@sourceware.cygnus.com Subject: Re: Need help with a backtrace Date: Thu, 15 Feb 2001 06:17:00 -0000 Message-id: <3A8BE44D.799A6BF4@redhat.com> References: <3A883607.BF2396E4@pacbell.net> <3A883F3C.6DB5C98D@cygnus.com> <3A888BCA.84305AE1@pacbell.net> X-SW-Source: 2001-02/msg00173.html Matt Schalit wrote: > > Ok. It looks like it only lists an entry when a function > calls another function, like main() calling printf()? > But it doesn't seem to list things like loops or if/case tests > or variable values? > Yes, because all information it has are the stack frames, which are created when a function is called. When you want to debug something in between, you set a breakpoint in a line of source code and tell your program to run (or continue if you had stopped somewhere else before). Of course, all this only work before you program crashes. > I know how to write C programs. How would I backtrace or > step my way through hello-world.c if it exits normally, and > I just want to see how the trace looks? > Insert a breakpoint at that last function (look at the source file and line number in the bad backtrace). Run your program. When it stops at the breakpoint use the backtrace command. > I say that as a possibility, because I read a Solairis Gnome > Install Howto that mentioned those were needed, and I've noticed, > when doing a truss on some of these programs that I get an extra '/' > showing up in paths to applications that are being called, as in: > > xstat(2, "./gnome/config-override//Gnome", 0x08047614) Err#2 ENOENT > xstat(2, "/usr/local/etc/gnome/config//Gnome", 0x08047614) Err#2 ENOENT > xstat(2, "./gnome/config//Gnome", 0x08047614) Err#2 ENOENT > xstat(2, "/home/matthew/.gnome//Gnome", 0x08047674) = 0 > open("/home/matthew/.gnome//Gnome", O_RDONLY, 0666) = 6 > > I guess the last two lines do show a file being found > using the odd path. > Yes, AFAIK the extra "/" won't hurt. > Is up and down how I see what variables get set to which values > while moving through a function? > You only see what the values of these variables where when the next function was called. It is a "snapshot". > And finally, where does > > > > #4 0xbfd95397 in create_label > ^^^^^^^^^^ > This is the instruction pointer (PC). That is where the CPU was executing instructions when another function was called or your program stopped/crashed. > that value come from, or what man page should I look at > for the decoding formula? > With the GDB sources, there is a nice user manual. It is in the sources under gdb/doc. It is in a format called "texinfo" which can produce several different formats like Postcript for instance. You just have to use "make" with the appropriate type on that directory. I am sure that if you do a Web search you'll find a HTML on line version. W.r.t. your original problem, maybe if you post it to the Gnome list people will recognize that as a known problem or something. It worth a try. Cheers, Fernando -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9