Debugging DUNE far detector SW

From DUNE
Revision as of 19:34, 18 September 2015 by DavidAdams (talk | contribs) (→‎FCL)
Jump to navigation Jump to search

Crashes

LArSoft will sometimes crash with a stack trace but other times simply exit prematurely without any error message. In the latter case, it may help to run in a debugger (e.g. gdb) and then print the stack trace when the program terminates. In gdb, the command "bt" will show the trace.

gdb

To run with gdb, I replace the command "lar $ARGS" with "gdb --args lar $ARGS" followed by the gdb command "r". One can also attach to an existing process with "gdb -a PID".

To stop execution when an exception is raised, use the gdb command "catch throw".

totalview

At FNAL, one can debug with totalview.

FCL

LArsSoft can have a rather complicated nest of FCL files to set parameter values. To see the final value assignments, export the variable ART_DEBUG_CONFIG=1 before running. This will invoke an art program that displays the fcl values including the file where each was defined.

Note that art appends the field service_type to each service description.

Or use fcldump from art_extensions. It does not append anything and has nicer formatting (but does not show the file for every variable).