mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-29 10:02:57 +03:00
Include backtrace in debug info in on_assert_failed
This commit is contained in:
parent
7245d2abe9
commit
e18c57cfd3
@ -2,6 +2,7 @@
|
||||
|
||||
#include "exception.hh"
|
||||
#include "debug.hh"
|
||||
#include "backtrace.hh"
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
@ -26,8 +27,10 @@ private:
|
||||
|
||||
void on_assert_failed(const char* message)
|
||||
{
|
||||
String debug_info = format("pid: {}", getpid());
|
||||
write_debug(format("assert failed: '{}' ", message, debug_info));
|
||||
char* callstack = Backtrace{}.desc();
|
||||
String debug_info = format("pid: {}\ncallstack:\n{}", getpid(), callstack);
|
||||
free(callstack);
|
||||
write_debug(format("assert failed: '{}'\n{}", message, debug_info));
|
||||
|
||||
const auto msg = format("{}\n[Debug Infos]\n{}", message, debug_info);
|
||||
#if defined(__CYGWIN__)
|
||||
|
@ -21,7 +21,7 @@ Backtrace::Backtrace()
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* Backtrace::desc() const
|
||||
char* Backtrace::desc() const
|
||||
{
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
char** symbols = backtrace_symbols(stackframes, num_frames);
|
||||
|
@ -11,7 +11,7 @@ struct Backtrace
|
||||
int num_frames = 0;
|
||||
|
||||
Backtrace();
|
||||
const char* desc() const;
|
||||
char* desc() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user