010523ee4a
Instead of trying to lazily create artificial nodes when needed for WeakSerializationReference (WSR) targets in all cases, create them eagerly for targets in reachable WSRs, since those are guaranteed to be needed. Those for unreachable WSRs are still lazily created as needed, since the WSR won't even be accessed by the clustered snapshot writer unless the unreachable WSR is part of another unreachable object that has an artificial node created. This rework avoids some issues seen on upcoming CLs where the artificial nodes for WSR targets weren't getting correctly generated. ----- Also extend the v8 snapshot profile writer tests to check the sizes of the text and data sections in ELF snapshots. That means the v8 snapshot profile writer tests check up to three different measures, from most precise to least precise, depending on the output mode: * If writing an ELF snapshot directly: the sum of the sizes attributed to the text and data section symbols are checked to be exactly the same as the sum of the sizes of the objects in the profile. * If writing an ELF snapshot either directly or via assembly: the sum of the sizes of the text and data sections are checked to be the same as the sum of the sizes of the objects in the profile. If using an assembler that merges text and data sections, then account for the padding between the sections using an approximate check. * For all: Check that the size of the snapshot as a whole is approximately equal to the sum of the sizes of the objects in the profile, accounting both for possible padding and for the global header information and non-data/non-text sections like the dynamic symbol section. TEST=vm/data{,_2}/v8_snapshot_profile_writer_test Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm64-try Change-Id: I66e0e7fdb5bb98045621bf516f150a4723e08147 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198942 Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Clement Skau <cskau@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> |
||
---|---|---|
.. | ||
bin | ||
lib | ||
.gitignore | ||
analysis_options.yaml | ||
AUTHORS | ||
CHANGELOG.md | ||
LICENSE | ||
pubspec.yaml | ||
README.md |
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.