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.execinfo

This module helps to decide whether an appropriate execinfo implementation is available in the underling C runtime or in an external library. In the latter case exactly one of the following version identifiers should be set at the time of building druntime.
Possible external execinfo version IDs based on possible backtrace output formats:

Version ID | Backtrace format
--- | ---
ExtExecinfo_BSDFmt | 0x00000000 <D6module4funcAFZv+0x78> at module
ExtExecinfo_DarwinFmt | 1 module 0x00000000 D6module4funcAFZv + 0
ExtExecinfo_GNUFmt | module(D6module4funcAFZv) [0x00000000] or module(D6module4funcAFZv+0x78) [0x00000000] or module(D6module4funcAFZv-0x78) [0x00000000]
ExtExecinfo_SolarisFmt | object'symbol+offset [pc]

The code also ensures that at most one format is selected (either by automatic C runtime detection or by ExtExecinfo_ version IDs) and stores the corresponding values in BacktraceFmt.
With getMangledSymbolName we can get the original mangled symbol name from backtrace_symbols output of any supported version.
License:
Boost License 1.0.

Source core/internal/execinfo.d

enum bool `hasExecinfo`;
  Indicates the availability of backtrace functions
alias `backtrace` = core.sys.linux.execinfo.`backtrace`;
  Always points to the platform's backtrace function.
alias `backtrace_symbols` = core.sys.linux.execinfo.`backtrace_symbols`;
  Always points to the platform's backtrace_symbols function. The supported output format can be obtained by testing BacktraceFmt enum values.
alias `backtrace_symbols_fd` = core.sys.linux.execinfo.`backtrace_symbols_fd`;
  Always points to the platform's backtrace_symbols_fd function.
enum `BacktraceFmt`: bool;
  Indicates the backtrace format of the actual execinfo implementation. At most one of the values is allowed to be set to true the others should be false.
  `BSD`
    0x00000000 <D6module4funcAFZv+0x78> at module
  `Darwin`
    1 module 0x00000000 D6module4funcAFZv + 0
  `GNU`
    module(D6module4funcAFZv) [0x00000000] or module(D6module4funcAFZv+0x78) [0x00000000] or module(D6module4funcAFZv-0x78) [0x00000000]
  `Solaris`
    object'symbol+offset [pc]
nothrow @nogc const(char)[] `getMangledSymbolName`(const(char)[] `btBuf`, out size_t `symBeg`, out size_t `symEnd`);
nothrow @nogc const(char)[] `getMangledSymbolName`(const(char)[] `btBuf`);
  Takes a backtrace_symbols output and identifies the mangled symbol name in it. Optionally, also sets the begin and end indices of the symbol name in the input buffer.
  Parameters:

  const(char)[] `btBuf` | The input buffer containing the output of backtrace_symbols
  size_t `symBeg` | Output parameter indexing the first character of the symbol's name
  size_t `symEnd` | Output parameter indexing the first character after the symbol's name

  Returns:
  The name of the symbol

Copyright © 1999-2021 by the D Language Foundation | Page generated by Ddoc on Thu Jun 3 21:31:16 2021