flutter / devtools

Performance tools for Flutter
https://flutter.dev/docs/development/tools/devtools/
BSD 3-Clause "New" or "Revised" License
1.59k stars 326 forks source link

Expression evaluation is only supported in the scope of the current frame #4069

Open bkonyi opened 2 years ago

bkonyi commented 2 years ago

As far as I can tell, it's only possible to evaluate an expression in the context of the current frame. While this is the most common use case, it should be possible to evaluate in the context of specific libraries, classes, and instances.

@rmacnak-google, feel free to add more details here if I missed anything.

kenzieschmoll commented 1 year ago

To meet the requirements here, we may be able to add a file selector to the eval console that defaults to the root library, but allows the user to select a different library if they want to. @rmacnak-google would that support the use case described here?

After https://github.com/flutter/devtools/pull/5248 lands, we'll have the ability to evaluate when the app is not paused, so that should get us part way there.

rmacnak-google commented 1 year ago

No. A file selector would allow evaluating in a chosen library*, but not in a chosen class, instance or frame.

(*Almost. The relationship from files to libraries is not quite a function because of shared parts.)

Since this issue has been labeled as about the debugger, I will focus on the case of frames. More fundamentally, the console is a broken debuggering UI because it makes all the per-frame operations like stepping or eval modal.

Observatory fixes this slightly making the display of source and local variables non-modal; eval is still modal but it is at least possible to select a frame in its console.

image

Hopscotch fixes this all the way: notice that a + b evaluated in the second frame (and the affordence to step with respect to any frame).

image