@@ -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
@@ -199,8 +200,8 @@ void RegisterContextUnwind::InitializeZerothFrame() {
199
200
m_current_offset_backed_up_one = m_current_offset;
200
201
} else {
201
202
m_start_pc = m_current_pc;
202
- m_current_offset = - 1 ;
203
- m_current_offset_backed_up_one = - 1 ;
203
+ m_current_offset = std::nullopt ;
204
+ m_current_offset_backed_up_one = std::nullopt ;
204
205
}
205
206
206
207
// We've set m_frame_type and m_sym_ctx before these calls.
@@ -439,8 +440,8 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
439
440
m_frame_type = eNormalFrame;
440
441
}
441
442
m_all_registers_available = false ;
442
- m_current_offset = - 1 ;
443
- m_current_offset_backed_up_one = - 1 ;
443
+ m_current_offset = std::nullopt ;
444
+ m_current_offset_backed_up_one = std::nullopt ;
444
445
RegisterKind row_register_kind = m_full_unwind_plan_sp->GetRegisterKind ();
445
446
if (const UnwindPlan::Row *row =
446
447
m_full_unwind_plan_sp->GetRowForFunctionOffset (0 )) {
@@ -571,16 +572,16 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
571
572
m_current_offset = pc - m_start_pc.GetLoadAddress (&process->GetTarget ());
572
573
m_current_offset_backed_up_one = m_current_offset;
573
574
if (decr_pc_and_recompute_addr_range &&
574
- m_current_offset_backed_up_one > 0 ) {
575
- m_current_offset_backed_up_one-- ;
575
+ m_current_offset_backed_up_one != 0 ) {
576
+ --*m_current_offset_backed_up_one ;
576
577
if (m_sym_ctx_valid) {
577
578
m_current_pc.SetLoadAddress (pc - 1 , &process->GetTarget ());
578
579
}
579
580
}
580
581
} else {
581
582
m_start_pc = m_current_pc;
582
- m_current_offset = - 1 ;
583
- m_current_offset_backed_up_one = - 1 ;
583
+ m_current_offset = std::nullopt ;
584
+ m_current_offset_backed_up_one = std::nullopt ;
584
585
}
585
586
586
587
if (IsTrapHandlerSymbol (process, m_sym_ctx)) {
@@ -748,7 +749,7 @@ bool RegisterContextUnwind::BehavesLikeZerothFrame() const {
748
749
// 2. m_sym_ctx should already be filled in, and
749
750
// 3. m_current_pc should have the current pc value for this frame
750
751
// 4. m_current_offset_backed_up_one should have the current byte offset into
751
- // the function, maybe backed up by 1, -1 if unknown
752
+ // the function, maybe backed up by 1, std::nullopt if unknown
752
753
753
754
std::shared_ptr<const UnwindPlan>
754
755
RegisterContextUnwind::GetFastUnwindPlanForFrame () {
@@ -790,7 +791,7 @@ 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
std::shared_ptr<const UnwindPlan>
796
797
RegisterContextUnwind::GetFullUnwindPlanForFrame () {
0 commit comments