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
24using __sanitizer::u32;
25using __sanitizer::u64;
26using __sanitizer::uptr;
27
28extern "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.
31SANITIZER_INTERFACE_ATTRIBUTE void __memprof_init();
32SANITIZER_INTERFACE_ATTRIBUTE void __memprof_preinit();
33SANITIZER_INTERFACE_ATTRIBUTE void __memprof_version_mismatch_check_v1();
34
35SANITIZER_INTERFACE_ATTRIBUTE
36void __memprof_record_access(void const volatile *addr);
37
38SANITIZER_INTERFACE_ATTRIBUTE
39void __memprof_record_access_range(void const volatile *addr, uptr size);
40
41SANITIZER_INTERFACE_ATTRIBUTE void __memprof_print_accumulated_stats();
42
43SANITIZER_INTERFACE_ATTRIBUTE
44const char *__memprof_default_options();
45
46SANITIZER_INTERFACE_ATTRIBUTE
47extern uptr __memprof_shadow_memory_dynamic_address;
48
49SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern char
50 __memprof_profile_filename[1];
51SANITIZER_INTERFACE_ATTRIBUTE int __memprof_profile_dump();
52SANITIZER_INTERFACE_ATTRIBUTE void __memprof_profile_reset();
53
54SANITIZER_INTERFACE_ATTRIBUTE void __memprof_load(uptr p);
55SANITIZER_INTERFACE_ATTRIBUTE void __memprof_store(uptr p);
56
57SANITIZER_INTERFACE_ATTRIBUTE
58void *__memprof_memcpy(void *dst, const void *src, uptr size);
59SANITIZER_INTERFACE_ATTRIBUTE
60void *__memprof_memset(void *s, int c, uptr n);
61SANITIZER_INTERFACE_ATTRIBUTE
62void *__memprof_memmove(void *dest, const void *src, uptr n);
63} // extern "C"
64
65#endif // MEMPROF_INTERFACE_INTERNAL_H
66