[Lldb-commits] [lldb] [lldb] Fix Linux core file tests hanging on Windows (PR #142143)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Fri May 30 08:28:24 PDT 2025


Jlalond wrote:

Hey @DavidSpickett thanks for fixing the test.

I think you fixed it the right way, but I wanted to share my understanding of how this probably happened

In ProcessElfCore, we check the siginfo status of all the threads

```
  if (!siginfo_signal_found) {
    // If we don't have signal from SIGINFO use the signal from each threads
    // PRSTATUS note.
    if (prstatus_signal_found) {
      for (auto &thread_data : m_thread_data)
        thread_data.signo = thread_data.prstatus_sig;
    } else if (m_thread_data.size() > 0) {
      // If all else fails force the first thread to be SIGSTOP
      m_thread_data.begin()->signo =
          GetUnixSignals()->GetSignalNumberFromName("SIGSTOP");
    }
  }
  ```
  
So in our case, I've changed this behavior, where `siginfo_signal_found` will always be set to true if we've extracted any bytes from the PT_NOTE even if we can't use them later due to a lack of a platform class. Because we passed the siginfo bytes check we never populate the `signo` from the PRSTATUS
  
Then in ThreadElfCore I think we'd fail to calculate stop info because we don't have a valid SIGNO.

I think a few fixes here:

Currently, we set the stop reason even for `signo = 0` so you get a confusing stopped with signal 0 in LLDB. We should always stop for ThreadElfCore, but only make stop info dependent on the actual siginfo.

This same infinite loop also can happen for Minidump, and I haven't had time to fix it. I think in general we can wrap all of this into a nice postmortem thread and have the postmortem thread know it should always stop, but optionally get the signal description. 

CC: @labath 


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


More information about the lldb-commits mailing list