2
0
mirror of https://github.com/wolfpld/tracy synced 2026-01-19 04:52:09 +00:00

Add option to ignore memory free faults

This replaces the IsApple flag, which was previously only used for this purpose.
This commit is contained in:
Trevor L. McDonell
2024-10-15 16:38:23 +02:00
parent 29e8bbbbb2
commit d1b0406801
6 changed files with 11 additions and 5 deletions

View File

@@ -141,6 +141,7 @@ set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported"
set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF)
set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF)
set_option(TRACY_DEBUGINFOD "Enable debuginfod support" OFF)
set_option(TRACY_IGNORE_MEMORY_FAULTS "Ignore instrumentation errors from memory free events that do not have a matching allocation" OFF)
# advanced
set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF)

View File

@@ -119,6 +119,10 @@ if get_option('debuginfod')
tracy_public_deps += dependency('libdebuginfod')
endif
if get_option('ignore_memory_faults')
tracy_common_args += ['-DTRACY_IGNORE_MEMORY_FAULTS']
endif
tracy_shared_libs = get_option('default_library') == 'shared'
if tracy_shared_libs

View File

@@ -24,4 +24,5 @@ option('manual_lifetime', type : 'boolean', value : false, description : 'Enable
option('fibers', type : 'boolean', value : false, description : 'Enable fibers support')
option('no_crash_handler', type : 'boolean', value : false, description : 'Disable crash handling')
option('verbose', type : 'boolean', value : false, description : 'Enable verbose logging')
option('debuginfod', type : 'boolean', value : false, description : 'Enable debuginfod support')
option('debuginfod', type : 'boolean', value : false, description : 'Enable debuginfod support')
option('ignore_memory_faults', type : 'boolean', value : false, description : 'Ignore instrumentation errors from memory free events that do not have a matching allocation')

View File

@@ -1765,8 +1765,8 @@ void Profiler::Worker()
#ifdef TRACY_ON_DEMAND
flags |= WelcomeFlag::OnDemand;
#endif
#ifdef __APPLE__
flags |= WelcomeFlag::IsApple;
#if defined TRACY_IGNORE_MEMORY_FAULTS || defined __APPLE__
flags |= WelcomeFlag::IgnoreMemFaults;
#endif
#ifndef TRACY_NO_CODE_TRANSFER
flags |= WelcomeFlag::CodeTransfer;

View File

@@ -83,7 +83,7 @@ struct WelcomeFlag
enum _t : uint8_t
{
OnDemand = 1 << 0,
IsApple = 1 << 1,
IgnoreMemFaults = 1 << 1,
CodeTransfer = 1 << 2,
CombineSamples = 1 << 3,
IdentifySamples = 1 << 4,

View File

@@ -2792,7 +2792,7 @@ void Worker::Exec()
m_captureProgram = welcome.programName;
m_captureTime = welcome.epoch;
m_executableTime = welcome.exectime;
m_ignoreMemFreeFaults = ( welcome.flags & WelcomeFlag::OnDemand ) || ( welcome.flags & WelcomeFlag::IsApple );
m_ignoreMemFreeFaults = ( welcome.flags & WelcomeFlag::OnDemand ) || ( welcome.flags & WelcomeFlag::IgnoreMemFaults );
m_ignoreFrameEndFaults = welcome.flags & WelcomeFlag::OnDemand;
m_data.cpuArch = (CpuArchitecture)welcome.cpuArch;
m_codeTransfer = welcome.flags & WelcomeFlag::CodeTransfer;