Skip to content

Commit eb06c7e

Browse files
authored
[lldb] Fix assertion caused by invalid SupportFileSP (#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
1 parent 1d63892 commit eb06c7e

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
@@ -275,7 +275,7 @@ Function::~Function() = default;
275275
void Function::GetStartLineSourceInfo(SupportFileSP &source_file_sp,
276276
uint32_t &line_no) {
277277
line_no = 0;
278-
source_file_sp.reset();
278+
source_file_sp = std::make_shared<SupportFile>();
279279

280280
if (m_comp_unit == nullptr)
281281
return;

0 commit comments

Comments
 (0)