Comments (4)
This would still be useful.
from wasm-c-api.
I'd like to be able to get the entire stacktrace from a trap (or other exception) in terms of (instance,function,offset)
triplets or (instance,module_offset)
pairs. The reason that in my language project, the instance is needed in that transforming wasm frames to source-language frames is not one-to-one; the translation is accomplished by a callback exported from the module (e.g. render_frames(func_index: i32, offset: i32)
) that transforms a wasm frame into one or more source-level frames. The metadata needed for the translation is encoded entirely within the module itself; i.e. the engine embedding does not know how to interpret it, since it is densely encoded and may change from language version to language version.
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:
wasm::Engine::GetTrapStackTrace(own<wasm::Trap*> trap) -> own vec<pair<wasm::Instance*, module_offset: int32_t>>
wdyt?
from wasm-c-api.
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?
from wasm-c-api.
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.
from wasm-c-api.
Related Issues (20)
- undefined reference to `wasm::vec<char>::free_data()'
- Syslog HOT 2
- Custom Sections API HOT 4
- WASM proposals supporting in Wasm C API HOT 1
- API to Terminate Execution for a wasm::Store
- Expectations for serialize/deserialize HOT 4
- make error:error: use of undeclared identifier 'errc' struct is_error_condition_enum<errc> HOT 1
- docker build fails in C++ Multi test HOT 2
- AddressSanitizer: allocation-size-too-big HOT 3
- Access of v8 isolate possible? HOT 1
- Deprecate wasm-c-api on big-endian hosts HOT 12
- Support import globals callback HOT 6
- posix shared memory with wamr
- Metering API
- `vec<T>::make_nt` may not be so helpful HOT 1
- Please tag when used in wabt
- memory64 support
- Type constructors should have a `wasm_engine_t*` parameter HOT 10
- How to import a native func to "env"? HOT 4
- Documentation? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasm-c-api.