================
@@ -259,12 +257,17 @@ bool
ProcessFreeBSDKernelCore::DoUpdateThreadList(ThreadList &old_thread_list,
proc = ReadPointerFromMemory(proc + offset_p_list, error))
process_addrs.push_back(proc);
}
-
- // Processes are in the linked list in descending PID order, so we must
walk
- // them in reverse to get ascending PID order.
- for (auto proc_it = process_addrs.rbegin(); proc_it !=
process_addrs.rend();
- ++proc_it) {
- lldb::addr_t proc = *proc_it;
+ std::sort(process_addrs.begin(), process_addrs.end(),
+ [&](lldb::addr_t a, lldb::addr_t b) {
+ Status err;
+ int32_t pid_a =
+ ReadSignedIntegerFromMemory(a + offset_p_pid, 4, -1, err);
+ int32_t pid_b =
+ ReadSignedIntegerFromMemory(b + offset_p_pid, 4, -1, err);
----------------
DavidSpickett wrote:
I was going to say can we do this in a way not to repeat reads, but this will
be going via process readmemory which has a caching layer anyway.
https://github.com/llvm/llvm-project/pull/187976
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits