* README.Portability: Remove note on an Irix compatibility issue.
[official-gcc.git] / libsanitizer / asan / asan_report.h
blob111b8400153932c643443fb7c00c7586a6600b5f
1 //===-- asan_report.h -------------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of AddressSanitizer, an address sanity checker.
9 //
10 // ASan-private header for error reporting functions.
11 //===----------------------------------------------------------------------===//
13 #include "asan_allocator.h"
14 #include "asan_internal.h"
15 #include "asan_thread.h"
17 namespace __asan {
19 struct StackVarDescr {
20 uptr beg;
21 uptr size;
22 const char *name_pos;
23 uptr name_len;
26 // Returns the number of globals close to the provided address and copies
27 // them to "globals" array.
28 int GetGlobalsForAddress(uptr addr, __asan_global *globals, u32 *reg_sites,
29 int max_globals);
31 const char *MaybeDemangleGlobalName(const char *name);
32 void PrintGlobalNameIfASCII(InternalScopedString *str, const __asan_global &g);
33 void PrintGlobalLocation(InternalScopedString *str, const __asan_global &g);
35 void PrintMemoryByte(InternalScopedString *str, const char *before, u8 byte,
36 bool in_shadow, const char *after = "\n");
38 // The following functions prints address description depending
39 // on the memory type (shadow/heap/stack/global).
40 bool ParseFrameDescription(const char *frame_descr,
41 InternalMmapVector<StackVarDescr> *vars);
43 // Different kinds of error reports.
44 void ReportGenericError(uptr pc, uptr bp, uptr sp, uptr addr, bool is_write,
45 uptr access_size, u32 exp, bool fatal);
46 void ReportStackOverflow(const SignalContext &sig);
47 void ReportDeadlySignal(int signo, const SignalContext &sig);
48 void ReportNewDeleteSizeMismatch(uptr addr, uptr delete_size,
49 BufferedStackTrace *free_stack);
50 void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack);
51 void ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack);
52 void ReportAllocTypeMismatch(uptr addr, BufferedStackTrace *free_stack,
53 AllocType alloc_type,
54 AllocType dealloc_type);
55 void ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack);
56 void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr,
57 BufferedStackTrace *stack);
58 void ReportStringFunctionMemoryRangesOverlap(const char *function,
59 const char *offset1, uptr length1,
60 const char *offset2, uptr length2,
61 BufferedStackTrace *stack);
62 void ReportStringFunctionSizeOverflow(uptr offset, uptr size,
63 BufferedStackTrace *stack);
64 void ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end,
65 uptr old_mid, uptr new_mid,
66 BufferedStackTrace *stack);
68 void ReportODRViolation(const __asan_global *g1, u32 stack_id1,
69 const __asan_global *g2, u32 stack_id2);
71 // Mac-specific errors and warnings.
72 void ReportMacMzReallocUnknown(uptr addr, uptr zone_ptr,
73 const char *zone_name,
74 BufferedStackTrace *stack);
75 void ReportMacCfReallocUnknown(uptr addr, uptr zone_ptr,
76 const char *zone_name,
77 BufferedStackTrace *stack);
79 } // namespace __asan