mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Expose symbol source location data.
This commit is contained in:
parent
26cee8acf0
commit
847069a59d
@ -11132,6 +11132,8 @@ void View::DrawCallstackWindow()
|
||||
ImGui::RadioButton( "Return address", &m_showCallstackFrameAddress, 1 );
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton( "Symbol address", &m_showCallstackFrameAddress, 2 );
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton( "Function", &m_showCallstackFrameAddress, 3 );
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
auto& cs = m_worker.GetCallstack( m_callstackInfoWindow );
|
||||
@ -11295,19 +11297,67 @@ void View::DrawCallstackWindow()
|
||||
ImGui::TextDisabled( "Custom #%" PRIu64, entry.idx );
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
const auto sym = m_worker.GetSymbolData( frame.symAddr );
|
||||
if( sym )
|
||||
{
|
||||
const auto symtxt = m_worker.GetString( sym->file );
|
||||
if( sym->line == 0 )
|
||||
{
|
||||
TextDisabledUnformatted( symtxt );
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextDisabled( "%s:%i", symtxt, sym->line );
|
||||
}
|
||||
if( ImGui::IsItemClicked() )
|
||||
{
|
||||
ImGui::SetClipboardText( symtxt );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TextDisabledUnformatted( "[unknown]" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
if( ImGui::IsItemClicked( 1 ) )
|
||||
{
|
||||
if( SourceFileValid( txt, m_worker.GetCaptureTime() ) )
|
||||
if( m_showCallstackFrameAddress == 3 )
|
||||
{
|
||||
SetTextEditorFile( txt, frame.line );
|
||||
const auto sym = m_worker.GetSymbolData( frame.symAddr );
|
||||
if( sym )
|
||||
{
|
||||
const auto symtxt = m_worker.GetString( sym->file );
|
||||
if( SourceFileValid( symtxt, m_worker.GetCaptureTime() ) )
|
||||
{
|
||||
SetTextEditorFile( symtxt, sym->line );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_callstackBuzzAnim.Enable( bidx, 0.5f );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_callstackBuzzAnim.Enable( bidx, 0.5f );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_callstackBuzzAnim.Enable( bidx, 0.5f );
|
||||
if( SourceFileValid( txt, m_worker.GetCaptureTime() ) )
|
||||
{
|
||||
SetTextEditorFile( txt, frame.line );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_callstackBuzzAnim.Enable( bidx, 0.5f );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( indentVal != 0.f )
|
||||
|
@ -2004,6 +2004,19 @@ const CallstackFrameData* Worker::GetCallstackFrame( const CallstackFrameId& ptr
|
||||
}
|
||||
}
|
||||
|
||||
const SymbolData* Worker::GetSymbolData( uint64_t sym ) const
|
||||
{
|
||||
auto it = m_data.symbolMap.find( sym );
|
||||
if( it == m_data.symbolMap.end() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &it->second;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Worker::GetZoneEnd( const ZoneEvent& ev )
|
||||
{
|
||||
auto ptr = &ev;
|
||||
|
@ -382,6 +382,7 @@ public:
|
||||
const VarArray<CallstackFrameId>& GetCallstack( uint32_t idx ) const { return *m_data.callstackPayload[idx]; }
|
||||
const CallstackFrameData* GetCallstackFrame( const CallstackFrameId& ptr ) const;
|
||||
uint64_t GetCanonicalPointer( const CallstackFrameId& id ) const;
|
||||
const SymbolData* GetSymbolData( uint64_t sym ) const;
|
||||
|
||||
const CrashEvent& GetCrashEvent() const { return m_data.crashEvent; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user