core.internal.backtrace.libunwind - D Programming Language
Description: D Programming Language
Keywords: D programming language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# core.internal.backtrace.libunwind

Basic D language bindings for LLVM libunwind
There are two available libunwind: The "upstream" one, inherited from HP, which is maintained as a GNU project, and the LLVM one, part of llvm-project, and the default on Mac OSX.
They are both essential part of other languages ABI, and are available in both GCC and LLVM. However, in GCC, only the higher-level functions are exposed (e.g. _Unwind_*) while LLVM expose the higher-level and lower-level (unw_*) functions. Many distributions have a `libunwind` package as well, that provides the unw_* functions, but since it also supports remote unwinding, the function names are actually platform dependent and binding them is a pain as many things rely on #define.
In the future, we would like to implement backtrace using only the higher-level functions (_Unwind_*), which will allow us to not use backtrace and friends directly, and only retrieve the functions names when needed (currently we need to eagerly get the functions names).
Authors:
Mathias 'Geod24' Lang
See Also:

- https://www.nongnu.org/libunwind/man/libunwind(3).html
- https://clang.llvm.org/docs/Toolchain.html#unwind-library

struct `unw_context_t`;
struct `unw_cursor_t`;
struct `unw_proc_info_t`;
nothrow @nogc @system int `unw_getcontext`(unw_context_t*);
  Initialize the context at the current call site
nothrow @nogc @system int `unw_init_local`(unw_cursor_t*, unw_context_t*);
  Initialize a cursor at the call site
nothrow @nogc @system int `unw_step`(unw_cursor_t*);
  Goes one level up in the call chain
nothrow @nogc @system int `unw_get_proc_info`(unw_cursor_t*, unw_proc_info_t*);
  Get infos about the current procedure (function)
nothrow @nogc @system int `unw_get_proc_name`(unw_cursor_t*, char*, size_t, unw_word_t*);
  Get the name of the current procedure (function)

Copyright © 1999-2021 by the D Language Foundation | Page generated by Ddoc on Sun Oct 10 11:25:32 2021