| 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 SANITIZER_WEAK_ATTRIBUTE extern char |
| 44 | __memprof_default_options_str[1]; |
| 45 | |
| 46 | SANITIZER_INTERFACE_ATTRIBUTE |
| 47 | const char *__memprof_default_options(); |
| 48 | |
| 49 | SANITIZER_INTERFACE_ATTRIBUTE |
| 50 | extern uptr __memprof_shadow_memory_dynamic_address; |
| 51 | |
| 52 | SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern char |
| 53 | __memprof_profile_filename[1]; |
| 54 | SANITIZER_INTERFACE_ATTRIBUTE int __memprof_profile_dump(); |
| 55 | SANITIZER_INTERFACE_ATTRIBUTE void __memprof_profile_reset(); |
| 56 | |
| 57 | SANITIZER_INTERFACE_ATTRIBUTE void __memprof_load(uptr p); |
| 58 | SANITIZER_INTERFACE_ATTRIBUTE void __memprof_store(uptr p); |
| 59 | |
| 60 | SANITIZER_INTERFACE_ATTRIBUTE |
| 61 | void *__memprof_memcpy(void *dst, const void *src, uptr size); |
| 62 | SANITIZER_INTERFACE_ATTRIBUTE |
| 63 | void *__memprof_memset(void *s, int c, uptr n); |
| 64 | SANITIZER_INTERFACE_ATTRIBUTE |
| 65 | void *__memprof_memmove(void *dest, const void *src, uptr n); |
| 66 | } // extern "C" |
| 67 | |
| 68 | #endif // MEMPROF_INTERFACE_INTERNAL_H |
| 69 | |