Commit Graph

42 Commits

Author SHA1 Message Date
Bartosz Taudul
be40c1e38e
Use strlen instead of pointer walking in the rest of places. 2024-06-16 18:20:16 +02:00
Bartosz Taudul
1ff73edd20
Add linux kernel symbol code retrieval. 2024-05-26 20:49:43 +02:00
Bartosz Taudul
82aecbdb31
Calculate size of kernel code sections. 2024-05-25 17:18:41 +02:00
Bartosz Taudul
64aad9e751
Load all kernel symbols, mark non-code sections with null name. 2024-05-25 17:18:41 +02:00
Bartosz Taudul
d5064aa8ea
Try to prevent reallocs when building kernel symbols table.
% wc -l /proc/kallsyms
419362 /proc/kallsyms
2024-05-25 17:18:41 +02:00
Bartosz Taudul
c45683506c
Merge pull request #783 from tiago-rodrigues/trodrigues/image_cache_deadlock_fix
Instead of calling dladdr inside the dl_iterate_phdr callback, do it outside to avoid deadlocks with other loader code
2024-05-04 11:33:54 +02:00
trodrigues
4bf9a8cecc Instead of calling dladdr inside the dl_iterate_phdr callback, do it outside to avoid deadlocks with other loader code 2024-05-03 16:05:59 -05:00
Elliot
a26f076a0e fix build warnings when compiling with clang-cl 2024-03-11 14:44:44 -04:00
Bartosz Taudul
4226f7888e
Manually allocate and free s_di_known.
Otherwise destructor will be called when main() returns while symbol
retrieval may still want to actively use the vector.
2024-02-26 23:03:37 +01:00
Bartosz Taudul
e9911ab127
Fix includes. 2023-12-20 13:16:51 +01:00
Bartosz Taudul
c39b7af4b3
Proper spelling of dbghelp. 2023-12-20 13:14:06 +01:00
Bartosz Taudul
cc3cbfe6f2
No need for indirection of ImageEntry vector. 2023-12-12 19:27:53 +01:00
Bartosz Taudul
5decb91cd0
Don't clear image cache on refresh. 2023-12-12 19:23:27 +01:00
Bartosz Taudul
7fc7935359
Cosmetics. 2023-12-12 19:09:41 +01:00
Bartosz Taudul
073e04e967
Remove redundant include. 2023-12-12 19:04:43 +01:00
trodrigues
ab1ec3f01c make sure we always copy the image name in ImageCache 2023-12-09 19:12:53 -06:00
trodrigues
15f1b6b0b4 make a copy of dli_fname after calling dladdr. Call ImageCache destructor. 2023-12-09 09:40:07 -06:00
trodrigues
55f53b9979 remove option to enable image cache, use it for TRACY_HAS_CALLSTACK == 3 to obtain image path and addreses instead of dladdr() 2023-12-05 20:01:12 -06:00
trodrigues
a618b6e6f8 simplify return from tracy::FastVector iterator 2023-12-03 08:36:54 -06:00
Tiago Rodrigues
a9d039e081 move under the tracy namespace, remove commented out code 2023-12-03 09:23:03 -05:00
Tiago Rodrigues
132419dba3 Add image cache to avoid calling dladdr() when doing offline symbol resolution. This cache can also be used in the runtime symbol resolution case to detect we should recreate "backtrace_state" when new images have been loaded 2023-11-29 13:23:58 -05:00
Tiago Rodrigues
a1ca8dd06a fixes according to review comments 2023-11-24 16:32:45 -05:00
trodrigues
301c9fb720 revert #ifdef of a lot of code by TRACY_SYMBOL_OFFLINE_RESOLVE, it now only force enables the offline symbol resolving codepath. 2023-11-19 06:32:17 -08:00
Tiago Rodrigues
79618c5a1a Add support for using defining TRACY_SYMBOL_OFFLINE_RESOLVE to enable only the offline symbol resolving codepath 2023-11-19 06:32:17 -08:00
Tiago Rodrigues
c302b509fe fix formatting 2023-11-19 06:32:17 -08:00
Tiago Rodrigues
f4f75eac64 Add support for offline symbol resolving by setting the "TRACY_SYMBOL_OFFLINE_RESOLVE=1" env var
- Add a tool "tracy-edit" that allows loading a tracy capture, patching symbols and recompress the result
- Add offline symbol resolvers for linux (using addr2line) and windows (using dbghelper)
2023-11-19 06:32:16 -08:00
Tiago Rodrigues
c373647dae fix coding style 2023-11-13 13:43:03 -05:00
Tiago Rodrigues
790d28911d Add env var "TRACY_NO_DBHELP_INIT_LOAD" to allow disabling dbghelp loading of DeviceDriver and ProcessModules at startup 2023-11-10 17:02:03 -05:00
Mathias Lang
c6d9741136 Fix and test TRACY_DEMANGLE for TracyClient
The configuration wasn't tested and stopped compiling.
This fixes it and adds a test to ensure it doesn't break again.
2023-09-06 01:28:58 +02:00
Lectem
ecdf6adc32 Fix race condition for symbols resolution on windows
There might have been new modules loaded by another thread between the `SymInitialize` and `EnumProcessModules` calls.
Since we register the enumerated modules into the cache, we need to make sure that symbols for this module are loaded.
The only way to do that is to call `SymLoadModuleEx`, just like we do when finding new modules after `InitCallstack`.
2023-02-14 15:32:37 +01:00
Bartosz Taudul
383ecb6a12
Remove CodeLocation query and CodeInformation response. 2022-10-11 22:56:23 +02:00
Bartosz Taudul
6f9dfc8469
Use dladdr, not libbacktrace in fast callstack decode path.
DecodeCallstackPtrFast() may be called outside the symbol processing thread,
for example in the crash handler. Using the less-capable dladdr functionality
doesn't have a big impact here. Callstack decoding in this context is used to
remove the uninteresting top part of the callstack, so that the callstack ends
at the crashing function, and not in the crash handler. Even if this
functionality would be impacted by this change, the damage done is close to
none.

