Summary: This change removes `__tsan::StackTrace` class. There are now three alternatives: # Lightweight `__sanitizer::StackTrace`, which doesn't own a buffer of PCs. It is used in functions that need stack traces in read-only mode, and helps to prevent unnecessary allocations/copies (e.g. for StackTraces fetched from StackDepot). # `__sanitizer::BufferedStackTrace`, which stores buffer of PCs in a constant array. It is used in TraceHeader (non-Go version) # `__tsan::VarSizeStackTrace`, which owns buffer of PCs, dynamically allocated via TSan internal allocator. Test Plan: compiler-rt test suite Reviewers: dvyukov, kcc Reviewed By: kcc Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D6004 llvm-svn: 221194
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
//===-- tsan_stack_trace.h --------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// 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_STACK_TRACE_H
|
|
#define TSAN_STACK_TRACE_H
|
|
|
|
#include "sanitizer_common/sanitizer_stacktrace.h"
|
|
#include "tsan_defs.h"
|
|
|
|
namespace __tsan {
|
|
|
|
// StackTrace which calls malloc/free to allocate the buffer for
|
|
// addresses in stack traces.
|
|
struct VarSizeStackTrace : public StackTrace {
|
|
uptr *trace_buffer; // Owned.
|
|
|
|
VarSizeStackTrace();
|
|
~VarSizeStackTrace();
|
|
void Init(const uptr *pcs, uptr cnt, uptr extra_top_pc = 0);
|
|
|
|
private:
|
|
void ResizeBuffer(uptr new_size);
|
|
|
|
VarSizeStackTrace(const VarSizeStackTrace &);
|
|
void operator=(const VarSizeStackTrace &);
|
|
};
|
|
|
|
} // namespace __tsan
|
|
|
|
#endif // TSAN_STACK_TRACE_H
|