[dds/dap] Handle parsing stack frames that contain dots in paths

Fixes https://github.com/dart-lang/sdk/issues/60797

Change-Id: Ia403648fdfc28d9ce9e4c20601d7dc01a66e0d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431221
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
This commit is contained in:
Danny Tuppeny
2025-05-27 10:15:02 -07:00
committed by Commit Queue
parent d828c36cec
commit 5047e6895f
4 changed files with 28 additions and 2 deletions
+3
View File
@@ -1,3 +1,6 @@
# 5.0.3
- [DAP] Stack frames with dots in paths will now be parsed and have locations attached to `OutputEvents`s.
# 5.0.2
- [DAP] Handle possible race condition when interacting with web applications
that can cause an `RPCError` to be thrown if the application's isolate is
+2 -1
View File
@@ -75,6 +75,7 @@ final _stackFrameLocationPattern =
// Characters we consider part of a path:
//
// - `\w` word characters
// - `.` dots (valid in paths)
// - `-` dash (valid in paths and URI schemes)
// - `:` colons (scheme or drive letters)
// - `/` forward slashes (URIs)
@@ -89,7 +90,7 @@ final _stackFrameLocationPattern =
// The whole string must end with the line/col sequence, a non-word
// character or be the end of the line. This avoids matching some strings
// that contain ".dart" but probably aren't valid paths, like ".dart2".
RegExp(r'([\w\-:\/\\%+]+\.dart)(?:(?:(?: +|:)(\d+):(\d+))|\W|$)');
RegExp(r'([\w\.\-:\/\\%+]+\.dart)(?:(?:(?: +|:)(\d+):(\d+))|\W|$)');
/// Attempts to parse a line as a stack frame in order to read path/line/col
/// information.
+1 -1
View File
@@ -1,5 +1,5 @@
name: dds
version: 5.0.2
version: 5.0.3
description: >-
A library used to spawn the Dart Developer Service, used to communicate with
a Dart VM Service instance.
+22
View File
@@ -190,6 +190,17 @@ main() {
2,
);
});
test('with dots in path', () {
expectFrames(
[
'foo a.b.c/d.dart',
'#1 A.b (a.b.c/d.dart)',
'flutter: #1 A.b (a.b.c/d.dart)',
],
Uri.file(path.join(Directory.current.path, 'a.b.c/d.dart')),
);
});
}, skip: Platform.isWindows);
group('Windows file URIs', () {
@@ -265,6 +276,17 @@ main() {
2,
);
});
test('with dots in path', () {
expectFrames(
[
r'foo a.b.c\d.dart',
r'#1 A.b (a.b.c\d.dart)',
r'flutter: #1 A.b (a.b.c\d.dart)',
],
Uri.file(path.join(Directory.current.path, 'a.b.c/d.dart')),
);
});
}, skip: !Platform.isWindows);
});
}