Skip to content

Evaluating variables (and viewing locals) in a frame behind (a few) async points doesn't work #48836

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

Closed
jensjoha opened this issue Apr 19, 2022 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-debugger

Comments

@jensjoha
Copy link
Contributor

Take this file for instance:

$ cat t.dart
import "dart:developer";

class Foo {
}

void main() async {
  Foo x = new Foo();
  await foo();
  print(x);
}

Future<void> foo() async {
  await null;
  await foo2();
}

Future<void> foo2() async {
  debugger();
  print("hello");
}

If I run as dart --enable-vm-service t.dart and go to observatory (or devtools for that matter) and try to evaluate x (or p x, or view the locals) in the main frame I'm being told org-dartlang-debug:synthetic_debug_expression:1:1: Error: Undefined name 'x'. (observatory), evaluateInFrame: (113) Expression compilation error; org-dartlang-debug:synthetic_debug_expression:1:1: Error: The getter 'x' isn't defined for the class '_FutureListener<S, T>'.; (DevTools), and presented with an empty list (locals listing).

That's not great.

If I go to the allocation profile I can find the Foo instance (having a retaining path like retained by [ 0 ] of Context (1) -> retained by [ 6 ] of Context (9) -> retained by a GC root (stack)), so it's definitely still there.

Why won't the debugger allow me to see it and evaluate it?

/cc @mkustermann

(to be fair this doesn't seem to have ever worked --- but it feels like a thing that should be possible)

@keertip keertip added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Apr 19, 2022
@mkustermann
Copy link
Member

There's currently work underway to change the way local variable state is stored async functions. It may not make sense to look into this issue before that work has been completed and/or may be done as part of that work.

/cc @alexmarkov

@dcharkes
Copy link
Contributor

Duplicate of #51763 (which has more details than this issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-debugger
Projects
None yet
Development

No branches or pull requests

5 participants