Line data Source code
1 0 : \cond NEVER 2 : Distributed under the MIT License. 3 : See LICENSE.txt for details. 4 : \endcond 5 : 6 : # Tips for debugging an executable {#runtime_errors} 7 : 8 : Learn how to use a debugger such as gdb. 9 : 10 : You can debug MPI executables using the `sys::attach_debugger()` function. See 11 : the documentation of that function for details. 12 : 13 : # Useful gdb commands 14 : 15 : - To break when an exception is thrown `catch throw` 16 : 17 : - To break on a specific exception type `catch throw std::out_of_range` 18 : (This may not work on all compilers or older versions of gdb. In this 19 : case you also try setting a breakpoint on the constructor of the exception 20 : type, `break std::out_of_range::out_of_range`) 21 : 22 : - SpECTRE has pretty printing facilities for various custom types. In order to 23 : enable these you must add 24 : `add-auto-load-safe-path /path/to/spectre/` to your `~/.gdbinit` file.