[Lldb-commits] [PATCH] D131335: WIP: [lldb] abi_tag support 3/3 - Use mangle tree API to determine approximate mangled matches

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 15 10:10:16 PDT 2022


aprantl added a comment.

In D131335#3722595 <https://reviews.llvm.org/D131335#3722595>, @Michael137 wrote:

> As @labath mentioned, we do force clang to preserve the linkage name via `asm()`, but only for class member functions. This was added in `675767a5910d2ec77ef8b51c78fe312cf9022896` (https://reviews.llvm.org/D40283) to also support `abi_tag`! But that didn't cover templates functions:
>
>   Use the DWARF linkage name when importing C++ methods.
>   When importing C++ methods into clang AST nodes from the DWARF symbol
>   table, preserve the DW_AT_linkage_name and use it as the linker
>   ("asm") name for the symbol.
>   
>   Concretely, this enables `expression` to call into names that use the
>   GNU `abi_tag` extension
>
> I tried adding an `AsmLabelAttr` to the `FunctionDecl`s we create when parsing DWARF and it does fix the ABI-tag problem on my small test case. But this only works because the way we create `FunctionTemplateDecl`s is incorrect (as I've described in my previous comments).
>
> So the options are any combination of the following:
>
> 1. carry this patch forward (and possibly remove the `asm()` hack for C++ member functions)
> 2. Add the `asm()` attribute hack to all function declarations (or just when we are dealing with template functions)
> 3. Fix the way we generate `FunctionTemplateDecl`s when parsing DWARF (this likely needs a change to DWARF generation)
>
> @aprantl @labath Any preference? To me it seems 1 and 3 are the more "proper" way to fix this issue. And once we fix 3 (which we should do anyway) #2 may break. The good thing about #2 is that we avoid searching object files, improving performance.

I think this sounds like a decent plan forward. I would suggest to start with (1) and then start a discussion about (3). Conceivably we could change the DWARF representation of function signatures to refer to `the DW_TAG_template_type_parameter` DIEs as types inside the `DW_AT_type`s of the other parameters. This is probably something we'd need to prototype in the LLDB debugger tuning first because it would confuse other consumers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131335/new/

https://reviews.llvm.org/D131335



More information about the lldb-commits mailing list