blob: c441ff3c126acddb1558e8fb5600588e5782a7ca [file] [log] [blame]
Kostya Serebryany712fc982016-06-07 01:20:26 +00001//===-- 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
Kostya Serebryany707894b2016-08-02 22:25:38 +000016#include "scudo_utils.h"
17
Kostya Serebryany712fc982016-06-07 01:20:26 +000018#include "sanitizer_common/sanitizer_common.h"
19
20namespace __sanitizer {
21
Kostya Serebryany707894b2016-08-02 22:25:38 +000022bool AddDieCallback(DieCallbackType Callback) { return true; }
Kostya Serebryany712fc982016-06-07 01:20:26 +000023
Kostya Serebryany707894b2016-08-02 22:25:38 +000024bool RemoveDieCallback(DieCallbackType Callback) { return true; }
Kostya Serebryany712fc982016-06-07 01:20:26 +000025
Kostya Serebryany707894b2016-08-02 22:25:38 +000026void SetUserDieCallback(DieCallbackType Callback) {}
Kostya Serebryany712fc982016-06-07 01:20:26 +000027
28void NORETURN Die() {
29 if (common_flags()->abort_on_error)
30 Abort();
31 internal__exit(common_flags()->exitcode);
32}
33
34void SetCheckFailedCallback(CheckFailedCallbackType callback) {}
35
Kostya Serebryany707894b2016-08-02 22:25:38 +000036void NORETURN CheckFailed(const char *File, int Line, const char *Condition,
37 u64 Value1, u64 Value2) {
38 __scudo::dieWithMessage("Scudo CHECK failed: %s:%d %s (%lld, %lld)\n",
39 File, Line, Condition, Value1, Value2);
Kostya Serebryany712fc982016-06-07 01:20:26 +000040}
41
Kostya Kortchinsky1148dc52016-11-30 17:32:20 +000042} // namespace __sanitizer