Skip to content

Commit 5047e68

Browse files
DanTupCommit Queue
authored andcommitted
[dds/dap] Handle parsing stack frames that contain dots in paths
Fixes #60797 Change-Id: Ia403648fdfc28d9ce9e4c20601d7dc01a66e0d40 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431221 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Ben Konyi <[email protected]> Reviewed-by: Derek Xu <[email protected]>
1 parent d828c36 commit 5047e68

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

pkg/dds/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 5.0.3
2+
- [DAP] Stack frames with dots in paths will now be parsed and have locations attached to `OutputEvents`s.
3+
14
# 5.0.2
25
- [DAP] Handle possible race condition when interacting with web applications
36
that can cause an `RPCError` to be thrown if the application's isolate is

pkg/dds/lib/src/dap/utils.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ final _stackFrameLocationPattern =
7575
// Characters we consider part of a path:
7676
//
7777
// - `\w` word characters
78+
// - `.` dots (valid in paths)
7879
// - `-` dash (valid in paths and URI schemes)
7980
// - `:` colons (scheme or drive letters)
8081
// - `/` forward slashes (URIs)
@@ -89,7 +90,7 @@ final _stackFrameLocationPattern =
8990
// The whole string must end with the line/col sequence, a non-word
9091
// character or be the end of the line. This avoids matching some strings
9192
// that contain ".dart" but probably aren't valid paths, like ".dart2".
92-
RegExp(r'([\w\-:\/\\%+]+\.dart)(?:(?:(?: +|:)(\d+):(\d+))|\W|$)');
93+
RegExp(r'([\w\.\-:\/\\%+]+\.dart)(?:(?:(?: +|:)(\d+):(\d+))|\W|$)');
9394

9495
/// Attempts to parse a line as a stack frame in order to read path/line/col
9596
/// information.

pkg/dds/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: dds
2-
version: 5.0.2
2+
version: 5.0.3
33
description: >-
44
A library used to spawn the Dart Developer Service, used to communicate with
55
a Dart VM Service instance.

pkg/dds/test/dap/utils_test.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ main() {
190190
2,
191191
);
192192
});
193+
194+
test('with dots in path', () {
195+
expectFrames(
196+
[
197+
'foo a.b.c/d.dart',
198+
'#1 A.b (a.b.c/d.dart)',
199+
'flutter: #1 A.b (a.b.c/d.dart)',
200+
],
201+
Uri.file(path.join(Directory.current.path, 'a.b.c/d.dart')),
202+
);
203+
});
193204
}, skip: Platform.isWindows);
194205

195206
group('Windows file URIs', () {
@@ -265,6 +276,17 @@ main() {
265276
2,
266277
);
267278
});
279+
280+
test('with dots in path', () {
281+
expectFrames(
282+
[
283+
r'foo a.b.c\d.dart',
284+
r'#1 A.b (a.b.c\d.dart)',
285+
r'flutter: #1 A.b (a.b.c\d.dart)',
286+
],
287+
Uri.file(path.join(Directory.current.path, 'a.b.c/d.dart')),
288+
);
289+
});
268290
}, skip: !Platform.isWindows);
269291
});
270292
}

0 commit comments

Comments
 (0)