2017-03-22 17:30:02 +00:00
|
|
|
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2021-04-26 17:58:57 +00:00
|
|
|
// @dart = 2.9
|
|
|
|
|
2019-12-18 14:14:41 +00:00
|
|
|
/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf.so
|
2017-03-22 17:30:02 +00:00
|
|
|
|
2019-11-25 09:21:24 +00:00
|
|
|
import 'dart:convert';
|
2017-03-22 17:30:02 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
2020-01-23 10:14:17 +00:00
|
|
|
import 'package:native_stack_traces/native_stack_traces.dart';
|
2019-12-18 14:14:41 +00:00
|
|
|
import 'package:path/path.dart' as path;
|
2020-02-24 23:53:33 +00:00
|
|
|
import 'package:expect/expect.dart';
|
2019-11-25 09:21:24 +00:00
|
|
|
|
|
|
|
@pragma("vm:prefer-inline")
|
2017-03-22 17:30:02 +00:00
|
|
|
bar() {
|
|
|
|
// Keep the 'throw' and its argument on separate lines.
|
2017-06-21 11:47:33 +00:00
|
|
|
throw // force linebreak with dartfmt
|
|
|
|
"Hello, Dwarf!";
|
2017-03-22 17:30:02 +00:00
|
|
|
}
|
|
|
|
|
2019-11-25 09:21:24 +00:00
|
|
|
@pragma("vm:never-inline")
|
2017-03-22 17:30:02 +00:00
|
|
|
foo() {
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
|
2019-11-25 09:21:24 +00:00
|
|
|
Future<void> main() async {
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
String rawStack = "";
|
2017-03-22 17:30:02 +00:00
|
|
|
try {
|
|
|
|
foo();
|
|
|
|
} catch (e, st) {
|
|
|
|
rawStack = st.toString();
|
|
|
|
}
|
2019-11-25 09:21:24 +00:00
|
|
|
|
2019-12-18 14:14:41 +00:00
|
|
|
if (path.basenameWithoutExtension(Platform.executable) !=
|
|
|
|
"dart_precompiled_runtime") {
|
2019-12-18 14:14:41 +00:00
|
|
|
return; // Not running from an AOT compiled snapshot.
|
2019-12-18 01:02:05 +00:00
|
|
|
}
|
|
|
|
|
2019-12-18 14:14:41 +00:00
|
|
|
if (Platform.isAndroid) {
|
|
|
|
return; // Generated dwarf.so not available on the test device.
|
2019-12-18 01:02:05 +00:00
|
|
|
}
|
|
|
|
|
2019-12-18 14:14:41 +00:00
|
|
|
final dwarf = Dwarf.fromFile("dwarf.so");
|
2019-12-18 01:02:05 +00:00
|
|
|
|
2019-12-18 14:14:41 +00:00
|
|
|
await checkStackTrace(rawStack, dwarf, expectedCallsInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> checkStackTrace(String rawStack, Dwarf dwarf,
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
List<List<DartCallInfo>> expectedCallsInfo) async {
|
2019-12-18 14:14:41 +00:00
|
|
|
print("");
|
|
|
|
print("Raw stack trace:");
|
|
|
|
print(rawStack);
|
|
|
|
|
2019-12-18 14:14:41 +00:00
|
|
|
final rawLines =
|
2019-11-25 09:21:24 +00:00
|
|
|
await Stream.value(rawStack).transform(const LineSplitter()).toList();
|
2017-03-22 17:30:02 +00:00
|
|
|
|
2020-01-24 11:40:59 +00:00
|
|
|
final pcOffsets = collectPCOffsets(rawLines).toList();
|
2017-03-22 17:30:02 +00:00
|
|
|
|
2019-11-25 09:21:24 +00:00
|
|
|
// We should have at least enough PC addresses to cover the frames we'll be
|
|
|
|
// checking.
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
Expect.isTrue(pcOffsets.length >= expectedCallsInfo.length);
|
2019-11-25 09:21:24 +00:00
|
|
|
|
2020-01-24 11:40:59 +00:00
|
|
|
final virtualAddresses =
|
|
|
|
pcOffsets.map((o) => dwarf.virtualAddressOf(o)).toList();
|
2019-11-25 09:21:24 +00:00
|
|
|
|
2020-05-26 08:47:30 +00:00
|
|
|
// Some double-checks using other information in the non-symbolic stack trace.
|
|
|
|
final dsoBase = dsoBaseAddresses(rawLines).single;
|
|
|
|
final absolutes = absoluteAddresses(rawLines);
|
|
|
|
final relocatedAddresses = absolutes.map((a) => a - dsoBase);
|
|
|
|
final explicits = explicitVirtualAddresses(rawLines);
|
2020-06-16 12:46:24 +00:00
|
|
|
|
|
|
|
// Explicits will be empty if not generating ELF snapshots directly, which
|
|
|
|
// means we can't depend on virtual addresses in the snapshot lining up with
|
|
|
|
// those in the separate debugging information.
|
2020-05-26 08:47:30 +00:00
|
|
|
if (explicits.isNotEmpty) {
|
2020-06-16 12:46:24 +00:00
|
|
|
// Direct-to-ELF snapshots should have a build ID.
|
|
|
|
Expect.isNotNull(dwarf.buildId);
|
2020-06-16 12:46:24 +00:00
|
|
|
Expect.deepEquals(relocatedAddresses, virtualAddresses);
|
2020-05-26 08:47:30 +00:00
|
|
|
Expect.deepEquals(explicits, virtualAddresses);
|
|
|
|
}
|
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final gotCallsInfo = <List<DartCallInfo>>[];
|
2020-01-24 11:40:59 +00:00
|
|
|
|
|
|
|
for (final addr in virtualAddresses) {
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final externalCallInfo = dwarf.callInfoFor(addr);
|
|
|
|
Expect.isNotNull(externalCallInfo);
|
|
|
|
final allCallInfo = dwarf.callInfoFor(addr, includeInternalFrames: true);
|
|
|
|
Expect.isNotNull(allCallInfo);
|
2021-04-27 23:31:02 +00:00
|
|
|
for (final call in externalCallInfo) {
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
Expect.isTrue(call is DartCallInfo, "got non-Dart call info ${call}");
|
2021-04-27 23:31:02 +00:00
|
|
|
Expect.isFalse(call.isInternal);
|
|
|
|
Expect.isTrue(allCallInfo.contains(call),
|
|
|
|
"External call info ${call} is not among all calls");
|
|
|
|
}
|
|
|
|
for (final call in allCallInfo) {
|
|
|
|
if (!call.isInternal) {
|
|
|
|
Expect.isTrue(externalCallInfo.contains(call),
|
|
|
|
"External call info ${call} is not among external calls");
|
|
|
|
}
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
}
|
2021-04-27 23:31:02 +00:00
|
|
|
gotCallsInfo.add(externalCallInfo.cast<DartCallInfo>().toList());
|
2020-01-24 11:40:59 +00:00
|
|
|
}
|
2019-11-25 09:21:24 +00:00
|
|
|
|
|
|
|
print("");
|
|
|
|
print("Call information for PC addresses:");
|
2020-01-24 11:40:59 +00:00
|
|
|
for (var i = 0; i < virtualAddresses.length; i++) {
|
|
|
|
print("For PC 0x${virtualAddresses[i].toRadixString(16)}:");
|
2019-11-25 09:21:24 +00:00
|
|
|
print(" Calls corresponding to user or library code:");
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
gotCallsInfo[i].forEach((frame) => print(" ${frame}"));
|
2017-03-22 17:30:02 +00:00
|
|
|
}
|
2019-11-25 09:21:24 +00:00
|
|
|
|
2021-04-27 23:31:02 +00:00
|
|
|
// Remove empty entries which correspond to skipped internal frames.
|
|
|
|
gotCallsInfo.removeWhere((calls) => calls.isEmpty);
|
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
checkFrames(gotCallsInfo, expectedCallsInfo);
|
2019-11-25 09:21:24 +00:00
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final gotSymbolizedLines = await Stream.fromIterable(rawLines)
|
2021-04-27 23:31:02 +00:00
|
|
|
.transform(DwarfStackTraceDecoder(dwarf, includeInternalFrames: false))
|
2019-11-25 09:21:24 +00:00
|
|
|
.toList();
|
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final gotSymbolizedCalls =
|
|
|
|
gotSymbolizedLines.where((s) => s.startsWith('#')).toList();
|
2019-11-25 09:21:24 +00:00
|
|
|
|
|
|
|
print("");
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
print("Symbolized stack trace:");
|
|
|
|
gotSymbolizedLines.forEach(print);
|
2019-11-25 09:21:24 +00:00
|
|
|
print("");
|
|
|
|
print("Extracted calls:");
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
gotSymbolizedCalls.forEach(print);
|
2019-11-25 09:21:24 +00:00
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final expectedStrings = extractCallStrings(expectedCallsInfo);
|
2019-11-25 09:21:24 +00:00
|
|
|
// There are two strings in the list for each line in the output.
|
|
|
|
final expectedCallCount = expectedStrings.length ~/ 2;
|
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
Expect.isTrue(gotSymbolizedCalls.length >= expectedCallCount);
|
2019-11-25 09:21:24 +00:00
|
|
|
|
|
|
|
// Strip off any unexpected lines, so we can also make sure we didn't get
|
|
|
|
// unexpected calls prior to those calls we expect.
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final gotCallsTrace =
|
|
|
|
gotSymbolizedCalls.sublist(0, expectedCallCount).join('\n');
|
2019-11-25 09:21:24 +00:00
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
Expect.stringContainsInOrder(gotCallsTrace, expectedStrings);
|
2019-11-25 09:21:24 +00:00
|
|
|
}
|
|
|
|
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final expectedCallsInfo = <List<DartCallInfo>>[
|
2019-11-25 09:21:24 +00:00
|
|
|
// The first frame should correspond to the throw in bar, which was inlined
|
|
|
|
// into foo (so we'll get information for two calls for that PC address).
|
|
|
|
[
|
2020-03-20 11:26:02 +00:00
|
|
|
DartCallInfo(
|
2019-11-25 09:21:24 +00:00
|
|
|
function: "bar",
|
|
|
|
filename: "dwarf_stack_trace_test.dart",
|
2021-04-26 17:58:57 +00:00
|
|
|
line: 19,
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
column: 3,
|
2019-11-25 09:21:24 +00:00
|
|
|
inlined: true),
|
2020-03-20 11:26:02 +00:00
|
|
|
DartCallInfo(
|
2019-11-25 09:21:24 +00:00
|
|
|
function: "foo",
|
|
|
|
filename: "dwarf_stack_trace_test.dart",
|
2021-04-26 17:58:57 +00:00
|
|
|
line: 25,
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
column: 3,
|
2019-11-25 09:21:24 +00:00
|
|
|
inlined: false)
|
|
|
|
],
|
2019-12-18 14:14:41 +00:00
|
|
|
// The second frame corresponds to call to foo in main.
|
2019-11-25 09:21:24 +00:00
|
|
|
[
|
2020-03-20 11:26:02 +00:00
|
|
|
DartCallInfo(
|
2019-11-25 09:21:24 +00:00
|
|
|
function: "main",
|
|
|
|
filename: "dwarf_stack_trace_test.dart",
|
2021-04-26 17:58:57 +00:00
|
|
|
line: 31,
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
column: 5,
|
2019-11-25 09:21:24 +00:00
|
|
|
inlined: false)
|
|
|
|
],
|
2019-12-18 16:11:41 +00:00
|
|
|
// Don't assume anything about any of the frames below the call to foo
|
|
|
|
// in main, as this makes the test too brittle.
|
2019-11-25 09:21:24 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
void checkFrames(
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
List<List<DartCallInfo>> gotInfo, List<List<DartCallInfo>> expectedInfo) {
|
2019-11-25 09:21:24 +00:00
|
|
|
// There may be frames below those we check.
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
Expect.isTrue(gotInfo.length >= expectedInfo.length);
|
2017-03-22 17:30:02 +00:00
|
|
|
|
2019-11-25 09:21:24 +00:00
|
|
|
// We can't just use deep equality, since we only have the filenames in the
|
|
|
|
// expected version, not the whole path, and we don't really care if
|
|
|
|
// non-positive line numbers match, as long as they're both non-positive.
|
|
|
|
for (var i = 0; i < expectedInfo.length; i++) {
|
|
|
|
for (var j = 0; j < expectedInfo[i].length; j++) {
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
final got = gotInfo[i][j];
|
|
|
|
final expected = expectedInfo[i][j];
|
2020-03-20 11:26:02 +00:00
|
|
|
Expect.equals(expected.function, got.function);
|
|
|
|
Expect.equals(expected.inlined, got.inlined);
|
|
|
|
Expect.equals(expected.filename, path.basename(got.filename));
|
|
|
|
if (expected.isInternal) {
|
|
|
|
Expect.isTrue(got.isInternal);
|
2019-11-25 09:21:24 +00:00
|
|
|
} else {
|
2020-03-20 11:26:02 +00:00
|
|
|
Expect.equals(expected.line, got.line);
|
2019-11-25 09:21:24 +00:00
|
|
|
}
|
2017-03-22 17:30:02 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-25 09:21:24 +00:00
|
|
|
}
|
2017-03-22 17:30:02 +00:00
|
|
|
|
2019-11-25 09:21:24 +00:00
|
|
|
List<String> extractCallStrings(List<List<CallInfo>> expectedCalls) {
|
|
|
|
var ret = <String>[];
|
|
|
|
for (final frame in expectedCalls) {
|
|
|
|
for (final call in frame) {
|
2020-03-20 11:26:02 +00:00
|
|
|
if (call is DartCallInfo) {
|
|
|
|
ret.add(call.function);
|
|
|
|
if (call.isInternal) {
|
|
|
|
ret.add("${call.filename}:??");
|
|
|
|
} else {
|
|
|
|
ret.add("${call.filename}:${call.line}");
|
|
|
|
}
|
2019-11-25 09:21:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
2017-03-22 17:30:02 +00:00
|
|
|
}
|
2020-05-26 08:47:30 +00:00
|
|
|
|
|
|
|
Iterable<int> parseUsingAddressRegExp(RegExp re, Iterable<String> lines) sync* {
|
|
|
|
for (final line in lines) {
|
|
|
|
final match = re.firstMatch(line);
|
[vm/aot] Reland "Keep column information when possible for precompiled mode."
Changes:
Doing this always in precompiled mode meant increased data segment sizes
when CodeSourceMaps are stored, since encoded line/column information is
larger in the LEB-like encoding used. Now we only store column
information when we produce non-symbolic stacks, since the increased
space needed to store the columns is instead in DWARF sections and can
be stripped or elided.
Original description:
Previously, we passed line number information to the stack trace printer
and to DWARF by changing the non-special positions in the CodeSourceMap
to line numbers in precompiled mode. However, doing this lost column
information.
We get the column information back in the majority of cases by encoding
the line number and column information when neither is too large to pack
together into 30 bits. (Here, 20 bits for line and 10 bits for column.)
Otherwise, we just store the line information as before, though due to
using a bit to encode whether column info exists, it's reduced to 30
bits. If the line info is too big for that, we just return kNoSourcePos.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: Ia8baee71468da6100a170fa305d03059ffd17f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-19 13:50:03 +00:00
|
|
|
if (match == null) continue;
|
|
|
|
final s = match.group(1);
|
|
|
|
if (s == null) continue;
|
|
|
|
yield int.parse(s, radix: 16);
|
2020-05-26 08:47:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final _absRE = RegExp(r'abs ([a-f\d]+)');
|
|
|
|
|
|
|
|
Iterable<int> absoluteAddresses(Iterable<String> lines) =>
|
|
|
|
parseUsingAddressRegExp(_absRE, lines);
|
|
|
|
|
|
|
|
final _virtRE = RegExp(r'virt ([a-f\d]+)');
|
|
|
|
|
|
|
|
Iterable<int> explicitVirtualAddresses(Iterable<String> lines) =>
|
|
|
|
parseUsingAddressRegExp(_virtRE, lines);
|
|
|
|
|
|
|
|
final _dsoBaseRE = RegExp(r'isolate_dso_base: ([a-f\d]+)');
|
|
|
|
|
|
|
|
Iterable<int> dsoBaseAddresses(Iterable<String> lines) =>
|
|
|
|
parseUsingAddressRegExp(_dsoBaseRE, lines);
|