mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
AK: Print backtrace with warnln
Printing the backtrace with our print function makes sure it is in one piece when multiple threads are printing.
This commit is contained in:
parent
54b9ddcc80
commit
b97892729f
Notes:
github-actions[bot]
2025-11-20 14:45:38 +00:00
Author: https://github.com/R-Goc
Commit: b97892729f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6877
Reviewed-by: https://github.com/gmta ✅
1 changed files with 3 additions and 1 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <AK/Backtrace.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
#ifdef AK_OS_WINDOWS
|
||||
# include <Windows.h>
|
||||
|
|
@ -49,7 +50,8 @@ void dump_backtrace(unsigned frames_to_skip, unsigned max_depth)
|
|||
auto* var = getenv("LADYBIRD_BACKTRACE_SNIPPETS");
|
||||
bool print_snippets = var && strnlen(var, 1) > 0;
|
||||
static auto formatter = cpptrace::formatter {}.snippets(print_snippets);
|
||||
formatter.print(std::cerr, stacktrace);
|
||||
auto string = formatter.format(stacktrace, true);
|
||||
warnln("{}", StringView { string.c_str(), string.length() });
|
||||
}
|
||||
#elif defined(AK_HAS_BACKTRACE_HEADER)
|
||||
void dump_backtrace(unsigned frames_to_skip, [[maybe_unused]] unsigned max_depth)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue