Skip to content

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

@annagrin

Description

@annagrin

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

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dev-compiler-evalweb-evalevaluation support on the web

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions