diff options
author | Brad King <brad.king@kitware.com> | 2014-04-21 13:32:28 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-04-21 13:32:28 (GMT) |
commit | bb891c2ef1d5f2cf95fff64fe183a8f6d512d6ea (patch) | |
tree | d3abbb52ac520b7ef6b2656862c0f00663b402ae /Source | |
parent | 464c8ab3a27fdf323a2607ee9389a79466648643 (diff) | |
parent | 3de4c2956539a4251b65b88bff477d5866e98510 (diff) | |
download | CMake-bb891c2ef1d5f2cf95fff64fe183a8f6d512d6ea.zip CMake-bb891c2ef1d5f2cf95fff64fe183a8f6d512d6ea.tar.gz CMake-bb891c2ef1d5f2cf95fff64fe183a8f6d512d6ea.tar.bz2 |
Merge topic 'internal-error-backtrace'
3de4c295 cmake: Print C++ stack trace after INTERNAL_ERROR messages
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmake.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 71ea3f5..7aada4b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -24,6 +24,7 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmGraphVizWriter.h" # include "cmVariableWatch.h" +# include <cmsys/SystemInformation.hxx> #endif #include <cmsys/Glob.hxx> @@ -2601,6 +2602,22 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, // Add a terminating blank line. msg << "\n"; +#if defined(CMAKE_BUILD_WITH_CMAKE) + // Add a C++ stack trace to internal errors. + if(t == cmake::INTERNAL_ERROR) + { + std::string stack = cmsys::SystemInformation::GetProgramStack(0,0); + if(!stack.empty()) + { + if(cmHasLiteralPrefix(stack, "WARNING:")) + { + stack = "Note:" + stack.substr(8); + } + msg << stack << "\n"; + } + } +#endif + // Output the message. if(isError) { |