From f98fc08bc710b581a02fe23cfb21d84048af9a69 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Tue, 7 Feb 2012 18:23:54 +0000 Subject: [PATCH] [asan] GET_CALLER_PC macro for Win. Patch by timurrrr@google.com llvm-svn: 149994 --- compiler-rt/lib/asan/asan_internal.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h index 041fa3dce803..e1c6caf825c2 100644 --- a/compiler-rt/lib/asan/asan_internal.h +++ b/compiler-rt/lib/asan/asan_internal.h @@ -212,12 +212,16 @@ const size_t kPageSizeBits = 12; const size_t kPageSize = 1UL << kPageSizeBits; #ifndef _WIN32 -#define GET_CALLER_PC() (uintptr_t)__builtin_return_address(0) -#define GET_CURRENT_FRAME() (uintptr_t)__builtin_frame_address(0) +# define GET_CALLER_PC() (uintptr_t)__builtin_return_address(0) +# define GET_CURRENT_FRAME() (uintptr_t)__builtin_frame_address(0) #else -// TODO(timurrrr): implement. -#define GET_CALLER_PC() (uintptr_t)0 -#define GET_CURRENT_FRAME() (uintptr_t)0 +extern "C" void* _ReturnAddress(void); +# pragma intrinsic(_ReturnAddress) +# define GET_CALLER_PC() (uintptr_t)_ReturnAddress() +// CaptureStackBackTrace doesn't need to know BP on Windows. +// FIXME: This macro is still used when printing error reports though it's not +// clear if the BP value is needed in the ASan reports on Windows. +# define GET_CURRENT_FRAME() (uintptr_t)0xDEADBEEF #endif #define GET_BP_PC_SP \ -- GitLab