-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Utility methods for artificial debug types in the generated DWARF #1482
Utility methods for artificial debug types in the generated DWARF #1482
Conversation
Subscribe to Label ActionThis issue or pull request has been labeled: "wasmtime:api" Users Subscribed to "wasmtime:api"To subscribe or unsubscribe from this label, edit the |
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.
Clever hack :)
/// Ensures that set_vmctx_memory and resolve_vmctx_memory_ptr are linked and | ||
/// exported as symbols. It is a workaround: the executable normally ignores | ||
/// `pub extern "C"`, see rust-lang/rust#25057. | ||
pub fn ensure_exported() { |
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.
If this module is pub
(can also be #[doc(hidden)]
to avoid "really" making it public) then I think we don't need this hack.
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.
Or use #[doc(hidden)] pub use crate::debug_builtins::{set_vmctx_memory, resolve_vmctx_memory_ptr};
in the crate root.
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.
If you are suggesting to remove ensure_exported
, then it does not work. See rust-lang/rust#25057
Co-Authored-By: Nick Fitzgerald <[email protected]>
dac2835
to
ba304fb
Compare
Currently, artificial "wrapper" types are created for pointer types. These wrappers display Wasm pointers as i32. To dereference such wrapper/pointer the function's vmctx is needed. This PR is an attempt to provide overrides for artificial type for
operator*
andoperator->
.The runtime/host has to have
set_vmctx_memory
andresolve_vmctx_memory_ptr
builtins. The former sets current context and the former derefernces the Wasm pointer using current context's memory base.During LLDB session, a user has to call
__vmctx.set()
to set the current context before calling any dereference operators. It can be automated via e.g.command regex pp 's/(.+)/p __vmctx->set(),%1/'
.Example of the LLDB session (see also gist):
TODO:
_set_vmctx_memory
/_resolve_vmctx_memory_ptr
exported (Unable to export not mangled symbol in an executable as libraries can do rust-lang/rust#25057 ?)