diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -361,9 +361,11 @@ Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { frame = exe_ctx.GetFramePtr(); - if (frame) { - ret_val = frame->GetRegisterContext()->SetPC(new_pc); - } + RegisterContextSP reg_ctx_sp = nullptr; + if (frame) + reg_ctx_sp = frame->GetRegisterContext(); + if (reg_ctx_sp) + ret_val = reg_ctx_sp->SetPC(new_pc); } } @@ -384,9 +386,11 @@ Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { frame = exe_ctx.GetFramePtr(); - if (frame) { - addr = frame->GetRegisterContext()->GetSP(); - } + RegisterContextSP reg_ctx_sp = nullptr; + if (frame) + reg_ctx_sp = frame->GetRegisterContext(); + if (reg_ctx_sp) + addr = reg_ctx_sp->GetSP(); } } @@ -407,8 +411,11 @@ Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) { frame = exe_ctx.GetFramePtr(); + RegisterContextSP reg_ctx_sp = nullptr; if (frame) - addr = frame->GetRegisterContext()->GetFP(); + reg_ctx_sp = frame->GetRegisterContext(); + if (reg_ctx_sp) + addr = reg_ctx_sp->GetFP(); } }