From: Mikhail Kurinnoi Date: Wed, 15 Jul 2020 16:07:29 +0000 (+0300) Subject: Fix UpdateCallStackPop(). X-Git-Tag: submit/tizen/20200719.220954~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d855ab2ef8dcfeba5d45ba69142f0f5e30b246fe;p=sdk%2Ftools%2Fcoreprofiler.git Fix UpdateCallStackPop(). Fix SIGABRT during stack unwind if CodeGen::genProfilingEnterCallback and CodeGen::genProfilingLeaveCallback no implemented in CoreCLR. --- diff --git a/src/trace/executiontrace.cpp b/src/trace/executiontrace.cpp index 9cef883..8cd836b 100644 --- a/src/trace/executiontrace.cpp +++ b/src/trace/executiontrace.cpp @@ -375,12 +375,20 @@ void ExecutionTrace::UpdateCallStackPop() noexcept { SamplingSharedState state = {}; state.stackWillBeChanged = true; + bool needPrintWarning = false; m_profiler.GetCommonTrace().InterruptSampling( state, {}, - [](ThreadInfo &thrInfo, SamplingSharedState &state) + [&needPrintWarning](ThreadInfo &thrInfo, SamplingSharedState &state) { - thrInfo.eventChannel.Pop(); + // AArch64 CoreCLR versions till 5.0 don't have CodeGen::genProfilingEnterCallback and CodeGen::genProfilingLeaveCallback + // implemented, CoreCLR will not call EnterNaked3(), LeaveNaked3() and TailcallNaked3(). As result, we don't have full callstack. + // Note, ICorProfilerInfo3::SetEnterLeaveFunctionHooks3() don't provide any errors connected to issue above. + if (thrInfo.eventChannel.GetStackSize() > 0) + thrInfo.eventChannel.Pop(); + else + needPrintWarning = true; + if (thrInfo.maxRestoreIpIdx > 0) { --thrInfo.maxRestoreIpIdx; @@ -389,6 +397,8 @@ void ExecutionTrace::UpdateCallStackPop() noexcept state.stackWillBeChanged = false; } ); + if (needPrintWarning) + LOG().Warn() << "More callstack pop requests, than data was pushed."; } UINT_PTR ExecutionTrace::FunctionIDMap(