Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: syzygy/agent/asan/unittest_util.h

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Fix comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « syzygy/agent/asan/syzyasan_rtl.def.template ('k') | syzygy/common/asan_parameters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: syzygy/agent/asan/unittest_util.h
diff --git a/syzygy/agent/asan/unittest_util.h b/syzygy/agent/asan/unittest_util.h
index b123f9daf701c665d16cc114fa1d5d5009f29d18..4dc708031534e3ed7a06ba22e3bc374df18a2756 100644
--- a/syzygy/agent/asan/unittest_util.h
+++ b/syzygy/agent/asan/unittest_util.h
@@ -143,180 +143,174 @@ class TestWithAsanLogger : public OnExceptionCallbackTest {
// Shorthand for discussing all the asan runtime functions.
#ifndef _WIN64
-#define ASAN_RTL_FUNCTIONS(F) \
- F(WINAPI, HANDLE, GetProcessHeap, (), ()) \
- F(WINAPI, HANDLE, HeapCreate, \
- (DWORD options, SIZE_T initial_size, SIZE_T maximum_size), \
- (options, initial_size, maximum_size)) \
- F(WINAPI, BOOL, HeapDestroy, \
- (HANDLE heap), (heap)) \
- F(WINAPI, LPVOID, HeapAlloc, \
- (HANDLE heap, DWORD flags, SIZE_T bytes), (heap, flags, bytes)) \
- F(WINAPI, LPVOID, HeapReAlloc, \
- (HANDLE heap, DWORD flags, LPVOID mem, SIZE_T bytes), \
- (heap, flags, mem, bytes)) \
- F(WINAPI, BOOL, HeapFree, \
- (HANDLE heap, DWORD flags, LPVOID mem), (heap, flags, mem)) \
- F(WINAPI, SIZE_T, HeapSize, \
- (HANDLE heap, DWORD flags, LPCVOID mem), (heap, flags, mem)) \
- F(WINAPI, BOOL, HeapValidate, \
- (HANDLE heap, DWORD flags, LPCVOID mem), (heap, flags, mem)) \
- F(WINAPI, SIZE_T, HeapCompact, \
- (HANDLE heap, DWORD flags), (heap, flags)) \
- F(WINAPI, BOOL, HeapLock, (HANDLE heap), (heap)) \
- F(WINAPI, BOOL, HeapUnlock, (HANDLE heap), (heap)) \
- F(WINAPI, BOOL, HeapWalk, \
- (HANDLE heap, LPPROCESS_HEAP_ENTRY entry), (heap, entry)) \
- F(WINAPI, BOOL, HeapSetInformation, \
- (HANDLE heap, HEAP_INFORMATION_CLASS info_class, \
- PVOID info, SIZE_T info_length), \
- (heap, info_class, info, info_length)) \
- F(WINAPI, BOOL, HeapQueryInformation, \
- (HANDLE heap, HEAP_INFORMATION_CLASS info_class, \
- PVOID info, SIZE_T info_length, PSIZE_T return_length), \
- (heap, info_class, info, info_length, return_length)) \
- F(WINAPI, void, SetCallBack, \
- (void (*callback)(AsanErrorInfo* error_info)), \
- (callback)) \
- F(_cdecl, void*, memcpy, \
- (void* destination, const void* source, size_t num), \
- (destination, source, num)) \
- F(_cdecl, void*, memmove, \
- (void* destination, const void* source, size_t num), \
- (destination, source, num)) \
- F(_cdecl, void*, memset, (void* ptr, int value, size_t num), \
- (ptr, value, num)) \
- F(_cdecl, const void*, memchr, (const void* ptr, int value, size_t num), \
- (ptr, value, num)) \
- F(_cdecl, size_t, strcspn, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, size_t, strlen, (const char* str), (str)) \
- F(_cdecl, size_t, strnlen, (const char* str, size_t max_len), \
- (str, max_len)) \
- F(_cdecl, const char*, strrchr, (const char* str, int character), \
- (str, character)) \
- F(_cdecl, const wchar_t*, wcsrchr, (const wchar_t* str, int character), \
- (str, character)) \
- F(_cdecl, const wchar_t*, wcschr, (const wchar_t* str, int character), \
- (str, character)) \
- F(_cdecl, int, strcmp, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, const char*, strpbrk, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, const char*, strstr, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, size_t, wcsnlen, (const wchar_t* str, size_t max_len), \
- (str, max_len)) \
- F(_cdecl, const wchar_t*, wcsstr, (const wchar_t* str1, \
- const wchar_t* str2), (str1, str2)) \
- F(_cdecl, size_t, strspn, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, char*, strncpy, \
- (char* destination, const char* source, size_t num), \
- (destination, source, num)) \
- F(_cdecl, char*, strncat, \
- (char* destination, const char* source, size_t num), \
- (destination, source, num)) \
- F(WINAPI, BOOL, ReadFile, \
- (HANDLE file_handle, LPVOID buffer, DWORD bytes_to_read, \
- LPDWORD bytes_read, LPOVERLAPPED overlapped), \
- (file_handle, buffer, bytes_to_read, bytes_read, overlapped)) \
- F(WINAPI, BOOL, WriteFile, \
- (HANDLE file_handle, LPCVOID buffer, DWORD bytes_to_write, \
- LPDWORD bytes_written, LPOVERLAPPED overlapped), \
- (file_handle, buffer, bytes_to_write, bytes_written, overlapped)) \
- F(_cdecl, void, SetInterceptorCallback, (void (*callback)()), (callback)) \
- F(WINAPI, agent::asan::AsanRuntime*, GetActiveRuntime, (), ()) \
- F(WINAPI, void, SetAllocationFilterFlag, (), ()) \
- F(WINAPI, void, ClearAllocationFilterFlag, (), ())
+#define ASAN_RTL_FUNCTIONS(F) \
+ F(WINAPI, HANDLE, GetProcessHeap, (), ()) \
+ F(WINAPI, HANDLE, HeapCreate, \
+ (DWORD options, SIZE_T initial_size, SIZE_T maximum_size), \
+ (options, initial_size, maximum_size)) \
+ F(WINAPI, BOOL, HeapDestroy, (HANDLE heap), (heap)) \
+ F(WINAPI, LPVOID, HeapAlloc, (HANDLE heap, DWORD flags, SIZE_T bytes), \
+ (heap, flags, bytes)) \
+ F(WINAPI, LPVOID, HeapReAlloc, \
+ (HANDLE heap, DWORD flags, LPVOID mem, SIZE_T bytes), \
+ (heap, flags, mem, bytes)) \
+ F(WINAPI, BOOL, HeapFree, (HANDLE heap, DWORD flags, LPVOID mem), \
+ (heap, flags, mem)) \
+ F(WINAPI, SIZE_T, HeapSize, (HANDLE heap, DWORD flags, LPCVOID mem), \
+ (heap, flags, mem)) \
+ F(WINAPI, BOOL, HeapValidate, (HANDLE heap, DWORD flags, LPCVOID mem), \
+ (heap, flags, mem)) \
+ F(WINAPI, SIZE_T, HeapCompact, (HANDLE heap, DWORD flags), (heap, flags)) \
+ F(WINAPI, BOOL, HeapLock, (HANDLE heap), (heap)) \
+ F(WINAPI, BOOL, HeapUnlock, (HANDLE heap), (heap)) \
+ F(WINAPI, BOOL, HeapWalk, (HANDLE heap, LPPROCESS_HEAP_ENTRY entry), \
+ (heap, entry)) \
+ F(WINAPI, BOOL, HeapSetInformation, \
+ (HANDLE heap, HEAP_INFORMATION_CLASS info_class, PVOID info, \
+ SIZE_T info_length), \
+ (heap, info_class, info, info_length)) \
+ F(WINAPI, BOOL, HeapQueryInformation, \
+ (HANDLE heap, HEAP_INFORMATION_CLASS info_class, PVOID info, \
+ SIZE_T info_length, PSIZE_T return_length), \
+ (heap, info_class, info, info_length, return_length)) \
+ F(WINAPI, void, SetCallBack, (void (*callback)(AsanErrorInfo * error_info)), \
+ (callback)) \
+ F(_cdecl, void*, memcpy, \
+ (void* destination, const void* source, size_t num), \
+ (destination, source, num)) \
+ F(_cdecl, void*, memmove, \
+ (void* destination, const void* source, size_t num), \
+ (destination, source, num)) \
+ F(_cdecl, void*, memset, (void* ptr, int value, size_t num), \
+ (ptr, value, num)) \
+ F(_cdecl, const void*, memchr, (const void* ptr, int value, size_t num), \
+ (ptr, value, num)) \
+ F(_cdecl, size_t, strcspn, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, size_t, strlen, (const char* str), (str)) \
+ F(_cdecl, size_t, strnlen, (const char* str, size_t max_len), \
+ (str, max_len)) \
+ F(_cdecl, const char*, strrchr, (const char* str, int character), \
+ (str, character)) \
+ F(_cdecl, const wchar_t*, wcsrchr, (const wchar_t* str, int character), \
+ (str, character)) \
+ F(_cdecl, const wchar_t*, wcschr, (const wchar_t* str, int character), \
+ (str, character)) \
+ F(_cdecl, int, strcmp, (const char* str1, const char* str2), (str1, str2)) \
+ F(_cdecl, const char*, strpbrk, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, const char*, strstr, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, size_t, wcsnlen, (const wchar_t* str, size_t max_len), \
+ (str, max_len)) \
+ F(_cdecl, const wchar_t*, wcsstr, \
+ (const wchar_t* str1, const wchar_t* str2), (str1, str2)) \
+ F(_cdecl, size_t, strspn, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, char*, strncpy, \
+ (char* destination, const char* source, size_t num), \
+ (destination, source, num)) \
+ F(_cdecl, char*, strncat, \
+ (char* destination, const char* source, size_t num), \
+ (destination, source, num)) \
+ F(WINAPI, BOOL, ReadFile, \
+ (HANDLE file_handle, LPVOID buffer, DWORD bytes_to_read, \
+ LPDWORD bytes_read, LPOVERLAPPED overlapped), \
+ (file_handle, buffer, bytes_to_read, bytes_read, overlapped)) \
+ F(WINAPI, BOOL, WriteFile, \
+ (HANDLE file_handle, LPCVOID buffer, DWORD bytes_to_write, \
+ LPDWORD bytes_written, LPOVERLAPPED overlapped), \
+ (file_handle, buffer, bytes_to_write, bytes_written, overlapped)) \
+ F(_cdecl, void, SetInterceptorCallback, (void (*callback)()), (callback)) \
+ F(WINAPI, agent::asan::AsanRuntime*, GetActiveRuntime, (), ()) \
+ F(WINAPI, void, InitializeCrashReporter, (), ()) \
+ F(WINAPI, void, SetAllocationFilterFlag, (), ()) \
+ F(WINAPI, void, ClearAllocationFilterFlag, (), ())
#else
// A copy of the previous block minus {Set,Clear}AllocationFilterFlag functions,
// as they're not implemented on win64.
// TODO: remove this once {Set,Clear}AllocationFilterFlag are implemented.
-#define ASAN_RTL_FUNCTIONS(F) \
- F(WINAPI, HANDLE, GetProcessHeap, (), ()) \
- F(WINAPI, HANDLE, HeapCreate, \
- (DWORD options, SIZE_T initial_size, SIZE_T maximum_size), \
- (options, initial_size, maximum_size)) \
- F(WINAPI, BOOL, HeapDestroy, \
- (HANDLE heap), (heap)) \
- F(WINAPI, LPVOID, HeapAlloc, \
- (HANDLE heap, DWORD flags, SIZE_T bytes), (heap, flags, bytes)) \
- F(WINAPI, LPVOID, HeapReAlloc, \
- (HANDLE heap, DWORD flags, LPVOID mem, SIZE_T bytes), \
- (heap, flags, mem, bytes)) \
- F(WINAPI, BOOL, HeapFree, \
- (HANDLE heap, DWORD flags, LPVOID mem), (heap, flags, mem)) \
- F(WINAPI, SIZE_T, HeapSize, \
- (HANDLE heap, DWORD flags, LPCVOID mem), (heap, flags, mem)) \
- F(WINAPI, BOOL, HeapValidate, \
- (HANDLE heap, DWORD flags, LPCVOID mem), (heap, flags, mem)) \
- F(WINAPI, SIZE_T, HeapCompact, \
- (HANDLE heap, DWORD flags), (heap, flags)) \
- F(WINAPI, BOOL, HeapLock, (HANDLE heap), (heap)) \
- F(WINAPI, BOOL, HeapUnlock, (HANDLE heap), (heap)) \
- F(WINAPI, BOOL, HeapWalk, \
- (HANDLE heap, LPPROCESS_HEAP_ENTRY entry), (heap, entry)) \
- F(WINAPI, BOOL, HeapSetInformation, \
- (HANDLE heap, HEAP_INFORMATION_CLASS info_class, \
- PVOID info, SIZE_T info_length), \
- (heap, info_class, info, info_length)) \
- F(WINAPI, BOOL, HeapQueryInformation, \
- (HANDLE heap, HEAP_INFORMATION_CLASS info_class, \
- PVOID info, SIZE_T info_length, PSIZE_T return_length), \
- (heap, info_class, info, info_length, return_length)) \
- F(WINAPI, void, SetCallBack, \
- (void (*callback)(AsanErrorInfo* error_info)), \
- (callback)) \
- F(_cdecl, void*, memcpy, \
- (void* destination, const void* source, size_t num), \
- (destination, source, num)) \
- F(_cdecl, void*, memmove, \
- (void* destination, const void* source, size_t num), \
- (destination, source, num)) \
- F(_cdecl, void*, memset, (void* ptr, int value, size_t num), \
- (ptr, value, num)) \
- F(_cdecl, const void*, memchr, (const void* ptr, int value, size_t num), \
- (ptr, value, num)) \
- F(_cdecl, size_t, strcspn, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, size_t, strlen, (const char* str), (str)) \
- F(_cdecl, size_t, strnlen, (const char* str, size_t max_len), \
- (str, max_len)) \
- F(_cdecl, const char*, strrchr, (const char* str, int character), \
- (str, character)) \
- F(_cdecl, const wchar_t*, wcsrchr, (const wchar_t* str, int character), \
- (str, character)) \
- F(_cdecl, const wchar_t*, wcschr, (const wchar_t* str, int character), \
- (str, character)) \
- F(_cdecl, int, strcmp, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, const char*, strpbrk, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, const char*, strstr, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, size_t, wcsnlen, (const wchar_t* str, size_t max_len), \
- (str, max_len)) \
- F(_cdecl, const wchar_t*, wcsstr, (const wchar_t* str1, \
- const wchar_t* str2), (str1, str2)) \
- F(_cdecl, size_t, strspn, (const char* str1, const char* str2), \
- (str1, str2)) \
- F(_cdecl, char*, strncpy, \
- (char* destination, const char* source, size_t num), \
- (destination, source, num)) \
- F(_cdecl, char*, strncat, \
- (char* destination, const char* source, size_t num), \
- (destination, source, num)) \
- F(WINAPI, BOOL, ReadFile, \
- (HANDLE file_handle, LPVOID buffer, DWORD bytes_to_read, \
- LPDWORD bytes_read, LPOVERLAPPED overlapped), \
- (file_handle, buffer, bytes_to_read, bytes_read, overlapped)) \
- F(WINAPI, BOOL, WriteFile, \
- (HANDLE file_handle, LPCVOID buffer, DWORD bytes_to_write, \
- LPDWORD bytes_written, LPOVERLAPPED overlapped), \
- (file_handle, buffer, bytes_to_write, bytes_written, overlapped)) \
- F(_cdecl, void, SetInterceptorCallback, (void (*callback)()), (callback)) \
- F(WINAPI, agent::asan::AsanRuntime*, GetActiveRuntime, (), ())
+#define ASAN_RTL_FUNCTIONS(F) \
+ F(WINAPI, HANDLE, GetProcessHeap, (), ()) \
+ F(WINAPI, HANDLE, HeapCreate, \
+ (DWORD options, SIZE_T initial_size, SIZE_T maximum_size), \
+ (options, initial_size, maximum_size)) \
+ F(WINAPI, BOOL, HeapDestroy, (HANDLE heap), (heap)) \
+ F(WINAPI, LPVOID, HeapAlloc, (HANDLE heap, DWORD flags, SIZE_T bytes), \
+ (heap, flags, bytes)) \
+ F(WINAPI, LPVOID, HeapReAlloc, \
+ (HANDLE heap, DWORD flags, LPVOID mem, SIZE_T bytes), \
+ (heap, flags, mem, bytes)) \
+ F(WINAPI, BOOL, HeapFree, (HANDLE heap, DWORD flags, LPVOID mem), \
+ (heap, flags, mem)) \
+ F(WINAPI, SIZE_T, HeapSize, (HANDLE heap, DWORD flags, LPCVOID mem), \
+ (heap, flags, mem)) \
+ F(WINAPI, BOOL, HeapValidate, (HANDLE heap, DWORD flags, LPCVOID mem), \
+ (heap, flags, mem)) \
+ F(WINAPI, SIZE_T, HeapCompact, (HANDLE heap, DWORD flags), (heap, flags)) \
+ F(WINAPI, BOOL, HeapLock, (HANDLE heap), (heap)) \
+ F(WINAPI, BOOL, HeapUnlock, (HANDLE heap), (heap)) \
+ F(WINAPI, BOOL, HeapWalk, (HANDLE heap, LPPROCESS_HEAP_ENTRY entry), \
+ (heap, entry)) \
+ F(WINAPI, BOOL, HeapSetInformation, \
+ (HANDLE heap, HEAP_INFORMATION_CLASS info_class, PVOID info, \
+ SIZE_T info_length), \
+ (heap, info_class, info, info_length)) \
+ F(WINAPI, BOOL, HeapQueryInformation, \
+ (HANDLE heap, HEAP_INFORMATION_CLASS info_class, PVOID info, \
+ SIZE_T info_length, PSIZE_T return_length), \
+ (heap, info_class, info, info_length, return_length)) \
+ F(WINAPI, void, SetCallBack, (void (*callback)(AsanErrorInfo * error_info)), \
+ (callback)) \
+ F(_cdecl, void*, memcpy, \
+ (void* destination, const void* source, size_t num), \
+ (destination, source, num)) \
+ F(_cdecl, void*, memmove, \
+ (void* destination, const void* source, size_t num), \
+ (destination, source, num)) \
+ F(_cdecl, void*, memset, (void* ptr, int value, size_t num), \
+ (ptr, value, num)) \
+ F(_cdecl, const void*, memchr, (const void* ptr, int value, size_t num), \
+ (ptr, value, num)) \
+ F(_cdecl, size_t, strcspn, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, size_t, strlen, (const char* str), (str)) \
+ F(_cdecl, size_t, strnlen, (const char* str, size_t max_len), \
+ (str, max_len)) \
+ F(_cdecl, const char*, strrchr, (const char* str, int character), \
+ (str, character)) \
+ F(_cdecl, const wchar_t*, wcsrchr, (const wchar_t* str, int character), \
+ (str, character)) \
+ F(_cdecl, const wchar_t*, wcschr, (const wchar_t* str, int character), \
+ (str, character)) \
+ F(_cdecl, int, strcmp, (const char* str1, const char* str2), (str1, str2)) \
+ F(_cdecl, const char*, strpbrk, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, const char*, strstr, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, size_t, wcsnlen, (const wchar_t* str, size_t max_len), \
+ (str, max_len)) \
+ F(_cdecl, const wchar_t*, wcsstr, \
+ (const wchar_t* str1, const wchar_t* str2), (str1, str2)) \
+ F(_cdecl, size_t, strspn, (const char* str1, const char* str2), \
+ (str1, str2)) \
+ F(_cdecl, char*, strncpy, \
+ (char* destination, const char* source, size_t num), \
+ (destination, source, num)) \
+ F(_cdecl, char*, strncat, \
+ (char* destination, const char* source, size_t num), \
+ (destination, source, num)) \
+ F(WINAPI, BOOL, ReadFile, \
+ (HANDLE file_handle, LPVOID buffer, DWORD bytes_to_read, \
+ LPDWORD bytes_read, LPOVERLAPPED overlapped), \
+ (file_handle, buffer, bytes_to_read, bytes_read, overlapped)) \
+ F(WINAPI, BOOL, WriteFile, \
+ (HANDLE file_handle, LPCVOID buffer, DWORD bytes_to_write, \
+ LPDWORD bytes_written, LPOVERLAPPED overlapped), \
+ (file_handle, buffer, bytes_to_write, bytes_written, overlapped)) \
+ F(_cdecl, void, SetInterceptorCallback, (void (*callback)()), (callback)) \
+ F(WINAPI, agent::asan::AsanRuntime*, GetActiveRuntime, (), ()) \
+ F(WINAPI, void, InitializeCrashReporter, (), ())
#endif
// Declare pointer types for the intercepted functions.
« no previous file with comments | « syzygy/agent/asan/syzyasan_rtl.def.template ('k') | syzygy/common/asan_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698