llvm-project/compiler-rt/lib/memprof/memprof_interface_internal.h
Snehasish Kumar 8377f90c21
[MemProf] Add sanitizer interface decls for histogram funcs. (#151398)
Add the necessary sanitizer interface decls required when the memprof
runtime is built in dynamic mode.  This was a latent issue since we didn't
add tests for the histogram feature in compiler-rt. These tests are run
with `ninja check-memprof-dynamic`.  I discovered this after the CI
failures for #147854.
2025-07-30 16:27:10 -07:00

79 lines
2.7 KiB
C++

//===-- memprof_interface_internal.h ---------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of MemProfiler, a memory profiler.
//
// This header declares the MemProfiler runtime interface functions.
// The runtime library has to define these functions so the instrumented program
// could call them.
//
// See also include/sanitizer/memprof_interface.h
//===----------------------------------------------------------------------===//
#ifndef MEMPROF_INTERFACE_INTERNAL_H
#define MEMPROF_INTERFACE_INTERNAL_H
#include "sanitizer_common/sanitizer_internal_defs.h"
#include "memprof_init_version.h"
using __sanitizer::u32;
using __sanitizer::u64;
using __sanitizer::uptr;
extern "C" {
// This function should be called at the very beginning of the process,
// before any instrumented code is executed and before any call to malloc.
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_init();
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_preinit();
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_version_mismatch_check_v1();
SANITIZER_INTERFACE_ATTRIBUTE
void __memprof_record_access(void const volatile *addr);
SANITIZER_INTERFACE_ATTRIBUTE
void __memprof_record_access_hist(void const volatile *addr);
SANITIZER_INTERFACE_ATTRIBUTE
void __memprof_record_access_range(void const volatile *addr, uptr size);
SANITIZER_INTERFACE_ATTRIBUTE
void __memprof_record_access_range_hist(void const volatile *addr, uptr size);
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_print_accumulated_stats();
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern char
__memprof_default_options_str[1];
SANITIZER_INTERFACE_ATTRIBUTE
const char *__memprof_default_options();
SANITIZER_INTERFACE_ATTRIBUTE
extern uptr __memprof_shadow_memory_dynamic_address;
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern char
__memprof_profile_filename[1];
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern bool
__memprof_histogram;
SANITIZER_INTERFACE_ATTRIBUTE int __memprof_profile_dump();
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_profile_reset();
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_load(uptr p);
SANITIZER_INTERFACE_ATTRIBUTE void __memprof_store(uptr p);
SANITIZER_INTERFACE_ATTRIBUTE
void *__memprof_memcpy(void *dst, const void *src, uptr size);
SANITIZER_INTERFACE_ATTRIBUTE
void *__memprof_memset(void *s, int c, uptr n);
SANITIZER_INTERFACE_ATTRIBUTE
void *__memprof_memmove(void *dest, const void *src, uptr n);
} // extern "C"
#endif // MEMPROF_INTERFACE_INTERNAL_H