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 
15 namespace lldb_private {
16 
17 class CFBasicHash {
18 public:
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 
36 private:
37  template <typename T> struct __CFBasicHash {
38  struct RuntimeBase {
39  T cfisa;
41  } base;
42 
43  struct Bits {
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;
55  } bits;
56 
57  T pointers[3];
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
lldb_private::CFBasicHash::m_exe_ctx_ref
ExecutionContextRef m_exe_ctx_ref
Definition: CFBasicHash.h:68
lldb_private::CFBasicHash::__CFBasicHash
Definition: CFBasicHash.h:37
lldb_private::CFBasicHash::GetValuePointer
lldb::addr_t GetValuePointer() const
Definition: CFBasicHash.cpp:106
lldb_private::CFBasicHash::m_ht_64
std::unique_ptr< __CFBasicHash< uint64_t > > m_ht_64
Definition: CFBasicHash.h:67
lldb_private::CFBasicHash::__CFBasicHash::Bits::deleted
uint64_t deleted
Definition: CFBasicHash.h:51
lldb_private::CFBasicHash
Definition: CFBasicHash.h:17
lldb_private::CFBasicHash::__CFBasicHash::RuntimeBase::cfinfoa
T cfinfoa
Definition: CFBasicHash.h:40
lldb_private::CFBasicHash::m_byte_order
lldb::ByteOrder m_byte_order
Definition: CFBasicHash.h:64
lldb_private::CFBasicHash::HashType::dict
@ dict
lldb_private::CFBasicHash::~CFBasicHash
~CFBasicHash()=default
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::CFBasicHash::IsMultiVariant
bool IsMultiVariant() const
Definition: CFBasicHash.h:29
lldb_private::CFBasicHash::GetPointerCount
size_t GetPointerCount() const
Definition: CFBasicHash.cpp:87
Process.h
lldb_private::CFBasicHash::HashType::set
@ set
Target.h
lldb_private::CFBasicHash::__CFBasicHash::Bits
Definition: CFBasicHash.h:43
lldb_private::CFBasicHash::__CFBasicHash::Bits::__reserved3
uint64_t __reserved3
Definition: CFBasicHash.h:53
lldb_private::CFBasicHash::__CFBasicHash::Bits::__reserved1
uint16_t __reserved1
Definition: CFBasicHash.h:45
lldb_private::CFBasicHash::__CFBasicHash::base
struct lldb_private::CFBasicHash::__CFBasicHash::RuntimeBase base
lldb_private::CFBasicHash::__CFBasicHash::pointers
T pointers[3]
Definition: CFBasicHash.h:57
lldb_private::CFBasicHash::__CFBasicHash::Bits::used_buckets
uint32_t used_buckets
Definition: CFBasicHash.h:50
lldb_private::CFBasicHash::m_ht_32
std::unique_ptr< __CFBasicHash< uint32_t > > m_ht_32
Definition: CFBasicHash.h:66
lldb_private::CFBasicHash::m_type
HashType m_type
Definition: CFBasicHash.h:71
lldb_private::CFBasicHash::__CFBasicHash::Bits::__reserved4
uint64_t __reserved4
Definition: CFBasicHash.h:54
lldb_private::CFBasicHash::__CFBasicHash::Bits::counts_width
uint16_t counts_width
Definition: CFBasicHash.h:48
lldb_private::CFBasicHash::__CFBasicHash::Bits::__reserved2
uint16_t __reserved2
Definition: CFBasicHash.h:49
lldb::eByteOrderInvalid
@ eByteOrderInvalid
Definition: lldb-enumerations.h:139
uint32_t
lldb_private::CFBasicHash::m_multi
bool m_multi
Definition: CFBasicHash.h:70
lldb_private::CFBasicHash::__CFBasicHash::Bits::counts_offset
uint16_t counts_offset
Definition: CFBasicHash.h:47
lldb_private::Address
Definition: Address.h:59
lldb_private::CFBasicHash::m_ptr_size
uint32_t m_ptr_size
Definition: CFBasicHash.h:63
lldb_private::CFBasicHash::__CFBasicHash::bits
struct lldb_private::CFBasicHash::__CFBasicHash::Bits bits
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
uint16_t
lldb_private::CFBasicHash::GetCount
size_t GetCount() const
Definition: CFBasicHash.cpp:75
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private::CFBasicHash::__CFBasicHash::Bits::__reserved0
uint16_t __reserved0
Definition: CFBasicHash.h:44
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::CFBasicHash::IsMutable
bool IsMutable() const
Definition: CFBasicHash.h:28
lldb_private::CFBasicHash::__CFBasicHash::Bits::keys_offset
uint16_t keys_offset
Definition: CFBasicHash.h:46
lldb_private::CFBasicHash::m_address
Address m_address
Definition: CFBasicHash.h:65
lldb_private::CFBasicHash::m_mutable
bool m_mutable
Definition: CFBasicHash.h:69
lldb_private::CFBasicHash::Update
bool Update(lldb::addr_t addr, ExecutionContextRef exe_ctx_rf)
Definition: CFBasicHash.cpp:20
lldb_private::CFBasicHash::__CFBasicHash::RuntimeBase::cfisa
T cfisa
Definition: CFBasicHash.h:39
lldb_private::CFBasicHash::UpdateFor
bool UpdateFor(std::unique_ptr< __CFBasicHash< T >> &m_ht)
Definition: CFBasicHash.cpp:41
lldb_private::CFBasicHash::CFBasicHash
CFBasicHash()=default
lldb_private::CFBasicHash::GetKeyPointer
lldb::addr_t GetKeyPointer() const
Definition: CFBasicHash.cpp:96
lldb_private::CFBasicHash::IsValid
bool IsValid() const
Definition: CFBasicHash.cpp:8
lldb_private::CFBasicHash::__CFBasicHash::Bits::num_buckets_idx
uint64_t num_buckets_idx
Definition: CFBasicHash.h:52
lldb_private::CFBasicHash::HashType
HashType
Definition: CFBasicHash.h:19
lldb_private::ExecutionContextRef
Execution context objects refer to objects in the execution of the program that is being debugged.
Definition: ExecutionContext.h:72
lldb_private::CFBasicHash::GetType
HashType GetType() const
Definition: CFBasicHash.h:30
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
lldb_private::CFBasicHash::__CFBasicHash::RuntimeBase
Definition: CFBasicHash.h:38