1//===-- tsan_stack_trace.h --------------------------------------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// This file is a part of ThreadSanitizer (TSan), a race detector. 10// 11//===----------------------------------------------------------------------===// 12#ifndef TSAN_STACK_TRACE_H 13#define TSAN_STACK_TRACE_H 14 15#include "sanitizer_common/sanitizer_stacktrace.h" 16#include "tsan_defs.h" 17 18namespace __tsan { 19 20// StackTrace which calls malloc/free to allocate the buffer for 21// addresses in stack traces. 22struct VarSizeStackTrace : public StackTrace { 23 uptr *trace_buffer; // Owned. 24 25 VarSizeStackTrace(); 26 ~VarSizeStackTrace(); 27 void Init(const uptr *pcs, uptr cnt, uptr extra_top_pc = 0); 28 29 // Reverses the current stack trace order, the top frame goes to the bottom, 30 // the last frame goes to the top. 31 void ReverseOrder(); 32 33 private: 34 void ResizeBuffer(uptr new_size); 35 36 VarSizeStackTrace(const VarSizeStackTrace &); 37 void operator=(const VarSizeStackTrace &); 38}; 39 40} // namespace __tsan 41 42#endif // TSAN_STACK_TRACE_H 43