scudo_termination.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===-- scudo_termination.cpp -----------------------------------*- 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 contains bare-bones termination functions to replace the
  10. /// __sanitizer ones, in order to avoid any potential abuse of the callbacks
  11. /// functionality.
  12. ///
  13. //===----------------------------------------------------------------------===//
  14. #include "scudo_utils.h"
  15. #include "sanitizer_common/sanitizer_common.h"
  16. namespace __sanitizer {
  17. bool AddDieCallback(DieCallbackType Callback) { return true; }
  18. bool RemoveDieCallback(DieCallbackType Callback) { return true; }
  19. void SetUserDieCallback(DieCallbackType Callback) {}
  20. void NORETURN Die() {
  21. if (common_flags()->abort_on_error)
  22. Abort();
  23. internal__exit(common_flags()->exitcode);
  24. }
  25. void SetCheckUnwindCallback(void (*callback)()) {}
  26. void NORETURN CheckFailed(const char *File, int Line, const char *Condition,
  27. u64 Value1, u64 Value2) {
  28. __scudo::dieWithMessage("CHECK failed at %s:%d %s (%lld, %lld)\n",
  29. File, Line, Condition, Value1, Value2);
  30. }
  31. } // namespace __sanitizer