-
Notifications
You must be signed in to change notification settings - Fork 577
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
C++ related issues in dwarf_extractor.cpp #3187
Comments
C++ allows unnamed arguments. In the debug info, they are represented as DW_TAG_formal_parameter w/o DW_AT_name. variable.GetName() here returns NULL for them. cf. bytecodealliance#3187
C++ allows unnamed arguments. In the debug info, they are represented as DW_TAG_formal_parameter w/o DW_AT_name. variable.GetName() here returns NULL for them. cf. #3187
btw, i wonder why dwarf_extractor.cpp uses the LLDB API, rather than, say, llvm/DebugInfo/DWARF/ api. |
The source debugger feature was implemented by Ant group long time ago, I just cannot remember the details now. Maybe the LLDB API provides more capability? |
a quick research on how other projects are reading the dwarf section in wasm: binaryen: llvm DWARFContext https://github.com/WebAssembly/binaryen/blob/d6c5e4ab15df271521df7b35665c7463b2c490ca/src/wasm/wasm-debug.cpp#L96-L116 cranelift: https://github.com/gimli-rs/gimli (something written in rust) |
It seems that AOT debugging now only has limited functionality. It was aimed to support C first It hardly covers any additional C++ features. Thus the current function-to-function debug symbol mapping only supports C styles function. And I think that's why it error when it comes to Cpp compiled wasm or Rust compiled wasm |
i agree. i tend to think a fix involves a major surgery like switching from lldb api to llvm api to read dwarf. how do you think? |
This is a workaroud for: bytecodealliance#3187 bytecodealliance#3163
I think it's feasible, but as you said it would be non-trivial changes. BTW, besides the extractor, will there also be some major modifications for code emission and file generation? |
i guess it will be mostly contained in dwarf_extractor.cpp. |
Got it, thanks |
…ce#3189) C++ allows unnamed arguments. In the debug info, they are represented as DW_TAG_formal_parameter w/o DW_AT_name. variable.GetName() here returns NULL for them. cf. bytecodealliance#3187
when compiling a C++ module, in lldb_function_to_function_dbi,
function_args
doesn't seem to include the "this" pointer. on the other hand,variable_list
contains it. it causes the "function args number dismatch" message and then ParamType overrun, which likely involves a crash. a workaround: lldb_function_to_function_dbi: a hack to avoid crashing on C++ methods #3190mergedvariable.GetName()
seems to return NULL for unnamed arg. it causes a NULL dereference. a suggested fix: lldb_function_to_function_dbi: fix a null dereference #3189LLVMCountParams(func_ctx->func)
doesn't match what's invariable_list
. (variable_list
has more.) usually it causes a crash inLLVMDIBuilderInsertDbgValueAtEnd
. see the attached d.tgz for an example. (also, it seems that something similar happens with rust: AOT debugging setup doesn't work #3163) i guess we can investigateDW_AT_location (DW_OP_WASM_location)
of variables to find the correspondingfunc_ctx->func
's parameters. (locals) but i don't know how it can be done with the LLDB API.DW_TAG_formal_parameter
withoutDW_AT_location
.d.tgz
The text was updated successfully, but these errors were encountered: