Skip to content
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

[dev_compiler] Support showing inherited fields in the debugger #45387

Open
annagrin opened this issue Mar 19, 2021 · 1 comment
Open

[dev_compiler] Support showing inherited fields in the debugger #45387

annagrin opened this issue Mar 19, 2021 · 1 comment
Assignees
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. dev-compiler-eval web-eval evaluation support on the web

Comments

@annagrin
Copy link
Contributor

Issue

Superclass fields do not show in Local variables window in the debugger.

Evaluation works fine, but local variables returned from dwds do not contain inherited fields - note that watch window and expression evaluation box evaluate b.t but it does not appear in local variables view.

We currently use ddc runtime function sdk_utils.getFields to get the fields of the object (this in code below), and it does not seem to list all the inherited properties. Note the comment: // TODO(alanknight): Handle superclass fields.:

https://github.com/dart-lang/webdev/blob/51ad9e76a8283499059a7357f7ada8a48aacd87d/dwds/lib/src/debugging/instance.dart#L276

Suggestion

  • Add getting all fields functionality to the ddc runtime
  • Add a more concise way for a debugger to ask for fields of an object
  • If possible, it should use dart evaluation instead of js evaluation
    • Can we create dart ddc runtime library that the debugger can use?
    • Another option could be reflection but it seems that dart:mirrors are not supported on flutter and I am not sure it works on web: Allow using dart:mirrors flutter/flutter#1150

Related

dart-lang/webdev#1263

Repro

class A {
  A(this.t);
  int t;
}

class B extends A {
  B(this.p): super(p+1);
  int p;

  void foo() {
    print('in foo');
  }
}

void main() {

  B b = B(0);
  A a = A(42);

  b.foo();
}

image

@annagrin annagrin self-assigned this Mar 19, 2021
@annagrin annagrin added area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. dev-compiler-eval web-eval evaluation support on the web labels Mar 19, 2021
@annagrin
Copy link
Contributor Author

Needs: #40273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. dev-compiler-eval web-eval evaluation support on the web
Projects
None yet
Development

No branches or pull requests

1 participant