[ASan] Small fix to please tests on Windows, where stack unwinding using provided pc/bp works too bad

llvm-svn: 161575
This commit is contained in:
Alexey Samsonov 2012-08-09 11:29:13 +00:00
parent f688412b8c
commit b53a670817
2 changed files with 7 additions and 15 deletions

View File

@ -221,8 +221,13 @@ static void PrintBytes(const char *before, uptr *a) {
AsanPrintf("\n"); AsanPrintf("\n");
} }
void ReportInvalidMemoryAccess(uptr pc, uptr bp, uptr sp, uptr addr, } // namespace __asan
bool is_write, uptr access_size) {
// --------------------------- Interface --------------------- {{{1
using namespace __asan; // NOLINT
void __asan_report_error(uptr pc, uptr bp, uptr sp,
uptr addr, bool is_write, uptr access_size) {
static atomic_uint32_t num_calls; static atomic_uint32_t num_calls;
if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) { if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
// Do not print more than one report, otherwise they will mix up. // Do not print more than one report, otherwise they will mix up.
@ -323,16 +328,6 @@ void ReportInvalidMemoryAccess(uptr pc, uptr bp, uptr sp, uptr addr,
Die(); Die();
} }
} // namespace __asan
// --------------------------- Interface --------------------- {{{1
using namespace __asan; // NOLINT
void __asan_report_error(uptr pc, uptr bp, uptr sp,
uptr addr, bool is_write, uptr access_size) {
ReportInvalidMemoryAccess(pc, bp, sp, addr, is_write, access_size);
}
void NOINLINE __asan_set_error_report_callback(void (*callback)(const char*)) { void NOINLINE __asan_set_error_report_callback(void (*callback)(const char*)) {
error_report_callback = callback; error_report_callback = callback;
if (callback) { if (callback) {

View File

@ -39,8 +39,5 @@ void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr,
void NORETURN ReportStringFunctionMemoryRangesOverlap( void NORETURN ReportStringFunctionMemoryRangesOverlap(
const char *function, const char *offset1, uptr length1, const char *function, const char *offset1, uptr length1,
const char *offset2, uptr length2, AsanStackTrace *stack); const char *offset2, uptr length2, AsanStackTrace *stack);
// Generic error report.
void NORETURN ReportInvalidMemoryAccess(uptr pc, uptr bp, uptr sp, uptr addr,
bool is_write, uptr access_size);
} // namespace __asan } // namespace __asan