Skip to content

Commit

Permalink
Optionally disable printing of diagnostics during terminate.
Browse files Browse the repository at this point in the history
This also removes the call to std::abort in the termination handler as the system is aborting anyways.
  • Loading branch information
hkaiser committed Feb 22, 2018
1 parent 6fbd8e1 commit 5791047
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/runtime.cpp
Expand Up @@ -64,14 +64,15 @@ namespace hpx
util::attach_debugger();
}

std::cerr
if (get_config_entry("hpx.diagnostics_on_terminate", "1") == "1")
{
std::cerr
#if defined(HPX_HAVE_STACKTRACES)
<< "{stack-trace}: " << hpx::util::trace() << "\n"
<< "{stack-trace}: " << hpx::util::trace() << "\n"
#endif
<< "{what}: " << (reason ? reason : "Unknown reason") << "\n"
<< full_build_string(); // add full build information

std::abort();
<< "{what}: " << (reason ? reason : "Unknown reason") << "\n"
<< full_build_string(); // add full build information
}
}

HPX_EXPORT BOOL WINAPI termination_handler(DWORD ctrl_type)
Expand Down Expand Up @@ -121,15 +122,16 @@ namespace hpx
util::attach_debugger();
}

char* reason = strsignal(signum);
std::cerr
if (get_config_entry("hpx.diagnostics_on_terminate", "1") == "1")
{
char* reason = strsignal(signum);
std::cerr
#if defined(HPX_HAVE_STACKTRACES)
<< "{stack-trace}: " << hpx::util::trace() << "\n"
<< "{stack-trace}: " << hpx::util::trace() << "\n"
#endif
<< "{what}: " << (reason ? reason : "Unknown signal") << "\n"
<< full_build_string(); // add full build information

std::abort();
<< "{what}: " << (reason ? reason : "Unknown signal") << "\n"
<< full_build_string(); // add full build information
}
}
}

Expand Down

0 comments on commit 5791047

Please sign in to comment.