[Lldb-commits] [PATCH] D115308: [LLDB] Uniquify Type in type list.
Zequan Wu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Dec 12 20:42:22 PST 2021
zequanwu added a comment.
In D115308#3184564 <https://reviews.llvm.org/D115308#3184564>, @shafik wrote:
> I would also like to know where this duplicate insertion is happening. Can you walk us through the steps that lead to the duplicate entries? thank you!
Firstly, I found that `SymbolFileDWARF::ParseType` -> `DWARFASTParserClang::ParseTypeFromDWARF` -> `DWARFASTParserClang::UpdateSymbolContextScopeForType`. It's inserting the same type at both places (SymbolFileDWARF::ParseType <https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L2982> and DWARFASTParserClang::UpdateSymbolContextScopeForType <https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L1555> ). In my first revision, I just attempted to remove the insertion in UpdateSymbolContextScopeForType. Then I found that when running `lldb-test symbols [binary]`, it's inserting same types at `ParseTypes`. For following dwarf info, when `ParseType` was called for `DW_TAG_subroutine_type`, it will also call `ParseType` for the type `DW_TAG_base_type` inside it. When the top-level `ParseTypes` iterates to `0x0000010f`, the type will be inserted twice:
0x0000010a: DW_TAG_subroutine_type
DW_AT_type (0x0000010f "int")
0x0000010f: DW_TAG_base_type
DW_AT_name ("int")
DW_AT_encoding (DW_ATE_signed)
DW_AT_byte_size (0x04)
So, I figured it might be better to deduplicate the types inside TypeList when insertion happens, though `ParseTypes` is only used at `lldb-test`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115308/new/
https://reviews.llvm.org/D115308
More information about the lldb-commits
mailing list