[Lldb-commits] [PATCH] D156774: [lldb][DWARFASTParserClang] Resolve nested types when parsing structures
Michael Buch via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Aug 20 05:26:15 PDT 2023
Michael137 added a comment.
In D156774#4601767 <https://reviews.llvm.org/D156774#4601767>, @Endill wrote:
> In D156774#4601736 <https://reviews.llvm.org/D156774#4601736>, @Michael137 wrote:
>
>> What were your lldb commands when you tested this?
>
> `script import lldb; frame = lldb.thread.GetFrameAtIndex(0); print(frame.variables[0].type.GetNumberOfMemberEnums())`
>
>> LLDB currently completes types lazily when it thinks it can. Does your new API still fail if you run `expr p` prior? (the idea is that that would trigger completion of the type and parse dwarf). If we dont ever call `GetFullCompilerType` on your type LLDB will never try to pull in the definition
>
> No amount of tinkering with `expr` makes `script print(frame.variables[0].type.GetNumberOfMemberEnums())` output a non-zero value.
> I tested this with the changes I uploaded here half an hour ago.
In D156774#4601767 <https://reviews.llvm.org/D156774#4601767>, @Endill wrote:
> In D156774#4601736 <https://reviews.llvm.org/D156774#4601736>, @Michael137 wrote:
>
>> What were your lldb commands when you tested this?
>
> `script import lldb; frame = lldb.thread.GetFrameAtIndex(0); print(frame.variables[0].type.GetNumberOfMemberEnums())`
>
>> LLDB currently completes types lazily when it thinks it can. Does your new API still fail if you run `expr p` prior? (the idea is that that would trigger completion of the type and parse dwarf). If we dont ever call `GetFullCompilerType` on your type LLDB will never try to pull in the definition
>
> No amount of tinkering with `expr` makes `script print(frame.variables[0].type.GetNumberOfMemberEnums())` output a non-zero value.
> I tested this with the changes I uploaded here half an hour ago.
I think you may want to use `GetCompleteQualType` before iterating the DeclContext. That will make sure we complete the type by the time we look for the enums.
E.g.,:
clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
if (GetCompleteQualType(&getASTContext(), qual_type)) {
const clang::RecordType *record_type =
llvm::cast<clang::RecordType>(qual_type.getTypePtr());
const clang::RecordDecl *record_decl = record_type->getDecl();
assert(record_decl);
return std::distance(EnumIt(record_decl->decls_begin()), EnumIt(record_decl->decls_end()));
}
Will review it more thoroughly on tomorrow though
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156774/new/
https://reviews.llvm.org/D156774
More information about the lldb-commits
mailing list