[lldb] Don't merge a frame provider's frames into the unwinder frame list (#216847)
`Thread::ClearStackFrames` keeps the previous public frame list as the
predecessor of the next unwinder list. When a scripted frame provider is
registered, that public list is a `SyntheticStackFrameList` holding
`BorrowedStackFrames`, and the unwinder list's merge step reuses a
predecessor frame whenever the stack IDs match, so it adopted frames
belonging to the provider's list.
`UpdatePreviousFrameFromCurrentFrame` refreshes
`StackFrame::m_frame_index`, but `BorrowedStackFrame::GetFrameIndex()`
returns its own `m_new_frame_index`, which supersedes it. The adopted
frame keeps reporting its index from the previous stop, so once the
stack grows the backtrace stops counting up:
```
frame #1: middle
frame #1: main
frame #2: start
```
Such a frame also delegates its stack ID, register context and symbol
context to a frame from the previous stop that the merge never
refreshes, so it could report stale state as well. In the backtrace
above, main also lost its source location.
When the merge finds a matching predecessor frame that is a
`BorrowedStackFrame`, keep the freshly unwound frame instead of adopting
it. Only providers create BorrowedStackFrames, so this never drops a
frame the unwinder built itself.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>