1 //===-- CPPLanguageRuntime.h
2 //---------------------------------------------------*- C++ -*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef liblldb_CPPLanguageRuntime_h_
12 #define liblldb_CPPLanguageRuntime_h_
13 
14 #include <vector>
15 #include "lldb/Core/PluginInterface.h"
16 #include "lldb/Target/LanguageRuntime.h"
17 #include "lldb/lldb-private.h"
18 
19 namespace lldb_private {
20 
21 class CPPLanguageRuntime : public LanguageRuntime {
22 public:
23   enum class LibCppStdFunctionCallableCase {
24     Lambda = 0,
25     CallableObject,
26     FreeOrMemberFunction,
27     Invalid
28   };
29 
30   struct LibCppStdFunctionCallableInfo {
31     Symbol callable_symbol;
32     Address callable_address;
33     LineEntry callable_line_entry;
34     lldb::addr_t member__f_pointer_value = 0u;
35     LibCppStdFunctionCallableCase callable_case =
36         LibCppStdFunctionCallableCase::Invalid;
37   };
38 
39   LibCppStdFunctionCallableInfo
40   FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);
41 
42   ~CPPLanguageRuntime() override;
43 
GetLanguageType()44   lldb::LanguageType GetLanguageType() const override {
45     return lldb::eLanguageTypeC_plus_plus;
46   }
47 
48   virtual bool IsVTableName(const char *name) = 0;
49 
50   bool GetObjectDescription(Stream &str, ValueObject &object) override;
51 
52   bool GetObjectDescription(Stream &str, Value &value,
53                             ExecutionContextScope *exe_scope) override;
54 
55   /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
56   ///
57   /// @param[in] thread
58   ///     Curent thrad of execution.
59   ///
60   /// @param[in] stop_others
61   ///     True if other threads should pause during execution.
62   ///
63   /// @return
64   ///      A ThreadPlan Shared pointer
65   lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
66                                                   bool stop_others);
67 
68 protected:
69   //------------------------------------------------------------------
70   // Classes that inherit from CPPLanguageRuntime can see and modify these
71   //------------------------------------------------------------------
72   CPPLanguageRuntime(Process *process);
73 
74 private:
75   DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime);
76 };
77 
78 } // namespace lldb_private
79 
80 #endif // liblldb_CPPLanguageRuntime_h_
81