[Lldb-commits] [lldb] [LLDB] Make the thread list for SBSaveCoreOptions iterable (PR #122541)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 10 15:01:29 PST 2025


================
@@ -100,6 +100,19 @@ SBSaveCoreOptions::AddMemoryRegionToSave(const SBMemoryRegionInfo &region) {
   return SBError();
 }
 
+uint32_t lldb::SBSaveCoreOptions::GetNumThreads() const {
+  LLDB_INSTRUMENT_VA(this);
+  return m_opaque_up->GetNumThreads();
+}
+
+SBThread SBSaveCoreOptions::GetThreadAtIndex(uint32_t idx) const {
+  LLDB_INSTRUMENT_VA(this, idx);
+  std::optional<lldb::ThreadSP> thread_sp = m_opaque_up->GetThreadAtIndex(idx);
+  if (thread_sp)
+    return SBThread(thread_sp.value());
+  return SBThread();
----------------
clayborg wrote:

If we remove the optional as suggested above, this can just be:
```
return SBThread(m_opaque_up->GetThreadAtIndex(idx));
```

https://github.com/llvm/llvm-project/pull/122541


More information about the lldb-commits mailing list