Debugging with Backtrace

From Yade

Revision as of 09:52, 18 June 2007 by Eudoxos (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Make sure that yade is compiled with debug=1 (the default scons setting). The are two ways to see the backtrace of yade crash.

Backtrace using automated crash handler

When yade crashes it will automatically call gdb for you and show the backtrace of crash. To have it working you only need to make sure that gdb is installed; note that a few particular kernel versions prior to 2.6.20 may cause backtraces to be useless.

Backtrace using a core dump file

Before you run yade from command line type this command:

ulimit -c unlimited
./yade

Then do whatever you want inside yade, until it crashes. A new file called core* will appear. Beware, that file will be huge. On each crash a new core appears, because they are big, you can quickly run out of disc space if you forget to delete them. Now type this:

gdb ./yade ./core.53414

The name core.53414 will be different on each time, you can pick the correct one, by looking at the date/time at which they were created (command: 'ls -la').

Then gdb runs. It will load all the debug information (it can take a while), when it finishes you can input a command. Type this:

bt

And now, you will see a backtrace of program crash. Read it carefully, and you will quickly understand the cause of your problem.