1//===-- report.h ------------------------------------------------*- 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#ifndef SCUDO_REPORT_H_
10#define SCUDO_REPORT_H_
11
12#include "internal_defs.h"
13
14namespace scudo {
15
16// Reports are *fatal* unless stated otherwise.
17
18// Generic error, adds newline to end of message.
19void NORETURN reportError(const char *Message);
20
21// Generic error, but the message is not modified.
22void NORETURN reportRawError(const char *Message);
23
24// Flags related errors.
25void NORETURN reportInvalidFlag(const char *FlagType, const char *Value);
26
27// Chunk header related errors.
28void NORETURN reportHeaderCorruption(void *Ptr);
29
30// Sanity checks related error.
31void NORETURN reportSanityCheckError(const char *Field);
32
33// Combined allocator errors.
34void NORETURN reportAlignmentTooBig(uptr Alignment, uptr MaxAlignment);
35void NORETURN reportAllocationSizeTooBig(uptr UserSize, uptr TotalSize,
36 uptr MaxSize);
37void NORETURN reportOutOfBatchClass();
38void NORETURN reportOutOfMemory(uptr RequestedSize);
39enum class AllocatorAction : u8 {
40 Recycling,
41 Deallocating,
42 Reallocating,
43 Sizing,
44};
45void NORETURN reportInvalidChunkState(AllocatorAction Action, void *Ptr);
46void NORETURN reportMisalignedPointer(AllocatorAction Action, void *Ptr);
47void NORETURN reportDeallocTypeMismatch(AllocatorAction Action, void *Ptr,
48 u8 TypeA, u8 TypeB);
49void NORETURN reportDeleteSizeMismatch(void *Ptr, uptr Size, uptr ExpectedSize);
50
51// C wrappers errors.
52void NORETURN reportAlignmentNotPowerOfTwo(uptr Alignment);
53void NORETURN reportInvalidPosixMemalignAlignment(uptr Alignment);
54void NORETURN reportCallocOverflow(uptr Count, uptr Size);
55void NORETURN reportPvallocOverflow(uptr Size);
56void NORETURN reportInvalidAlignedAllocAlignment(uptr Size, uptr Alignment);
57
58} // namespace scudo
59
60#endif // SCUDO_REPORT_H_
61

source code of compiler-rt/lib/scudo/standalone/report.h