Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!zombie.ncsc.mil!news.mathworks.com!gatech!howland.reston.ans.net!xlink.net!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!bonnie.heep!not-for-mail From: j@bonnie.heep.sax.de (J Wunsch) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: gdb debugger question (FreeBSD 2.0) Date: 10 Jul 1995 09:50:41 +0200 Organization: Private U**x site, Dresden. Lines: 37 Message-ID: <3tqm4h$bpd@bonnie.tcd-dresden.de> References: <rjb-0807952240230001@palpk-s13.intac.com> Reply-To: joerg_wunsch@uriah.heep.sax.de NNTP-Posting-Host: 192.109.108.139 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Bob Badaracco <rjb@intac.com> wrote: >I'm trying to debug a C program with the gdb debugger under FreeBSD. I don't >have that much experience with this type of debugger and need some help. > >1. What compiler options do I need to turn on in order to generate a >symbol table for the debugger to use? -g If you're using -g in company with -O or -O2 (which is possible for the gcc), expect some bogus ``look & feel'' when single-stepping the code due to the optimization. This is harmless, but sometimes confusing. >2. When my program dies, how can I get the debugger to stop where it happens? Depends on how you define ``the program dies''. If it's receiving a signal, the debugger will catch the signal before the program sees it anyway. This is effectively the same as if you had inserted a breakpoint just where the program failed. If your program is voluntarily exiting due to a failure condition, it might help to set a breakpoint at the function `exit', so you can trace back to the spot where the program has been calling `exit'. >Any useful documentation available anywhere for this? The online help is already somewhat useful (try `help', or `help <command>'). There used to be a large info file for gdb. You can look at it by running the `info' command. Beware, the info in 2.0.5 does not yet understand arrow keys; you will have to use ^P and ^N to move the cursor back and forth. I've been commiting a fix by Thomas Gellekum for this recently. -- cheers, J"org private: joerg_wunsch@uriah.heep.sax.de http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-)