1 //===-- LanguageRuntime.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_LanguageRuntime_h_
11 #define liblldb_LanguageRuntime_h_
15 // Other libraries and framework 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 #include "lldb/Expression/LLVMUserExpression.h"
27 #include "clang/Basic/TargetOptions.h"
29 namespace lldb_private {
31 class LanguageRuntime :
32 public PluginInterface
36 ~LanguageRuntime() override;
38 static LanguageRuntime*
39 FindPlugin (Process *process, lldb::LanguageType language);
42 InitializeCommands (CommandObject* parent);
44 virtual lldb::LanguageType
45 GetLanguageType () const = 0;
48 GetObjectDescription (Stream &str, ValueObject &object) = 0;
51 GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) = 0;
53 // this call should return true if it could set the name and/or the type
55 GetDynamicTypeAndAddress (ValueObject &in_value,
56 lldb::DynamicValueType use_dynamic,
57 TypeAndOrName &class_type_or_name,
59 Value::ValueType &value_type) = 0;
61 // This call should return a CompilerType given a generic type name
62 // and an ExecutionContextScope in which one can actually fetch
63 // any specialization information required.
65 GetConcreteType (ExecutionContextScope *exe_scope,
66 ConstString abstract_type_name)
68 return CompilerType();
71 // This should be a fast test to determine whether it is likely that this value would
72 // have a dynamic type.
74 CouldHaveDynamicValue (ValueObject &in_value) = 0;
76 // The contract for GetDynamicTypeAndAddress() is to return a "bare-bones" dynamic type
77 // For instance, given a Base* pointer, GetDynamicTypeAndAddress() will return the type of
78 // Derived, not Derived*. The job of this API is to correct this misalignment between the
79 // static type and the discovered dynamic type
81 FixUpDynamicType (const TypeAndOrName& type_and_or_name,
82 ValueObject& static_value) = 0;
85 SetExceptionBreakpoints ()
90 ClearExceptionBreakpoints ()
95 ExceptionBreakpointsAreSet ()
101 ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
106 static lldb::BreakpointSP
107 CreateExceptionBreakpoint (Target &target,
108 lldb::LanguageType language,
111 bool is_internal = false);
113 static Breakpoint::BreakpointPreconditionSP
114 CreateExceptionPrecondition (lldb::LanguageType language,
126 return m_process->GetTarget();
129 virtual lldb::BreakpointResolverSP
130 CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
132 virtual lldb::SearchFilterSP
133 CreateExceptionSearchFilter ();
136 GetTypeBitSize (const CompilerType& compiler_type,
143 IsRuntimeSupportValue (ValueObject& valobj)
149 ModulesDidLoad (const ModuleList &module_list)
153 // Called by the Clang expression evaluation engine to allow runtimes to alter the set of target options provided to
155 // If the options prototype is modified, runtimes must return true, false otherwise.
157 GetOverrideExprOptions(clang::TargetOptions &prototype)
162 // Called by ClangExpressionParser::PrepareForExecution to query for any custom LLVM IR passes
163 // that need to be run before an expression is assembled and run.
165 GetIRPasses(LLVMUserExpression::IRPasses &custom_passes)
170 //------------------------------------------------------------------
171 // Classes that inherit from LanguageRuntime can see and modify these
172 //------------------------------------------------------------------
174 LanguageRuntime(Process *process);
178 DISALLOW_COPY_AND_ASSIGN (LanguageRuntime);
181 } // namespace lldb_private
183 #endif // liblldb_LanguageRuntime_h_