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

RE: 'Segmentation Fault' - how do i find out what thr problem is



Sorry if this is too basic .....

a segmentation fault (seg fault) is a UNIX app crashing.  The most common cause
is a pointer writing or reading an incorrect memory location.  Possibly you are
not compiling the bin correctly (leaving off a libray or a define).

to find out why you can use gdb (gnu debugger).  Compile the app with the -g
compiler flag (both compilers will accept this).  Then run it as: gdb <app>. 
At the gdb prompt type run and the app will run.  If/when it dies type bt to
get a back trace of the calls to see where it seg'ed.  You can also run the app
via strace or ltrace which will print each syscall the app makes until it dies.

another good start is to run: ldd <app>.  This will output all the libraries
your app needs.  If you notice any of them listed incorrectly this could be a
problem.

Need more help?  Just ask.


Reply to: