tsan_stack_trace.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include "sanitizer_common/sanitizer_stacktrace.h"
  15. #include "tsan_defs.h"
  16. namespace __tsan {
  17. // StackTrace which calls malloc/free to allocate the buffer for
  18. // addresses in stack traces.
  19. struct VarSizeStackTrace : public StackTrace {
  20. uptr *trace_buffer; // Owned.
  21. VarSizeStackTrace();
  22. ~VarSizeStackTrace();
  23. void Init(const uptr *pcs, uptr cnt, uptr extra_top_pc = 0);
  24. // Reverses the current stack trace order, the top frame goes to the bottom,
  25. // the last frame goes to the top.
  26. void ReverseOrder();
  27. private:
  28. void ResizeBuffer(uptr new_size);
  29. VarSizeStackTrace(const VarSizeStackTrace &);
  30. void operator=(const VarSizeStackTrace &);
  31. };
  32. } // namespace __tsan
  33. #endif // TSAN_STACK_TRACE_H