AppleObjCRuntime.h revision 314564
1293116Semaste//===-- AppleObjCRuntime.h --------------------------------------*- C++ -*-===// 2293116Semaste// 3293116Semaste// The LLVM Compiler Infrastructure 4293116Semaste// 5293116Semaste// This file is distributed under the University of Illinois Open Source 6293116Semaste// License. See LICENSE.TXT for details. 7293116Semaste// 8293116Semaste//===----------------------------------------------------------------------===// 9293116Semaste 10293116Semaste#ifndef liblldb_AppleObjCRuntime_h_ 11293116Semaste#define liblldb_AppleObjCRuntime_h_ 12293116Semaste 13293116Semaste// C Includes 14293116Semaste// C++ Includes 15293116Semaste// Other libraries and framework includes 16293116Semaste#include "llvm/ADT/Optional.h" 17293116Semaste 18293116Semaste// Project includes 19314564Sdim#include "AppleObjCTrampolineHandler.h" 20314564Sdim#include "AppleThreadPlanStepThroughObjCTrampoline.h" 21293116Semaste#include "lldb/Target/LanguageRuntime.h" 22293116Semaste#include "lldb/Target/ObjCLanguageRuntime.h" 23314564Sdim#include "lldb/lldb-private.h" 24293116Semaste 25293116Semastenamespace lldb_private { 26314564Sdim 27314564Sdimclass AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime { 28293116Semastepublic: 29314564Sdim ~AppleObjCRuntime() override; 30293116Semaste 31314564Sdim //------------------------------------------------------------------ 32314564Sdim // Static Functions 33314564Sdim //------------------------------------------------------------------ 34314564Sdim // Note there is no CreateInstance, Initialize & Terminate functions here, 35314564Sdim // because 36314564Sdim // you can't make an instance of this generic runtime. 37293116Semaste 38314564Sdim static bool classof(const ObjCLanguageRuntime *runtime) { 39314564Sdim switch (runtime->GetRuntimeVersion()) { 40314564Sdim case ObjCRuntimeVersions::eAppleObjC_V1: 41314564Sdim case ObjCRuntimeVersions::eAppleObjC_V2: 42314564Sdim return true; 43314564Sdim default: 44314564Sdim return false; 45293116Semaste } 46314564Sdim } 47293116Semaste 48314564Sdim // These are generic runtime functions: 49314564Sdim bool GetObjectDescription(Stream &str, Value &value, 50314564Sdim ExecutionContextScope *exe_scope) override; 51293116Semaste 52314564Sdim bool GetObjectDescription(Stream &str, ValueObject &object) override; 53293116Semaste 54314564Sdim bool CouldHaveDynamicValue(ValueObject &in_value) override; 55293116Semaste 56314564Sdim bool GetDynamicTypeAndAddress(ValueObject &in_value, 57314564Sdim lldb::DynamicValueType use_dynamic, 58314564Sdim TypeAndOrName &class_type_or_name, 59314564Sdim Address &address, 60314564Sdim Value::ValueType &value_type) override; 61293116Semaste 62314564Sdim TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, 63314564Sdim ValueObject &static_value) override; 64314564Sdim 65314564Sdim // These are the ObjC specific functions. 66314564Sdim 67314564Sdim bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override; 68314564Sdim 69314564Sdim bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override; 70314564Sdim 71314564Sdim bool HasReadObjCLibrary() override { return m_read_objc_library; } 72314564Sdim 73314564Sdim lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, 74314564Sdim bool stop_others) override; 75314564Sdim 76314564Sdim // Get the "libobjc.A.dylib" module from the current target if we can find 77314564Sdim // it, also cache it once it is found to ensure quick lookups. 78314564Sdim lldb::ModuleSP GetObjCModule(); 79314564Sdim 80314564Sdim // Sync up with the target 81314564Sdim 82314564Sdim void ModulesDidLoad(const ModuleList &module_list) override; 83314564Sdim 84314564Sdim void SetExceptionBreakpoints() override; 85314564Sdim 86314564Sdim void ClearExceptionBreakpoints() override; 87314564Sdim 88314564Sdim bool ExceptionBreakpointsAreSet() override; 89314564Sdim 90314564Sdim bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override; 91314564Sdim 92314564Sdim lldb::SearchFilterSP CreateExceptionSearchFilter() override; 93314564Sdim 94314564Sdim uint32_t GetFoundationVersion(); 95314564Sdim 96314564Sdim virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, 97314564Sdim lldb::addr_t &cf_false); 98314564Sdim 99293116Semasteprotected: 100314564Sdim // Call CreateInstance instead. 101314564Sdim AppleObjCRuntime(Process *process); 102293116Semaste 103314564Sdim bool CalculateHasNewLiteralsAndIndexing() override; 104293116Semaste 105314564Sdim static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp); 106293116Semaste 107314564Sdim static ObjCRuntimeVersions GetObjCVersion(Process *process, 108314564Sdim lldb::ModuleSP &objc_module_sp); 109293116Semaste 110314564Sdim void ReadObjCLibraryIfNeeded(const ModuleList &module_list); 111314564Sdim 112314564Sdim Address *GetPrintForDebuggerAddr(); 113314564Sdim 114314564Sdim std::unique_ptr<Address> m_PrintForDebugger_addr; 115314564Sdim bool m_read_objc_library; 116314564Sdim std::unique_ptr<lldb_private::AppleObjCTrampolineHandler> 117314564Sdim m_objc_trampoline_handler_ap; 118314564Sdim lldb::BreakpointSP m_objc_exception_bp_sp; 119314564Sdim lldb::ModuleWP m_objc_module_wp; 120314564Sdim std::unique_ptr<FunctionCaller> m_print_object_caller_up; 121314564Sdim 122314564Sdim llvm::Optional<uint32_t> m_Foundation_major; 123293116Semaste}; 124314564Sdim 125293116Semaste} // namespace lldb_private 126293116Semaste 127293116Semaste#endif // liblldb_AppleObjCRuntime_h_ 128