Teuchos: how to debug with TEUCHOS_STANDARD_CATCH_MACROS
Created by: aprokop
@teuchos @bartlettroscoe
Typically, writing a test involves wrapping the code in the macro like this:
bool success = true;
bool verbose = true;
try {
// your code
}
TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
This works fine. However, when you have a bug in the code which throws an exception, you cannot use a debugger in the standard mode to get the backtrace as the exception is going to be caught by Teuchos.
The only workaround I'm aware is to try doing something with catch throw
in gdb. However, this seems quite hard.
I wonder if it's possible for Teuchos to address this issue. One thing that comes to mind is that we could add an additional parameter to the macro or create a new macro with extra argument. If that parameter is true, we don't catch any exceptions. If it's false, we exhibit the standard behavior.