diff --git a/profiler/src/profiler/TracySourceView.cpp b/profiler/src/profiler/TracySourceView.cpp index 08b89669..7d753a85 100644 --- a/profiler/src/profiler/TracySourceView.cpp +++ b/profiler/src/profiler/TracySourceView.cpp @@ -5590,6 +5590,16 @@ const std::vector* SourceView::GetAddressesForLocation( uint32_t fileS } else { + // In some cases debug data can be nonsense, assigning an inline function to the same line as the parent. + // The specific example is in TracySysTrace.cpp:1150, which has the following local stack trace: + // 1. RingBuffer::Enable() TracySysTrace.cpp:1150 + // 2. SysTraceWorker() TracySysTrace.cpp:1150 + // RingBuffer::Enable() is in TracyRingBuffer.hpp:74, and this line is assigned to the remaining asm lines + // generated by this inline function. But for some reason, the parent call site is assigned for the first + // asm line, that should be assigned to the inline function itself. + // Workaround this by checking if the asm line address is already in the list. + if( lit->second.back() == op.addr ) continue; + assert( lit->second.back() < op.addr ); lit->second.emplace_back( op.addr ); }