]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/scudo/scudo_termination.cpp
Update compiler-rt to release_39 branch r288513. Since this contains a
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / scudo / scudo_termination.cpp
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
20 bool AddDieCallback(DieCallbackType callback) { return true; }
21
22 bool RemoveDieCallback(DieCallbackType callback) { return true; }
23
24 void SetUserDieCallback(DieCallbackType callback) {}
25
26 void NORETURN Die() {
27   if (common_flags()->abort_on_error)
28     Abort();
29   internal__exit(common_flags()->exitcode);
30 }
31
32 void SetCheckFailedCallback(CheckFailedCallbackType callback) {}
33
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