[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrameProvider for real threads (PR #161870)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 31 13:15:17 PDT 2025
================
@@ -1439,13 +1445,59 @@ void Thread::CalculateExecutionContext(ExecutionContext &exe_ctx) {
StackFrameListSP Thread::GetStackFrameList() {
std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
- if (!m_curr_frames_sp)
- m_curr_frames_sp =
- std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
+ if (!m_curr_frames_sp) {
+ // Try to load the frame provider if we don't have one yet
+ if (!m_frame_provider_sp) {
+ ProcessSP process_sp = GetProcess();
+ if (process_sp) {
+ Target &target = process_sp->GetTarget();
+ auto descriptor = target.GetScriptedFrameProviderDescriptor();
+ if (descriptor && descriptor->IsValid()) {
+ // Check if this descriptor applies to this thread
+ if (descriptor->AppliesToThread(GetID())) {
+ if (llvm::Error error = LoadScriptedFrameProvider()) {
----------------
jimingham wrote:
I think this would be a lot easier to read if you returned m_curr_frames_sp unset from this branch if you get an error. This whole complicated structure is to see if you want to call LoadScriptedFrameProvider, and return without setting m_curr_frames_sp if it fails. Every other path through here does call the same make_shared in the end, so you could eliminate the last else clause altogether, and move the make_shared out of the if. That would be much clearer.
https://github.com/llvm/llvm-project/pull/161870
More information about the lldb-commits
mailing list