LLDB mainline
CFBasicHash.h
Go to the documentation of this file.
1//===-- CFBasicHash.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#ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H
11
12#include "lldb/Target/Process.h"
13#include "lldb/Target/Target.h"
14
15namespace lldb_private {
16
18public:
19 enum class HashType { set = 0, dict };
20
21 CFBasicHash() = default;
22 ~CFBasicHash() = default;
23
24 bool Update(lldb::addr_t addr, ExecutionContextRef exe_ctx_rf);
25
26 bool IsValid() const;
27
28 bool IsMutable() const { return m_mutable; };
29 bool IsMultiVariant() const { return m_multi; }
30 HashType GetType() const { return m_type; }
31
32 size_t GetCount() const;
35
36private:
37 template <typename T> struct __CFBasicHash {
38 struct RuntimeBase {
42
43 struct Bits {
44 uint16_t __reserved0;
45 uint16_t __reserved1 : 2;
46 uint16_t keys_offset : 1;
47 uint16_t counts_offset : 2;
48 uint16_t counts_width : 2;
49 uint16_t __reserved2 : 9;
50 uint32_t used_buckets; // number of used buckets
51 uint64_t deleted : 16; // number of elements deleted
52 uint64_t num_buckets_idx : 8; // index to number of buckets
53 uint64_t __reserved3 : 40;
54 uint64_t __reserved4;
56
58 };
59 template <typename T> bool UpdateFor(std::unique_ptr<__CFBasicHash<T>> &m_ht);
60
61 size_t GetPointerCount() const;
62
66 std::unique_ptr<__CFBasicHash<uint32_t>> m_ht_32 = nullptr;
67 std::unique_ptr<__CFBasicHash<uint64_t>> m_ht_64 = nullptr;
69 bool m_mutable = true;
70 bool m_multi = false;
72};
73
74} // namespace lldb_private
75
76#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_CFBASICHASH_H
A section + offset based address class.
Definition: Address.h:62
size_t GetPointerCount() const
Definition: CFBasicHash.cpp:87
lldb::addr_t GetKeyPointer() const
Definition: CFBasicHash.cpp:96
bool UpdateFor(std::unique_ptr< __CFBasicHash< T > > &m_ht)
Definition: CFBasicHash.cpp:41
bool Update(lldb::addr_t addr, ExecutionContextRef exe_ctx_rf)
Definition: CFBasicHash.cpp:20
HashType GetType() const
Definition: CFBasicHash.h:30
std::unique_ptr< __CFBasicHash< uint64_t > > m_ht_64
Definition: CFBasicHash.h:67
std::unique_ptr< __CFBasicHash< uint32_t > > m_ht_32
Definition: CFBasicHash.h:66
bool IsMultiVariant() const
Definition: CFBasicHash.h:29
lldb::addr_t GetValuePointer() const
ExecutionContextRef m_exe_ctx_ref
Definition: CFBasicHash.h:68
lldb::ByteOrder m_byte_order
Definition: CFBasicHash.h:64
Execution context objects refer to objects in the execution of the program that is being debugged.
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
#define UINT32_MAX
Definition: lldb-defines.h:19
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.
@ eByteOrderInvalid
uint64_t addr_t
Definition: lldb-types.h:80
struct lldb_private::CFBasicHash::__CFBasicHash::Bits bits
struct lldb_private::CFBasicHash::__CFBasicHash::RuntimeBase base