[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 20 12:27:10 PST 2024


================
@@ -120,15 +120,23 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info,
   case eStateCrashed:
   case eStateExited:
   case eStateSuspended:
-  case eStateUnloaded:
+  case eStateUnloaded: {
     if (log)
       LogThreadStopInfo(*log, m_stop_info, "m_stop_info in thread:");
     stop_info = m_stop_info;
+    // Include child process PID/TID for forks.
+    // Client expects "<fork_pid> <fork_tid>" format for parsing.
+    if (stop_info.reason == eStopReasonFork ||
+        stop_info.reason == eStopReasonVFork) {
+      m_stop_description = std::to_string(stop_info.details.fork.child_pid);
+      m_stop_description += " ";
+      m_stop_description += std::to_string(stop_info.details.fork.child_tid);
+    }
----------------
clayborg wrote:

We should be doing this work in:
```
void NativeThreadLinux::SetStoppedByFork(bool is_vfork, lldb::pid_t child_pid);
```


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


More information about the lldb-commits mailing list