Update README

This commit is contained in:
Jeremy 2023-11-08 13:03:05 -05:00
parent f21874cbf7
commit f4cf8c198b
No known key found for this signature in database
GPG Key ID: B4C8300FEC395042

View File

@ -560,12 +560,21 @@ To static link the library set `-DCPPTRACE_STATIC=On`.
## Library Internals
Cpptrace supports a number of back-ends and middle-ends to produce stack traces. Stack traces are produced in roughly
three steps: Unwinding, symbol resolution, and demangling. Cpptrace by default on linux / macos will generate traces
with `_Unwind_Backtrace`, libdwarf, and `__cxa_demangle`. On windows traces are generated by default with `StackWalk64`
and dbghelp.h (no demangling is needed with dbghelp). Under mingw libdwarf and dbghelp.h are used, along with
`__cxa_demangle`. Support for these is the main focus of cpptrace and they should work well. If you want to use a
different back-end such as addr2line, however, you can configure the library to do so.
Cpptrace supports a number of back-ends to produce stack traces. Stack traces are produced in roughly three steps:
Unwinding, symbol resolution, and demangling.
The library's CMake automatically configures itself for what your system supports. The ideal configuration is as
follows:
| Platform | Unwinding | Symbols | Demangling |
| -------- | ------------- | ------------------ | -------------------- |
| Linux | `_Unwind` | libdwarf | cxxabi.h |
| MacOS | `_Unwind` | libdwarf | cxxabi.h |
| Windows | `StackWalk64` | dbghelp | No demangling needed |
| MinGW | `StackWalk64` | libdwarf + dbghelp | cxxabi.h |
Support for these back-ends is the main development focus and they should work well. If you want to use a different
back-end such as addr2line, for example, you can configure the library to do so.
**Unwinding**
@ -605,7 +614,7 @@ Lastly, depending on other back-ends used a demangler back-end may be needed.
| Library | CMake config | Platforms | Info |
| --------- | -------------------------------- | ------------------- | ---------------------------------------------------------------------------------- |
| cxxabi.h | `CPPTRACE_DEMANGLE_WITH_CXXABI` | Linux, macos, mingw | Should be available everywhere other than [msvc](https://godbolt.org/z/93ca9rcdz). |
| dbghelp.h | `CPPTRACE_DEMANGLE_WITH_WINAPI` | Windows | Demangle with `UnDecorateSymbolName`. |
| dbghelp.h | `CPPTRACE_DEMANGLE_WITH_WINAPI` | Windows | Demangle with `UnDecorateSymbolName`. |
| N/A | `CPPTRACE_DEMANGLE_WITH_NOTHING` | all | Don't attempt to do anything beyond what the symbol resolution back-end does. |
**More?**