-
Notifications
You must be signed in to change notification settings - Fork 691
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 suggested format for wasm frames in Error.stack #814
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,21 @@ Because JavaScript exceptions can be handled, and JavaScript can continue to | |
call WebAssembly exports after a trap has been handled, traps do not, in | ||
general, prevent future execution. | ||
|
||
Even though the `stack` property of JS `Error` objects is not specified by | ||
ES-262, implementations *should* include WebAssembly stack frames in | ||
the generated callstacks. [User-defined sections](BinaryEncoding.md#high-level-structure) | ||
may arbitrarily affect the displayed stack frames. However, by default, when | ||
no relevant sections are present: | ||
* The line number reported for a WebAssembly frame *should* be the offset of the | ||
the trap/call instruction within the module's originally-compiled binary. | ||
* The column number reported for WebAssembly frames, if not omitted entirely, | ||
*should* be 1. | ||
* The function name *should* be generated from the template string literal | ||
`wasm-function[${i}]` where `i` is the index of the function in the module's | ||
[Code section](BinaryEncoding.md#code-section). | ||
* The filename *should* be that of the JS caller of the originating `Module` | ||
constructor call. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only JS APIs we have atm take an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, right. |
||
|
||
## The `WebAssembly` object | ||
|
||
The `WebAssembly` object is the initial value of the `WebAssembly` property of | ||
|
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.
wasm-function
is the symbol section?"or
$i
if no symbol section is present"?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.
Not quite: I'm saying that if you have a stack frame which you'd print as foo@url:line:col (if it was JS) and if you have no Names section (so you don't have any "foo"), that a function name would be generated, with strawman "wasm-function[0]" (where "0" is the index of the function).
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.
Ah gotcha. Why not have
wasm-function
at all then, and not just$i
?Also: I'm not sure I understand where you mention the Names section. Could you say:
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.
The intention was just to be able to syntactically distinguish the wasm functions from the normal JS functions since you'll see them mixed into the same callstack. I did indeed forget to explicitly mention the Names section here; I'll add that.
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.
Cool, update looks good.