[asan] GET_CALLER_PC macro for Win. Patch by timurrrr@google.com

llvm-svn: 149994
This commit is contained in:
Kostya Serebryany 2012-02-07 18:23:54 +00:00
parent d61255638f
commit f98fc08bc7
1 changed files with 9 additions and 5 deletions

View File

@ -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 \