[Lldb-commits] [lldb] [lldb][debugserver] Synchronize interrupt and resume signals (PR #131073)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 13 13:49:06 PDT 2025


jasonmolenda wrote:

I was worried about the timing in `MachProcess::PrivateResume` versus `Interrupt` but I think it will be OK.  `PrivateResume` does

```
void MachProcess::PrivateResume() {
  PTHREAD_MUTEX_LOCKER(locker, m_exception_messages_mutex);

  // Set our state accordingly
  if (m_thread_actions.NumActionsWithState(eStateStepping))
    SetState(eStateStepping);
  else
    SetState(eStateRunning);

  // Now resume our task.
  m_task.Resume();
}
```

and `SetState` acquires the `m_state_mutex` (which `GetState` also acquires), so it is possible for Interrupt to call `GetState()` while this is calling `m_task.Resume()` which actually resumes the process, but because `PrivateResume` is holding the `m_exception_messages_mutex` mutex still, our conditional block will wait until the `m_task.Resume()` has completed and this function exits.  Should be OK.

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


More information about the lldb-commits mailing list