* include/bits/allocator.h (operator==, operator!=): Add exception
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_stackdepot.h
blobc2c04ef9d64b6e87d3344badc9bf0ac633087433
1 //===-- sanitizer_stackdepot.h ----------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is shared between AddressSanitizer and ThreadSanitizer
9 // run-time libraries.
10 //===----------------------------------------------------------------------===//
11 #ifndef SANITIZER_STACKDEPOT_H
12 #define SANITIZER_STACKDEPOT_H
14 #include "sanitizer_common.h"
15 #include "sanitizer_internal_defs.h"
17 namespace __sanitizer {
19 // StackDepot efficiently stores huge amounts of stack traces.
21 // Maps stack trace to an unique id.
22 u32 StackDepotPut(const uptr *stack, uptr size);
23 // Retrieves a stored stack trace by the id.
24 const uptr *StackDepotGet(u32 id, uptr *size);
26 struct StackDepotStats {
27 uptr n_uniq_ids;
28 uptr mapped;
31 StackDepotStats *StackDepotGetStats();
33 struct StackDesc;
35 // Instantiating this class creates a snapshot of StackDepot which can be
36 // efficiently queried with StackDepotGet(). You can use it concurrently with
37 // StackDepot, but the snapshot is only guaranteed to contain those stack traces
38 // which were stored before it was instantiated.
39 class StackDepotReverseMap {
40 public:
41 StackDepotReverseMap();
42 const uptr *Get(u32 id, uptr *size);
44 private:
45 struct IdDescPair {
46 u32 id;
47 StackDesc *desc;
49 static bool IdComparator(const IdDescPair &a, const IdDescPair &b);
52 InternalMmapVector<IdDescPair> map_;
54 // Disallow evil constructors.
55 StackDepotReverseMap(const StackDepotReverseMap&);
56 void operator=(const StackDepotReverseMap&);
58 } // namespace __sanitizer
60 #endif // SANITIZER_STACKDEPOT_H