diff --git a/AK/Assertions.cpp b/AK/Assertions.cpp index f5adf981f35..dfc8ab6ec37 100644 --- a/AK/Assertions.cpp +++ b/AK/Assertions.cpp @@ -33,18 +33,17 @@ # define ERRORLN warnln #endif +extern "C" { + #if defined(AK_HAS_STD_STACKTRACE) -namespace { -ALWAYS_INLINE void dump_backtrace() +void dump_backtrace() { // We assume the stacktrace implementation demangles symbols, as does microsoft/STL PRINT_ERROR(std::to_string(std::stacktrace::current(2)).c_str()); PRINT_ERROR("\n"); } -} #elif defined(AK_HAS_BACKTRACE_HEADER) -namespace { -ALWAYS_INLINE void dump_backtrace() +void dump_backtrace() { // Grab symbols and dso name for up to 256 frames void* trace[256] = {}; @@ -89,11 +88,13 @@ ALWAYS_INLINE void dump_backtrace() } free(syms); } +#else +void dump_backtrace() +{ + PRINT_ERROR("dump_backtrace() is not supported with the current compilation options.\n"); } #endif -extern "C" { - bool ak_colorize_output(void) { #if defined(AK_OS_SERENITY) || defined(AK_OS_ANDROID) diff --git a/AK/Assertions.h b/AK/Assertions.h index 83d913067ba..1d339e4d46b 100644 --- a/AK/Assertions.h +++ b/AK/Assertions.h @@ -6,6 +6,7 @@ #pragma once +extern "C" void dump_backtrace(); extern "C" bool ak_colorize_output(void); extern "C" __attribute__((noreturn)) void ak_trap(void);