-
Notifications
You must be signed in to change notification settings - Fork 17
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
Encode scopes and variables in source map #2
Comments
Here are some cases that I think the source map's environment rematerialization
|
Awesome, that's pretty damn comprehensive and covers the vast majority of the use cases developer will see. Few questions:
|
Types are interesting, especially when the generated JS representation of multiple source-level types are the same. An example where this is true is with emscripten's pointers and integers. It seems to me that the only way a pretty printer could do the right thing in this case is if it had the source-level type information. So yes, I agree it is very important. There's lots of information we could (and I hope to) encode in source maps about variables:
However, trying to bite off everything at once is less than ideal. We'd risk either getting stuck trying to over-engineer the perfect format, or we would ship the wrong things and have no good story for fixing it in future iterations. I'd prefer if we could figure out the (a) bare minimum set of data points needed to recreate the source environment, and (b) how to ensure that we can extend the format in the future to add the bells and whistles. My hope is that we can initially add pretty printing functions that take only the value, and independently add environments without optional source-level type information. After we've agreed upon those things, we can add optional type information to the environment, and pass that as a second parameter to the pretty printing functions. In this way, we can continually and incrementally ship improvements to the format without trapping ourselves in a dead end by making future improvements impossible. |
I have much less of an understanding of how compilers targeting CSS use source maps than I do of compilers targeting JS and JS debuggers consuming source maps. My understanding is that they work pretty alright, and there were much less deficiencies than with the to-JS case. It would be great if someone who understands this subdomain really well stepped up and took responsibility for ensuring that we provide for the to-CSS needs as well. |
I wrote a little bit about how DWARF solves this problem: http://fitzgeraldnick.com/weblog/62/ |
How does this proposal address or complicate the issue of transitivity? With source maps it's currently trivial to merge transformations between distinct and unrelated JavaScript compilation technology. Once you start encoding scopes it seems to me transitivity becomes increasingly more difficult to preserve. I could be wrong about that and happy to hear that there is prior art or that this is fundamentally a non-issue. |
The good news is that adding these scopes and bindings doesn't make it more If some tool in the pipeline does not modify the environment in any way, then As far as prior art goes, unfortunately I'm not aware of anything directly The next closest tools are things like Valgrind and DTrace which instrument the Yacc emits I'd be interested if you know of any bytecode instrumenters in JVM-land that The minifier, or any other tool that takes JS for further processing and changes
Note again that if the tool does not modify the environment, then it can skip When the tool does modify the environment (eg, a minifier shortening variable At the end of the day, I think the benefits outweight the drawbacks, especially |
I've always thought that it might one day be replaced with something with a
different structure more inline with a traditional debug format (a binary
format) but something would need to be proposed.
…On Mon, Mar 5, 2018 at 7:34 AM, Daniel Ehrenberg ***@***.***> wrote:
It's great to see this investigation. The lack of encoding of variables
and scopes was cited
<https://github.com/WebAssembly/design/pull/1051/files#diff-8e85308ab5cc1e83e91ef59233648be2R338>
in the draft WebAssembly/source-map integration as a downside of
source-maps, and it seems like there is frequent discussion of this feature
in the mailing list (e.g., @rbuckton <https://github.com/rbuckton>'s post
<https://groups.google.com/forum/#!topic/mozilla.dev.js-sourcemap/NVuynvaFQDY>
).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABMDKvkvc5D7itStxCg8HS3z-GFmcJ8Yks5tbVrXgaJpZM4Dh5o4>
.
|
@concavelenz Now that we have the motivation from both @dschuff's WebAssembly integration and the continued widespread use of minimizers and transpilers, should we start this effort to create this new structure? |
* Configure github actions * Fix missing source * Explicitly configure toolchain * Newer ubuntu runner
I believe this is subsumed by the current scopes proposal. If there is anything missing, we should add it as a follow up to the main proposal. |
Source maps should be able to encode the original source language's environment, scopes, and variables. They should be encoded in such a way that if a debugger is paused at a given generated JS location, it can restore and display the original source language's variables and parent scopes that are in scope at the paused location.
The text was updated successfully, but these errors were encountered: