[gambit-list] Tracking Down a Segfault

Christian Jaeger christian at pflanze.mine.nu
Fri Sep 5 08:40:42 EDT 2008


Mikael More wrote:
> 2008/9/4 Joel J. Adamson <adamsonj at email.unc.edu> <adamsonj at email.unc.edu>
>
>   
>> Dear Gambit-List,
>>
>> I've been accumulating a library of functions for simulating population
>> processes (called "genxic"), and I'm running into some pesky errors.
>> This code includes quite a lot of foreign functions, interfacing with
>> the GNU Scientific Library.
>>
>> 1)  When running numerically intense simulations, I'll get a segfault:
>>
>> ,----
>> | Process scheme segmentation fault
>> `----
>>
>> This might be after 50 iterations of a simulation when I'd planned to do
>> 1152.
>>
>> Where do I go from there?  I've tried running gsc and gsi in GDB, but
>> pretty often I can't get a backtrace after the segfault.  The conditions
>> under which the segfault occurs varies.  Sometimes I get it after
>> loading the library.
>>     
>
>
> Recompile Gambit with debug options flipped on:
>
> Unpack the Gambit sources.
>
> Run ./configure --enable-single-host
>
> (Should we flip on --enable-debug here also ?? )
>   

This will switch on debug logging (it will write logging messages to a 
file "console" in the current directory wherever you start Gambit).

> Replace the two occurrences -O1 in Makefile with -O0 -g (more important than
> -O0 is -g, I heard a rumor that debugging info may be better if you do -O1
> -g but have no idea).
>   

No, -O0 is better, because it doesn't optimize the C code. -O1 will 
eliminate a number of local variables so you won't be able to inspect 
their values, but that's not a problem usually.

I suggest someone start writing a wiki page. I'm starting to get tired 
of explaining things. I'll then add more details there.

Christian.




More information about the Gambit-list mailing list