The other alternative is to use locking each time a libbacktrace is to be
used, which does not seem to be worthy to do, considering that the problem
only occurs in a very rare code path.

NB everything was working when it was first implemented, because back then the
callstack decoding was still performed on the main thread, and not on a
separate, dedicated one.
2022-10-08 13:22:56 +02:00
Bartosz Taudul
7552341ff0
Increase possible inline stack size to 64 elements. 2022-10-04 22:16:20 +02:00
Bartosz Taudul
2cc5eff9a2
Normalize symbol paths on libbacktrace systems. 2022-09-02 01:23:29 +02:00
Bartosz Taudul
8cc43284bd
Add path normalization function. 2022-09-02 01:23:14 +02:00
Bartosz Taudul
d32dc47845
Add debug logging for debuginfod queries. 2022-08-16 22:05:08 +02:00
Bartosz Taudul
72ad40698b
Move initialization of callstack structs to a thread.
Initializing structures for callstack processing (building memory map of the
process, gathering kernel symbols, etc) takes some time, which in some cases
may be significant.

Callstack queries are now handled on a separate thread. In such setup it no
longer makes sense to block main thread execution with this lengthy init
process.

All the heavy initialization phase has been now moved to this separate
processing thread. Some initial callstack queries may now not produce
responses as promptly as before, but this is only because the main thread is
able to start working earlier.

Some parts of the initialization process may be critical to do in the main
thread, for example because the function responsible for gathering callstacks
must be loaded first. This is done still on the main thread, in a new function
InitCallstackCritical().
2022-08-16 13:55:46 +02:00
Bartosz Taudul
c6464f44da
Fix typo. 2022-07-30 22:02:25 +02:00
Bartosz Taudul
a75846dd88
Do not try to demangle really long function names. 2022-07-23 12:37:00 +02:00
Bartosz Taudul
d282425287
Fix demangle buffer. 2022-07-23 12:34:35 +02:00
Bartosz Taudul
7dc95bf3a8
Fix demangling of functions with names >64KB. 2022-07-20 01:21:43 +02:00
Bartosz Taudul
06c7984a16
Move all client headers and sources to public/ directory. 2022-07-17 15:47:38 +02:00