1 //===-- memprof_interface_internal.h ---------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file is a part of MemProfiler, a memory profiler. 10 // 11 // This header declares the MemProfiler runtime interface functions. 12 // The runtime library has to define these functions so the instrumented program 13 // could call them. 14 // 15 // See also include/sanitizer/memprof_interface.h 16 //===----------------------------------------------------------------------===// 17 #ifndef MEMPROF_INTERFACE_INTERNAL_H 18 #define MEMPROF_INTERFACE_INTERNAL_H 19 20 #include "sanitizer_common/sanitizer_internal_defs.h" 21 22 #include "memprof_init_version.h" 23 24 using __sanitizer::u32; 25 using __sanitizer::u64; 26 using __sanitizer::uptr; 27 28 extern "C" { 29 // This function should be called at the very beginning of the process, 30 // before any instrumented code is executed and before any call to malloc. 31 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_init(); 32 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_preinit(); 33 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_version_mismatch_check_v1(); 34 35 SANITIZER_INTERFACE_ATTRIBUTE 36 void __memprof_record_access(void const volatile *addr); 37 38 SANITIZER_INTERFACE_ATTRIBUTE 39 void __memprof_record_access_range(void const volatile *addr, uptr size); 40 41 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_print_accumulated_stats(); 42 43 SANITIZER_INTERFACE_ATTRIBUTE 44 const char *__memprof_default_options(); 45 46 SANITIZER_INTERFACE_ATTRIBUTE 47 extern uptr __memprof_shadow_memory_dynamic_address; 48 49 SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern char 50 __memprof_profile_filename[1]; 51 SANITIZER_INTERFACE_ATTRIBUTE int __memprof_profile_dump(); 52 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_profile_reset(); 53 54 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_load(uptr p); 55 SANITIZER_INTERFACE_ATTRIBUTE void __memprof_store(uptr p); 56 57 SANITIZER_INTERFACE_ATTRIBUTE 58 void *__memprof_memcpy(void *dst, const void *src, uptr size); 59 SANITIZER_INTERFACE_ATTRIBUTE 60 void *__memprof_memset(void *s, int c, uptr n); 61 SANITIZER_INTERFACE_ATTRIBUTE 62 void *__memprof_memmove(void *dest, const void *src, uptr n); 63 } // extern "C" 64 65 #endif // MEMPROF_INTERFACE_INTERNAL_H 66