@@ -358,15 +358,15 @@ bool SBFrame::SetPC(addr_t new_pc) {
358
358
std::unique_lock<std::recursive_mutex> lock;
359
359
ExecutionContext exe_ctx (m_opaque_sp.get (), lock);
360
360
361
- StackFrame *frame = nullptr ;
362
361
Target *target = exe_ctx.GetTargetPtr ();
363
362
Process *process = exe_ctx.GetProcessPtr ();
364
363
if (target && process) {
365
364
Process::StopLocker stop_locker;
366
365
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
+ }
370
370
}
371
371
}
372
372
}
@@ -381,15 +381,15 @@ addr_t SBFrame::GetSP() const {
381
381
std::unique_lock<std::recursive_mutex> lock;
382
382
ExecutionContext exe_ctx (m_opaque_sp.get (), lock);
383
383
384
- StackFrame *frame = nullptr ;
385
384
Target *target = exe_ctx.GetTargetPtr ();
386
385
Process *process = exe_ctx.GetProcessPtr ();
387
386
if (target && process) {
388
387
Process::StopLocker stop_locker;
389
388
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
+ }
393
393
}
394
394
}
395
395
}
@@ -404,15 +404,16 @@ addr_t SBFrame::GetFP() const {
404
404
std::unique_lock<std::recursive_mutex> lock;
405
405
ExecutionContext exe_ctx (m_opaque_sp.get (), lock);
406
406
407
- StackFrame *frame = nullptr ;
408
407
Target *target = exe_ctx.GetTargetPtr ();
409
408
Process *process = exe_ctx.GetProcessPtr ();
410
409
if (target && process) {
411
410
Process::StopLocker stop_locker;
412
411
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
+ }
416
417
}
417
418
}
418
419
0 commit comments