1 //===-- AppleObjCRuntime.h --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_AppleObjCRuntime_h_
11 #define liblldb_AppleObjCRuntime_h_
15 // Other libraries and framework includes
16 #include "llvm/ADT/Optional.h"
19 #include "lldb/lldb-private.h"
20 #include "lldb/Target/LanguageRuntime.h"
21 #include "lldb/Target/ObjCLanguageRuntime.h"
22 #include "AppleObjCTrampolineHandler.h"
23 #include "AppleThreadPlanStepThroughObjCTrampoline.h"
25 namespace lldb_private {
27 class AppleObjCRuntime :
28 public lldb_private::ObjCLanguageRuntime
31 ~AppleObjCRuntime() override;
33 //------------------------------------------------------------------
35 //------------------------------------------------------------------
36 // Note there is no CreateInstance, Initialize & Terminate functions here, because
37 // you can't make an instance of this generic runtime.
39 static bool classof(const ObjCLanguageRuntime* runtime)
41 switch (runtime->GetRuntimeVersion())
43 case ObjCRuntimeVersions::eAppleObjC_V1:
44 case ObjCRuntimeVersions::eAppleObjC_V2:
51 // These are generic runtime functions:
53 GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) override;
56 GetObjectDescription (Stream &str, ValueObject &object) override;
59 CouldHaveDynamicValue (ValueObject &in_value) override;
62 GetDynamicTypeAndAddress (ValueObject &in_value,
63 lldb::DynamicValueType use_dynamic,
64 TypeAndOrName &class_type_or_name,
66 Value::ValueType &value_type) override;
69 FixUpDynamicType (const TypeAndOrName& type_and_or_name,
70 ValueObject& static_value) override;
72 // These are the ObjC specific functions.
75 IsModuleObjCLibrary (const lldb::ModuleSP &module_sp) override;
78 ReadObjCLibrary (const lldb::ModuleSP &module_sp) override;
81 HasReadObjCLibrary () override
83 return m_read_objc_library;
87 GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) override;
89 // Get the "libobjc.A.dylib" module from the current target if we can find
90 // it, also cache it once it is found to ensure quick lookups.
94 // Sync up with the target
97 ModulesDidLoad (const ModuleList &module_list) override;
100 SetExceptionBreakpoints() override;
103 ClearExceptionBreakpoints() override;
106 ExceptionBreakpointsAreSet() override;
109 ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
112 CreateExceptionSearchFilter() override;
115 GetFoundationVersion();
118 // Call CreateInstance instead.
119 AppleObjCRuntime(Process *process);
122 CalculateHasNewLiteralsAndIndexing() override;
125 AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp);
127 static ObjCRuntimeVersions
128 GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp);
131 ReadObjCLibraryIfNeeded(const ModuleList &module_list);
134 GetPrintForDebuggerAddr();
136 std::unique_ptr<Address> m_PrintForDebugger_addr;
137 bool m_read_objc_library;
138 std::unique_ptr<lldb_private::AppleObjCTrampolineHandler> m_objc_trampoline_handler_ap;
139 lldb::BreakpointSP m_objc_exception_bp_sp;
140 lldb::ModuleWP m_objc_module_wp;
141 std::unique_ptr<FunctionCaller> m_print_object_caller_up;
143 llvm::Optional<uint32_t> m_Foundation_major;
146 } // namespace lldb_private
148 #endif // liblldb_AppleObjCRuntime_h_