forked from dlang/druntime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibunwind.dd
20 lines (15 loc) · 1.08 KB
/
libunwind.dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Experimental llvm-libunwind based backtrace printing was added
Currently, druntime uses the `backtrace` and `backtrace_symbols` functions
to provide debug informations (addresses and function names, respectively).
This can create issues for target that do not provide `backtrace`, such as Musl libc.
Additionally, the `backtrace` interface is inherently limited, as it only allow
to get up to `X` frames (where `X` is the size of the buffer), and forces them
to be stored continuously in memory. The same apply to `backtrace_symbols`.
On the other hand, libunwind is an industry standard for unwinding and stack trace inspection.
It has been ported to a variety of platform, has a simple yet flexible API,
and is part of GCC, and a similar library is part of LLVM.
Starting from this release, druntime includes a way to use LLVM's libunwind as a backtrace provider.
The support is limited to LLVM's version of libunwind, as it is available on Alpine Linux,
and easier to interface with.
For packagers, one can define `DRuntime_Use_Libunwind` when building druntime,
enabling the support by default.