[Lldb-commits] [lldb] [lldb] Select signal-frame CFI at the raw PC (PR #223109)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 16 18:04:56 PDT 2026


jasonmolenda wrote:

I need to look at this closely, but RegisterContextUnwind is _intended_ to handle this case correctly already, see `m_behaves_like_zeroth_frame` (and `m_all_registers_available` which means the same thing, we shouldn't have two); `RegisterContextUnwind::BehavesLikeZerothFrame()`.  We set these on the stack frame above a signaler handler stack frame (that is, we set them in the stack frame that was interrupted asynchronously/faulted/syscalled).  Set like this,

```
  if (IsFrameZero() || GetNextFrame()->m_frame_type == eTrapHandlerFrame ||
      GetNextFrame()->m_frame_type == eDebuggerFrame) {
    m_behaves_like_zeroth_frame = true;
    // If this frame behaves like a 0th frame (currently executing or
    // interrupted asynchronously), all registers can be retrieved.
    m_all_registers_available = true;
  }
```

When we are in a `m_behaves_like_zeroth_frame==true` stack frame, (1) pc is not backed up by one, (2) all registers are allowed to be fetched from the stack frame below.  (normally only the ABI callee-spilled aka non-volatile registers are allowed to be fetched from the newer stack frame blow)

This depends on us recognizing that the trap handler stack frame _is_ a trap handler stack frame, `GetNextFrame()->m_frame_type == eTrapHandlerFrame`.  Is that the issue here, that we aren't detecting that in your case?


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


More information about the lldb-commits mailing list