diff --git a/nano/lib/utility.cpp b/nano/lib/utility.cpp index fd71e439..44b61c3f 100644 --- a/nano/lib/utility.cpp +++ b/nano/lib/utility.cpp @@ -108,9 +108,11 @@ void nano::move_all_files_to_dir (boost::filesystem::path const & from, boost::f /* * Backing code for "release_assert" & "debug_assert", which are macros */ -void assert_internal (const char * check_expr, const char * file, unsigned int line, bool is_release_assert) +void assert_internal (const char * check_expr, const char * func, const char * file, unsigned int line, bool is_release_assert) { - std::cerr << "Assertion (" << check_expr << ") failed " << file << ":" << line << "\n\n"; + std::cerr << "Assertion (" << check_expr << ") failed\n" + << func << "\n" + << file << ":" << line << "\n\n"; // Output stack trace to cerr auto backtrace_str = nano::generate_stacktrace (); diff --git a/nano/lib/utility.hpp b/nano/lib/utility.hpp index b61450dd..1bd9e18f 100644 --- a/nano/lib/utility.hpp +++ b/nano/lib/utility.hpp @@ -2,6 +2,8 @@ #include +#include + #include #include #include @@ -20,13 +22,13 @@ namespace system } } -void assert_internal (const char * check_expr, const char * file, unsigned int line, bool is_release_assert); -#define release_assert(check) check ? (void)0 : assert_internal (#check, __FILE__, __LINE__, true) +void assert_internal (const char * check_expr, const char * func, const char * file, unsigned int line, bool is_release_assert); +#define release_assert(check) check ? (void)0 : assert_internal (#check, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, true) #ifdef NDEBUG #define debug_assert(check) (void)0 #else -#define debug_assert(check) check ? (void)0 : assert_internal (#check, __FILE__, __LINE__, false) +#define debug_assert(check) check ? (void)0 : assert_internal (#check, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, false) #endif namespace nano