Skip to content

Commit d6d45ad

Browse files
committed
Save core doesn't store thread info, instead we get the threadlist from process
1 parent 47c0c50 commit d6d45ad

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lldb/include/lldb/Symbol/SaveCoreOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class SaveCoreOptions {
5757
std::optional<lldb_private::FileSpec> m_file;
5858
std::optional<lldb::SaveCoreStyle> m_style;
5959
lldb::ProcessSP m_process_sp;
60-
std::unordered_map<lldb::tid_t, lldb::ThreadSP> m_threads_to_save;
60+
std::unordered_set<lldb::tid_t> m_threads_to_save;
6161
MemoryRanges m_regions_to_save;
6262
};
6363
} // namespace lldb_private

lldb/source/Symbol/SaveCoreOptions.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Status SaveCoreOptions::AddThread(lldb::ThreadSP thread_sp) {
8787
m_process_sp = thread_sp->GetProcess();
8888
}
8989

90-
m_threads_to_save.insert({thread_sp->GetID(), thread_sp});
90+
m_threads_to_save.insert(thread_sp->GetID());
9191
return error;
9292
}
9393

@@ -118,9 +118,13 @@ const MemoryRanges &SaveCoreOptions::GetCoreFileMemoryRanges() const {
118118
lldb::ThreadCollectionSP SaveCoreOptions::GetThreadsToSave() const {
119119
lldb::ThreadCollectionSP threadcollection_sp =
120120
std::make_shared<ThreadCollection>();
121-
for (const auto &thread : m_threads_to_save) {
122-
threadcollection_sp->AddThread(thread.second);
123-
}
121+
if (!m_process_sp)
122+
return threadcollection_sp;
123+
124+
ThreadList &thread_list = m_process_sp->GetThreadList();
125+
for (const auto &tid : m_threads_to_save)
126+
threadcollection_sp->AddThread(thread_list.FindThreadByID(tid));
127+
124128
return threadcollection_sp;
125129
}
126130

0 commit comments

Comments
 (0)