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
18namespace __sanitizer {
19
20bool AddDieCallback(DieCallbackType callback) { return true; }
21
22bool RemoveDieCallback(DieCallbackType callback) { return true; }
23
24void SetUserDieCallback(DieCallbackType callback) {}
25
26void NORETURN Die() {
27  if (common_flags()->abort_on_error)
28    Abort();
29  internal__exit(common_flags()->exitcode);
30}
31
32void SetCheckFailedCallback(CheckFailedCallbackType callback) {}
33
34void 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