mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Fix crashes when callstack frames are not yet available.
This commit is contained in:
parent
5620597fb4
commit
dfc35c1bf1
@ -12059,7 +12059,10 @@ static tracy_force_inline CallstackFrameTree* GetFrameTreeItemNoGroup( flat_hash
|
|||||||
|
|
||||||
static tracy_force_inline CallstackFrameTree* GetFrameTreeItemGroup( flat_hash_map<uint64_t, CallstackFrameTree, nohash<uint64_t>>& tree, CallstackFrameId idx, const Worker& worker )
|
static tracy_force_inline CallstackFrameTree* GetFrameTreeItemGroup( flat_hash_map<uint64_t, CallstackFrameTree, nohash<uint64_t>>& tree, CallstackFrameId idx, const Worker& worker )
|
||||||
{
|
{
|
||||||
auto& frameData = *worker.GetCallstackFrame( idx );
|
auto frameDataPtr = worker.GetCallstackFrame( idx );
|
||||||
|
if( !frameDataPtr ) return nullptr;
|
||||||
|
|
||||||
|
auto& frameData = *frameDataPtr;
|
||||||
auto& frame = frameData.data[frameData.size-1];
|
auto& frame = frameData.data[frameData.size-1];
|
||||||
auto fidx = frame.name.Idx();
|
auto fidx = frame.name.Idx();
|
||||||
|
|
||||||
@ -12132,19 +12135,22 @@ flat_hash_map<uint64_t, CallstackFrameTree, nohash<uint64_t>> View::GetCallstack
|
|||||||
|
|
||||||
auto base = cs.back();
|
auto base = cs.back();
|
||||||
auto treePtr = GetFrameTreeItemGroup( root, base, m_worker );
|
auto treePtr = GetFrameTreeItemGroup( root, base, m_worker );
|
||||||
|
if( treePtr )
|
||||||
|
{
|
||||||
treePtr->count += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->alloc += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
|
|
||||||
for( int i = int( cs.size() ) - 2; i >= 0; i-- )
|
for( int i = int( cs.size() ) - 2; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker );
|
treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker );
|
||||||
|
if( !treePtr ) break;
|
||||||
treePtr->count += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->alloc += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( auto& path : pathSum )
|
for( auto& path : pathSum )
|
||||||
@ -12182,6 +12188,8 @@ flat_hash_map<uint64_t, CallstackFrameTree, nohash<uint64_t>> View::GetCallstack
|
|||||||
|
|
||||||
auto base = cs.front();
|
auto base = cs.front();
|
||||||
auto treePtr = GetFrameTreeItemGroup( root, base, m_worker );
|
auto treePtr = GetFrameTreeItemGroup( root, base, m_worker );
|
||||||
|
if( treePtr )
|
||||||
|
{
|
||||||
treePtr->count += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->alloc += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
@ -12189,12 +12197,14 @@ flat_hash_map<uint64_t, CallstackFrameTree, nohash<uint64_t>> View::GetCallstack
|
|||||||
for( int i = 1; i < cs.size(); i++ )
|
for( int i = 1; i < cs.size(); i++ )
|
||||||
{
|
{
|
||||||
treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker );
|
treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker );
|
||||||
|
if( !treePtr ) break;
|
||||||
treePtr->count += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->alloc += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( auto& path : pathSum )
|
for( auto& path : pathSum )
|
||||||
@ -12698,7 +12708,10 @@ void View::DrawFrameTreeLevel( const flat_hash_map<uint64_t, CallstackFrameTree,
|
|||||||
{
|
{
|
||||||
auto& v = _v->second;
|
auto& v = _v->second;
|
||||||
idx++;
|
idx++;
|
||||||
auto& frameData = *m_worker.GetCallstackFrame( v.frame );
|
auto frameDataPtr = m_worker.GetCallstackFrame( v.frame );
|
||||||
|
if( frameDataPtr )
|
||||||
|
{
|
||||||
|
auto& frameData = *frameDataPtr;
|
||||||
auto frame = frameData.data[frameData.size-1];
|
auto frame = frameData.data[frameData.size-1];
|
||||||
bool expand = false;
|
bool expand = false;
|
||||||
if( v.children.empty() )
|
if( v.children.empty() )
|
||||||
@ -12786,6 +12799,7 @@ void View::DrawFrameTreeLevel( const flat_hash_map<uint64_t, CallstackFrameTree,
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::DrawAllocList()
|
void View::DrawAllocList()
|
||||||
|
Loading…
Reference in New Issue
Block a user