yurydelendik opened Issue #1518:
C global variables (such as
double s = 0;
) are compiled to WebAssembly as locations in the memory. The produced DWARF describes them as DIEs withDW_AT_location
attribute that points to that memory address, e.g.:0x00000072: DW_TAG_variable DW_AT_name ("s") DW_AT_type (0x00000083 "double") DW_AT_external (true) DW_AT_decl_file ("/Users/yury/Work/wasmtime/t.c") DW_AT_decl_line (11) DW_AT_location (DW_OP_addr 0x410)The wasmtime does not attempt to transform such locations since it needs "vmctx". In https://github.com/bytecodealliance/wasmtime/pull/1482 , we used some global state, accessible to debugger, to resolve pointers. It is possible to do the same for
DW_OP_addr
in static variables expression: user sets current vmctx in some global memory and a debugger gets it in DWARF expressions (in crates/debug/transform/expression.rs). Though we need to able to relocate the data in the DWARF expression written by gimli to make this work.The similar approach can be used for transformation of
DW_OP_Wasm_location wasm-global
operation.
Last updated: Dec 23 2024 at 12:05 UTC