report.h 2.1 KB

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