[vm] Allow breakpoints on record assignments
TEST=pkg/vm_service/test/breakpoint_on_record_assignment_test.dart
Fixes https://github.com/dart-lang/sdk/issues/51909
Change-Id: I9a57b0f8374056af5928ab2e4b8bf02fc6d1e171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292802
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/vm_service/test/breakpoint_on_record_assignment_test.dart b/pkg/vm_service/test/breakpoint_on_record_assignment_test.dart
new file mode 100644
index 0000000..ddb6cc0
--- /dev/null
+++ b/pkg/vm_service/test/breakpoint_on_record_assignment_test.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2023, 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.
+
+// @dart=3.0
+
+import 'common/service_test_common.dart';
+import 'common/test_helper.dart';
+
+const int LINE = 14;
+const String file = "breakpoint_on_record_assignment_test.dart";
+
+testMain() {
+ (int, String name, bool) triple = (3, 'f', true);
+ ({int n, String s}) pair = (n: 2, s: 's');
+ (bool, num, {int n, String s}) quad = (false, 3.14, n: 7, s: 'd');
+ print('$pair $triple $quad');
+}
+
+var tests = <IsolateTest>[
+ hasPausedAtStart,
+ setBreakpointAtUriAndLine(file, LINE),
+ resumeIsolate,
+ hasStoppedAtBreakpoint,
+ stoppedAtLine(LINE),
+ setBreakpointAtUriAndLine(file, LINE + 1),
+ resumeIsolate,
+ hasStoppedAtBreakpoint,
+ stoppedAtLine(LINE + 1),
+ setBreakpointAtUriAndLine(file, LINE + 2),
+ resumeIsolate,
+ hasStoppedAtBreakpoint,
+ stoppedAtLine(LINE + 2),
+ setBreakpointAtUriAndLine(file, LINE + 3),
+ resumeIsolate,
+ hasStoppedAtBreakpoint,
+ stoppedAtLine(LINE + 3),
+];
+
+main(args) {
+ runIsolateTestsSynchronous(
+ args,
+ tests,
+ 'breakpoint_on_record_assignment_test.dart',
+ testeeConcurrent: testMain,
+ pause_on_start: true,
+ pause_on_exit: true,
+ );
+}
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index ed7cff3..0a8ce2a 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -1828,13 +1828,15 @@
return false;
}
Definition* definition = value->definition();
- if (definition->IsConstant() || definition->IsLoadStaticField()) {
+ if (definition->IsConstant() || definition->IsLoadStaticField() ||
+ definition->IsLoadLocal() || definition->IsAssertAssignable() ||
+ definition->IsAllocateSmallRecord() || definition->IsAllocateRecord()) {
return true;
}
if (auto const alloc = definition->AsAllocateClosure()) {
return !alloc->known_function().IsNull();
}
- return definition->IsLoadLocal() || definition->IsAssertAssignable();
+ return false;
}
Fragment FlowGraphBuilder::EvaluateAssertion() {