Skip to content

Add getters to the vm_service protocol spec #52920

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
annagrin opened this issue Jul 12, 2023 · 4 comments
Closed

Add getters to the vm_service protocol spec #52920

annagrin opened this issue Jul 12, 2023 · 4 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-service The VM Service Protocol, both the specification and its implementation

Comments

@annagrin
Copy link
Contributor

Currently displays of objects are inconsistent between tools (VSCode and DevTools) and backends (VM and dwds).

The following issues prevent us from always consistently displaying objects:

  1. dwds is representing getters as fields instead of methods
    We are working on matching the VM behavior.

  2. dart-code is using a VM-specific way (checking if private field _kind on the Function object equals to GetterFunction, which only works for VM, not dwds).
    https://github.com/Dart-Code/Dart-Code/blob/15ad6615d8e8c02fd4393112f9896cf3bfc3c1fe/src/debug/dart_debug_impl.ts#L1424

  3. DevTools does not show getters on objects at all.
    We would like to eventually use dart-code logic for DevTools object display so all the debugging tools are consistent.

  4. vm_service protocol does not provide a way of easily identifying getters:

Suggestion

So solve all the issues, we would need to solve 4. first.
Define a way to identify getters in vm_service protocol so the debugger can evaluate getters if requested (for all backends).

@annagrin annagrin added the vm-service The VM Service Protocol, both the specification and its implementation label Jul 12, 2023
@annagrin
Copy link
Contributor Author

/cc @bkonyi @elliette @DanTup

@annagrin
Copy link
Contributor Author

Related: #46723

@annagrin annagrin changed the title Add getters to the vm_service_protocol spec Add getters to the vm_service protocol spec Jul 12, 2023
@DanTup
Copy link
Collaborator

DanTup commented Jul 12, 2023

dart-code is using a VM-specific way (checking if private field _kind on the Function object equals to GetterFunction, which only works for VM, not dwds).
https://github.com/Dart-Code/Dart-Code/blob/15ad6615d8e8c02fd4393112f9896cf3bfc3c1fe/src/debug/dart_debug_impl.ts#L1424

That link is for the legacy adapters, but the new adapters do the same thing here:

f.json?['_kind'] == 'GetterFunction' &&

FWIW, I recently added support for lazy-evaluation of getters in the new adapters (the user will see the names of the getters but we won't evaluate them unless they click), so if changes are made to simplify accessing getters and their values, we should ensure it still supports getting only the names so they can be fetched lazily/individually.

@mraleph mraleph added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Jul 13, 2023
@derekxu16 derekxu16 self-assigned this Jul 13, 2023
@derekxu16
Copy link
Member

isGetter and isSetter properties have been added to @Function and Function in package:vm_service 11.8.0.

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-service The VM Service Protocol, both the specification and its implementation
Projects
None yet
Development

No branches or pull requests

4 participants