1//===-- tsan_stack_trace.h --------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file is a part of ThreadSanitizer (TSan), a race detector. 11// 12//===----------------------------------------------------------------------===// 13#ifndef TSAN_STACK_TRACE_H 14#define TSAN_STACK_TRACE_H 15 16//#include "sanitizer_common/sanitizer_atomic.h" 17//#include "sanitizer_common/sanitizer_common.h" 18//#include "sanitizer_common/sanitizer_deadlock_detector_interface.h" 19#include "tsan_defs.h" 20//#include "tsan_clock.h" 21//#include "tsan_mutex.h" 22//#include "tsan_dense_alloc.h" 23 24namespace __tsan { 25 26class StackTrace { 27 public: 28 StackTrace(); 29 // Initialized the object in "static mode", 30 // in this mode it never calls malloc/free but uses the provided buffer. 31 StackTrace(uptr *buf, uptr cnt); 32 ~StackTrace(); 33 void Reset(); 34 35 void Init(const uptr *pcs, uptr cnt); 36 void ObtainCurrent(ThreadState *thr, uptr toppc); 37 bool IsEmpty() const; 38 uptr Size() const; 39 uptr Get(uptr i) const; 40 const uptr *Begin() const; 41 void CopyFrom(const StackTrace& other); 42 43 private: 44 uptr n_; 45 uptr *s_; 46 const uptr c_; 47 48 StackTrace(const StackTrace&); 49 void operator = (const StackTrace&); 50}; 51 52} // namespace __tsan 53 54#endif // TSAN_STACK_TRACE_H 55