Fix the ASan ioctl.cc test when using COMPILER_RT_DEBUG=On

In debug mode (COMPILER_RT_DEBUG=On), we still build with -fomit-frame-pointer and wrap_ioctl doesn't set up a proper stack frame.  In release mode it does, because ioctl_common_pre gets inlined into wrap_ioctl and it uses the COMMON_INTERCEPTOR_READ_RANGE macro which in the end calls GET_CURRENT_FRAME and that forces the compiler to generate a stack frame for the function.

Not having a proper stack frame breaks the unwinder.  This patch forces to generate a frame pointer (via ENABLE_FRAME_POINTER macro).

Reviewed at http://reviews.llvm.org/D7815

llvm-svn: 230318
This commit is contained in:
Kuba Brecka 2015-02-24 10:10:25 +00:00
parent e4ac10179c
commit 987bf0400d
1 changed files with 6 additions and 0 deletions

View File

@ -1034,6 +1034,12 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_snprintf, __isoc99_vsnprintf, str, size,
#if SANITIZER_INTERCEPT_IOCTL
#include "sanitizer_common_interceptors_ioctl.inc"
INTERCEPTOR(int, ioctl, int d, unsigned long request, ...) {
// We need a frame pointer, because we call into ioctl_common_[pre|post] which
// can trigger a report and we need to be able to unwind through this
// function. On Mac in debug mode we might not have a frame pointer, because
// ioctl_common_[pre|post] doesn't get inlined here.
ENABLE_FRAME_POINTER;
void *ctx;
va_list ap;
va_start(ap, request);