Skip to content

Commit 9419b7f

Browse files
committed
[lldb] Fix assertion caused by invalid SupportFileSP (llvm#162710)
SupportFileSP should never be null, and instead should use a default constructed SupportFile to represent an invalid instance. This is because the class used to be a value type before it became polymorphic. We have various places in LLDB where we check this precondition, including in DisplaySourceLinesWithLineNumbers. The assertion was tripped when calling GetStartLineSourceInfo which starts by resetting the SupportFileSP and has a series of early returns which leave the shared pointer in that state. rdar://161607247 (cherry picked from commit eb06c7e)
1 parent eff752e commit 9419b7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Symbol/Function.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Function::~Function() = default;
280280
void Function::GetStartLineSourceInfo(SupportFileSP &source_file_sp,
281281
uint32_t &line_no) {
282282
line_no = 0;
283-
source_file_sp.reset();
283+
source_file_sp = std::make_shared<SupportFile>();
284284

285285
if (m_comp_unit == nullptr)
286286
return;

0 commit comments

Comments
 (0)