[Lldb-commits] [lldb] [lldb] Make SBProcess thread related actions listen to StopLocker (PR #134339)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 11 10:17:33 PDT 2025


================
@@ -870,6 +870,16 @@ llvm::json::Value CreateThread(lldb::SBThread &thread, lldb::SBFormat &format) {
   return llvm::json::Value(std::move(object));
 }
 
+llvm::json::Array GetThreads(lldb::SBProcess process, lldb::SBFormat &format) {
+  llvm::json::Array threads;
+  const uint32_t num_threads = process.GetNumThreads();
+  for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) {
+    lldb::SBThread thread = process.GetThreadAtIndex(thread_idx);
+    threads.emplace_back(CreateThread(thread, format));
+  }
+  return threads;
----------------
clayborg wrote:

Might be nice to add a `lldb::SBThreadList` to the API and then add:
```
lldb::SBThreadList lldb::SBProcess::GetThreads();
```


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


More information about the lldb-commits mailing list