Skip to content
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

Using gdb with asyncify #66

Open
rennergade opened this issue Dec 18, 2024 · 5 comments
Open

Using gdb with asyncify #66

rennergade opened this issue Dec 18, 2024 · 5 comments
Assignees

Comments

@rennergade
Copy link
Contributor

As of now if we apply asyncify it disables our ability to use gdb.

I think the problem is similar to this issue: WebAssembly/binaryen#3462

I inquired about any updates that may help us.

@rennergade
Copy link
Contributor Author

It seems like this older PR enabled DWARF info, I wonder if using this would make this work for us:

WebAssembly/binaryen#2520

@rennergade
Copy link
Contributor Author

Got a response here: WebAssembly/binaryen#3462 (comment)

It looks like it may be pretty difficult to use gdb or anything depending on DWARF.

I looked into using lldb which may be a useful alternative.

@rennergade
Copy link
Contributor Author

I was able to run lldb on hello world with the following:

apt install lldb

changed debug line to:
lldb -- $wasmtime_base/target/debug/wasmtime run -D debug-info -O opt-level=0 --wasi threads=y --wasi preview2=n [target]

and had to set aslr off once running:
settings set target.disable-aslr false

@qianxichen233 or @yzhang71 can one of you test this method on something more complicated that uses asyncify?

@qianxichen233
Copy link
Contributor

I just tried lldb with write.wasm (with asyncify applied), unfortunately it gives the error when I tried to break into user program's main function Error: failed to emit DWARF debug information

@qianxichen233
Copy link
Contributor

another very minor issue on using gdb on lind-wasm, just also post here to see if we have a better solution on it:
Since all the pointers in user code is based on virtual address, not real sys address, when I try to print the string or other pointer based struct in gdb, I am not able to simply do p str since str is virtual address pointer. A work around is to manually add the base_address to the str and print it but I wonder if there is even simpler way to do it so I do not need to pull out the base address every time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants