Kostya Serebryany | 712fc98 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 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 | |
Kostya Serebryany | 707894b | 2016-08-02 22:25:38 +0000 | [diff] [blame] | 16 | #include "scudo_utils.h" |
| 17 | |
Kostya Serebryany | 712fc98 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 18 | #include "sanitizer_common/sanitizer_common.h" |
| 19 | |
| 20 | namespace __sanitizer { |
| 21 | |
Kostya Serebryany | 707894b | 2016-08-02 22:25:38 +0000 | [diff] [blame] | 22 | bool AddDieCallback(DieCallbackType Callback) { return true; } |
Kostya Serebryany | 712fc98 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 23 | |
Kostya Serebryany | 707894b | 2016-08-02 22:25:38 +0000 | [diff] [blame] | 24 | bool RemoveDieCallback(DieCallbackType Callback) { return true; } |
Kostya Serebryany | 712fc98 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 25 | |
Kostya Serebryany | 707894b | 2016-08-02 22:25:38 +0000 | [diff] [blame] | 26 | void SetUserDieCallback(DieCallbackType Callback) {} |
Kostya Serebryany | 712fc98 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 27 | |
| 28 | void NORETURN Die() { |
| 29 | if (common_flags()->abort_on_error) |
| 30 | Abort(); |
| 31 | internal__exit(common_flags()->exitcode); |
| 32 | } |
| 33 | |
| 34 | void SetCheckFailedCallback(CheckFailedCallbackType callback) {} |
| 35 | |
Kostya Serebryany | 707894b | 2016-08-02 22:25:38 +0000 | [diff] [blame] | 36 | void 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 Serebryany | 712fc98 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 40 | } |
| 41 | |
Kostya Kortchinsky | 1148dc5 | 2016-11-30 17:32:20 +0000 | [diff] [blame] | 42 | } // namespace __sanitizer |