-
Notifications
You must be signed in to change notification settings - Fork 346
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
Wasm source maps #387
Wasm source maps #387
Conversation
src/webassembly.cc
Outdated
uint32_t size = ReadVarUInt32(§ion.contents); | ||
string_view source_mapping_url = | ||
ReadPiece(size, §ion.contents); | ||
id.resize(size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be simpler and safer to write as id.assign(source_mapping_url)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! done
Hi. Wanted to quickly check if there is additional work needed for PR or if it is ready to go? |
@@ -2166,6 +2196,8 @@ bool DoParseOptions(bool skip_unknown, int* argc, char** argv[], | |||
} | |||
} else if (args.TryParseOption("--source-filter", &option)) { | |||
options->set_source_filter(std::string(option)); | |||
} else if (args.TryParseOption("--source-map", &option)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add documentation for this flag to the usage string and into the user guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - added usage notes to using.md and added the option to the usage string
@@ -0,0 +1,30 @@ | |||
# RUN: %yaml2obj %s -o %t.obj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for adding yaml2obj tests. Could we add one for diff mode, so we can test our design for distinguishing between different versions of the same file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think the simplest way to do this would be to make a copy of the Wasm binary generated by yaml2obj, then create 2 different source maps for each of these. Made the change. PTAL
I'm trying to use this with an emscripten build, and using the generated source map file: Example:
Passing the map file as an argument doesn't seem to work:
It's not clear to me what the cmd line help actually means:
|
There is a bit more documentation here: https://github.com/google/bloaty/blob/main/doc/using.md#source-maps |
Add support for "inlines" and "compileunits" sources for Wasm using source maps.
Adds a new option "--source-map" which can be specified to map a URL to source map file:
--source-map=http://myurl/output.wasm.map=output.wasm.map
The source map URL is found in the Wasm binary in the
sourceMappingURL
section.We also support specifying the source map by file name, which is useful for specifying multiple source maps in diff mode where the
sourceMappingURL
might be identical between the binaries.--source-map=path/to/output.wasm=output.wasm.map