diff --git a/include/aws/common/allocator.h b/include/aws/common/allocator.h index 3d5b441e9..ad5a07cd6 100644 --- a/include/aws/common/allocator.h +++ b/include/aws/common/allocator.h @@ -116,10 +116,6 @@ enum aws_mem_trace_level { AWS_MEMTRACE_STACKS = 2, /* capture callstacks for each allocation */ }; -#if defined(AWS_HAVE_EXECINFO) || defined(WIN32) || defined(__APPLE__) -# define AWS_MEMTRACE_STACKS_AVAILABLE -#endif - /* * Wraps an allocator and tracks all external allocations. If aws_mem_trace_dump() is called * and there are still allocations active, they will be reported to the aws_logger at TRACE level. diff --git a/tests/memtrace_test.c b/tests/memtrace_test.c index 3a1dd5d2c..541ac2c72 100644 --- a/tests/memtrace_test.c +++ b/tests/memtrace_test.c @@ -93,9 +93,12 @@ static struct aws_logger s_test_logger; static int s_test_memtrace_stacks(struct aws_allocator *allocator, void *ctx) { (void)ctx; -#if !defined(AWS_MEMTRACE_STACKS_AVAILABLE) - return 0; -#endif + + /* only bother to run this test if the platform can do a backtrace */ + void *probe_stack[1]; + if (!aws_backtrace(probe_stack, 1)) { + return 0; + } test_logger_init(&s_test_logger, allocator, AWS_LL_TRACE, 0); aws_logger_set(&s_test_logger);