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

C++ related issues in dwarf_extractor.cpp #3187

Open
yamt opened this issue Feb 29, 2024 · 8 comments
Open

C++ related issues in dwarf_extractor.cpp #3187

yamt opened this issue Feb 29, 2024 · 8 comments

Comments

@yamt
Copy link
Collaborator

yamt commented Feb 29, 2024

when compiling a C++ module, in lldb_function_to_function_dbi,

d.tgz

yamt added a commit to yamt/wasm-micro-runtime that referenced this issue Feb 29, 2024
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
wenyongh pushed a commit that referenced this issue Feb 29, 2024
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
@yamt
Copy link
Collaborator Author

yamt commented Mar 7, 2024

btw, i wonder why dwarf_extractor.cpp uses the LLDB API, rather than, say, llvm/DebugInfo/DWARF/ api.
@wenyongh do you remember?

@wenyongh
Copy link
Contributor

wenyongh commented Mar 7, 2024

btw, i wonder why dwarf_extractor.cpp uses the LLDB API, rather than, say, llvm/DebugInfo/DWARF/ api. @wenyongh do you remember?

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?

@yamt
Copy link
Collaborator Author

yamt commented Mar 8, 2024

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)

@TianlongLiang
Copy link
Contributor

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

@yamt
Copy link
Collaborator Author

yamt commented Apr 1, 2024

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?

@TianlongLiang
Copy link
Contributor

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?

@yamt
Copy link
Collaborator Author

yamt commented Apr 3, 2024

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.

@TianlongLiang
Copy link
Contributor

i guess it will be mostly contained in dwarf_extractor.cpp.

Got it, thanks

wenyongh pushed a commit that referenced this issue Apr 3, 2024
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this issue May 27, 2024
…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
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this issue May 27, 2024
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