diff --git a/pkg/native_stack_traces/CHANGELOG.md b/pkg/native_stack_traces/CHANGELOG.md index 38b806bcaf4..7084a605058 100644 --- a/pkg/native_stack_traces/CHANGELOG.md +++ b/pkg/native_stack_traces/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.4 + +- Relaxed requirement for spaces before non-symbolic stack trace line. + ## 0.5.3 - Exported more ELF utilities for use in Dart tests. diff --git a/pkg/native_stack_traces/lib/src/convert.dart b/pkg/native_stack_traces/lib/src/convert.dart index de255d01955..bda01ebc49f 100644 --- a/pkg/native_stack_traces/lib/src/convert.dart +++ b/pkg/native_stack_traces/lib/src/convert.dart @@ -125,9 +125,9 @@ const _symbolOffsetREString = r'(?' + constants.isolateSymbolName + r')\+(?(?:0x)?[\da-f]+)'; final _symbolOffsetRE = RegExp(_symbolOffsetREString); -final _traceLineRE = RegExp( - r' #(\d+) abs (?[\da-f]+)(?: virt (?[\da-f]+))? ' - r'(?.*)$'); +final _traceLineRE = + RegExp(r'#(\d+) abs (?[\da-f]+)(?: virt (?[\da-f]+))? ' + r'(?.*)$'); /// Parses strings of the format +, where /// is one of the static symbols used for Dart instruction diff --git a/pkg/native_stack_traces/pubspec.yaml b/pkg/native_stack_traces/pubspec.yaml index 39174a6e522..2500b74e536 100644 --- a/pkg/native_stack_traces/pubspec.yaml +++ b/pkg/native_stack_traces/pubspec.yaml @@ -1,5 +1,5 @@ name: native_stack_traces -version: 0.5.3 +version: 0.5.4 description: Utilities for working with non-symbolic stack traces. repository: https://github.com/dart-lang/sdk/tree/main/pkg/native_stack_traces @@ -19,3 +19,4 @@ dependencies: # See also https://dart.dev/tools/pub/dependencies. dev_dependencies: lints: any + test: any diff --git a/pkg/native_stack_traces/test/convert/regress_262474517_test.dart b/pkg/native_stack_traces/test/convert/regress_262474517_test.dart new file mode 100644 index 00000000000..2442663486a --- /dev/null +++ b/pkg/native_stack_traces/test/convert/regress_262474517_test.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2022, 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. + +import 'dart:io'; + +import 'package:native_stack_traces/src/convert.dart'; +import 'package:native_stack_traces/src/dwarf.dart'; +import 'package:path/path.dart' as path; +import 'package:test/test.dart'; + +void main() { + group('convert tests', defineConvertTests); +} + +final String pkgDir = Platform.script.resolve('../..').toFilePath(); + +void defineConvertTests() { + test('b/262474517 regression', () async { + final inputPath = path.join( + pkgDir, 'testcases', 'convert', 'regress_262474517_trace.txt'); + final contents = await File(inputPath).readAsLines(); + final pcOffsets = collectPCOffsets(contents); + expect(pcOffsets.map((o) => o.offset).toList(), + [0x14e87f, 0x2a4e27, 0x4ee12b, 0x477fc7]); + expect(pcOffsets.map((o) => o.section).toList(), [ + InstructionsSection.isolate, + InstructionsSection.isolate, + InstructionsSection.isolate, + InstructionsSection.isolate + ]); + }); +} diff --git a/pkg/native_stack_traces/testcases/convert/regress_262474517_trace.txt b/pkg/native_stack_traces/testcases/convert/regress_262474517_trace.txt new file mode 100644 index 00000000000..15cfbed2b35 --- /dev/null +++ b/pkg/native_stack_traces/testcases/convert/regress_262474517_trace.txt @@ -0,0 +1,6 @@ +Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Bad state: No element. Error thrown null. +BuildId: c3126a4381294e13185549e5e94a4db9 +at . #00 abs 0 virt 000000000031ba6f _kDartIsolateSnapshotInstructions+0x14e87f +at . #01 abs 0 virt 0000000000472017 _kDartIsolateSnapshotInstructions+0x2a4e27 +at . #02 abs 0 virt 00000000006bb31b _kDartIsolateSnapshotInstructions+0x4ee12b +at . #03 abs 0 virt 00000000006451b7 _kDartIsolateSnapshotInstructions+0x477fc7