
Summary: Following up on and complementing D44404 and other sanitizer allocators. Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, no stack, no details, not too helpful nor informative. To improve the situation, detailed and structured common errors were defined and reported under the appropriate conditions. Common tests were generalized a bit to cover a slightly different TSan stack reporting format, extended to verify errno value and returned pointer value check is now explicit to facilitate debugging. Reviewers: dvyukov Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48087 llvm-svn: 334975
44 lines
1.2 KiB
C++
44 lines
1.2 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);
|
|
|
|
// Reverses the current stack trace order, the top frame goes to the bottom,
|
|
// the last frame goes to the top.
|
|
void ReverseOrder();
|
|
|
|
private:
|
|
void ResizeBuffer(uptr new_size);
|
|
|
|
VarSizeStackTrace(const VarSizeStackTrace &);
|
|
void operator=(const VarSizeStackTrace &);
|
|
};
|
|
|
|
} // namespace __tsan
|
|
|
|
#endif // TSAN_STACK_TRACE_H
|