Re: Segmentation Fault
- From: Wallace Owen <wallace owen L-3com com>
- To: John Vetterli <jvetterli linux ca>
- Cc: Gtk <gtk-app-devel-list gnome org>
- Subject: Re: Segmentation Fault
- Date: Tue, 04 Apr 2006 17:17:05 -0700
On Tue, 2006-04-04 at 19:38 -0400, John Vetterli wrote:
On Tue, 4 Apr 2006, Sandeep KS wrote:
I have written a program using GTK which executes some shellscripts in
the background...After the shellscripts complete executing, a window is
displayed showing the completion details.... At this time segmentation
Is there anyway to trace the exact cause of the segmentation fault...
I tried gdb, but it didn't show any error while executing the code..The
segmentation fault occured when the execution went to loop after
displaying the final window and waiting for user's interaction...
How can i find the reason for the segmentation fault?
At the shell prompt, run "ulimit -c unlimited", then run your application.
When it segfaults, a file called "core" will be created in the
application's current working directory, containing the state of the
application when the segfault occurred. You can then inspect the core
file with gdb by running "gdb <myapp> core" where <myapp> is the name of
the application's binary file.
Alternatively, run under gdb. When the segfault occurs tell gdb to show
you a backtrace (bt). At the top of the stack trace (most nested
function called) will be in some lib code. But further down it'll show
you your code that called it. Or, maybe, it'll show that the inferior*
program dumped core in a callback of yours.
(* gdb refers to the program being debugged as the inferior program for
two reasons. The other reason is because it's run under gdb. :^)
Constructing a program is like painting a room. A beginner at either
will start in one corner and end in another, left there to discover just
how important approach and technique are in obtaining a good result.
] [Thread Prev