Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2020-10-06 15:50:55 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2020-10-06 15:50:55 +0300
commit8adfd45453709524b35441335ff3a575607da9fe (patch)
tree222a9b3c64a6d453353416464e2906336e8e302b /capture
parentc9b64ef5c5ef5231151665b739d58a10111e415e (diff)
Display failure callstack in capture utility.
Diffstat (limited to 'capture')
-rw-r--r--capture/build/win32/capture.vcxproj2
-rw-r--r--capture/build/win32/capture.vcxproj.filters6
-rw-r--r--capture/src/capture.cpp71
3 files changed, 79 insertions, 0 deletions
diff --git a/capture/build/win32/capture.vcxproj b/capture/build/win32/capture.vcxproj
index 2a9230b3..58616ca3 100644
--- a/capture/build/win32/capture.vcxproj
+++ b/capture/build/win32/capture.vcxproj
@@ -142,6 +142,7 @@
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
<ClCompile Include="..\..\..\server\TracyMmap.cpp" />
<ClCompile Include="..\..\..\server\TracyPrint.cpp" />
+ <ClCompile Include="..\..\..\server\TracyStackFrames.cpp" />
<ClCompile Include="..\..\..\server\TracyTaskDispatch.cpp" />
<ClCompile Include="..\..\..\server\TracyTextureCompression.cpp" />
<ClCompile Include="..\..\..\server\TracyThreadCompress.cpp" />
@@ -194,6 +195,7 @@
<ClInclude Include="..\..\..\server\TracyPopcnt.hpp" />
<ClInclude Include="..\..\..\server\TracyPrint.hpp" />
<ClInclude Include="..\..\..\server\TracySlab.hpp" />
+ <ClInclude Include="..\..\..\server\TracyStackFrames.hpp" />
<ClInclude Include="..\..\..\server\TracyTaskDispatch.hpp" />
<ClInclude Include="..\..\..\server\TracyTextureCompression.hpp" />
<ClInclude Include="..\..\..\server\TracyThreadCompress.hpp" />
diff --git a/capture/build/win32/capture.vcxproj.filters b/capture/build/win32/capture.vcxproj.filters
index 8b0cc276..e90842af 100644
--- a/capture/build/win32/capture.vcxproj.filters
+++ b/capture/build/win32/capture.vcxproj.filters
@@ -132,6 +132,9 @@
<ClCompile Include="..\..\..\getopt\getopt.c">
<Filter>getopt</Filter>
</ClCompile>
+ <ClCompile Include="..\..\..\server\TracyStackFrames.cpp">
+ <Filter>server</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
@@ -296,5 +299,8 @@
<ClInclude Include="..\..\..\getopt\getopt.h">
<Filter>getopt</Filter>
</ClInclude>
+ <ClInclude Include="..\..\..\server\TracyStackFrames.hpp">
+ <Filter>server</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/capture/src/capture.cpp b/capture/src/capture.cpp
index 5b4bf436..c2122dec 100644
--- a/capture/src/capture.cpp
+++ b/capture/src/capture.cpp
@@ -17,6 +17,7 @@
#include "../../server/TracyFileWrite.hpp"
#include "../../server/TracyMemory.hpp"
#include "../../server/TracyPrint.hpp"
+#include "../../server/TracyStackFrames.hpp"
#include "../../server/TracyWorker.hpp"
#include "../../getopt/getopt.h"
@@ -165,6 +166,76 @@ int main( int argc, char** argv )
if( failure != tracy::Worker::Failure::None )
{
printf( "\n\033[31;1mInstrumentation failure: %s\033[0m", tracy::Worker::GetFailureString( failure ) );
+ auto& fd = worker.GetFailureData();
+ if( fd.callstack != 0 )
+ {
+ printf( "\n\033[1mFailure callstack:\033[0m\n" );
+ auto& cs = worker.GetCallstack( fd.callstack );
+ int fidx = 0;
+ int bidx = 0;
+ for( auto& entry : cs )
+ {
+ auto frameData = worker.GetCallstackFrame( entry );
+ if( !frameData )
+ {
+ printf( "%3i. %p\n", fidx++, (void*)worker.GetCanonicalPointer( entry ) );
+ }
+ else
+ {
+ const auto fsz = frameData->size;
+ for( uint8_t f=0; f<fsz; f++ )
+ {
+ const auto& frame = frameData->data[f];
+ auto txt = worker.GetString( frame.name );
+
+ if( fidx == 0 && f != fsz-1 )
+ {
+ auto test = tracy::s_tracyStackFrames;
+ bool match = false;
+ do
+ {
+ if( strcmp( txt, *test ) == 0 )
+ {
+ match = true;
+ break;
+ }
+ }
+ while( *++test );
+ if( match ) continue;
+ }
+
+ bidx++;
+
+ if( f == fsz-1 )
+ {
+ printf( "%3i. ", fidx++ );
+ }
+ else
+ {
+ printf( "\033[30;1minl. " );
+ }
+ printf( "\033[0;36m%s ", txt );
+ txt = worker.GetString( frame.file );
+ if( frame.line == 0 )
+ {
+ printf( "\033[33m(%s)", txt );
+ }
+ else
+ {
+ printf( "\033[33m(%s:%" PRIu32 ")", txt, frame.line );
+ }
+ if( frameData->imageName.Active() )
+ {
+ printf( "\033[35m %s\033[0m\n", worker.GetString( frameData->imageName ) );
+ }
+ else
+ {
+ printf( "\033[0m\n" );
+ }
+ }
+ }
+ }
+ }
}
printf( "\nFrames: %" PRIu64 "\nTime span: %s\nZones: %s\nElapsed time: %s\nSaving trace...",