[CF-Devel] Crossfire debugging tips.

Mark Wedel mwedel at scruz.net
Fri Feb 23 23:48:11 CST 2001


 Give me access to a crossfire core file, and I'll investigate.  Note that
access typically means login to the system that the core was generated on. 
Given that, here are tips to make debugging for either myself or others more
useful:


1) By default, configure/autoconf use -g -O2 as compiler flags if it finds gcc. 
the -O2 makes debugging more difficult, as variables can get optimized out,
execution is not necessarily in the same order, and so on.  To get around this,
I set my environment flags to "-ggdb" before running configure.  You can in fact
add that to your .cshrc/.profile, but then all programs will get that.

2) Keep the core file with the tree that made it.  If you have a core file from
a few days ago and are about to do a cvs update and recompile, copy the current
compilation and put the core file with that.  Trying to debug programs in which
the core file does not match the executable is virtually impossible.

3) Keep the log file that crossfire generates with the core file.  The crossloop
scripts already do this.  Not always, but many times the log file may say why
the program is exiting (this is typically if link lists are corrupted or it gets
internally caugt errors, vs something like memory scrambling and bad pointer
derefs).  

4) Make sure you don't strip the binaries as you install them.  By default, the
installation does not do this, but you can just make sure that your executable
(installdir/bin/crossfire) matches soucedir/server/crossfire).  doing a size
check is sufficient.

5) Send me a stack trace.  To do this:  gdb executable core_file (ie, gdb
/usr/games/bin/crossfire core), and then from within gdb do a 'where'.  If you
don't have gdb, install it as one can't do debug work without it.  Also include
the version of crossfire (including latest cvs update).  This information will
at least let me quickly see where the crash happened, and will let me know if
its a duplicate, and may even provide enough information to fix the problem.


 I really want to get all these bugs squashed.  Note that I can not promise I
will always look at all cores - if some really widespread bug comes out such
that there are core files all over the place, I'll just look at a few and once I
figure out the problem, go from there.

    
    


More information about the crossfire mailing list