Commit Graph

1175 Commits

Author SHA1 Message Date
Blake Taylor
cc33846111 Fix unreachable error when compiling warnings as errors + timer fallback 2022-05-02 16:35:48 -07:00
Bartosz Taudul
0c9eb0b5be
Absolute source paths are required by debuginfod. 2022-05-02 01:12:34 +02:00
Bartosz Taudul
6455fcfa91
Make source code query handling easier to follow.
Also, limit debuginfod source file upload to not exceed target frame size.
2022-05-02 01:12:34 +02:00
Bartosz Taudul
b6f155bb6a
Move debuginfod include to TracyCallstack.hpp. 2022-05-02 01:12:34 +02:00
Bartosz Taudul
f540f3ad89
Remove accidentally committed line. 2022-05-02 01:12:34 +02:00
Bartosz Taudul
6e6f19d8f7
Query debuginfod for source code. 2022-05-02 01:12:34 +02:00
Bartosz Taudul
726b70b683
Add debuginfod context accessor. 2022-05-02 01:12:33 +02:00
Bartosz Taudul
ae373b4050
Implement build id retrieval by image name. 2022-05-02 01:12:33 +02:00
Michael Puskas
a5ea07f107 Fix build options, add TRACY_TIMER_FALLBACK option.
Renamed TRACY_NO_SYS_TRACE -> TRACY_NO_SYSTEM_TRACING to match the
build flag name. Unlike the meson logic, the CMake logic directly
maps the option name to the build flag that is injected. With the
mismatched name, the flag wasn't being properly applied.

Added TRACY_TIMER_FALLBACK option to expose the same-named flag.

Moved signal.h include to get sigaction definition that was missing when
TRACY_NO_CALLSTACK was defined.
2022-05-01 13:52:27 -07:00
Bartosz Taudul
aa2bbfe5f9
Transfer executable image name in source file queries. 2022-05-01 14:30:18 +02:00
Bartosz Taudul
20cfdc3022
Save executable file names next to build identifiers. 2022-05-01 12:43:15 +02:00
Bartosz Taudul
6b10ed0af7
Remove debug info retrieval and download separation.
Retrieval of the descriptor has to be performed in a single step. Finding out
what is missing and then downloading in bulk is not possible, as libbacktrace
caches the returned descriptors.
2022-04-30 23:23:20 +02:00
Bartosz Taudul
4549671caa
Collect and issue debuginfod requests.
Build identifiers stored in vectors are searched linearly. While not optimal,
this is enough for a basic implementation. In the future binary search option
may be explored, to see if it is worthwhile. Possible gains wouldn't be
significant, due to relatively small amount of debug info modules to handle.

Debug info descriptor requests that have not yet been checked for (i.e. not in
the s_di_known vector) are stored in the s_di_pending vector. When a check is
performed from within a libbacktrace callback handler, there are some unknown
problems with downloading data. Hence, the download process is delayed to be
performed at a later time. The debug info descriptors retrieval can be then
repeated.
2022-04-30 21:35:14 +02:00
Bartosz Taudul
d9fb5c71eb
Add debug info data structures. 2022-04-30 20:07:47 +02:00
Bartosz Taudul
8b477291f2
Initialize debuginfod session. 2022-04-30 19:19:00 +02:00
Bartosz Taudul
532c5a240c
Add no-op callstack cleanup procedure. 2022-04-30 19:18:52 +02:00
Bartosz Taudul
254e87cbac
Fix preprocessor syntax. 2022-04-30 19:00:54 +02:00
Bartosz Taudul
2ef014608f
Notify when software sampling setup has failed. 2022-04-29 19:13:40 +02:00
Blake Taylor
8c5120ee5a Add flag to disable crash handler 2022-04-27 07:11:53 -07:00
Bartosz Taudul
7493663e13
It's Debian, it's always Debian.
/usr/lib/gcc/x86_64-linux-gnu/9/include/cpuid.h:223:1: error: redefinition of ‘unsigned int __get_cpuid_max(unsigned int, unsigned int*)’
In file included from ../../client/TracyProfiler.cpp:108,
                 from ../../TracyClient.cpp:23:
/usr/lib/gcc/x86_64-linux-gnu/9/include/cpuid.h:223:1: note: ‘unsigned int __get_cpuid_max(unsigned int, unsigned int*)’ previously defined here
2022-04-26 22:19:32 +02:00
Bartosz Taudul
80d760d950
Define NEON data tables only if NEON is available. 2022-04-26 22:01:09 +02:00
Bartosz Taudul
95cf143336
Remove unused variables. 2022-04-26 22:01:09 +02:00
Bartosz Taudul
066c266df9
Add missing includes. 2022-04-26 22:01:09 +02:00
Blake Taylor
c176d1d603 -Set thread init false on thread exit for manual lifetime cases 2022-04-05 09:12:05 -07:00
Bartosz Taudul
3d28d1259b
Check if ring buffer was properly mapped. 2022-04-04 17:56:40 +02:00
Bartosz Taudul
e83e83dae9
Revert "Backport SPSCQueue commit 3086fa9."
This reverts commit 2a3a57d245.

