mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
AK: Fix libbacktrace fallback
Introducing cpptrace as the primary backtrace library broke the backtrace fallback during the code move. This commit properly links AK to libbacktrace. It also fixes the function signatures for the fallback backtrace handlers.
This commit is contained in:
Notes:
github-actions[bot]
2025-10-10 10:47:34 +00:00
Author: https://github.com/R-Goc Commit: https://github.com/LadybirdBrowser/ladybird/commit/ba5ef052e48 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6427 Reviewed-by: https://github.com/JanKoudijs Reviewed-by: https://github.com/gmta ✅
@@ -52,11 +52,11 @@ void dump_backtrace(unsigned frames_to_skip, unsigned max_depth)
|
||||
formatter.print(std::cerr, stacktrace);
|
||||
}
|
||||
#elif defined(AK_HAS_BACKTRACE_HEADER)
|
||||
void dump_backtrace(int frames_to_skip)
|
||||
void dump_backtrace(unsigned frames_to_skip, [[maybe_unused]] unsigned max_depth)
|
||||
{
|
||||
// Grab symbols and dso name for up to 256 frames
|
||||
void* trace[256] = {};
|
||||
int const num_frames = backtrace(trace, array_size(trace));
|
||||
unsigned const num_frames = backtrace(trace, array_size(trace));
|
||||
char** syms = backtrace_symbols(trace, num_frames);
|
||||
|
||||
for (auto i = frames_to_skip; i < num_frames; ++i) {
|
||||
@@ -98,7 +98,7 @@ void dump_backtrace(int frames_to_skip)
|
||||
free(syms);
|
||||
}
|
||||
#else
|
||||
void dump_backtrace([[maybe_unused]] int frames_to_skip)
|
||||
void dump_backtrace([[maybe_unused]] unsigned frames_to_skip, [[maybe_unused]] unsigned max_depth)
|
||||
{
|
||||
PRINT_ERROR("dump_backtrace() is not supported with the current compilation options.\n");
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ if(cpptrace_FOUND AND LADYBIRD_ENABLE_CPPTRACE)
|
||||
target_compile_definitions(AK PRIVATE AK_HAS_CPPTRACE=1)
|
||||
elseif(Backtrace_FOUND)
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
|
||||
target_link_libraries(${target} PRIVATE Backtrace::Backtrace)
|
||||
target_link_libraries(AK PRIVATE Backtrace::Backtrace)
|
||||
else()
|
||||
target_include_directories(${target} PRIVATE ${Backtrace_INCLUDE_DIRS})
|
||||
target_link_libraries(${target} PRIVATE ${Backtrace_LIBRARIES})
|
||||
target_include_directories(AK PRIVATE ${Backtrace_INCLUDE_DIRS})
|
||||
target_link_libraries(AK PRIVATE ${Backtrace_LIBRARIES})
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Cpptrace and Backtrace.h not found. Stack traces will not be available.")
|
||||
|
||||
Reference in New Issue
Block a user