1 //===-- scudo_termination.cpp -----------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// This file contains bare-bones termination functions to replace the
11 /// __sanitizer ones, in order to avoid any potential abuse of the callbacks
12 /// functionality.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #include "sanitizer_common/sanitizer_common.h"
17
18 namespace __sanitizer {
19
AddDieCallback(DieCallbackType callback)20 bool AddDieCallback(DieCallbackType callback) { return true; }
21
RemoveDieCallback(DieCallbackType callback)22 bool RemoveDieCallback(DieCallbackType callback) { return true; }
23
SetUserDieCallback(DieCallbackType callback)24 void SetUserDieCallback(DieCallbackType callback) {}
25
Die()26 void NORETURN Die() {
27 if (common_flags()->abort_on_error)
28 Abort();
29 internal__exit(common_flags()->exitcode);
30 }
31
SetCheckFailedCallback(CheckFailedCallbackType callback)32 void SetCheckFailedCallback(CheckFailedCallbackType callback) {}
33
CheckFailed(const char * file,int line,const char * cond,u64 v1,u64 v2)34 void NORETURN CheckFailed(const char *file, int line, const char *cond,
35 u64 v1, u64 v2) {
36 Report("Sanitizer CHECK failed: %s:%d %s (%lld, %lld)\n", file, line, cond,
37 v1, v2);
38 Die();
39 }
40
41 } // namespace __sanitizer
42