@@ -354,15 +354,15 @@ bool SBFrame::SetPC(addr_t new_pc) {
354
354
std::unique_lock<std::recursive_mutex> lock;
355
355
ExecutionContext exe_ctx (m_opaque_sp.get (), lock);
356
356
357
- StackFrame *frame = nullptr ;
358
357
Target *target = exe_ctx.GetTargetPtr ();
359
358
Process *process = exe_ctx.GetProcessPtr ();
360
359
if (target && process) {
361
360
Process::StopLocker stop_locker;
362
361
if (stop_locker.TryLock (&process->GetRunLock ())) {
363
- frame = exe_ctx.GetFramePtr ();
364
- if (frame) {
365
- ret_val = frame->GetRegisterContext ()->SetPC (new_pc);
362
+ if (StackFrame *frame = exe_ctx.GetFramePtr ()) {
363
+ if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext ()) {
364
+ ret_val = reg_ctx_sp->SetPC (new_pc);
365
+ }
366
366
}
367
367
}
368
368
}
@@ -377,15 +377,15 @@ addr_t SBFrame::GetSP() const {
377
377
std::unique_lock<std::recursive_mutex> lock;
378
378
ExecutionContext exe_ctx (m_opaque_sp.get (), lock);
379
379
380
- StackFrame *frame = nullptr ;
381
380
Target *target = exe_ctx.GetTargetPtr ();
382
381
Process *process = exe_ctx.GetProcessPtr ();
383
382
if (target && process) {
384
383
Process::StopLocker stop_locker;
385
384
if (stop_locker.TryLock (&process->GetRunLock ())) {
386
- frame = exe_ctx.GetFramePtr ();
387
- if (frame) {
388
- addr = frame->GetRegisterContext ()->GetSP ();
385
+ if (StackFrame *frame = exe_ctx.GetFramePtr ()) {
386
+ if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext ()) {
387
+ addr = reg_ctx_sp->GetSP ();
388
+ }
389
389
}
390
390
}
391
391
}
@@ -400,15 +400,16 @@ addr_t SBFrame::GetFP() const {
400
400
std::unique_lock<std::recursive_mutex> lock;
401
401
ExecutionContext exe_ctx (m_opaque_sp.get (), lock);
402
402
403
- StackFrame *frame = nullptr ;
404
403
Target *target = exe_ctx.GetTargetPtr ();
405
404
Process *process = exe_ctx.GetProcessPtr ();
406
405
if (target && process) {
407
406
Process::StopLocker stop_locker;
408
407
if (stop_locker.TryLock (&process->GetRunLock ())) {
409
- frame = exe_ctx.GetFramePtr ();
410
- if (frame)
411
- addr = frame->GetRegisterContext ()->GetFP ();
408
+ if (StackFrame *frame = exe_ctx.GetFramePtr ()) {
409
+ if (RegisterContextSP reg_ctx_sp = frame->GetRegisterContext ()) {
410
+ addr = reg_ctx_sp->GetFP ();
411
+ }
412
+ }
412
413
}
413
414
}
414
415
0 commit comments