Skip to content
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

SAFE_HEAP=1 disables proper source code mapping #4224

Closed
cforger opened this issue Apr 4, 2016 · 8 comments
Closed

SAFE_HEAP=1 disables proper source code mapping #4224

cforger opened this issue Apr 4, 2016 · 8 comments
Labels

Comments

@cforger
Copy link

cforger commented Apr 4, 2016

Hello,

With this command line, I get proper source code mapping in the comments of the .js file output.

emcc -g4 -O0 --js-opts 0 -s FS_LOG=1 -s EMULATE_FUNCTION_POINTER_CASTS=1 -s ASSERTIONS=2 --separate-asm --memory-init-file 1

By adding SAFE_HEAP=1 the source code map is no longer correct

emcc -g4 -O0 --js-opts 0 -s SAFE_HEAP=1 -s FS_LOG=1 -s EMULATE_FUNCTION_POINTER_CASTS=1 -s ASSERTIONS=2 --separate-asm --memory-init-file 1

What I see with this setting is "//@line 70514" which judging by the line# is a reference to the inside of my asm.js file, not the original C source code.

Removing SAFE_HEAP=1 fixes the problem, and I get a proper source map output "//@line 284 "./Modules/sre_lib.h""

Perhaps this is by design? I didn't see mention of this behaviour in the documentation that recommends the use of SAFE_HEAP, so I assume it's a bug.

@kripken
Copy link
Member

kripken commented Apr 4, 2016

This does look like a bug. I suspect the issue is that SAFE_HEAP uses js optimizations to apply itself, and those can mess up those annotations.

@cforger
Copy link
Author

cforger commented Apr 4, 2016

Great, let me know if I_can assist in it's squashing.

@kripken
Copy link
Member

kripken commented Apr 4, 2016

Sure, if you have time to look into this that would be great. I don't really know the source mapping code well myself, so probably whoever looks into it will be learning some new code anyhow ;)

@cforger
Copy link
Author

cforger commented Apr 5, 2016

Alright, it may be a bit steep for me considering I'm ~3 days into Emscripten, but I'll see if I can divert the time to it.

@kripken
Copy link
Member

kripken commented Apr 5, 2016

If it's tricky, I wouldn't spend much time on it. That's a rare combination of flags. It would be nice to have it work, but I don't see a reason why 2 builds couldn't be almost as good.

@martijnthe
Copy link

Maybe related? #5246

@Stuk
Copy link
Contributor

Stuk commented Mar 13, 2018

I'm seeing this issue too. My command line is:

-g4 -s ASSERTIONS=2 -s GL_ASSERTIONS=1 -s DEMANGLE_SUPPORT=1 -s SAFE_HEAP=1 -D DEBUG

I've combined these because I would like to get better errors on "segfaults" in dev, but it actually makes it harder to debug in normal cases!

@stale
Copy link

stale bot commented Sep 19, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Sep 19, 2019
@stale stale bot closed this as completed Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants