2014-05-29 21:50:54 +08:00
|
|
|
//===-- 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
|
|
|
|
|
2014-11-04 06:23:44 +08:00
|
|
|
#include "sanitizer_common/sanitizer_stacktrace.h"
|
2014-05-29 21:50:54 +08:00
|
|
|
#include "tsan_defs.h"
|
|
|
|
|
|
|
|
namespace __tsan {
|
|
|
|
|
2014-11-04 06:23:44 +08:00
|
|
|
// 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);
|
2014-05-29 21:50:54 +08:00
|
|
|
|
[TSan] Report proper error on allocator failures instead of CHECK(0)-ing
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
2018-06-19 04:03:31 +08:00
|
|
|
// Reverses the current stack trace order, the top frame goes to the bottom,
|
|
|
|
// the last frame goes to the top.
|
|
|
|
void ReverseOrder();
|
|
|
|
|
2014-05-29 21:50:54 +08:00
|
|
|
private:
|
2014-11-04 06:23:44 +08:00
|
|
|
void ResizeBuffer(uptr new_size);
|
2014-05-29 21:50:54 +08:00
|
|
|
|
2014-11-04 06:23:44 +08:00
|
|
|
VarSizeStackTrace(const VarSizeStackTrace &);
|
|
|
|
void operator=(const VarSizeStackTrace &);
|
2014-05-29 21:50:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace __tsan
|
|
|
|
|
|
|
|
#endif // TSAN_STACK_TRACE_H
|