Skip to content

Add a script to process emscripten debug output and embed source maps #1252

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
fitzgen opened this issue Jun 5, 2013 · 2 comments
Closed

Comments

@fitzgen
Copy link

fitzgen commented Jun 5, 2013

The js created by debug builds has enough information in the @line comments that we should be able to create a source map. We should have a script that does this ;)

Notes:

  • Source map library that is npm install-able: https://github.com/mozilla/source-map
  • Should create an embedded source map: use data urls in //# sourceMappingURL=... and sourcesContent to completely embed the source map in the emscripten output so there aren't any external dependencies

Question:

  • When there isn't an //@line comment for a line in the js output, does that mean that it is generated by the compiler and doesn't directly represent something from the source code or that you should infer the line number based on the previous //@line comment?
@kripken
Copy link
Member

kripken commented Jun 6, 2013

  1. When there isn't, that means that llvm did not say anything about the original line number. We can probably use the previous line number, but there is no guarantee.
  2. Pasting some irc discussion about this with @int3 who might work on this:

so yes, the idea is to not modify the compiler at all. instead write an external script
the script takes the current -g output in -O0, and parses (in node or python, whichever we want) that out into sourcemaps format

for optimized builds, we can almost do the same in fact. again no need to modify the compiler and thread any debug info through it. instead, save emcc-4-original.js, which has debug info printed out (just like -O0)
then correlate emcc-4-original to the final emcc-6-js-opts
looking at some examples of those (from EMCC_DEBUG=1) should give an idea, i think this might not be too hard actually

int3 added a commit to int3/emscripten that referenced this issue Jun 7, 2013
int3 added a commit to int3/emscripten that referenced this issue Jun 19, 2013
@int3
Copy link
Contributor

int3 commented Jul 9, 2013

This can be closed now.

@kripken kripken closed this as completed Jul 15, 2013
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

No branches or pull requests

3 participants