@@ -94,8 +94,9 @@ bool RegisterContextUnwind::IsUnwindPlanValidForCurrentPC(
94
94
return true ;
95
95
}
96
96
97
- // if m_current_offset <= 0, we've got nothing else to try
98
- if (m_current_offset <= 0 )
97
+ // If don't have an offset or we're at the start of the function, we've got
98
+ // nothing else to try.
99
+ if (!m_current_offset || m_current_offset == 0 )
99
100
return false ;
100
101
101
102
// check pc - 1 to see if it's valid
@@ -198,8 +199,8 @@ void RegisterContextUnwind::InitializeZerothFrame() {
198
199
m_current_offset_backed_up_one = m_current_offset;
199
200
} else {
200
201
m_start_pc = m_current_pc;
201
- m_current_offset = - 1 ;
202
- m_current_offset_backed_up_one = - 1 ;
202
+ m_current_offset = std::nullopt ;
203
+ m_current_offset_backed_up_one = std::nullopt ;
203
204
}
204
205
205
206
// We've set m_frame_type and m_sym_ctx before these calls.
@@ -437,8 +438,8 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
437
438
m_frame_type = eNormalFrame;
438
439
}
439
440
m_all_registers_available = false ;
440
- m_current_offset = - 1 ;
441
- m_current_offset_backed_up_one = - 1 ;
441
+ m_current_offset = std::nullopt ;
442
+ m_current_offset_backed_up_one = std::nullopt ;
442
443
RegisterKind row_register_kind = m_full_unwind_plan_sp->GetRegisterKind ();
443
444
if (const UnwindPlan::Row *row =
444
445
m_full_unwind_plan_sp->GetRowForFunctionOffset (0 )) {
@@ -569,16 +570,16 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
569
570
m_current_offset = pc - m_start_pc.GetLoadAddress (&process->GetTarget ());
570
571
m_current_offset_backed_up_one = m_current_offset;
571
572
if (decr_pc_and_recompute_addr_range &&
572
- m_current_offset_backed_up_one > 0 ) {
573
- m_current_offset_backed_up_one-- ;
573
+ m_current_offset_backed_up_one != 0 ) {
574
+ --*m_current_offset_backed_up_one ;
574
575
if (m_sym_ctx_valid) {
575
576
m_current_pc.SetLoadAddress (pc - 1 , &process->GetTarget ());
576
577
}
577
578
}
578
579
} else {
579
580
m_start_pc = m_current_pc;
580
- m_current_offset = - 1 ;
581
- m_current_offset_backed_up_one = - 1 ;
581
+ m_current_offset = std::nullopt ;
582
+ m_current_offset_backed_up_one = std::nullopt ;
582
583
}
583
584
584
585
if (IsTrapHandlerSymbol (process, m_sym_ctx)) {
@@ -746,7 +747,7 @@ bool RegisterContextUnwind::BehavesLikeZerothFrame() const {
746
747
// 2. m_sym_ctx should already be filled in, and
747
748
// 3. m_current_pc should have the current pc value for this frame
748
749
// 4. m_current_offset_backed_up_one should have the current byte offset into
749
- // the function, maybe backed up by 1, -1 if unknown
750
+ // the function, maybe backed up by 1, std::nullopt if unknown
750
751
751
752
UnwindPlanSP RegisterContextUnwind::GetFastUnwindPlanForFrame () {
752
753
UnwindPlanSP unwind_plan_sp;
@@ -790,7 +791,7 @@ UnwindPlanSP RegisterContextUnwind::GetFastUnwindPlanForFrame() {
790
791
// 2. m_sym_ctx should already be filled in, and
791
792
// 3. m_current_pc should have the current pc value for this frame
792
793
// 4. m_current_offset_backed_up_one should have the current byte offset into
793
- // the function, maybe backed up by 1, -1 if unknown
794
+ // the function, maybe backed up by 1, std::nullopt if unknown
794
795
795
796
UnwindPlanSP RegisterContextUnwind::GetFullUnwindPlanForFrame () {
796
797
UnwindPlanSP unwind_plan_sp;
0 commit comments