-
Notifications
You must be signed in to change notification settings - Fork 115
Generating Backtrace
When reporting problems with the model it is often useful to obtain a backtrace identifying the source code location of an error. If the model terminated via an internal abort command (an FLAbort) then a backtrace is output to standard error:
*** FLUIDITY ERROR ***
Source location: (State.F90, 1528)
Error message: Density is not a field name in this state
Backtrace will follow if it is available:
../../bin/fluidity(fprint_backtrace_+0x1f) [0x81a7bb5]
../../bin/fluidity(__fldebug_MOD_flabort_pinpoint+0x2e0) [0x816d575]
../../bin/fluidity(__state_module_MOD_extract_from_one_scalar_field+0xb23) [0x82244
../../bin/fluidity(__momentum_equation_MOD_solve_momentum+0x3983) [0x8779c1c]
../../bin/fluidity(__momentum_equation_MOD_momentum_loop+0x970) [0x8785bdc]
../../bin/fluidity(__fluids_module_MOD_fluids+0xf1f4) [0x819b7fc]
../../bin/fluidity(mainfl_+0x155) [0x816cf7d]
../../bin/fluidity(main+0x301) [0x8161931]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb5c57685]
../../bin/fluidity [0x8161541]
Use addr2line -e <binary> <address> to decipher.
Error is terminal.
Line numbers for each call in the backtrace can be obtained via:
addr2line -e fluidity address
where address is one of the addresses in square brackets at the end of a line of the backtrace. If the model aborts via some other error, such as a Fortran run-time error or a segmentation fault, then a backtrace can be obtained with gdb. First make sure you have compiled with debugging, enabled at configure time with the ''--enable-debugging'' argument. Then run Fluidity in the debugger:
gdb fluidity
Run the debugger command “break exit”:
(gdb) break exit
Function "exit" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (exit) pending.
to abort on any exit calls, and run the model with the required options:
(gdb) r arguments
where arguments are the arguments passed to Fluidity. If the debugger breaks due to an exit command or segmentation fault you can retrieve a backtrace with:
(gdb) bt
To obtain a backtrace for a parallel simulation you must launch gdb in parallel, e.g.:
mpiexec -n 4 xterm -e gdb fluidity
This will launch multiple instances of the debugger. Run the commands above in each instance to retrieve a backtrace for each process.