Print a more useful BP value from MSVC-built ASan runtimes

MSVC doesn't have an exact equivalent for __builtin_frame_address, but
_AddressOfReturnAddress() + sizeof(void*) should be equivalent for all
frames build with -fno-omit-frame-pointer.

llvm-svn: 277826
This commit is contained in:
Reid Kleckner 2016-08-05 16:01:57 +00:00
parent 5bf494e73d
commit 2a06f48bb5
1 changed files with 3 additions and 3 deletions

View File

@ -296,12 +296,12 @@ inline void Trap() {
}
#else
extern "C" void* _ReturnAddress(void);
extern "C" void* _AddressOfReturnAddress(void);
# pragma intrinsic(_ReturnAddress)
# pragma intrinsic(_AddressOfReturnAddress)
# define GET_CALLER_PC() (uptr)_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() (uptr)0xDEADBEEF
# define GET_CURRENT_FRAME() (((uptr)_AddressOfReturnAddress()) + sizeof(uptr))
extern "C" void __ud2(void);
# pragma intrinsic(__ud2)