1 //===-- tsan_stack_trace.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 ThreadSanitizer (TSan), a race detector. 9 // 10 //===----------------------------------------------------------------------===// 11 #ifndef TSAN_STACK_TRACE_H 12 #define TSAN_STACK_TRACE_H 13 14 #include "sanitizer_common/sanitizer_stacktrace.h" 15 #include "tsan_defs.h" 16 17 namespace __tsan { 18 19 // StackTrace which calls malloc/free to allocate the buffer for 20 // addresses in stack traces. 21 struct VarSizeStackTrace : public StackTrace { 22 uptr *trace_buffer; // Owned. 23 24 VarSizeStackTrace(); 25 ~VarSizeStackTrace(); 26 void Init(const uptr *pcs, uptr cnt, uptr extra_top_pc = 0); 27 28 // Reverses the current stack trace order, the top frame goes to the bottom, 29 // the last frame goes to the top. 30 void ReverseOrder(); 31 32 private: 33 void ResizeBuffer(uptr new_size); 34 35 VarSizeStackTrace(const VarSizeStackTrace &); 36 void operator=(const VarSizeStackTrace &); 37 }; 38 39 } // namespace __tsan 40 41 #endif // TSAN_STACK_TRACE_H 42