Re: Seg Fault: Debugging Beginner



On Tue, 2003-12-23 at 11:06, Dimitar Haralanov wrote:
On Sat, 20 Dec 2003 12:18:55 -0700
Michael Torrie <torriem chem byu edu> wrote:

To find the place in your code where it is segfaulting, compile your
program with a "-g" (both compile and link stage) parameter.  Then use
a debugger like ddd or kdbg (comes with KDE), or even commandline gdb
and you can see the exact line of code where the problem is occurring.
 You
can also use a debugger to step through your code to watch variables
and make sure they are right.  Debuggers seem to be lost arts these
days, but I assure you learning a powerful debugging interface like
ddd is well worth your time.

      Of course, this will only work if the problem is somewhere in your
code. If for some reason the crash occurs in one of the GTK functions
you will be out of luck unless you have compiled GTK with debugging
enabled.
      As far as I can tell from my week long search, there are not debugging
libraries for GTK (unless you are running Debian)

Its been my experience that the problem is almost never in the library's
code, its almost always in your code. When my app segfaults in the
library, I use the up command to return to my code and test the
parameters that I am passing to the library.

Cheers,
Ryan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]