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

Add filename and line number to functions in the names section? #729

Closed
lukewagner opened this issue Jul 19, 2016 · 1 comment
Closed

Add filename and line number to functions in the names section? #729

lukewagner opened this issue Jul 19, 2016 · 1 comment
Milestone

Comments

@lukewagner
Copy link
Member

The names section is intended to be the simplest thing possible to provide a basic source-code callstack. Currently, the names in the names section show up in Error.stack and devtools debugger callstacks. However, Error.stack and the debugger's callstacks also show filename and line number and, for lack of a better option, these are set to the URL of the JS function that compiled the wasm and the bytecode offset of the function in the wasm module. I think there's be a pretty big win, at low impl cost, to extend the names section to additionally specify filename and line number for each function as well.

Since filenames are long and there are far fewer unique filenames than functions, I think the names section should start with a sequence of filenames and then each function could index into that array.

Of course we'd like to avoid feature creep given that there are already tentative plans for something much more general to support first-class source debugger, but I think this fits pretty squarely in the scope of the names section given that it shows up in even the most basic callstack machinery.

@lukewagner
Copy link
Member Author

A few problems were pointed out that, to fix, would start down the slippery slope of building a mini DWARF (which I think we should avoid in preference to the vision outlined in #708). One issue is that what a callstack wants is per-callsite line numbers, not per-function. Another is that inlining makes source filenames more nuanced than simple per-function. So I'll keep the names section as-is and close this issue. It'll still be possible to add a "callstacks" section in the future (that was complementary to the names section) if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants