1 //===-- LanguageRuntime.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_LanguageRuntime_h_ 11 #define liblldb_LanguageRuntime_h_ 12 13 // C Includes 14 // C++ Includes 15 // Other libraries and framework includes 16 // Project includes 17 #include "lldb/lldb-public.h" 18 #include "lldb/Breakpoint/BreakpointResolver.h" 19 #include "lldb/Breakpoint/BreakpointResolverName.h" 20 #include "lldb/Core/PluginInterface.h" 21 #include "lldb/lldb-private.h" 22 #include "lldb/Core/ValueObject.h" 23 #include "lldb/Core/Value.h" 24 #include "lldb/Target/ExecutionContextScope.h" 25 26 namespace lldb_private { 27 28 class LanguageRuntime : 29 public PluginInterface 30 { 31 public: 32 virtual 33 ~LanguageRuntime(); 34 35 static LanguageRuntime* 36 FindPlugin (Process *process, lldb::LanguageType language); 37 38 static void 39 InitializeCommands (CommandObject* parent); 40 41 virtual lldb::LanguageType 42 GetLanguageType () const = 0; 43 44 virtual bool 45 GetObjectDescription (Stream &str, ValueObject &object) = 0; 46 47 virtual bool 48 GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) = 0; 49 50 // this call should return true if it could set the name and/or the type 51 virtual bool 52 GetDynamicTypeAndAddress (ValueObject &in_value, 53 lldb::DynamicValueType use_dynamic, 54 TypeAndOrName &class_type_or_name, 55 Address &address) = 0; 56 57 // This should be a fast test to determine whether it is likely that this value would 58 // have a dynamic type. 59 virtual bool 60 CouldHaveDynamicValue (ValueObject &in_value) = 0; 61 62 virtual void SetExceptionBreakpoints()63 SetExceptionBreakpoints () 64 { 65 } 66 67 virtual void ClearExceptionBreakpoints()68 ClearExceptionBreakpoints () 69 { 70 } 71 72 virtual bool ExceptionBreakpointsAreSet()73 ExceptionBreakpointsAreSet () 74 { 75 return false; 76 } 77 78 virtual bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason)79 ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) 80 { 81 return false; 82 } 83 84 static lldb::BreakpointSP 85 CreateExceptionBreakpoint (Target &target, 86 lldb::LanguageType language, 87 bool catch_bp, 88 bool throw_bp, 89 bool is_internal = false); 90 91 static Breakpoint::BreakpointPreconditionSP 92 CreateExceptionPrecondition (lldb::LanguageType language, 93 bool catch_bp, 94 bool throw_bp); 95 96 static lldb::LanguageType 97 GetLanguageTypeFromString (const char *string); 98 99 static const char * 100 GetNameForLanguageType (lldb::LanguageType language); 101 102 static void 103 PrintAllLanguages (Stream &s, const char *prefix, const char *suffix); 104 105 static bool 106 LanguageIsCPlusPlus (lldb::LanguageType language); 107 108 Process * GetProcess()109 GetProcess() 110 { 111 return m_process; 112 } 113 114 virtual lldb::BreakpointResolverSP 115 CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0; 116 117 virtual lldb::SearchFilterSP 118 CreateExceptionSearchFilter (); 119 120 virtual bool GetTypeBitSize(const ClangASTType & clang_type,uint64_t & size)121 GetTypeBitSize (const ClangASTType& clang_type, 122 uint64_t &size) 123 { 124 return false; 125 } 126 127 virtual bool IsRuntimeSupportValue(ValueObject & valobj)128 IsRuntimeSupportValue (ValueObject& valobj) 129 { 130 return false; 131 } 132 133 virtual void ModulesDidLoad(const ModuleList & module_list)134 ModulesDidLoad (const ModuleList &module_list) 135 { 136 return; 137 } 138 139 protected: 140 //------------------------------------------------------------------ 141 // Classes that inherit from LanguageRuntime can see and modify these 142 //------------------------------------------------------------------ 143 144 LanguageRuntime(Process *process); 145 Process *m_process; 146 private: 147 DISALLOW_COPY_AND_ASSIGN (LanguageRuntime); 148 }; 149 150 } // namespace lldb_private 151 152 #endif // liblldb_LanguageRuntime_h_ 153