@@ -160,8 +160,7 @@ void RegisterContextUnwind::InitializeZerothFrame() {
160160 UnwindLogMsg (" using architectural default unwind method" );
161161 }
162162
163- AddressRange addr_range;
164- m_sym_ctx_valid = m_current_pc.ResolveFunctionScope (m_sym_ctx, &addr_range);
163+ m_sym_ctx_valid = m_current_pc.ResolveFunctionScope (m_sym_ctx);
165164
166165 if (m_sym_ctx.symbol ) {
167166 UnwindLogMsg (" with pc value of 0x%" PRIx64 " , symbol name is '%s'" ,
@@ -185,15 +184,9 @@ void RegisterContextUnwind::InitializeZerothFrame() {
185184 // If we were able to find a symbol/function, set addr_range to the bounds of
186185 // that symbol/function. else treat the current pc value as the start_pc and
187186 // record no offset.
188- if (addr_range.GetBaseAddress ().IsValid ()) {
189- m_start_pc = addr_range.GetBaseAddress ();
190- if (m_current_pc.GetSection () == m_start_pc.GetSection ()) {
191- m_current_offset = m_current_pc.GetOffset () - m_start_pc.GetOffset ();
192- } else if (m_current_pc.GetModule () == m_start_pc.GetModule ()) {
193- // This means that whatever symbol we kicked up isn't really correct ---
194- // we should not cross section boundaries ... We really should NULL out
195- // the function/symbol in this case unless there is a bad assumption here
196- // due to inlined functions?
187+ if (m_sym_ctx_valid) {
188+ m_start_pc = m_sym_ctx.GetFunctionOrSymbolAddress ();
189+ if (m_current_pc.GetModule () == m_start_pc.GetModule ()) {
197190 m_current_offset =
198191 m_current_pc.GetFileAddress () - m_start_pc.GetFileAddress ();
199192 }
@@ -499,8 +492,7 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
499492 return ;
500493 }
501494
502- AddressRange addr_range;
503- m_sym_ctx_valid = m_current_pc.ResolveFunctionScope (m_sym_ctx, &addr_range);
495+ m_sym_ctx_valid = m_current_pc.ResolveFunctionScope (m_sym_ctx);
504496
505497 if (m_sym_ctx.symbol ) {
506498 UnwindLogMsg (" with pc value of 0x%" PRIx64 " , symbol name is '%s'" , pc,
@@ -524,9 +516,8 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
524516 // Don't decrement if we're "above" an asynchronous event like
525517 // sigtramp.
526518 decr_pc_and_recompute_addr_range = false ;
527- } else if (!addr_range.GetBaseAddress ().IsValid () ||
528- addr_range.GetBaseAddress ().GetSection () != m_current_pc.GetSection () ||
529- addr_range.GetBaseAddress ().GetOffset () != m_current_pc.GetOffset ()) {
519+ } else if (Address addr = m_sym_ctx.GetFunctionOrSymbolAddress ();
520+ addr != m_current_pc) {
530521 // If our "current" pc isn't the start of a function, decrement the pc
531522 // if we're up the stack.
532523 if (m_behaves_like_zeroth_frame)
@@ -559,7 +550,7 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
559550 Address temporary_pc;
560551 temporary_pc.SetLoadAddress (pc - 1 , &process->GetTarget ());
561552 m_sym_ctx.Clear (false );
562- m_sym_ctx_valid = temporary_pc.ResolveFunctionScope (m_sym_ctx, &addr_range );
553+ m_sym_ctx_valid = temporary_pc.ResolveFunctionScope (m_sym_ctx);
563554
564555 UnwindLogMsg (" Symbol is now %s" ,
565556 GetSymbolOrFunctionName (m_sym_ctx).AsCString (" " ));
@@ -568,8 +559,8 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
568559 // If we were able to find a symbol/function, set addr_range_ptr to the
569560 // bounds of that symbol/function. else treat the current pc value as the
570561 // start_pc and record no offset.
571- if (addr_range. GetBaseAddress (). IsValid () ) {
572- m_start_pc = addr_range. GetBaseAddress ();
562+ if (m_sym_ctx_valid ) {
563+ m_start_pc = m_sym_ctx. GetFunctionOrSymbolAddress ();
573564 m_current_offset = pc - m_start_pc.GetLoadAddress (&process->GetTarget ());
574565 m_current_offset_backed_up_one = m_current_offset;
575566 if (decr_pc_and_recompute_addr_range &&
@@ -1952,8 +1943,7 @@ void RegisterContextUnwind::PropagateTrapHandlerFlagFromUnwindPlan(
19521943 GetSymbolOrFunctionName (m_sym_ctx).AsCString (" " ));
19531944 m_current_offset_backed_up_one = m_current_offset;
19541945
1955- AddressRange addr_range;
1956- m_sym_ctx_valid = m_current_pc.ResolveFunctionScope (m_sym_ctx, &addr_range);
1946+ m_sym_ctx_valid = m_current_pc.ResolveFunctionScope (m_sym_ctx);
19571947
19581948 UnwindLogMsg (" Symbol is now %s" ,
19591949 GetSymbolOrFunctionName (m_sym_ctx).AsCString (" " ));
@@ -1962,9 +1952,11 @@ void RegisterContextUnwind::PropagateTrapHandlerFlagFromUnwindPlan(
19621952 Process *process = exe_ctx.GetProcessPtr ();
19631953 Target *target = &process->GetTarget ();
19641954
1965- m_start_pc = addr_range.GetBaseAddress ();
1966- m_current_offset =
1967- m_current_pc.GetLoadAddress (target) - m_start_pc.GetLoadAddress (target);
1955+ if (m_sym_ctx_valid) {
1956+ m_start_pc = m_sym_ctx.GetFunctionOrSymbolAddress ();
1957+ m_current_offset = m_current_pc.GetLoadAddress (target) -
1958+ m_start_pc.GetLoadAddress (target);
1959+ }
19681960 }
19691961}
19701962
0 commit comments