[Lldb-commits] [lldb] [llvm] [lldb][Process/FreeBSDKernelCore] Improve DoUpdateThreadList() (PR #183981)

via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 10 08:48:08 PDT 2026


================
@@ -217,19 +220,45 @@ bool ProcessFreeBSDKernelCore::DoUpdateThreadList(ThreadList &old_thread_list,
         ReadSignedIntegerFromMemory(FindSymbol("pcb_size"), 4, -1, error);
     lldb::addr_t stoppcbs = FindSymbol("stoppcbs");
 
-    // from FreeBSD sys/param.h
+    // Read stopped_cpus bitmask and mp_maxid for CPU validation.
+    lldb::addr_t stopped_cpus = FindSymbol("stopped_cpus");
+    uint32_t mp_maxid = 0;
+    uint32_t long_size_bytes = GetAddressByteSize();
+    uint32_t long_bit = long_size_bytes * 8;
+
+    if (stopped_cpus != LLDB_INVALID_ADDRESS) {
+      // https://cgit.freebsd.org/src/tree/sys/kern/subr_smp.c
+      mp_maxid =
+          ReadSignedIntegerFromMemory(FindSymbol("mp_maxid"), 4, 0, error);
+      if (error.Fail())
+        stopped_cpus = LLDB_INVALID_ADDRESS;
+      else if (auto type_system_or_err =
----------------
aokblast wrote:

Can we decouple the size of long and stopped_cpus check?

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


More information about the lldb-commits mailing list