Skip to content

Commit 3674a9e

Browse files
author
git apple-llvm automerger
committed
Merge commit 'ac83e27cddd4' from apple/stable/20200108 into swift/release/5.3
2 parents 2bb6a12 + ac83e27 commit 3674a9e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

lldb/source/API/SBFrame.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,15 @@ bool SBFrame::SetPC(addr_t new_pc) {
358358
std::unique_lock<std::recursive_mutex> lock;
359359
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
360360

361-
StackFrame *frame = nullptr;
362361
Target *target = exe_ctx.GetTargetPtr();
363362
Process *process = exe_ctx.GetProcessPtr();
364363
if (target && process) {
365364
Process::StopLocker stop_locker;
366365
if (stop_locker.TryLock(&process->GetRunLock())) {
367-
frame = exe_ctx.GetFramePtr();
368-
if (frame) {
369-
ret_val = frame->GetRegisterContext()->SetPC(new_pc);
366+
if (StackFrame *frame = exe_ctx.GetFramePtr()) {
367+
if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
368+
ret_val = reg_ctx_sp->SetPC(new_pc);
369+
}
370370
}
371371
}
372372
}
@@ -381,15 +381,15 @@ addr_t SBFrame::GetSP() const {
381381
std::unique_lock<std::recursive_mutex> lock;
382382
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
383383

384-
StackFrame *frame = nullptr;
385384
Target *target = exe_ctx.GetTargetPtr();
386385
Process *process = exe_ctx.GetProcessPtr();
387386
if (target && process) {
388387
Process::StopLocker stop_locker;
389388
if (stop_locker.TryLock(&process->GetRunLock())) {
390-
frame = exe_ctx.GetFramePtr();
391-
if (frame) {
392-
addr = frame->GetRegisterContext()->GetSP();
389+
if (StackFrame *frame = exe_ctx.GetFramePtr()) {
390+
if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
391+
addr = reg_ctx_sp->GetSP();
392+
}
393393
}
394394
}
395395
}
@@ -404,15 +404,16 @@ addr_t SBFrame::GetFP() const {
404404
std::unique_lock<std::recursive_mutex> lock;
405405
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
406406

407-
StackFrame *frame = nullptr;
408407
Target *target = exe_ctx.GetTargetPtr();
409408
Process *process = exe_ctx.GetProcessPtr();
410409
if (target && process) {
411410
Process::StopLocker stop_locker;
412411
if (stop_locker.TryLock(&process->GetRunLock())) {
413-
frame = exe_ctx.GetFramePtr();
414-
if (frame)
415-
addr = frame->GetRegisterContext()->GetFP();
412+
if (StackFrame *frame = exe_ctx.GetFramePtr()) {
413+
if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext()) {
414+
addr = reg_ctx_sp->GetFP();
415+
}
416+
}
416417
}
417418
}
418419

0 commit comments

Comments
 (0)