lsan_posix.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //=-- lsan_posix.h -----------------------------------------------------===//
  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 LeakSanitizer.
  10. // Standalone LSan RTL code common to POSIX-like systems.
  11. //
  12. //===---------------------------------------------------------------------===//
  13. #ifndef LSAN_POSIX_H
  14. #define LSAN_POSIX_H
  15. #include "lsan_thread.h"
  16. #include "sanitizer_common/sanitizer_platform.h"
  17. #if !SANITIZER_POSIX
  18. #error "lsan_posix.h is used only on POSIX-like systems (SANITIZER_POSIX)"
  19. #endif
  20. namespace __sanitizer {
  21. struct DTLS;
  22. }
  23. namespace __lsan {
  24. class ThreadContext final : public ThreadContextLsanBase {
  25. public:
  26. explicit ThreadContext(int tid);
  27. void OnStarted(void *arg) override;
  28. uptr tls_begin() { return tls_begin_; }
  29. uptr tls_end() { return tls_end_; }
  30. DTLS *dtls() { return dtls_; }
  31. private:
  32. uptr tls_begin_ = 0;
  33. uptr tls_end_ = 0;
  34. DTLS *dtls_ = nullptr;
  35. };
  36. void ThreadStart(u32 tid, tid_t os_id,
  37. ThreadType thread_type = ThreadType::Regular);
  38. } // namespace __lsan
  39. #endif // LSAN_POSIX_H