mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
970468f937
Provide a custom no-op implementation of dlclose(), in order to prevent shared object data from disappearing from profiler view. The server makes queries for program executable code, which has to be always available, otherwise wrong data may be provided, or the program may crash, due to referencing no longer mapped memory. The dlclose() documentation states that the function internally decreases the reference count, and only does unload the shared object when the count reaches zero. There is no guarantee that the shared object data will be unloaded immediately after any dlclose call originating from the program. This function override exploits this fact.
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
//
|
|
// Tracy profiler
|
|
// ----------------
|
|
//
|
|
// For fast integration, compile and
|
|
// link with this source file (and none
|
|
// other) in your executable (or in the
|
|
// main DLL / shared object on multi-DLL
|
|
// projects).
|
|
//
|
|
|
|
// Define TRACY_ENABLE to enable profiler.
|
|
|
|
#include "common/TracySystem.cpp"
|
|
|
|
#ifdef TRACY_ENABLE
|
|
|
|
#ifdef _MSC_VER
|
|
# pragma warning(push, 0)
|
|
#endif
|
|
|
|
#include "common/tracy_lz4.cpp"
|
|
#include "client/TracyProfiler.cpp"
|
|
#include "client/TracyCallstack.cpp"
|
|
#include "client/TracySysTime.cpp"
|
|
#include "client/TracySysTrace.cpp"
|
|
#include "common/TracySocket.cpp"
|
|
#include "client/tracy_rpmalloc.cpp"
|
|
#include "client/TracyDxt1.cpp"
|
|
#include "client/TracyAlloc.cpp"
|
|
#include "client/TracyOverride.cpp"
|
|
|
|
#if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6
|
|
# include "libbacktrace/alloc.cpp"
|
|
# include "libbacktrace/dwarf.cpp"
|
|
# include "libbacktrace/fileline.cpp"
|
|
# include "libbacktrace/mmapio.cpp"
|
|
# include "libbacktrace/posix.cpp"
|
|
# include "libbacktrace/sort.cpp"
|
|
# include "libbacktrace/state.cpp"
|
|
# if TRACY_HAS_CALLSTACK == 4
|
|
# include "libbacktrace/macho.cpp"
|
|
# else
|
|
# include "libbacktrace/elf.cpp"
|
|
# endif
|
|
# include "common/TracyStackFrames.cpp"
|
|
#endif
|
|
|
|
#ifdef _MSC_VER
|
|
# pragma comment(lib, "ws2_32.lib")
|
|
# pragma comment(lib, "dbghelp.lib")
|
|
# pragma comment(lib, "advapi32.lib")
|
|
# pragma comment(lib, "user32.lib")
|
|
# pragma warning(pop)
|
|
#endif
|
|
|
|
#endif
|