[vm] Remove old async_debugger flag.

Effectively it is true for all environments where
debugger is actually present.

TEST=service tests

Change-Id: I0592e83004271ca32c107f4347f7bd82172b0a62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310622
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This commit is contained in:
Vyacheslav Egorov 2023-06-27 07:18:50 +00:00 committed by Commit Queue
parent cdd1163b27
commit ec15052c7f
9 changed files with 66 additions and 62 deletions

View file

@ -13,10 +13,10 @@ namespace dart {
DEFINE_NATIVE_ENTRY(AsyncStarMoveNext_debuggerStepCheck, 0, 1) {
#if !defined(PRODUCT)
GET_NON_NULL_NATIVE_ARGUMENT(Closure, async_op, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Closure, generator, arguments->NativeArgAt(0));
Debugger* debugger = isolate->debugger();
if (debugger != nullptr) {
debugger->MaybeAsyncStepInto(async_op);
if (debugger != nullptr && debugger->IsSingleStepping()) {
debugger->AsyncStepInto(generator);
}
#endif
return Object::null();

View file

@ -2,8 +2,8 @@
// 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.
//
// VMOptions=--async_debugger
// VMOptions=--async_debugger --optimization-counter-threshold=90
// VMOptions=
// VMOptions=--optimization-counter-threshold=90
import 'package:observatory/service_io.dart';
import 'package:observatory/models.dart' as M;
@ -11,7 +11,14 @@ import 'package:test/test.dart';
import 'test_helper.dart';
import 'service_test_common.dart';
const LINE_A = 35;
// AUTOGENERATED START
//
// Update these constants by running:
//
// dart runtime/observatory/tests/service/test_helper.dart update-lines
//
const int LINE_A = 42;
// AUTOGENERATED END
class Foo {}

View file

@ -1,8 +1,6 @@
// Copyright (c) 2017, 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.
//
// VMOptions=--async_debugger
import 'package:observatory/service_io.dart';
import 'package:observatory/models.dart' as M;
@ -10,7 +8,14 @@ import 'package:test/test.dart';
import 'test_helper.dart';
import 'service_test_common.dart';
const LINE_A = 36;
// AUTOGENERATED START
//
// Update these constants by running:
//
// dart runtime/observatory/tests/service/test_helper.dart update-lines
//
const int LINE_A = 41;
// AUTOGENERATED END
class Foo {}

View file

@ -2,8 +2,8 @@
// 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.
//
// VMOptions=--async_debugger
// VMOptions=--async_debugger --optimization-counter-threshold=90
// VMOptions=
// VMOptions=--optimization-counter-threshold=90
import 'package:observatory_2/service_io.dart';
import 'package:observatory_2/models.dart' as M;
@ -11,7 +11,14 @@ import 'package:test/test.dart';
import 'test_helper.dart';
import 'service_test_common.dart';
const LINE_A = 36;
// AUTOGENERATED START
//
// Update these constants by running:
//
// dart runtime/observatory/tests/service/test_helper.dart update-lines
//
const int LINE_A = 43;
// AUTOGENERATED END
class Foo {}

View file

@ -1,15 +1,20 @@
// Copyright (c) 2017, 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.
//
// VMOptions=--async_debugger
import 'package:observatory_2/service_io.dart';
import 'package:test/test.dart';
import 'test_helper.dart';
import 'service_test_common.dart';
const LINE_A = 35;
// AUTOGENERATED START
//
// Update these constants by running:
//
// dart runtime/observatory/tests/service/test_helper.dart update-lines
//
const int LINE_A = 40;
// AUTOGENERATED END
class Foo {}

View file

@ -3098,26 +3098,25 @@ void Debugger::HandleSteppingRequest(DebuggerStackTrace* stack_trace,
OS::PrintErr("HandleSteppingRequest- kStepOver %" Px "\n", stepping_fp_);
}
} else if (resume_action_ == kStepOut) {
if (FLAG_async_debugger) {
if (stack_trace->FrameAt(0)->function().IsAsyncFunction() ||
stack_trace->FrameAt(0)->function().IsAsyncGenerator()) {
CallerClosureFinder caller_closure_finder(Thread::Current()->zone());
// Request to step out of an async/async* closure.
const Object& async_op = Object::Handle(
stack_trace->FrameAt(0)->GetAsyncAwaiter(&caller_closure_finder));
if (!async_op.IsNull()) {
// Step out to the awaiter.
ASSERT(async_op.IsClosure());
AsyncStepInto(Closure::Cast(async_op));
if (FLAG_verbose_debug) {
OS::PrintErr("HandleSteppingRequest- kContinue to async_op %s\n",
Function::Handle(Closure::Cast(async_op).function())
.ToFullyQualifiedCString());
}
return;
if (stack_trace->FrameAt(0)->function().IsAsyncFunction() ||
stack_trace->FrameAt(0)->function().IsAsyncGenerator()) {
CallerClosureFinder caller_closure_finder(Thread::Current()->zone());
// Request to step out of an async/async* closure.
const Object& async_op = Object::Handle(
stack_trace->FrameAt(0)->GetAsyncAwaiter(&caller_closure_finder));
if (!async_op.IsNull()) {
// Step out to the awaiter.
ASSERT(async_op.IsClosure());
AsyncStepInto(Closure::Cast(async_op));
if (FLAG_verbose_debug) {
OS::PrintErr("HandleSteppingRequest- kContinue to async_op %s\n",
Function::Handle(Closure::Cast(async_op).function())
.ToFullyQualifiedCString());
}
return;
}
}
// Fall through to synchronous stepping.
DeoptimizeWorld();
NotifySingleStepping(true);
@ -4124,14 +4123,6 @@ Breakpoint* Debugger::GetBreakpointByIdInTheList(intptr_t id,
return nullptr;
}
void Debugger::MaybeAsyncStepInto(const Closure& async_op) {
if (FLAG_async_debugger && IsSingleStepping()) {
// We are single stepping, set a breakpoint on the closure activation
// and resume execution so we can hit the breakpoint.
AsyncStepInto(async_op);
}
}
void Debugger::AsyncStepInto(const Closure& awaiter) {
Zone* zone = Thread::Current()->zone();
CallerClosureFinder caller_closure_finder(zone);

View file

@ -696,7 +696,6 @@ class Debugger {
void RemoveBreakpoint(intptr_t bp_id);
Breakpoint* GetBreakpointById(intptr_t id);
void MaybeAsyncStepInto(const Closure& async_op);
void AsyncStepInto(const Closure& awaiter);
void Continue();

View file

@ -92,8 +92,6 @@ constexpr bool FLAG_support_il_printer = false;
"Abort if memory allocation fails - use only with --old-gen-heap-size") \
P(add_readonly_data_symbols, bool, false, \
"Add static symbols for objects in snapshot read-only data") \
C(async_debugger, false, false, bool, true, \
"Debugger support async functions.") \
P(background_compilation, bool, kDartUseBackgroundCompilation, \
"Run optimizing compilation in background") \
P(check_token_positions, bool, false, \

View file

@ -214,15 +214,6 @@ FunctionPtr ObjectStore::PrivateObjectLookup(const String& name) {
return result.ptr();
}
#if !defined(DART_PRECOMPILED_RUNTIME)
static void DisableDebuggingAndInlining(const Function& function) {
if (FLAG_async_debugger) {
function.set_is_debuggable(false);
function.set_is_inlinable(false);
}
}
#endif // DART_PRECOMPILED_RUNTIME
void ObjectStore::InitKnownObjects() {
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
@ -267,18 +258,19 @@ void ObjectStore::InitKnownObjects() {
ASSERT(!field.IsNull());
set_async_star_stream_controller_async_star_body(field);
if (FLAG_async_debugger) {
// Disable debugging and inlining of all functions on the
// _AsyncStarStreamController class.
const Array& functions = Array::Handle(zone, cls.current_functions());
for (intptr_t i = 0; i < functions.Length(); i++) {
function ^= functions.At(i);
if (function.IsNull()) {
break;
}
DisableDebuggingAndInlining(function);
#if !defined(PRODUCT)
// Disable debugging and inlining of all functions on the
// _AsyncStarStreamController class.
const Array& functions = Array::Handle(zone, cls.current_functions());
for (intptr_t i = 0; i < functions.Length(); i++) {
function ^= functions.At(i);
if (function.IsNull()) {
break;
}
function.set_is_debuggable(false);
function.set_is_inlinable(false);
}
#endif
cls = async_lib.LookupClassAllowPrivate(Symbols::Stream());
ASSERT(!cls.IsNull());