-
Notifications
You must be signed in to change notification settings - Fork 29
[WIP] Enable native debugging for wasm modules/components #129
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
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.
This looks great! If I understand it correctly, the actual "registering loaded code with GDB" is taken care of by the upstream wasmtime code that handles the GDB jit interface, which automatically works for us since when gdb loads the debug information for the sandbox binary, it gets the jit interface symbols from wasmtime?
One minor note that is not really completely related to this PR---this changeset made me notice that we still have a .vscode in this directory, which we removed from hyperlight core in hyperlight-dev/hyperlight#66. Do we want to remove that here as well, and make sure that any/all relevant settings are documented?
"HelloWorld", | ||
"Message from Rust Example to Wasm Function".to_string(), | ||
), | ||
// ( |
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.
Why is this commented out?
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.
I have a plan to move a test from the Rust code here to exercise both C and Rust source code of the debug symbols.
#[cfg(feature = "gdb")] | ||
{ | ||
config.debug_info(true); | ||
config.cranelift_opt_level(OptLevel::None); |
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.
Do we want this to be unconditional? Sometimes it's quite useful to be able to debug the optimized code.
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.
This was is still in dev, I'll remove it
@@ -17,6 +17,6 @@ limitations under the License. | |||
fn main() { | |||
println!("cargo:rustc-link-arg=-zstack-size=4096"); | |||
println!("cargo:rustc-link-arg=--initial-memory=65536"); | |||
println!("cargo:rustc-link-arg=--strip-all"); | |||
//println!("cargo:rustc-link-arg=--strip-all"); |
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.
Should this either be a cfg gate or removed entirely, rather than commented out?
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.
I'll gate it somehow before finalizing
Thanks for taking a look at this. You are correct, the GDB jit interface is handled by the changes in wasmtime that enable it for I'll remove the .vscode, I don't have a strong preference. |
I'm a fan of keeping the .vscode for what it's worth. We brought it back in hl-core as well. |
Agreed, I don't think this impacts folks who don't care and helps those who do? |
This PR address part of hyperlight-dev/hyperlight#684 and closes #120 that concerns the hyperlight-wasm related work to enable the wasm modules/components native debugging running in hyperlight-wasm guest.
What this includes:
debug-builtins
no_std feature ofwasmtime
introduced by Allow compiling debug-builtins in no_std environment to enable gdb jit bytecodealliance/wasmtime#11304 which hasn't yet been mergedgdb
feature to enable support of debugging in host (hyperlight-host handles the connection to the debugger) and guest (concerns the settings ofwasmtime
to correctly report jit code to the debugger)