1 //===-- RenderScriptRuntime.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_RenderScriptRuntime_h_
11 #define liblldb_RenderScriptRuntime_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Target/LanguageRuntime.h"
19 #include "lldb/Target/CPPLanguageRuntime.h"
20 #include "lldb/Core/Module.h"
21 
22 namespace lldb_private
23 {
24 
25 typedef uint32_t RSSlot;
26 class RSModuleDescriptor;
27 
28 struct RSKernelDescriptor
29 {
30   public:
31     RSKernelDescriptor(const RSModuleDescriptor &module, const char *name, uint32_t slot)
32         : m_module(module)
33         , m_name(name)
34         , m_slot(slot)
35     {
36     }
37 
38     void Dump(Stream &strm) const;
39 
40     const RSModuleDescriptor &m_module;
41     ConstString m_name;
42     RSSlot m_slot;
43 };
44 
45 struct RSGlobalDescriptor
46 {
47   public:
48     RSGlobalDescriptor(const RSModuleDescriptor &module, const char *name)
49         : m_module(module)
50         , m_name(name)
51     {
52     }
53 
54     void Dump(Stream &strm) const;
55 
56     const RSModuleDescriptor &m_module;
57     ConstString m_name;
58     RSSlot m_slot;
59 };
60 
61 class RSModuleDescriptor
62 {
63   public:
64     RSModuleDescriptor(const lldb::ModuleSP &module)
65         : m_module(module)
66     {
67     }
68 
69     ~RSModuleDescriptor() {}
70 
71     bool ParseRSInfo();
72 
73     void Dump(Stream &strm) const;
74 
75     const lldb::ModuleSP m_module;
76     std::vector<RSKernelDescriptor> m_kernels;
77     std::vector<RSGlobalDescriptor> m_globals;
78 };
79 
80 class RenderScriptRuntime : public lldb_private::CPPLanguageRuntime
81 {
82   public:
83     ~RenderScriptRuntime() {}
84 
85     //------------------------------------------------------------------
86     // Static Functions
87     //------------------------------------------------------------------
88     static void Initialize();
89 
90     static void Terminate();
91 
92     static lldb_private::LanguageRuntime *CreateInstance(Process *process, lldb::LanguageType language);
93 
94     static lldb_private::ConstString GetPluginNameStatic();
95 
96     //------------------------------------------------------------------
97     // PluginInterface protocol
98     //------------------------------------------------------------------
99     virtual lldb_private::ConstString GetPluginName();
100 
101     virtual uint32_t GetPluginVersion();
102 
103     virtual bool IsVTableName(const char *name);
104 
105     virtual bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
106                                           TypeAndOrName &class_type_or_name, Address &address);
107 
108     virtual bool CouldHaveDynamicValue(ValueObject &in_value);
109 
110     virtual lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp);
111 
112     bool LoadModule(const lldb::ModuleSP &module_sp);
113 
114     bool ProbeModules(const ModuleList module_list);
115 
116     void DumpModules(Stream &strm) const;
117 
118   protected:
119     std::vector<RSModuleDescriptor> m_rsmodules;
120 
121   private:
122     RenderScriptRuntime(Process *process); // Call CreateInstance instead.
123 };
124 
125 } // namespace lldb_private
126 
127 #endif // liblldb_RenderScriptRuntime_h_
128