Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@eyebrowsoffire
Copy link
Contributor

@eyebrowsoffire eyebrowsoffire commented Apr 10, 2023

This PR makes some improvements to the debugging experience for built wasm modules (CanvasKit and Skwasm):

  • We now make sure to copy over the .map files to the artifacts directory for the host.dart.js files as well as any .wasm outputs, if they are produced.
  • We serve source files so that devtools can find them
  • We also support DWARF instead of sourcemaps if --dwarf is passed to felt on the command line.

One thing to note is that the sourcemap strategy doesn't currently work for CanvasKit. This is because the CanvasKit target specifies the --source-map-base to be the location inside node_modules for npm clients. I will follow up with the Skia team to try to change this behavior so that the sourcemap strategy works. However, DWARF debugging works for both CanvasKit and Skwasm.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Apr 10, 2023
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@eyebrowsoffire eyebrowsoffire requested a review from mdebbar April 11, 2023 00:35
);
argParser.addFlag(
'dwarf',
help: 'Embed dwarf debugging info into the output wasm modules. This is'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/dwarf/DWARF/ (but keep the small case flag name)

);
argParser.addFlag(
'dwarf',
help: 'Embed dwarf debugging info into the output wasm modules. This is'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit2: add one space after "is" so it's not glued to "only" on the next line.

FutureOr<bool> run() async {
final bool embedDwarf = boolArg('dwarf');
if (embedDwarf && runtimeMode != RuntimeMode.debug) {
throw ToolExit('Embedding dwarf data requires debug runtime mode.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DWARF

// * /test/alarm_clock_test.dart
// * /lib/src/engine/alarm_clock.dart
.add(createStaticHandler(env.environment.webUiRootDir.path))
.add(_createSourceHandler())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both _createSourceHandler and the previous handler attempt to handle .dart sources. Can't tell which one wins when.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out the first one is subsumed by the new one, so I removed the old one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we still need that static handler, because it serves specific files that the tests use, but it isn't for sources anymore, so I updated the comment.

)
..addFlag(
'dwarf',
help: 'Debug wasm modules using embedded dwarf data.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DWARF

'--wasm-use-dwarf',
action='store_true',
default=False,
help='Embed dwarf debugging info in the output module instead of using '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DWARF

DEPS Outdated
Comment on lines 242 to 245
# TODO(jacksongardner): This targets a commit that is not on the master branch.
# This needs to be removed before this PR lands, but this will allow us to verify
# these changes in CI.
'src': 'https://github.com/flutter/buildroot.git' + '@' + '5adf0d1951587debc612831a285d765d8603dfbb',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the debugging experience!

"//third_party/icu/source/common/ustrtrns.cpp",
"//third_party/icu/source/common/utf_impl.cpp",
"//third_party/icu/source/common/utrie2.cpp",
"//third_party/icu/source/common/utypes.cpp",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind explaining what these changes mean? I think I understand adding utypes.cpp. It's used in debug mode to show error messages.

What about static_library => source_set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utypes.cpp was because of a compile error I was getting when debugging, for the u_errorName_skia symbol. Changing from static_library to source_set was just something that is a holdover from when I was troubleshooting this issue. I think I can change it back.

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 12, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 12, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 12, 2023

auto label is removed for flutter/engine, pr: 41054, due to - This commit is not mergeable and has conflicts. Please rebase your PR and fix all the conflicts.

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 12, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 12, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 12, 2023

auto label is removed for flutter/engine, pr: 41054, due to - This commit is not mergeable and has conflicts. Please rebase your PR and fix all the conflicts.

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 12, 2023
@auto-submit auto-submit bot merged commit 11d3300 into flutter:main Apr 12, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 12, 2023
zhongwuzw pushed a commit to zhongwuzw/engine that referenced this pull request Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App needs tests platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants