Merge topic 'internal-error-backtrace'
3de4c295
cmake: Print C++ stack trace after INTERNAL_ERROR messages
This commit is contained in:
commit
bb891c2ef1
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue