From charlesreid1

No edit summary
Line 32: Line 32:


==Compile Your Driver==
==Compile Your Driver==
<pre>
...
</pre>


==Firing Up GDB==
==Firing Up GDB==

Revision as of 03:42, 5 June 2013

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. I've created a simple driver below, to illustrate by example.

...

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.