2014-09-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
[official-gcc.git] / libsanitizer / asan / asan_report.h
blobd9a0bca64233e886e416fbc4660b864ddaaa3569
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 // The following functions prints address description depending
20 // on the memory type (shadow/heap/stack/global).
21 void DescribeHeapAddress(uptr addr, uptr access_size);
22 bool DescribeAddressIfGlobal(uptr addr, uptr access_size);
23 bool DescribeAddressRelativeToGlobal(uptr addr, uptr access_size,
24 const __asan_global &g);
25 bool DescribeAddressIfShadow(uptr addr);
26 bool DescribeAddressIfStack(uptr addr, uptr access_size);
27 // Determines memory type on its own.
28 void DescribeAddress(uptr addr, uptr access_size);
30 void DescribeThread(AsanThreadContext *context);
32 // Different kinds of error reports.
33 void NORETURN
34 ReportStackOverflow(uptr pc, uptr sp, uptr bp, void *context, uptr addr);
35 void NORETURN
36 ReportSIGSEGV(uptr pc, uptr sp, uptr bp, void *context, uptr addr);
37 void NORETURN ReportDoubleFree(uptr addr, StackTrace *free_stack);
38 void NORETURN ReportFreeNotMalloced(uptr addr, StackTrace *free_stack);
39 void NORETURN ReportAllocTypeMismatch(uptr addr, StackTrace *free_stack,
40 AllocType alloc_type,
41 AllocType dealloc_type);
42 void NORETURN ReportMallocUsableSizeNotOwned(uptr addr,
43 StackTrace *stack);
44 void NORETURN ReportAsanGetAllocatedSizeNotOwned(uptr addr,
45 StackTrace *stack);
46 void NORETURN ReportStringFunctionMemoryRangesOverlap(
47 const char *function, const char *offset1, uptr length1,
48 const char *offset2, uptr length2, StackTrace *stack);
49 void NORETURN
50 ReportStringFunctionSizeOverflow(uptr offset, uptr size, StackTrace *stack);
51 void NORETURN
52 ReportBadParamsToAnnotateContiguousContainer(uptr beg, uptr end, uptr old_mid,
53 uptr new_mid, StackTrace *stack);
55 void NORETURN
56 ReportODRViolation(const __asan_global *g1, const __asan_global *g2);
58 // Mac-specific errors and warnings.
59 void WarnMacFreeUnallocated(
60 uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
61 void NORETURN ReportMacMzReallocUnknown(
62 uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
63 void NORETURN ReportMacCfReallocUnknown(
64 uptr addr, uptr zone_ptr, const char *zone_name, StackTrace *stack);
66 } // namespace __asan