Fucking MSVC 2015 has chosen to emit errors on unsupported attributes.
2022-04-01 16:46:50 +02:00
Benoit Jacob
5eb3e3a1f0 set s_numCpus before reading it 2022-03-24 18:31:38 +00:00
Bartosz Taudul
2a3a57d245
Backport SPSCQueue commit 3086fa9. 2022-03-18 02:09:00 +01:00
Bartosz Taudul
c2fcc699be
Apply SPSCQueue commit 62cdc1f3. 2022-03-18 02:05:55 +01:00
Bartosz Taudul
0b1e5d2c96
Define ___tracy_demangle on Android. 2022-03-11 15:40:56 +01:00
Bartosz Taudul
7d3c7049dc
Fix compilation on MSVC 2015. 2022-03-10 12:27:44 +01:00
Dave Rigby
2073ffb684 program_invocation_short_name is Linux-specific
'program_invocation_short_name' is Linux-specific; other OSs such as
macOS do not support it.

Fixes build break on macOS 12.2 with _GNU_SOURCE defined.
2022-02-28 16:09:06 +00:00
Bartosz Taudul
e2b0268d7a
Allow disabling callstack handling. 2022-02-22 21:26:55 +01:00
Bartosz Taudul
d318f75123
Merge pull request #325 from BrychDaneel/automatic_timer_fallback
Automatic timer fallback
2022-02-21 13:47:50 +01:00
Daniil Brychikov
a9ba1ce688 Codestyle fixes 2022-02-19 11:44:15 +03:00
Daniil Brychikov
73f6c66cde Automatic timer fallback 2022-02-16 15:18:45 +03:00
Bartosz Taudul
46d2977694
prev_state is long. 2022-02-14 22:34:20 +01:00
Bartosz Taudul
9f2ffb05ac
Check if memory can be allocated in a thread.
Consider running the following code with operator new and delete overloaded to
track allocations with call stacks:

std::thread( []({ thread_local std::string str; });

Each call stack requires a memory allocation to be performed by the profiler,
to make the stack available at a later time. When the thread is created, the
TLS block is initialized and the std::string buffer can be allocated. To track
this allocation, rpmalloc has to be initialized. This initialization also
happens within the TLS block.

Now, when the thread exits, the heap managed by rpmalloc may be released first
during the TLS block destruction (and if the destruction is performed in
reverse creation order, then it *will* be destroyed first, as rpmalloc was
initialized only after the std::string initialization, to track the allocation
performed within). The next thing to happen is destruction of std::string and
release of the memory block it contains.

The release is tracked by the profiler, and as mentioned earlier, to save the
call stack for later use, a memory allocation is needed. But the allocator is
no longer available in this thread, because rpmalloc was released just before!

As a solution to this issue, profiler will detect whether the allocator is
still available and will ignore the call stack, if it's not. The other
solution is to disable the rpmalloc thread cleanup, which may potentially
cause leak-like behavior, in case a large number of threads is spawned and
destroyed.

Note that this is not a water-tight solution. Other functions will still want
to allocate memory for call stacks, but it is rather unlikely that such calls
would be performed during TLS block destruction. It is also possible that the
event queue will run out of allocated space for events at this very moment,
and in such a case the allocator will also fail.
2022-02-14 17:55:46 +01:00
Bartosz Taudul
793e6b0e29
Add rpmalloc thread state accessor. 2022-02-14 17:53:27 +01:00
Bartosz Taudul
20680fa6a3
Keep track of rpmalloc thread shutdown state. 2022-02-14 17:52:33 +01:00
Balazs Kovacsics
aa44cedcd2 Fix indentation 2022-02-11 17:14:16 +01:00
Balazs Kovacsics
a0a56eaf9e Move TRACY_UWP define to own header 2022-02-10 20:26:45 +01:00
Balazs Kovacsics
7169f5f30a Fix compiling TracyClient.cpp on UWP with defined TRACY_ENABLE 2022-02-09 22:14:36 +01:00
Bartosz Taudul
f058ad01fc
Don't process ring buffers when not connected in on-demand mode. 2022-01-31 20:53:10 +01:00
hulakdar
e98f7e5019 Fix potentially unitialized value warning 2022-01-26 21:08:54 +02:00
hulakdar
9fda60820a Silence padding warnings, as this is intended behaviour 2022-01-26 21:08:54 +02:00
Bartosz Taudul
4731bb9ec1
Cast GetProcAddress() ptr to const void*. 2022-01-05 20:03:20 +01:00
Bartosz Taudul
621c68352b
Call RtlWalkFrameChain directly from inlined function. 2022-01-01 17:33:39 +01:00
Bartosz Taudul
e368266837
Add custom demangler interface. 2021-12-22 18:17:48 +01:00
Bartosz Taudul
2f0d4a7707
Merge pull request #294 from Lectem/symbols_post_init
Call SymLoadModuleEx for modules loaded after init (Fixes #293)
2021-12-22 16:36:08 +01:00