Path: blob/main/contrib/llvm-project/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
39690 views
//===-- AppleObjCRuntimeV1.h ------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIMEV1_H9#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIMEV1_H1011#include "AppleObjCRuntime.h"12#include "lldb/lldb-private.h"1314#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"1516namespace lldb_private {1718class AppleObjCRuntimeV1 : public AppleObjCRuntime {19public:20~AppleObjCRuntimeV1() override = default;2122// Static Functions23static void Initialize();2425static void Terminate();2627static lldb_private::LanguageRuntime *28CreateInstance(Process *process, lldb::LanguageType language);2930static llvm::StringRef GetPluginNameStatic() { return "apple-objc-v1"; }3132static char ID;3334bool isA(const void *ClassID) const override {35return ClassID == &ID || AppleObjCRuntime::isA(ClassID);36}3738static bool classof(const LanguageRuntime *runtime) {39return runtime->isA(&ID);40}4142lldb::addr_t GetTaggedPointerObfuscator();4344class ClassDescriptorV1 : public ObjCLanguageRuntime::ClassDescriptor {45public:46ClassDescriptorV1(ValueObject &isa_pointer);47ClassDescriptorV1(ObjCISA isa, lldb::ProcessSP process_sp);4849~ClassDescriptorV1() override = default;5051ConstString GetClassName() override { return m_name; }5253ClassDescriptorSP GetSuperclass() override;5455ClassDescriptorSP GetMetaclass() const override;5657bool IsValid() override { return m_valid; }5859// v1 does not support tagged pointers60bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,61uint64_t *value_bits = nullptr,62uint64_t *payload = nullptr) override {63return false;64}6566bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,67int64_t *value_bits = nullptr,68uint64_t *payload = nullptr) override {69return false;70}7172uint64_t GetInstanceSize() override { return m_instance_size; }7374ObjCISA GetISA() override { return m_isa; }7576bool77Describe(std::function<void(ObjCLanguageRuntime::ObjCISA)> const78&superclass_func,79std::function<bool(const char *, const char *)> const80&instance_method_func,81std::function<bool(const char *, const char *)> const82&class_method_func,83std::function<bool(const char *, const char *, lldb::addr_t,84uint64_t)> const &ivar_func) const override;8586protected:87void Initialize(ObjCISA isa, lldb::ProcessSP process_sp);8889private:90ConstString m_name;91ObjCISA m_isa;92ObjCISA m_parent_isa;93bool m_valid;94lldb::ProcessWP m_process_wp;95uint64_t m_instance_size;96};9798// These are generic runtime functions:99bool GetDynamicTypeAndAddress(ValueObject &in_value,100lldb::DynamicValueType use_dynamic,101TypeAndOrName &class_type_or_name,102Address &address,103Value::ValueType &value_type) override;104105llvm::Expected<std::unique_ptr<UtilityFunction>>106CreateObjectChecker(std::string, ExecutionContext &exe_ctx) override;107108// PluginInterface protocol109llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }110111ObjCRuntimeVersions GetRuntimeVersion() const override {112return ObjCRuntimeVersions::eAppleObjC_V1;113}114115void UpdateISAToDescriptorMapIfNeeded() override;116117DeclVendor *GetDeclVendor() override;118119protected:120lldb::BreakpointResolverSP121CreateExceptionResolver(const lldb::BreakpointSP &bkpt,122bool catch_bp, bool throw_bp) override;123124class HashTableSignature {125public:126HashTableSignature() = default;127128bool NeedsUpdate(uint32_t count, uint32_t num_buckets,129lldb::addr_t buckets_ptr) {130return m_count != count || m_num_buckets != num_buckets ||131m_buckets_ptr != buckets_ptr;132}133134void UpdateSignature(uint32_t count, uint32_t num_buckets,135lldb::addr_t buckets_ptr) {136m_count = count;137m_num_buckets = num_buckets;138m_buckets_ptr = buckets_ptr;139}140141protected:142uint32_t m_count = 0;143uint32_t m_num_buckets = 0;144lldb::addr_t m_buckets_ptr = LLDB_INVALID_ADDRESS;145};146147lldb::addr_t GetISAHashTablePointer();148149HashTableSignature m_hash_signature;150lldb::addr_t m_isa_hash_table_ptr;151std::unique_ptr<DeclVendor> m_decl_vendor_up;152153private:154AppleObjCRuntimeV1(Process *process);155};156157} // namespace lldb_private158159#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIMEV1_H160161162