Path: blob/main/contrib/llvm-project/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
39690 views
//===-- AppleObjCRuntime.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_APPLEOBJCRUNTIME_H9#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIME_H101112#include "AppleObjCTrampolineHandler.h"13#include "AppleThreadPlanStepThroughObjCTrampoline.h"14#include "lldb/Target/LanguageRuntime.h"15#include "lldb/lldb-private.h"1617#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"18#include <optional>1920namespace lldb_private {2122class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {23public:24~AppleObjCRuntime() override;2526// Static Functions27// Note there is no CreateInstance, Initialize & Terminate functions here,28// because29// you can't make an instance of this generic runtime.3031static char ID;3233static void Initialize();3435static void Terminate();3637bool isA(const void *ClassID) const override {38return ClassID == &ID || ObjCLanguageRuntime::isA(ClassID);39}4041static bool classof(const LanguageRuntime *runtime) {42return runtime->isA(&ID);43}4445// These are generic runtime functions:46llvm::Error GetObjectDescription(Stream &str, Value &value,47ExecutionContextScope *exe_scope) override;4849llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override;5051bool CouldHaveDynamicValue(ValueObject &in_value) override;5253bool GetDynamicTypeAndAddress(ValueObject &in_value,54lldb::DynamicValueType use_dynamic,55TypeAndOrName &class_type_or_name,56Address &address,57Value::ValueType &value_type) override;5859TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,60ValueObject &static_value) override;6162// These are the ObjC specific functions.6364bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override;6566bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override;6768bool HasReadObjCLibrary() override { return m_read_objc_library; }6970lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,71bool stop_others) override;7273// Get the "libobjc.A.dylib" module from the current target if we can find74// it, also cache it once it is found to ensure quick lookups.75lldb::ModuleSP GetObjCModule();7677// Sync up with the target7879void ModulesDidLoad(const ModuleList &module_list) override;8081void SetExceptionBreakpoints() override;8283void ClearExceptionBreakpoints() override;8485bool ExceptionBreakpointsAreSet() override;8687bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;8889lldb::SearchFilterSP CreateExceptionSearchFilter() override;9091static std::tuple<FileSpec, ConstString> GetExceptionThrowLocation();9293lldb::ValueObjectSP GetExceptionObjectForThread(94lldb::ThreadSP thread_sp) override;9596lldb::ThreadSP GetBacktraceThreadFromException(97lldb::ValueObjectSP thread_sp) override;9899uint32_t GetFoundationVersion();100101virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,102lldb::addr_t &cf_false);103104virtual bool IsTaggedPointer (lldb::addr_t addr) { return false; }105106protected:107// Call CreateInstance instead.108AppleObjCRuntime(Process *process);109110bool CalculateHasNewLiteralsAndIndexing() override;111112static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp);113114static ObjCRuntimeVersions GetObjCVersion(Process *process,115lldb::ModuleSP &objc_module_sp);116117void ReadObjCLibraryIfNeeded(const ModuleList &module_list);118119Address *GetPrintForDebuggerAddr();120121std::unique_ptr<Address> m_PrintForDebugger_addr;122bool m_read_objc_library;123std::unique_ptr<lldb_private::AppleObjCTrampolineHandler>124m_objc_trampoline_handler_up;125lldb::BreakpointSP m_objc_exception_bp_sp;126lldb::ModuleWP m_objc_module_wp;127std::unique_ptr<FunctionCaller> m_print_object_caller_up;128129std::optional<uint32_t> m_Foundation_major;130};131132} // namespace lldb_private133134#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIME_H135136137