Viewing version 0.4.3. Open the latest package page.
native_stack_traces
0.4.3Utilities for working with non-symbolic stack traces.
Readme
native_stack_traces
This package provides libraries and a utility for decoding non-symbolic stack traces generated by an AOT-compiled Dart application.
Converting stack traces
In some modes of AOT compilation, information on mapping execution points to source locations is no longer stored in the Dart image. Instead, this information is translated to separately stored debugging information. This debugging information can then be stripped from the application before shipping.
However, there is a drawback. Stack traces generated by such an application no longer includes file, function, and line number information (i.e., symbolic stack traces). Instead, stack trace frames simply include program counter information. Thus, to find the source information for these frames, we must use the debugging information. This means either keeping the original unstripped application, or saving the debugging information into a separate file.
Given this debugging information, the libraries in this package can turn
non-symbolic stack traces back into symbolic stack traces. In addition, this
package includes a command line tool decode whose output is the same as its
input except that non-symbolic stack traces are translated.
Using decode
Take the following Dart code, which we put in throws.dart. The inlining
pragmas are here just to ensure that bar is inlined into foo and that foo
is not inlined into bar, to illustrate how inlined code is handled in the
translated output.
@pragma('vm:prefer-inline')
bar() => throw null;
@pragma('vm:never-inline')
foo() => bar();
main() => foo();
Now we run the following commands:
# Make sure that we have the native_stack_traces package.
$ pub get native_stack_traces
$ pub global activate native_stack_traces
# We compile the example program, removing the source location information
# from the snapshot and saving the debugging information into throws.debug.
$ dart2native -k aot -S throws.debug -o throws.aotsnapshot throws.dart
# Run the program, saving the error output to throws.err.
$ dartaotruntime throws.aotsnapshot 2>throws.err
# Using the saved debugging information, we can translate the stack trace
# contained in throws.err to its symbolic form.
$ pub global run native_stack_traces:decode translate -d throws.debug -i throws.err
# We can also just pipe the output of running the program directly into
# the utility.
$ dartaotruntime throws.aotsnapshot |& \
pub global run native_stack_traces:decode translate -d throws.debug
Features and bugs
Please file feature requests and bugs at the issue tracker.
Changelog
Changelog
0.4.3
- Exported some more of the ELF utilities for use in Dart tests.
0.4.2
- When decoding a stack trace, frames corresponding to the functions with DW_AT_artificial DWARF attribute are now omitted from the symbolized stack traces. This is needed because Dart VM no longer omits invisible functions from binary stack traces in certain cases.
0.4.1
- Exported some ELF utilities in lib/elf.dart for use in Dart tests.
0.4.0
- Stable null safe version of package.
0.4.0-nullsafety
- Unstable null safe version of package.
0.3.8
- Support columns when present in line number programs.
0.3.7
- Added buildId accessor for retrieving GNU build IDs from DWARF files that include them.
0.3.6
- Adjusts RegExp for stack trace header line to be more flexible in what it permits to allow additional information to be added in the Dart VM.
0.3.5
- Use virtual addresses in non-symbolic stack frames as a fallback if we cannot retrieve an appropriate offset from the instructions section otherwise.
0.3.4
-
Decoded Dart calls are now never considered internal, only VM stub calls. This is due to a concurrent change in the Dart VM that no longer prints non-symbolic frames for functions considered invisible, which matches the symbolic frame printer and removes the need for the decoder to guess which frames should be hidden.
This package still works on earlier versions of Dart, so the dependencies have not changed. However, it may print more frame information than expected when decoding stack frames from a Dart VM that does not include this change to non-symbolic stack printing.
0.3.3
- No externally visible changes.
0.3.2
- The
findcommand can now look up addresses given as offsets from static symbols, not just hexadecimal virtual or absolute addresses. - Integer inputs (addresses or offsets) without an '0x' prefix or hexadecimal
digits will now be parsed as decimal unless the
-x/--force_hexadecimalflag is used.
0.3.1
- Uses dynamic symbol information embedded in stack frame lines when available.
0.3.0
- Adds handling of virtual addresses within stub code payloads.
0.2.2
- Finds instruction sections by the dynamic symbols the Dart VM creates instead of assuming there are two text sections.
0.2.1
- Added static method
Dwarf.fromBuffer.
0.2.0
- API and documentation cleanups
0.1.0
- Initial release
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'native_stack_traces:0.4.3'pubspec.yaml
name: native_stack_traces
description: Utilities for working with non-symbolic stack traces.
version: 0.4.3
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/native_stack_traces
environment:
sdk: '>=2.12.0-0 <3.0.0'
executables:
decode:
dependencies:
args: ^2.0.0
path: ^1.8.0
dev_dependencies:
pedantic: ^1.10.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | Cached · Upstream SHA-256 matched | Download | 19ce271b…5e7d4b |
| 0.2.0 | Cached · Upstream SHA-256 matched | Download | 2a936cd6…6976b8 |
| 0.2.2 | Cached · Upstream SHA-256 matched | Download | 72f7d26d…f026b1 |
| 0.3.0 | Cached · Upstream SHA-256 matched | Download | e86d82e3…4d64b3 |
| 0.3.1 | Cached · Upstream SHA-256 matched | Download | cb8587d9…eab909 |
| 0.3.2 | Cached · Upstream SHA-256 matched | Download | dc69b781…935024 |
| 0.3.3 | Cached · Upstream SHA-256 matched | Download | 68475ec4…2d6fb1 |
| 0.3.6 | Cached · Upstream SHA-256 matched | Download | e53de201…302093 |
| 0.3.7 | Cached · Upstream SHA-256 matched | Download | 094372b4…78438a |
| 0.4.0 | Cached · Upstream SHA-256 matched | Download | aa90ca18…034e5f |
| 0.4.3 | Cached · Upstream SHA-256 matched | Download | 6773cb61…448a0b |
| 0.4.5 | Cached · Upstream SHA-256 matched | Download | 8a5c9214…7c78bd |
| 0.4.6 | Cached · Upstream SHA-256 matched | Download | 4af5cf89…c6a066 |
| 0.5.0 | Cached · Upstream SHA-256 matched | Download | e1917b08…9dceab |
| 0.5.2 | Cached · Upstream SHA-256 matched | Download | 42393c08…fcc421 |
| 0.5.4 | Cached · Upstream SHA-256 matched | Download | 56eb633e…0af899 |
| 0.5.5 | Cached · Upstream SHA-256 matched | Download | 5f1938ea…bcd104 |
| 0.5.6 | Cached · Upstream SHA-256 matched | Download | c797830b…74013f |
| 0.5.7 | Cached · Upstream SHA-256 matched | Download | 64d2f4bc…34bfd3 |
| 0.6.0 | Cached · Upstream SHA-256 matched | Download | 8ba566c1…ee470f |
| 0.6.1 | Cached · Upstream SHA-256 matched | Download | d34cf916…3d6a11 |
| 0.7.0 | Cached · Upstream SHA-256 matched | Download | 2117de75…1b19d0 |
Dependencies
args "^2.0.0"
path "^1.8.0"