[Lldb-commits] [PATCH] D137983: [lldb] Disable looking at pointee types to find synthetic value for non-ObjC
Arthur Eubanks via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 14 13:59:34 PST 2022
aeubanks created this revision.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
After D134378 <https://reviews.llvm.org/D134378>, we started seeing crashes with incomplete types (in the
context of shared libraries).
When trying to print a `std::vector<int> &` with only debug info for a
declaration, we now try to use the formatter after D134378 <https://reviews.llvm.org/D134378>. With an
incomplete type, this somehow goes into infinite recursion with the
frames
lldb_private::ValueObject::Dereference
lldb_private::ValueObjectSynthetic::CreateSynthFilter
lldb_private::ValueObjectSynthetic::ValueObjectSynthetic
lldb_private::ValueObject::CalculateSyntheticValue
lldb_private::ValueObject::HasSyntheticValue
The reason this only started appearing after D134378 <https://reviews.llvm.org/D134378> was because
previously with incomplete types, for names with `<`, lldb would attempt
to parse template parameter DIEs, which were empty, then create an empty
`ClassTemplateSpecializationDecl` which overrode the name used to lookup
a formatter in `FormattersMatchData()` to not include template
parameters (e.g. `std::vector<> &`). After D134378 <https://reviews.llvm.org/D134378> we don't create a
`ClassTemplateSpecializationDecl` when there are no template parameters
and the name to lookup a formatter is the original name (e.g.
`std::vector<int> &`).
The code to try harder with incomplete child compiler types was added in
D79554 <https://reviews.llvm.org/D79554> for ObjC purposes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137983
Files:
lldb/source/Core/ValueObject.cpp
Index: lldb/source/Core/ValueObject.cpp
===================================================================
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -2673,7 +2673,10 @@
// In case of incomplete child compiler type, use the pointee type and try
// to recreate a new ValueObjectChild using it.
if (!m_deref_valobj) {
- if (HasSyntheticValue()) {
+ // FIXME: C++ stdlib formatters break with incomplete types (e.g.
+ // `std::vector<int> &`). Remove ObjC restriction once that's resolved.
+ if (Language::LanguageIsObjC(GetPreferredDisplayLanguage()) &&
+ HasSyntheticValue()) {
child_compiler_type = compiler_type.GetPointeeType();
if (child_compiler_type) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137983.475271.patch
Type: text/x-patch
Size: 757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221114/5b0296d3/attachment-0001.bin>
More information about the lldb-commits
mailing list