memprof_interface_internal.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include "sanitizer_common/sanitizer_internal_defs.h"
  20. #include "memprof_init_version.h"
  21. using __sanitizer::u32;
  22. using __sanitizer::u64;
  23. using __sanitizer::uptr;
  24. extern "C" {
  25. // This function should be called at the very beginning of the process,
  26. // before any instrumented code is executed and before any call to malloc.
  27. SANITIZER_INTERFACE_ATTRIBUTE void __memprof_init();
  28. SANITIZER_INTERFACE_ATTRIBUTE void __memprof_preinit();
  29. SANITIZER_INTERFACE_ATTRIBUTE void __memprof_version_mismatch_check_v1();
  30. SANITIZER_INTERFACE_ATTRIBUTE
  31. void __memprof_record_access(void const volatile *addr);
  32. SANITIZER_INTERFACE_ATTRIBUTE
  33. void __memprof_record_access_range(void const volatile *addr, uptr size);
  34. SANITIZER_INTERFACE_ATTRIBUTE void __memprof_print_accumulated_stats();
  35. SANITIZER_INTERFACE_ATTRIBUTE
  36. const char *__memprof_default_options();
  37. SANITIZER_INTERFACE_ATTRIBUTE
  38. extern uptr __memprof_shadow_memory_dynamic_address;
  39. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE extern char
  40. __memprof_profile_filename[1];
  41. SANITIZER_INTERFACE_ATTRIBUTE int __memprof_profile_dump();
  42. SANITIZER_INTERFACE_ATTRIBUTE void __memprof_load(uptr p);
  43. SANITIZER_INTERFACE_ATTRIBUTE void __memprof_store(uptr p);
  44. SANITIZER_INTERFACE_ATTRIBUTE
  45. void *__memprof_memcpy(void *dst, const void *src, uptr size);
  46. SANITIZER_INTERFACE_ATTRIBUTE
  47. void *__memprof_memset(void *s, int c, uptr n);
  48. SANITIZER_INTERFACE_ATTRIBUTE
  49. void *__memprof_memmove(void *dest, const void *src, uptr n);
  50. } // extern "C"
  51. #endif // MEMPROF_INTERFACE_INTERNAL_H