-
Notifications
You must be signed in to change notification settings - Fork 79
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
Provide source location for traps #54
Comments
This would still be useful. |
I'd like to be able to get the entire stacktrace from a trap (or other exception) in terms of Sourcefiles are not that useful, since my embedding would then need to map the source files back to the instances in order to get to the callback that renders source-level frames. So I would propose that the engine has an API roughly like:
wdyt? |
In principle this makes sense to me (especially since it avoids source names). OTOH, I can imagine engines that would not want to maintain this information (esp. the byte offset). So maybe this should be some kind of optional feature? |
We should think about a set of debugging features for dynamic introspection. That should probably be a separate sub-API, with a mirror-like interface. I'm happy to defer the design of that API until later (when I need it :-)). This feature falls somewhere in-between raw execution and that more general debugging API, though I'd argue for languages that make every effort to guarantee some kind of stack trace (like Virgil), it's not really optional. For comparison, the JVM produces "source level" stack traces from the source mapping in class files. It assumes that each class file is produced from a single source file and does the bytecode offset->line number translation for you via a table inlined into the classfile. That means it has no (direct) support for inlining. This makes it a huge pain to get exact stack traces the way Virgil expects, which I pretty much gave up on after native bootstrapping. The JVM would have been more useful it if would have given classfile (or method) + bytecode offset pairs like I propose. Wasm can do better here, in my opinion, and the function+offset pairs is enough to be fully general, I think. |
Extend Trap API to include file name and binary offset.
The text was updated successfully, but these errors were encountered: