Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for some debugging APIs with the DDC library bundle format #2564

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7caa652
Added support for getClassMetadata with the DDc library bundle format
jyameo Dec 5, 2024
5f29674
Merge branch 'main' into yj-dartdevembedder-3
jyameo Dec 10, 2024
17a9775
Merge branch 'main' into yj-dartdevembedder-3
jyameo Dec 12, 2024
f3b2bd7
Added support for some debugging APIs with the DDC library bundle for…
jyameo Dec 12, 2024
a1f017c
Update pattern test to account for new DDC JS variable naming
jyameo Dec 13, 2024
58b8762
reverting change to pattern test
jyameo Dec 13, 2024
c781e5f
Added support for debugging API with the DDC library bundle format.
jyameo Dec 13, 2024
8a9006a
Merge branch 'main' into yj-dartdevembedder-4
jyameo Dec 17, 2024
0b235e6
updated licenses
jyameo Dec 17, 2024
607c7e4
updated licenses and remove new line from changelog
jyameo Dec 17, 2024
067ab27
Merge branch 'main' into yj-dartdevembedder-5
jyameo Dec 18, 2024
b9a8c2f
Added support for some debugging APIs with the DDC library bundle for…
jyameo Dec 18, 2024
b220536
Merge branch 'main' into yj-dartdevembedder-5
jyameo Dec 23, 2024
75f57a9
Merge branch 'main' into yj-dartdevembedder-5
jyameo Dec 23, 2024
3401d30
Merge branch 'main' into yj-dartdevembedder-5
jyameo Dec 23, 2024
1e44766
Added support for some debugging APIs with the DDC library bundle format
jyameo Jan 9, 2025
62c3cea
Merge branch 'main' into yj-dartdevembedder-6
jyameo Jan 9, 2025
c537b7b
updated CHANGELOG
jyameo Jan 9, 2025
0e35c5e
refactored test to use common file
jyameo Jan 10, 2025
344867d
delete main_ddc_library_bundle.dart
jyameo Jan 10, 2025
22cdf34
Merge branch 'main' into yj-dartdevembedder-6
jyameo Jan 10, 2025
db9abfb
fixed broken test - decoded response body to match source and renamed…
jyameo Jan 15, 2025
c7b0632
Merge branch 'main' into yj-dartdevembedder-6
jyameo Jan 15, 2025
1bc9d5c
updated changelog
jyameo Jan 15, 2025
32c12a5
updated dart_scope to not renamed wildcard and skipped related test case
jyameo Jan 16, 2025
aa38d3a
formatted test/common/chrome_proxy_service_common.dart
jyameo Jan 16, 2025
d4ec13f
replaced wildcard with timer
jyameo Jan 16, 2025
f5758a2
updated call to DartUri and removed unecessary check
jyameo Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 24.3.1

- Add support for binding DDS to a custom port.
- Added support for some debugging APIs with the DDC library bundle format. - [#2563](https://github.com/dart-lang/webdev/issues/2563)

## 24.3.0

Expand Down
14 changes: 9 additions & 5 deletions dwds/lib/src/debugging/dart_runtime_debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ class DartRuntimeDebugger {
String _generateJsExpression(
String ddcExpression,
String libraryBundleExpression,
) {
return _useLibraryBundleExpression
? libraryBundleExpression
: ddcExpression;
}
) =>
_useLibraryBundleExpression ? libraryBundleExpression : ddcExpression;

/// Wraps a JS function call with SDK loader logic.
String _wrapWithSdkLoader(String args, String functionCall) {
Expand Down Expand Up @@ -199,4 +196,11 @@ class DartRuntimeDebugger {
),
);
}

String invokeExtensionJsExpression(String methodName, String encodedJson) {
return _generateJsExpression(
"${_loadStrategy.loadModuleSnippet}('dart_sdk').developer.invokeExtension('$methodName', JSON.stringify($encodedJson));",
"dartDevEmbedder.debugger.invokeExtension('$methodName', JSON.stringify($encodedJson));",
);
}
}
10 changes: 10 additions & 0 deletions dwds/lib/src/debugging/dart_scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ Future<List<Property>> visibleVariables({
final objectId = scope.object.objectId;
if (objectId != null) {
final properties = await inspector.getProperties(objectId);
for (final property in properties) {
if (property.name == '_\$35wc2\$35formal') {
final newProperty = Property({
'name': '_',
'value': property.value,
});
properties.remove(property);
properties.add(newProperty);
}
}
allProperties.addAll(properties);
}
}
Expand Down
6 changes: 2 additions & 4 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,8 @@ class ChromeProxyService implements VmServiceInterface {
v is String ? v : jsonEncode(v),
),
);
final expression = '''
${globalToolConfiguration.loadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
"$method", JSON.stringify(${jsonEncode(stringArgs)}));
''';
final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
.invokeExtensionJsExpression(method, jsonEncode(stringArgs));
final result = await inspector.jsEvaluate(expression, awaitPromise: true);
final decodedResponse =
jsonDecode(result.value as String) as Map<String, dynamic>;
Expand Down
40 changes: 40 additions & 0 deletions dwds/test/chrome_proxy_service_amd_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2025, 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.

@TestOn('vm')
@Tags(['daily'])
@Timeout(Duration(minutes: 2))
library;

import 'package:dwds/expression_compiler.dart';
import 'package:test/test.dart';
import 'package:test_common/test_sdk_configuration.dart';

import 'common/chrome_proxy_service_common.dart';
import 'fixtures/context.dart';

void main() {
// Enable verbose logging for debugging.
final debug = false;
final canaryFeatures = false;
final moduleFormat = ModuleFormat.amd;
final compilationMode = CompilationMode.buildDaemon;

group('canary: $canaryFeatures |', () {
final provider = TestSdkConfigurationProvider(
verbose: debug,
canaryFeatures: canaryFeatures,
ddcModuleFormat: moduleFormat,
);
tearDownAll(provider.dispose);

runTests(
provider: provider,
moduleFormat: moduleFormat,
compilationMode: compilationMode,
canaryFeatures: canaryFeatures,
debug: debug,
);
});
}
40 changes: 40 additions & 0 deletions dwds/test/chrome_proxy_service_ddc_library_bundle_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2025, 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.

@TestOn('vm')
@Tags(['daily'])
@Timeout(Duration(minutes: 2))
library;

import 'package:dwds/expression_compiler.dart';
import 'package:test/test.dart';
import 'package:test_common/test_sdk_configuration.dart';

import 'common/chrome_proxy_service_common.dart';
import 'fixtures/context.dart';

void main() {
// Enable verbose logging for debugging.
final debug = false;
final canaryFeatures = true;
final moduleFormat = ModuleFormat.ddc;
final compilationMode = CompilationMode.frontendServer;

group('canary: $canaryFeatures |', () {
final provider = TestSdkConfigurationProvider(
verbose: debug,
canaryFeatures: canaryFeatures,
ddcModuleFormat: moduleFormat,
);
tearDownAll(provider.dispose);

runTests(
provider: provider,
moduleFormat: moduleFormat,
compilationMode: compilationMode,
canaryFeatures: canaryFeatures,
debug: debug,
);
});
}
Loading
Loading