[llvm-commits] [compiler-rt] r153327 - /compiler-rt/trunk/lib/asan/asan_malloc_win.cc
Timur Iskhodzhanov
timurrrr at google.com
Fri Mar 23 04:33:02 PDT 2012
Author: timurrrr
Date: Fri Mar 23 06:33:02 2012
New Revision: 153327
URL: http://llvm.org/viewvc/llvm-project?rev=153327&view=rev
Log:
[ASan] Add a few more malloc-related interceptors for Windows
Modified:
compiler-rt/trunk/lib/asan/asan_malloc_win.cc
Modified: compiler-rt/trunk/lib/asan/asan_malloc_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_win.cc?rev=153327&r1=153326&r2=153327&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_malloc_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_malloc_win.cc Fri Mar 23 06:33:02 2012
@@ -34,19 +34,34 @@
return asan_free(ptr, &stack);
}
+void _free_dbg(void* ptr, int) {
+ free(ptr);
+}
+
+void cfree(void *ptr) {
+ CHECK(!"cfree() should not be used on Windows?");
+}
+
void *malloc(size_t size) {
GET_STACK_TRACE_HERE_FOR_MALLOC;
return asan_malloc(size, &stack);
}
+void* _malloc_dbg(size_t size, int , const char*, int) {
+ return malloc(size);
+}
+
void *calloc(size_t nmemb, size_t size) {
GET_STACK_TRACE_HERE_FOR_MALLOC;
return asan_calloc(nmemb, size, &stack);
}
+void* _calloc_dbg(size_t n, size_t size, int, const char*, int) {
+ return calloc(n, size);
+}
+
void *_calloc_impl(size_t nmemb, size_t size, int *errno_tmp) {
- GET_STACK_TRACE_HERE_FOR_MALLOC;
- return asan_calloc(nmemb, size, &stack);
+ return calloc(nmemb, size);
}
void *realloc(void *ptr, size_t size) {
@@ -54,10 +69,38 @@
return asan_realloc(ptr, size, &stack);
}
+void *_realloc_dbg(void *ptr, size_t size, int) {
+ CHECK(!"_realloc_dbg should not exist!");
+ return NULL;
+}
+
+void* _recalloc(void* p, size_t n, size_t elem_size) {
+ if (!p)
+ return calloc(n, elem_size);
+ const size_t size = n * elem_size;
+ if (elem_size != 0 && size / elem_size != n)
+ return NULL;
+ return realloc(p, size);
+}
+
size_t _msize(void *ptr) {
GET_STACK_TRACE_HERE_FOR_MALLOC;
return asan_malloc_usable_size(ptr, &stack);
}
+
+int _CrtDbgReport(int, const char*, int,
+ const char*, const char*, ...) {
+ ShowStatsAndAbort();
+}
+
+int _CrtDbgReportW(int reportType, const wchar_t*, int,
+ const wchar_t*, const wchar_t*, ...) {
+ ShowStatsAndAbort();
+}
+
+int _CrtSetReportMode(int, int) {
+ return 0;
+}
} // extern "C"
using __interception::GetRealFunctionAddress;
More information about the llvm-commits
mailing list