#include "sanitizer_common.h"
#include "sanitizer_allocator_interface.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_atomic.h"
#include "sanitizer_flags.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_libc.h"
#include "sanitizer_placement_new.h"
namespace __sanitizer {
const char *SanitizerToolName = …;
atomic_uint32_t current_verbosity;
uptr PageSizeCached;
u32 NumberOfCPUsCached;
uptr stoptheworld_tracer_pid = …;
uptr stoptheworld_tracer_ppid = …;
void NORETURN ReportMmapFailureAndDie(uptr size, const char *mem_type,
const char *mmap_type, error_t err,
bool raw_report) { … }
void NORETURN ReportMunmapFailureAndDie(void *addr, uptr size, error_t err,
bool raw_report) { … }
UptrComparisonFunction;
U32ComparisonFunction;
const char *StripPathPrefix(const char *filepath,
const char *strip_path_prefix) { … }
const char *StripModuleName(const char *module) { … }
void ReportErrorSummary(const char *error_message, const char *alt_tool_name) { … }
void RemoveANSIEscapeSequencesFromString(char *str) { … }
void LoadedModule::set(const char *module_name, uptr base_address) { … }
void LoadedModule::set(const char *module_name, uptr base_address,
ModuleArch arch, u8 uuid[kModuleUUIDSize],
bool instrumented) { … }
void LoadedModule::setUuid(const char *uuid, uptr size) { … }
void LoadedModule::clear() { … }
void LoadedModule::addAddressRange(uptr beg, uptr end, bool executable,
bool writable, const char *name) { … }
bool LoadedModule::containsAddress(uptr address) const { … }
static atomic_uintptr_t g_total_mmaped;
void IncreaseTotalMmap(uptr size) { … }
void DecreaseTotalMmap(uptr size) { … }
bool TemplateMatch(const char *templ, const char *str) { … }
static char binary_name_cache_str[kMaxPathLength];
static char process_name_cache_str[kMaxPathLength];
const char *GetProcessName() { … }
static uptr ReadProcessName( char *buf, uptr buf_len) { … }
void UpdateProcessName() { … }
void CacheBinaryName() { … }
uptr ReadBinaryNameCached(char *buf, uptr buf_len) { … }
uptr ReadBinaryDir( char *buf, uptr buf_len) { … }
#if !SANITIZER_GO
void PrintCmdline() { … }
#endif
static const int kMaxMallocFreeHooks = …;
struct MallocFreeHook { … };
static MallocFreeHook MFHooks[kMaxMallocFreeHooks];
void RunMallocHooks(void *ptr, uptr size) { … }
int RunFreeHooks(void *ptr) { … }
static int InstallMallocFreeHooks(void (*malloc_hook)(const void *, uptr),
void (*free_hook)(const void *)) { … }
void internal_sleep(unsigned seconds) { … }
void SleepForSeconds(unsigned seconds) { … }
void SleepForMillis(unsigned millis) { … }
void WaitForDebugger(unsigned seconds, const char *label) { … }
}
usingnamespace__sanitizer;
extern "C" {
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_report_error_summary,
const char *error_summary) { … }
SANITIZER_INTERFACE_ATTRIBUTE
int __sanitizer_acquire_crash_state() { … }
SANITIZER_INTERFACE_ATTRIBUTE
int __sanitizer_install_malloc_and_free_hooks(void (*malloc_hook)(const void *,
uptr),
void (*free_hook)(const void *)) { … }
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_malloc_hook, void *ptr,
uptr size) { … }
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_free_hook, void *ptr) { … }
SANITIZER_INTERFACE_WEAK_DEF(int, __sanitizer_ignore_free_hook, void *ptr) { … }
}