Valgrind.h 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. //===- llvm/Support/Valgrind.h - Communication with Valgrind ----*- 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. // Methods for communicating with a valgrind instance this program is running
  10. // under. These are all no-ops unless LLVM was configured on a system with the
  11. // valgrind headers installed and valgrind is controlling this process.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_SUPPORT_VALGRIND_H
  15. #define LLVM_SUPPORT_VALGRIND_H
  16. #include <cstddef>
  17. namespace llvm {
  18. namespace sys {
  19. // True if Valgrind is controlling this process.
  20. bool RunningOnValgrind();
  21. // Discard valgrind's translation of code in the range [Addr .. Addr + Len).
  22. // Otherwise valgrind may continue to execute the old version of the code.
  23. void ValgrindDiscardTranslations(const void *Addr, size_t Len);
  24. } // namespace sys
  25. } // end namespace llvm
  26. #endif // LLVM_SUPPORT_VALGRIND_H