Skip to content

[dwds] Late variables show up obfuscated on object drill down #1179

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
vsmenon opened this issue Nov 6, 2020 · 7 comments · Fixed by #1355
Closed

[dwds] Late variables show up obfuscated on object drill down #1179

vsmenon opened this issue Nov 6, 2020 · 7 comments · Fixed by #1355
Assignees

Comments

@vsmenon
Copy link
Member

vsmenon commented Nov 6, 2020

This is debugging a Flutter Web app running with null safety at version:

Flutter 1.24.0-8.0.pre.129 • channel master • https://github.com/flutter/flutter.git
Framework • revision 9edfa1225d (2 hours ago) • 2020-11-06 15:24:02 -0500
Engine • revision cf376142ed
Tools • Dart 2.12.0 (build 2.12.0-27.0.dev)

In the following (vscode watch):

Screen Shot 2020-11-06 at 2 48 34 PM

the variables p0, p1, and pot are marked late and appear somewhat obfuscated. I think the isSet is from lowering in the CFE / DDC. The variables deck and playerType are not late and show as expected.

I assume this is going through the getObject path. Are we doing field/variable renaming here?

@grouma @annagrin @nshahan

@nshahan
Copy link
Contributor

nshahan commented Nov 7, 2020

Yes, those look like the synthesized variable names that come from the CFE late lowering. We probably want to hide the isSets from the debugger and make sure we cleanup the name for the variables themselves.

@annagrin I thought there was already an issue filed collecting the kinds of names that we need to cleanup from the scope but I couldn't find it. Do you have one we can add these to?

@grouma grouma self-assigned this Nov 17, 2020
@grouma
Copy link
Member

grouma commented Nov 19, 2020

Action Items:

grouma@ - Filter out #isSet properties from the variable display
nshahan@ - Investigate the CFE logic for late variable naming and determine if a heuristic for renaming is possible

Long term we'll want to leverage the DDC metadata files and gather property names directly from there instead of Chrome.

@vsmenon
Copy link
Member Author

vsmenon commented Nov 19, 2020

I'm now on the version below. I'm not seeing the #isSet synthetic fields, but I am still seeing _#GameData#p0. On mobile, I just see p0.

flutter --version
Flutter 1.24.0-10.1.pre • channel dev • https://github.com/flutter/flutter.git
Framework • revision 405c85fe7e (6 days ago) • 2020-11-13 21:22:10 -0800
Engine • revision bd390c0310
Tools • Dart 2.12.0 (build 2.12.0-29.7.beta)

FWIW, if I break before a late field is initialized on mobile, I see <not initialized> in the watch window. On web, I see null.

@nshahan
Copy link
Contributor

nshahan commented Nov 20, 2020

Here is the source code where the names are constructed by the CFE.
https://github.com/dart-lang/sdk/blob/75a540725f894068773b9fd844f1d8403fd2e80a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart#L5888

As short term fix, we can reverse engineer the names to extract the name of the actual field/variable that would appear in the original dart source file.

For a more robust solution I had a conversation with the CFE team and we agree that there should be some way for backends to identify when synthetic nodes are created from a CFE lowering and a way to map them back to the actual name. DDC could use these features to help output more metadata information. I opened a tracking issue dart-lang/sdk#44262.

@vsmenon
Copy link
Member Author

vsmenon commented Nov 20, 2020

How is the VM mapping back from the CFE synthetic names to the original for debugging? Is it using heuristics?

@bkonyi - do you know?

@bkonyi
Copy link
Collaborator

bkonyi commented Nov 30, 2020

I'm not sure myself, so I'd have to do some digging. Maybe @rmacnak-google would know more?

@nshahan
Copy link
Contributor

nshahan commented Jan 19, 2021

Update: The CFE now tags the synthetic fields as such so we can identify them and handle them differently than a field that actually appears in the dart source. There is also an API that can be used to find the original name of the late field from the synthetic versions dart-lang/sdk#44262.

We should be unblocked to create a straightforward solution to rename/hide the fields we want via information DDC can emit in the metadata file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants