[ASan] Move error reporting code away from file with interceptors

llvm-svn: 161570
This commit is contained in:
Alexey Samsonov 2012-08-09 08:32:33 +00:00
parent b4b316fc5b
commit c0ff933d8b
3 changed files with 16 additions and 5 deletions

View File

@ -17,6 +17,7 @@
#include "asan_interface.h"
#include "asan_internal.h"
#include "asan_mapping.h"
#include "asan_report.h"
#include "asan_stack.h"
#include "asan_stats.h"
#include "asan_thread_registry.h"
@ -190,11 +191,9 @@ static inline bool RangesOverlap(const char *offset1, uptr length1,
const char *offset1 = (const char*)_offset1; \
const char *offset2 = (const char*)_offset2; \
if (RangesOverlap(offset1, length1, offset2, length2)) { \
AsanReport("ERROR: AddressSanitizer %s-param-overlap: " \
"memory ranges [%p,%p) and [%p, %p) overlap\n", \
name, offset1, offset1 + length1, offset2, offset2 + length2); \
PRINT_CURRENT_STACK(); \
ShowStatsAndAbort(); \
GET_STACK_TRACE_HERE(kStackTraceMax); \
ReportStringFunctionMemoryRangesOverlap(name, offset1, length1, \
offset2, length2, &stack); \
} \
} while (0)

View File

@ -62,5 +62,14 @@ void ReportAsanGetAllocatedSizeNotOwned(uptr addr, AsanStackTrace *stack) {
ShowStatsAndAbort();
}
void ReportStringFunctionMemoryRangesOverlap(
const char *function, const char *offset1, uptr length1,
const char *offset2, uptr length2, AsanStackTrace *stack) {
AsanReport("ERROR: AddressSanitizer %s-param-overlap: "
"memory ranges [%p,%p) and [%p, %p) overlap\n", \
function, offset1, offset1 + length1, offset2, offset2 + length2);
stack->PrintStack();
ShowStatsAndAbort();
}
} // namespace __asan

View File

@ -24,5 +24,8 @@ void NORETURN ReportMallocUsableSizeNotOwned(uptr addr,
AsanStackTrace *stack);
void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr,
AsanStackTrace *stack);
void NORETURN ReportStringFunctionMemoryRangesOverlap(
const char *function, const char *offset1, uptr length1,
const char *offset2, uptr length2, AsanStackTrace *stack);
} // namespace __asan