AK: Clean up backtraces

This commit replaces the default backtrace logic with cpptrace, for
nicer, colored backtraces. Cpptrace runs on all of our supported
platforms excpet android. As such backtrace.h is left in place.

All the backtrace functions are made noinline to have a consistent
number of frames. A maximum depth parameter is added to dump_backtrace
with a default of 100. This should be enough, and can be easily
changed, and allows for limiting the maximum depth.

Setting the LADYBIRD_BACKTRACE_SNIPPETS environment variable enables
surrouding code snippets in the backtrace. Specifically 2 lines above
and below. This number can be changed by calling snippet_context on the
formatter. For the whole list of options of what can be done with
formatting see the cpptrace repository.

On Windows we skipped frames when verification fails and when
dump_backtrace was added the logic was wrong and would have skipped
frames we care about.

This commit also implements skipping frames on Linux.
The only time where this does not skip all frames is when the call to
backtrace gets intercepted. Then we will end up skipping one frame less
than needed.

To keep delayload on Windows a patch and overlay port is used. When
upstream accepts these changes and vcpkg bumps the version the patch
could be removed to have just the cmake define.
This commit is contained in:
R-Goc
2025-06-26 18:29:30 +02:00
committed by Jelle Raaijmakers
parent 1e6ac54b75
commit 3c7bad32cd
Notes: github-actions[bot] 2025-10-08 05:09:20 +00:00
11 changed files with 139 additions and 100 deletions

View File

@@ -12,6 +12,10 @@
"name": "angle",
"platform": "linux | windows | android | freebsd"
},
{
"name": "cpptrace",
"platform": "linux | windows | freebsd | osx"
},
{
"name": "curl",
"default-features": false,