#include "sanitizer_common/sanitizer_platform.h"
#if !SANITIZER_LINUX
#error Unsupported OS
#endif
#include "memprof_allocator.h"
#include "memprof_interceptors.h"
#include "memprof_internal.h"
#include "memprof_stack.h"
#include "sanitizer_common/sanitizer_allocator_checks.h"
#include "sanitizer_common/sanitizer_allocator_dlsym.h"
#include "sanitizer_common/sanitizer_errno.h"
#include "sanitizer_common/sanitizer_tls_get_addr.h"
usingnamespace__memprof;
struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> { … };
INTERCEPTOR(void, free, void *ptr) { … }
#if SANITIZER_INTERCEPT_CFREE
INTERCEPTOR(void, cfree, void *ptr) { … }
#endif
INTERCEPTOR(void *, malloc, uptr size) { … }
INTERCEPTOR(void *, calloc, uptr nmemb, uptr size) { … }
INTERCEPTOR(void *, realloc, void *ptr, uptr size) { … }
#if SANITIZER_INTERCEPT_REALLOCARRAY
INTERCEPTOR(void *, reallocarray, void *ptr, uptr nmemb, uptr size) { … }
#endif
#if SANITIZER_INTERCEPT_MEMALIGN
INTERCEPTOR(void *, memalign, uptr boundary, uptr size) { … }
INTERCEPTOR(void *, __libc_memalign, uptr boundary, uptr size) { … }
#endif
#if SANITIZER_INTERCEPT_ALIGNED_ALLOC
INTERCEPTOR(void *, aligned_alloc, uptr boundary, uptr size) { … }
#endif
INTERCEPTOR(uptr, malloc_usable_size, void *ptr) { … }
#if SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO
struct fake_mallinfo { … };
INTERCEPTOR(struct fake_mallinfo, mallinfo, void) { … }
INTERCEPTOR(int, mallopt, int cmd, int value) { … }
#endif
INTERCEPTOR(int, posix_memalign, void **memptr, uptr alignment, uptr size) { … }
INTERCEPTOR(void *, valloc, uptr size) { … }
#if SANITIZER_INTERCEPT_PVALLOC
INTERCEPTOR(void *, pvalloc, uptr size) { … }
#endif
INTERCEPTOR(void, malloc_stats, void) { … }
namespace __memprof {
void ReplaceSystemMalloc() { … }
}