Skip to content

Commit ae4ee87

Browse files
sstricklCommit Queue
authored and
Commit Queue
committed
[native_stack_traces] Remove initial spaces check in stack trace lines.
The strictness of the old "check for four spaces" was causing failures in `flutter symbolize`, and there's no reason to check how much initial whitespace we got prior to the line contents anyway. TEST=pkg/native_stack_traces/test/convert/regress_262474517_test Change-Id: I6a6e31732cb2a5b5d40a088b9a04877052726be2 Bug: b/262474517 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276905 Reviewed-by: Daco Harkes <[email protected]> Commit-Queue: Tess Strickland <[email protected]>
1 parent 0c87c84 commit ae4ee87

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

pkg/native_stack_traces/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.4
2+
3+
- Relaxed requirement for spaces before non-symbolic stack trace line.
4+
15
## 0.5.3
26

37
- Exported more ELF utilities for use in Dart tests.

pkg/native_stack_traces/lib/src/convert.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ const _symbolOffsetREString = r'(?<symbol>' +
125125
constants.isolateSymbolName +
126126
r')\+(?<offset>(?:0x)?[\da-f]+)';
127127
final _symbolOffsetRE = RegExp(_symbolOffsetREString);
128-
final _traceLineRE = RegExp(
129-
r' #(\d+) abs (?<absolute>[\da-f]+)(?: virt (?<virtual>[\da-f]+))? '
130-
r'(?<rest>.*)$');
128+
final _traceLineRE =
129+
RegExp(r'#(\d+) abs (?<absolute>[\da-f]+)(?: virt (?<virtual>[\da-f]+))? '
130+
r'(?<rest>.*)$');
131131

132132
/// Parses strings of the format <static symbol>+<integer offset>, where
133133
/// <static symbol> is one of the static symbols used for Dart instruction

pkg/native_stack_traces/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: native_stack_traces
2-
version: 0.5.3
2+
version: 0.5.4
33
description: Utilities for working with non-symbolic stack traces.
44
repository: https://github.com/dart-lang/sdk/tree/main/pkg/native_stack_traces
55

@@ -19,3 +19,4 @@ dependencies:
1919
# See also https://dart.dev/tools/pub/dependencies.
2020
dev_dependencies:
2121
lints: any
22+
test: any
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:io';
6+
7+
import 'package:native_stack_traces/src/convert.dart';
8+
import 'package:native_stack_traces/src/dwarf.dart';
9+
import 'package:path/path.dart' as path;
10+
import 'package:test/test.dart';
11+
12+
void main() {
13+
group('convert tests', defineConvertTests);
14+
}
15+
16+
final String pkgDir = Platform.script.resolve('../..').toFilePath();
17+
18+
void defineConvertTests() {
19+
test('b/262474517 regression', () async {
20+
final inputPath = path.join(
21+
pkgDir, 'testcases', 'convert', 'regress_262474517_trace.txt');
22+
final contents = await File(inputPath).readAsLines();
23+
final pcOffsets = collectPCOffsets(contents);
24+
expect(pcOffsets.map((o) => o.offset).toList(),
25+
[0x14e87f, 0x2a4e27, 0x4ee12b, 0x477fc7]);
26+
expect(pcOffsets.map((o) => o.section).toList(), [
27+
InstructionsSection.isolate,
28+
InstructionsSection.isolate,
29+
InstructionsSection.isolate,
30+
InstructionsSection.isolate
31+
]);
32+
});
33+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Bad state: No element. Error thrown null.
2+
BuildId: c3126a4381294e13185549e5e94a4db9
3+
at . #00 abs 0 virt 000000000031ba6f _kDartIsolateSnapshotInstructions+0x14e87f
4+
at . #01 abs 0 virt 0000000000472017 _kDartIsolateSnapshotInstructions+0x2a4e27
5+
at . #02 abs 0 virt 00000000006bb31b _kDartIsolateSnapshotInstructions+0x4ee12b
6+
at . #03 abs 0 virt 00000000006451b7 _kDartIsolateSnapshotInstructions+0x477fc7

0 commit comments

Comments
 (0)