From charlesreid1

Creating a Cantera Debug Build

Cantera 1.x

If you're using Cantera 1.8.0, you can edit the Cantera Preconfig file and change these lines:


to this:


and then run ./preconfig && make && make install to make a debug build of Cantera.

Cantera 2.x

You can create a debug build with scons by adding the debug=yes option to your scons build script. Here's mine, for Mac OS X 10.9 (Maverick?):


scons build \
    f90_interface=n \
    F90='gfortran ' \
    F90FLAGS='-arch x86_64' \
    cc_flags='-arch x86_64' \
    cxx_flags='-arch x86_64' \
    prefix=$HOME/codes/cantalysis/build \
    python_package=full \
    with_html_log_files=yes \
    use_sundials=y \
    sundials_include=$HOME/pkg/sundials/std/include \
    sundials_libdir=$HOME/pkg/sundials/std/lib \
    optimize=no \
    debug=yes \
&& \
scons install

Running Cantera through GDB

Once you've built a version of Cantera that includes debug symbols, you'll be able to run it through GDB and step through code, set breakpoints, and get stack traces at arbitrary points in the code. This is very useful for (a) learning how Cantera works, and (b) identifying where an exception or error is being thrown, in order to determine the cause.

Create Your Driver

Before you run anything, you'll need a driver - the main program that is using the Cantera library.


Compile Your Driver


Firing Up GDB

First things first, fire up GDB. What you'll be doing is running your executable (your driver) through gdb. You'll set some breakpoints, and jump into the Cantera code using some breakpoints.