696d846a56
libsanitizer/ 2015-10-20 Maxim Ostapenko <m.ostapenko@partner.samsung.com> * All source files: Merge from upstream r250806. * configure.ac (link_sanitizer_common): Add -lrt flag. * configure.tgt: Enable TSAN and LSAN for aarch64-linux targets. Set CXX_ABI_NEEDED=true for darwin. * asan/Makefile.am (asan_files): Add new files. (DEFS): Add DCAN_SANITIZE_UB=0 and remove unused and legacy DASAN_FLEXIBLE_MAPPING_AND_OFFSET=0. * asan/Makefile.in: Regenerate. * ubsan/Makefile.am (ubsan_files): Add new files. (DEFS): Add DCAN_SANITIZE_UB=1. (libubsan_la_LIBADD): Add -lc++abi if CXX_ABI_NEEDED is true. * ubsan/Makefile.in: Regenerate. * tsan/Makefile.am (tsan_files): Add new files. (DEFS): Add DCAN_SANITIZE_UB=0. * tsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.am (sanitizer_common_files): Add new files. * sanitizer_common/Makefile.in: Regenerate. * asan/libtool-version: Bump the libasan SONAME. From-SVN: r229111
128 lines
2.5 KiB
C++
128 lines
2.5 KiB
C++
//===-- tsan_report.h -------------------------------------------*- C++ -*-===//
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file is a part of ThreadSanitizer (TSan), a race detector.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef TSAN_REPORT_H
|
|
#define TSAN_REPORT_H
|
|
|
|
#include "sanitizer_common/sanitizer_symbolizer.h"
|
|
#include "tsan_defs.h"
|
|
#include "tsan_vector.h"
|
|
|
|
namespace __tsan {
|
|
|
|
enum ReportType {
|
|
ReportTypeRace,
|
|
ReportTypeVptrRace,
|
|
ReportTypeUseAfterFree,
|
|
ReportTypeVptrUseAfterFree,
|
|
ReportTypeThreadLeak,
|
|
ReportTypeMutexDestroyLocked,
|
|
ReportTypeMutexDoubleLock,
|
|
ReportTypeMutexBadUnlock,
|
|
ReportTypeMutexBadReadLock,
|
|
ReportTypeMutexBadReadUnlock,
|
|
ReportTypeSignalUnsafe,
|
|
ReportTypeErrnoInSignal,
|
|
ReportTypeDeadlock
|
|
};
|
|
|
|
struct ReportStack {
|
|
SymbolizedStack *frames;
|
|
bool suppressable;
|
|
static ReportStack *New();
|
|
|
|
private:
|
|
ReportStack();
|
|
};
|
|
|
|
struct ReportMopMutex {
|
|
u64 id;
|
|
bool write;
|
|
};
|
|
|
|
struct ReportMop {
|
|
int tid;
|
|
uptr addr;
|
|
int size;
|
|
bool write;
|
|
bool atomic;
|
|
Vector<ReportMopMutex> mset;
|
|
ReportStack *stack;
|
|
|
|
ReportMop();
|
|
};
|
|
|
|
enum ReportLocationType {
|
|
ReportLocationGlobal,
|
|
ReportLocationHeap,
|
|
ReportLocationStack,
|
|
ReportLocationTLS,
|
|
ReportLocationFD
|
|
};
|
|
|
|
struct ReportLocation {
|
|
ReportLocationType type;
|
|
DataInfo global;
|
|
uptr heap_chunk_start;
|
|
uptr heap_chunk_size;
|
|
int tid;
|
|
int fd;
|
|
bool suppressable;
|
|
ReportStack *stack;
|
|
|
|
static ReportLocation *New(ReportLocationType type);
|
|
private:
|
|
explicit ReportLocation(ReportLocationType type);
|
|
};
|
|
|
|
struct ReportThread {
|
|
int id;
|
|
uptr pid;
|
|
bool running;
|
|
char *name;
|
|
int parent_tid;
|
|
ReportStack *stack;
|
|
};
|
|
|
|
struct ReportMutex {
|
|
u64 id;
|
|
uptr addr;
|
|
bool destroyed;
|
|
ReportStack *stack;
|
|
};
|
|
|
|
class ReportDesc {
|
|
public:
|
|
ReportType typ;
|
|
Vector<ReportStack*> stacks;
|
|
Vector<ReportMop*> mops;
|
|
Vector<ReportLocation*> locs;
|
|
Vector<ReportMutex*> mutexes;
|
|
Vector<ReportThread*> threads;
|
|
Vector<int> unique_tids;
|
|
ReportStack *sleep;
|
|
int count;
|
|
|
|
ReportDesc();
|
|
~ReportDesc();
|
|
|
|
private:
|
|
ReportDesc(const ReportDesc&);
|
|
void operator = (const ReportDesc&);
|
|
};
|
|
|
|
// Format and output the report to the console/log. No additional logic.
|
|
void PrintReport(const ReportDesc *rep);
|
|
void PrintStack(const ReportStack *stack);
|
|
|
|
} // namespace __tsan
|
|
|
|
#endif // TSAN_REPORT_H
|