From charlesreid1

(No difference)

Revision as of 20:34, 28 January 2014

Creating a Cantera Debug Build

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

CANTERA_CONFIG_PREFIX=${CANTERA_CONFIG_PREFIX:="/path/to/cantera/build"}
...
DEBUG_MODE=${DEBUG_MODE:='n'}

to this:

CANTERA_CONFIG_PREFIX=${CANTERA_CONFIG_PREFIX:="/path/to/cantera/dbg_build"}
...
DEBUG_MODE=${DEBUG_MODE:='y'}

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

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.