how to debug when "Segmentation fault"
Pierre Barbier de Reuille
pierre.barbier at cirad.fr
Tue Oct 4 19:29:37 CEST 2005
Maksim Kasimov a écrit :
> my programm sometime gives "Segmentation fault" message (no matter how
> long the programm had run (1 day or 2 weeks). And there is nothing in
> log-files that can points the problem.
> My question is how it possible to find out where is the problem in the
> code? Thanks for any help.
> Python 2.2.3
Well, your best bet is to generate a core file !
To do so, in the shell launching the program, you need to accept core
files. The command is :
$ ulimit -c <max size of core file accepted>
$ ulimit -c 500000
For a 500MB max file.
Then, if your program crash, you should see a file named "core.XXXX"
where XXXX is the PID of the process. You can know exactly where the
program crashed using gbd :
$ gdb --core=core.XXXX
Then, depending on the debug information you have in your executables
you may (or may not) be able to know what happened :)
More information about the Python-list