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

[NativeAOT-LLVM] Debug info generation does not define types properly #2728

Open
SingleAccretion opened this issue Oct 22, 2024 · 0 comments

Comments

@SingleAccretion
Copy link

SingleAccretion commented Oct 22, 2024

The reproduction for this problem is to run the WasmDebugging.csrpoj -c Debug test under wasmtime+LLDB:

> (lldb) b Main
> r
> type lookup WasmDebugging_Program

The output will be:

struct WasmDebugging_Program {
    static int Main();
}

This is NOT expected, since we have a number of other static methods hanging off of this type. And indeed, if we try to step into them, it will work, but things that rely on .debug_info DIEs more directly, like expression evaluation, will not work. I suspect this problem is also why we often see "debugging information not available" "red" frames in the Chrome debugger.

The root cause is that the way we can duplicate type definitions across bitcode files is not supported by the system. In this case in particular, Main happened to have been compiled into HelloWasm.X.bc, while most other methods - into some other module. This can be observed directly via wasm-tools unbundle WasmDebugging.wasm > $null && llvm-dwarfdump -F unbundled-module0.wasm | sls 'DW_AT_name [DW_FORM_strp] ("WasmDebugging_Program")' -s.

The end result is that LLDB caches the lookup results from the HelloWasm.X compile unit, where Main was recorded, and doesn't realize there are other parts present.

The fix here should be relatively straightforward.

Edit: further investigation with C++ classes revealed that a similar pattern is not handled by the wasmtime DWARF translator either, so we may have two bugs at hand.

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

1 participant