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

Support enabling debug symbol generation for wasm #52

Open
tschneidereit opened this issue Jul 21, 2021 · 7 comments
Open

Support enabling debug symbol generation for wasm #52

tschneidereit opened this issue Jul 21, 2021 · 7 comments
Labels
feature-ux Concerning ergonomics and ease-of-use

Comments

@tschneidereit
Copy link
Contributor

Viceroy currently doesn't enable, or support enabling, generation of wasm debug symbols, because of an issue with Wasmtime.

It'd be great if we could figure out a way to fix this, so we can support using native debuggers on services' code.

@aturon aturon added the feature-ux Concerning ergonomics and ease-of-use label Jul 21, 2021
@peterhuene
Copy link

Is there more context into the Wasmtime issue already somewhere? A backtrace of the hang would be extremely useful.

@pchickey
Copy link
Contributor

I ran into this issue and left the comment a while ago while on an unrelated adventure and never dug in.

Right now, if you enable it, make test fails with:

     Running tests/body.rs (target/debug/deps/body-11984d2c1fa2bd56)

running 2 tests
test bodies_can_be_written_and_read ... FAILED
test bodies_can_be_written_and_appended ... FAILED

failures:

---- bodies_can_be_written_and_read stdout ----
thread 'bodies_can_be_written_and_read' panicked at 'failed to set up execution context: Other(Debug information error

Caused by:
    The end offset of a location list entry must not be before the beginning.)', cli/tests/common.rs:121:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- bodies_can_be_written_and_appended stdout ----
thread 'bodies_can_be_written_and_appended' panicked at 'failed to set up execution context: Other(Debug information error

Caused by:
    The end offset of a location list entry must not be before the beginning.)', cli/tests/common.rs:121:14


failures:
    bodies_can_be_written_and_appended
    bodies_can_be_written_and_read

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.87s

error: test failed, to rerun pass '-p viceroy --test body'
make: *** [Makefile:18: test-crates] Error 101

@peterhuene
Copy link

I recall this error coming from gimli with a problem relating to the wasm's debug info section; perhaps the generated section isn't valid for some reason?

@peterhuene
Copy link

This is the check that is failing in gimli:

https://github.com/gimli-rs/gimli/blob/master/src/read/loclists.rs#L605-L608

Looks like range.begin is 0xfffffffe and range.end is 204 for me. Trying to determine if gimli bug or toolset bug.

@peterhuene
Copy link

So it appears one of the location list entries has a base address of 0xfffffffe, which for this offset pair of begin: 0, end: 206 translates to a begin at 0xfffffffe and an end at 204 as it wraps with a 32-bit address, hence the invalid range error.

@peterhuene
Copy link

From what I can tell, the .debug_loc section here has a problematic entry 0xffffffff for begin and 0xfffffffe for end, which is being parsed as a "base address selection entry" with a base address of 0xfffffffe for the subsequent entries.

$ dwarfdump write-and-read-body.wasm --debug-loc gives:

.debug_loc contents:
0x00000000: 
            (0x00000000, 0x00000034): DW_OP_WASM_location 0x0 +0, DW_OP_stack_value

0x00000016: 
            [0xfffffffe, 0x100000035): DW_OP_WASM_location 0x0 +1, DW_OP_stack_value

0x00000034: 
            [0xfffffffe, 0x100000063): DW_OP_WASM_location 0x0 +2, DW_OP_stack_value

...

Someone with more DWARF experience than I probably needs to look at this.

@itsrainy
Copy link
Contributor

I just poked at this a bit and it seems to have been fixed since the last discussion here (possibly by bytecodealliance/wasmtime#2901, bytecodealliance/wasmtime#5358, or some other dependency upgrade). Setting debug_info to true and running make test currently succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-ux Concerning ergonomics and ease-of-use
Projects
None yet
Development

No branches or pull requests

5 participants