]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Plugins / LanguageRuntime / ObjC / AppleObjCRuntime / AppleObjCRuntime.h
1 //===-- AppleObjCRuntime.h --------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_AppleObjCRuntime_h_
11 #define liblldb_AppleObjCRuntime_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 #include "llvm/ADT/Optional.h"
17
18 // Project includes
19 #include "AppleObjCTrampolineHandler.h"
20 #include "AppleThreadPlanStepThroughObjCTrampoline.h"
21 #include "lldb/Target/LanguageRuntime.h"
22 #include "lldb/Target/ObjCLanguageRuntime.h"
23 #include "lldb/lldb-private.h"
24
25 namespace lldb_private {
26
27 class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
28 public:
29   ~AppleObjCRuntime() override;
30
31   //------------------------------------------------------------------
32   // Static Functions
33   //------------------------------------------------------------------
34   // Note there is no CreateInstance, Initialize & Terminate functions here,
35   // because
36   // you can't make an instance of this generic runtime.
37
38   static bool classof(const ObjCLanguageRuntime *runtime) {
39     switch (runtime->GetRuntimeVersion()) {
40     case ObjCRuntimeVersions::eAppleObjC_V1:
41     case ObjCRuntimeVersions::eAppleObjC_V2:
42       return true;
43     default:
44       return false;
45     }
46   }
47
48   // These are generic runtime functions:
49   bool GetObjectDescription(Stream &str, Value &value,
50                             ExecutionContextScope *exe_scope) override;
51
52   bool GetObjectDescription(Stream &str, ValueObject &object) override;
53
54   bool CouldHaveDynamicValue(ValueObject &in_value) override;
55
56   bool GetDynamicTypeAndAddress(ValueObject &in_value,
57                                 lldb::DynamicValueType use_dynamic,
58                                 TypeAndOrName &class_type_or_name,
59                                 Address &address,
60                                 Value::ValueType &value_type) override;
61
62   TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
63                                  ValueObject &static_value) override;
64
65   // These are the ObjC specific functions.
66
67   bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override;
68
69   bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override;
70
71   bool HasReadObjCLibrary() override { return m_read_objc_library; }
72
73   lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
74                                                   bool stop_others) override;
75
76   // Get the "libobjc.A.dylib" module from the current target if we can find
77   // it, also cache it once it is found to ensure quick lookups.
78   lldb::ModuleSP GetObjCModule();
79
80   // Sync up with the target
81
82   void ModulesDidLoad(const ModuleList &module_list) override;
83
84   void SetExceptionBreakpoints() override;
85
86   void ClearExceptionBreakpoints() override;
87
88   bool ExceptionBreakpointsAreSet() override;
89
90   bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
91
92   lldb::SearchFilterSP CreateExceptionSearchFilter() override;
93
94   uint32_t GetFoundationVersion();
95
96   virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
97                                             lldb::addr_t &cf_false);
98
99 protected:
100   // Call CreateInstance instead.
101   AppleObjCRuntime(Process *process);
102
103   bool CalculateHasNewLiteralsAndIndexing() override;
104
105   static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp);
106
107   static ObjCRuntimeVersions GetObjCVersion(Process *process,
108                                             lldb::ModuleSP &objc_module_sp);
109
110   void ReadObjCLibraryIfNeeded(const ModuleList &module_list);
111
112   Address *GetPrintForDebuggerAddr();
113
114   std::unique_ptr<Address> m_PrintForDebugger_addr;
115   bool m_read_objc_library;
116   std::unique_ptr<lldb_private::AppleObjCTrampolineHandler>
117       m_objc_trampoline_handler_ap;
118   lldb::BreakpointSP m_objc_exception_bp_sp;
119   lldb::ModuleWP m_objc_module_wp;
120   std::unique_ptr<FunctionCaller> m_print_object_caller_up;
121
122   llvm::Optional<uint32_t> m_Foundation_major;
123 };
124
125 } // namespace lldb_private
126
127 #endif // liblldb_AppleObjCRuntime_h_