11b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//===-- sanitizer_stackdepot.h ----------------------------------*- C++ -*-===//
21b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//
31b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//                     The LLVM Compiler Infrastructure
41b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//
51b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// This file is distributed under the University of Illinois Open Source
61b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// License. See LICENSE.TXT for details.
71b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//
81b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//===----------------------------------------------------------------------===//
91b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//
101b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// This file is shared between AddressSanitizer and ThreadSanitizer
111b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// run-time libraries.
121b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov//===----------------------------------------------------------------------===//
131b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov#ifndef SANITIZER_STACKDEPOT_H
141b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov#define SANITIZER_STACKDEPOT_H
151b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov
16250f221ae0dee295098da8aa631977b6c2ebc99bEvgeniy Stepanov#include "sanitizer_internal_defs.h"
171b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov
181b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukovnamespace __sanitizer {
191b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov
201b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// StackDepot efficiently stores huge amounts of stack traces.
211b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov
221b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// Maps stack trace to an unique id.
23ff35f1d82b4f145b3477ef27a7a2e7b63c486988Dmitry Vyukovu32 StackDepotPut(const uptr *stack, uptr size);
241b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov// Retrieves a stored stack trace by the id.
25ff35f1d82b4f145b3477ef27a7a2e7b63c486988Dmitry Vyukovconst uptr *StackDepotGet(u32 id, uptr *size);
261b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov
279e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya Serebryanystruct StackDepotStats {
289e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya Serebryany  uptr n_uniq_ids;
299e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya Serebryany  uptr mapped;
309e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya Serebryany};
319e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya Serebryany
329e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya SerebryanyStackDepotStats *StackDepotGetStats();
339e3bd38388a7c182db57f6e3fc0943e6d12f012eKostya Serebryany
341b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov}  // namespace __sanitizer
351b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov
361b37017f0216d0b8f3ae3a7dea8b3cc20d74db25Dmitry Vyukov#endif  // SANITIZER_STACKDEPOT_H
37