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
15 #include "scudo_utils.h"
16
17 #include "sanitizer_common/sanitizer_common.h"
18
19 namespace __sanitizer {
20
AddDieCallback(DieCallbackType Callback)21 bool AddDieCallback(DieCallbackType Callback) { return true; }
22
RemoveDieCallback(DieCallbackType Callback)23 bool RemoveDieCallback(DieCallbackType Callback) { return true; }
24
SetUserDieCallback(DieCallbackType Callback)25 void SetUserDieCallback(DieCallbackType Callback) {}
26
Die()27 void NORETURN Die() {
28 if (common_flags()->abort_on_error)
29 Abort();
30 internal__exit(common_flags()->exitcode);
31 }
32
SetCheckUnwindCallback(void (* callback)())33 void SetCheckUnwindCallback(void (*callback)()) {}
34
CheckFailed(const char * File,int Line,const char * Condition,u64 Value1,u64 Value2)35 void NORETURN CheckFailed(const char *File, int Line, const char *Condition,
36 u64 Value1, u64 Value2) {
37 __scudo::dieWithMessage("CHECK failed at %s:%d %s (%lld, %lld)\n",
38 File, Line, Condition, Value1, Value2);
39 }
40
41 } // namespace __sanitizer
42