================
@@ -183,13 +183,21 @@ bool ProcessFreeBSDKernel::DoUpdateThreadList(ThreadList 
&old_thread_list,
     // from FreeBSD sys/param.h
     constexpr size_t fbsd_maxcomlen = 19;
 
-    // iterate through a linked list of all processes
-    // allproc is a pointer to the first list element, p_list field
-    // (found at offset_p_list) specifies the next element
+    // pid is in reverse order. Order it incrementally
+    std::vector<lldb::addr_t> process_addrs;
     for (lldb::addr_t proc =
              ReadPointerFromMemory(FindSymbol("allproc"), error);
          proc != 0 && proc != LLDB_INVALID_ADDRESS;
          proc = ReadPointerFromMemory(proc + offset_p_list, error)) {
+      process_addrs.push_back(proc);
+    }
+
+    // iterate through a linked list of all processes
+    // allproc is a pointer to the first list element, p_list field
+    // (found at offset_p_list) specifies the next element
----------------
DavidSpickett wrote:

Feels like this comment should go above, when you first lookup all the process 
addresses. It seems to refer to the lookup you already did.

https://github.com/llvm/llvm-project/pull/178306
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to