diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h index 041fa3dce803be895a325f1601891bc98bffad92..e1c6caf825c25417de45d110ae5327540f65172d 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 \