blob: 50db2e13bcbec43fce8a161f06eef5c7a58adcc2 [file] [log] [blame]
Colin Riley5ec532a2015-04-09 16:49:25 +00001//===-- 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
Eugene Zelenko222b9372015-10-27 00:45:06 +000015#include <array>
16#include <map>
17#include <memory>
18#include <string>
19#include <vector>
20
Colin Riley5ec532a2015-04-09 16:49:25 +000021// Other libraries and framework includes
22// Project includes
Colin Riley5ec532a2015-04-09 16:49:25 +000023#include "lldb/Core/Module.h"
Luke Drummond19459582016-07-28 14:21:07 +000024#include "lldb/Expression/LLVMUserExpression.h"
Aidan Doddsb3f7f692016-01-28 16:39:44 +000025#include "lldb/Target/CPPLanguageRuntime.h"
26#include "lldb/Target/LanguageRuntime.h"
27#include "lldb/lldb-private.h"
Colin Riley5ec532a2015-04-09 16:49:25 +000028
Aidan Doddsb3f7f692016-01-28 16:39:44 +000029namespace lldb_private
30{
31namespace lldb_renderscript
32{
Ewan Crawford98156582015-09-04 08:56:52 +000033
Colin Riley5ec532a2015-04-09 16:49:25 +000034typedef uint32_t RSSlot;
35class RSModuleDescriptor;
Colin Riley4640cde2015-06-01 18:23:41 +000036struct RSGlobalDescriptor;
37struct RSKernelDescriptor;
38
39typedef std::shared_ptr<RSModuleDescriptor> RSModuleDescriptorSP;
40typedef std::shared_ptr<RSGlobalDescriptor> RSGlobalDescriptorSP;
41typedef std::shared_ptr<RSKernelDescriptor> RSKernelDescriptorSP;
Ewan Crawford4f8817c2016-01-20 12:03:29 +000042typedef std::array<uint32_t, 3> RSCoordinate;
Colin Riley4640cde2015-06-01 18:23:41 +000043
Ewan Crawford98156582015-09-04 08:56:52 +000044// Breakpoint Resolvers decide where a breakpoint is placed,
45// so having our own allows us to limit the search scope to RS kernel modules.
46// As well as check for .expand kernels as a fallback.
47class RSBreakpointResolver : public BreakpointResolver
48{
Eugene Zelenko222b9372015-10-27 00:45:06 +000049public:
Aidan Doddsb3f7f692016-01-28 16:39:44 +000050 RSBreakpointResolver(Breakpoint *bkpt, ConstString name)
51 : BreakpointResolver(bkpt, BreakpointResolver::NameResolver), m_kernel_name(name)
Ewan Crawford98156582015-09-04 08:56:52 +000052 {
53 }
54
55 void
56 GetDescription(Stream *strm) override
57 {
58 if (strm)
59 strm->Printf("RenderScript kernel breakpoint for '%s'", m_kernel_name.AsCString());
60 }
61
62 void
63 Dump(Stream *s) const override
64 {
65 }
66
67 Searcher::CallbackReturn
Aidan Doddsb3f7f692016-01-28 16:39:44 +000068 SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr, bool containing) override;
Ewan Crawford98156582015-09-04 08:56:52 +000069
70 Searcher::Depth
71 GetDepth() override
72 {
73 return Searcher::eDepthModule;
74 }
75
76 lldb::BreakpointResolverSP
77 CopyForBreakpoint(Breakpoint &breakpoint) override
78 {
79 lldb::BreakpointResolverSP ret_sp(new RSBreakpointResolver(&breakpoint, m_kernel_name));
80 return ret_sp;
81 }
82
Eugene Zelenko222b9372015-10-27 00:45:06 +000083protected:
Ewan Crawford98156582015-09-04 08:56:52 +000084 ConstString m_kernel_name;
85};
Colin Riley5ec532a2015-04-09 16:49:25 +000086
87struct RSKernelDescriptor
88{
Eugene Zelenko222b9372015-10-27 00:45:06 +000089public:
Colin Riley4640cde2015-06-01 18:23:41 +000090 RSKernelDescriptor(const RSModuleDescriptor *module, const char *name, uint32_t slot)
Aidan Doddsb3f7f692016-01-28 16:39:44 +000091 : m_module(module), m_name(name), m_slot(slot)
Colin Riley5ec532a2015-04-09 16:49:25 +000092 {
93 }
94
Aidan Doddsb3f7f692016-01-28 16:39:44 +000095 void
96 Dump(Stream &strm) const;
Colin Riley5ec532a2015-04-09 16:49:25 +000097
Colin Riley4640cde2015-06-01 18:23:41 +000098 const RSModuleDescriptor *m_module;
Colin Riley5ec532a2015-04-09 16:49:25 +000099 ConstString m_name;
100 RSSlot m_slot;
101};
102
103struct RSGlobalDescriptor
104{
Eugene Zelenko222b9372015-10-27 00:45:06 +0000105public:
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000106 RSGlobalDescriptor(const RSModuleDescriptor *module, const char *name) : m_module(module), m_name(name) {}
Colin Riley5ec532a2015-04-09 16:49:25 +0000107
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000108 void
109 Dump(Stream &strm) const;
Colin Riley5ec532a2015-04-09 16:49:25 +0000110
Colin Riley4640cde2015-06-01 18:23:41 +0000111 const RSModuleDescriptor *m_module;
Colin Riley5ec532a2015-04-09 16:49:25 +0000112 ConstString m_name;
Colin Riley5ec532a2015-04-09 16:49:25 +0000113};
114
115class RSModuleDescriptor
116{
Eugene Zelenko222b9372015-10-27 00:45:06 +0000117public:
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000118 RSModuleDescriptor(const lldb::ModuleSP &module) : m_module(module) {}
Colin Riley5ec532a2015-04-09 16:49:25 +0000119
Eugene Zelenko222b9372015-10-27 00:45:06 +0000120 ~RSModuleDescriptor() = default;
Colin Riley5ec532a2015-04-09 16:49:25 +0000121
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000122 bool
123 ParseRSInfo();
Colin Riley5ec532a2015-04-09 16:49:25 +0000124
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000125 void
126 Dump(Stream &strm) const;
Colin Riley5ec532a2015-04-09 16:49:25 +0000127
128 const lldb::ModuleSP m_module;
129 std::vector<RSKernelDescriptor> m_kernels;
130 std::vector<RSGlobalDescriptor> m_globals;
Colin Riley4640cde2015-06-01 18:23:41 +0000131 std::map<std::string, std::string> m_pragmas;
132 std::string m_resname;
Colin Riley5ec532a2015-04-09 16:49:25 +0000133};
134
Eugene Zelenko222b9372015-10-27 00:45:06 +0000135} // namespace lldb_renderscript
Ewan Crawford98156582015-09-04 08:56:52 +0000136
Colin Riley5ec532a2015-04-09 16:49:25 +0000137class RenderScriptRuntime : public lldb_private::CPPLanguageRuntime
138{
Eugene Zelenko222b9372015-10-27 00:45:06 +0000139public:
Colin Rileyef20b082015-04-14 07:39:24 +0000140 enum ModuleKind
141 {
142 eModuleKindIgnored,
143 eModuleKindLibRS,
144 eModuleKindDriver,
145 eModuleKindImpl,
146 eModuleKindKernelObj
147 };
148
Eugene Zelenko222b9372015-10-27 00:45:06 +0000149 ~RenderScriptRuntime() override;
Colin Riley5ec532a2015-04-09 16:49:25 +0000150
151 //------------------------------------------------------------------
152 // Static Functions
153 //------------------------------------------------------------------
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000154 static void
155 Initialize();
Colin Riley5ec532a2015-04-09 16:49:25 +0000156
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000157 static void
158 Terminate();
Colin Riley5ec532a2015-04-09 16:49:25 +0000159
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000160 static lldb_private::LanguageRuntime *
161 CreateInstance(Process *process, lldb::LanguageType language);
Colin Riley5ec532a2015-04-09 16:49:25 +0000162
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000163 static lldb::CommandObjectSP
164 GetCommandObject(CommandInterpreter &interpreter);
Colin Riley4640cde2015-06-01 18:23:41 +0000165
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000166 static lldb_private::ConstString
167 GetPluginNameStatic();
Colin Riley5ec532a2015-04-09 16:49:25 +0000168
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000169 static bool
170 IsRenderScriptModule(const lldb::ModuleSP &module_sp);
Colin Rileyef20b082015-04-14 07:39:24 +0000171
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000172 static ModuleKind
173 GetModuleKind(const lldb::ModuleSP &module_sp);
Colin Rileyef20b082015-04-14 07:39:24 +0000174
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000175 static void
176 ModulesDidLoad(const lldb::ProcessSP &process_sp, const ModuleList &module_list);
Colin Rileyef20b082015-04-14 07:39:24 +0000177
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000178 bool
179 IsVTableName(const char *name) override;
Colin Riley5ec532a2015-04-09 16:49:25 +0000180
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000181 bool
Enrico Granata5f57b6e2016-05-05 21:10:28 +0000182 GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
183 TypeAndOrName &class_type_or_name, Address &address,
184 Value::ValueType &value_type) override;
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000185
Eugene Zelenko222b9372015-10-27 00:45:06 +0000186 TypeAndOrName
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000187 FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override;
Colin Riley5ec532a2015-04-09 16:49:25 +0000188
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000189 bool
190 CouldHaveDynamicValue(ValueObject &in_value) override;
Colin Riley5ec532a2015-04-09 16:49:25 +0000191
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000192 lldb::BreakpointResolverSP
193 CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override;
Colin Riley5ec532a2015-04-09 16:49:25 +0000194
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000195 bool
196 LoadModule(const lldb::ModuleSP &module_sp);
Colin Riley5ec532a2015-04-09 16:49:25 +0000197
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000198 void
199 DumpModules(Stream &strm) const;
Colin Riley5ec532a2015-04-09 16:49:25 +0000200
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000201 void
202 DumpContexts(Stream &strm) const;
Colin Riley4640cde2015-06-01 18:23:41 +0000203
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000204 void
205 DumpKernels(Stream &strm) const;
Colin Riley4640cde2015-06-01 18:23:41 +0000206
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000207 bool
208 DumpAllocation(Stream &strm, StackFrame *frame_ptr, const uint32_t id);
Ewan Crawforda0f08672015-10-16 08:28:47 +0000209
Ewan Crawfordb649b002016-01-26 10:41:08 +0000210 void
211 ListAllocations(Stream &strm, StackFrame *frame_ptr, const uint32_t index);
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000212
Ewan Crawford0d2bfcf2016-02-04 09:44:23 +0000213 bool
214 RecomputeAllAllocations(Stream &strm, StackFrame *frame_ptr);
215
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000216 void
217 PlaceBreakpointOnKernel(Stream &strm, const char *name, const std::array<int, 3> coords, Error &error,
218 lldb::TargetSP target);
Colin Riley4640cde2015-06-01 18:23:41 +0000219
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000220 void
221 SetBreakAllKernels(bool do_break, lldb::TargetSP target);
Ewan Crawford7dc77712015-09-10 10:08:48 +0000222
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000223 void
224 Status(Stream &strm) const;
Colin Riley4640cde2015-06-01 18:23:41 +0000225
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000226 void
227 ModulesDidLoad(const ModuleList &module_list) override;
Colin Rileyef20b082015-04-14 07:39:24 +0000228
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000229 bool
230 LoadAllocation(Stream &strm, const uint32_t alloc_id, const char *filename, StackFrame *frame_ptr);
Ewan Crawford55232f02015-10-21 08:50:42 +0000231
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000232 bool
233 SaveAllocation(Stream &strm, const uint32_t alloc_id, const char *filename, StackFrame *frame_ptr);
Ewan Crawford55232f02015-10-21 08:50:42 +0000234
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000235 void
236 Update();
Colin Rileyef20b082015-04-14 07:39:24 +0000237
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000238 void
239 Initiate();
Ewan Crawford018f5a7e2015-10-26 14:04:37 +0000240
Eugene Zelenko222b9372015-10-27 00:45:06 +0000241 //------------------------------------------------------------------
242 // PluginInterface protocol
243 //------------------------------------------------------------------
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000244 lldb_private::ConstString
245 GetPluginName() override;
Ewan Crawford7dc77712015-09-10 10:08:48 +0000246
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000247 uint32_t
248 GetPluginVersion() override;
Eugene Zelenko222b9372015-10-27 00:45:06 +0000249
Ewan Crawford4f8817c2016-01-20 12:03:29 +0000250 static bool
251 GetKernelCoordinate(lldb_renderscript::RSCoordinate &coord, Thread *thread_ptr);
252
Eugene Zelenko222b9372015-10-27 00:45:06 +0000253protected:
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000254 struct ScriptDetails;
255 struct AllocationDetails;
Ewan Crawford8b244e22015-11-30 10:29:49 +0000256 struct Element;
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000257
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000258 void
259 InitSearchFilter(lldb::TargetSP target)
Ewan Crawford7dc77712015-09-10 10:08:48 +0000260 {
261 if (!m_filtersp)
262 m_filtersp.reset(new SearchFilterForUnconstrainedSearches(target));
263 }
Luke Drummond19459582016-07-28 14:21:07 +0000264
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000265 void
266 FixupScriptDetails(lldb_renderscript::RSModuleDescriptorSP rsmodule_sp);
Colin Riley4640cde2015-06-01 18:23:41 +0000267
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000268 void
269 LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind);
Ewan Crawford7dc77712015-09-10 10:08:48 +0000270
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000271 bool
272 RefreshAllocation(AllocationDetails *allocation, StackFrame *frame_ptr);
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000273
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000274 bool
275 EvalRSExpression(const char *expression, StackFrame *frame_ptr, uint64_t *result);
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000276
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000277 lldb::BreakpointSP
278 CreateKernelBreakpoint(const ConstString &name);
Ewan Crawford7dc77712015-09-10 10:08:48 +0000279
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000280 void
281 BreakOnModuleKernels(const lldb_renderscript::RSModuleDescriptorSP rsmodule_sp);
282
Colin Riley4640cde2015-06-01 18:23:41 +0000283 struct RuntimeHook;
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000284 typedef void (RenderScriptRuntime::*CaptureStateFn)(RuntimeHook *hook_info,
285 ExecutionContext &context); // Please do this!
Colin Riley4640cde2015-06-01 18:23:41 +0000286
287 struct HookDefn
288 {
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000289 const char *name;
290 const char *symbol_name_m32; // mangled name for the 32 bit architectures
291 const char *symbol_name_m64; // mangled name for the 64 bit archs
Colin Riley4640cde2015-06-01 18:23:41 +0000292 uint32_t version;
293 ModuleKind kind;
294 CaptureStateFn grabber;
295 };
296
297 struct RuntimeHook
298 {
299 lldb::addr_t address;
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000300 const HookDefn *defn;
Colin Riley4640cde2015-06-01 18:23:41 +0000301 lldb::BreakpointSP bp_sp;
302 };
Ewan Crawford55232f02015-10-21 08:50:42 +0000303
Colin Riley4640cde2015-06-01 18:23:41 +0000304 typedef std::shared_ptr<RuntimeHook> RuntimeHookSP;
305
Colin Riley4640cde2015-06-01 18:23:41 +0000306 lldb::ModuleSP m_libRS;
307 lldb::ModuleSP m_libRSDriver;
308 lldb::ModuleSP m_libRSCpuRef;
Ewan Crawford98156582015-09-04 08:56:52 +0000309 std::vector<lldb_renderscript::RSModuleDescriptorSP> m_rsmodules;
Ewan Crawford78f339d2015-09-21 10:53:18 +0000310
311 std::vector<std::unique_ptr<ScriptDetails>> m_scripts;
312 std::vector<std::unique_ptr<AllocationDetails>> m_allocations;
Colin Riley4640cde2015-06-01 18:23:41 +0000313
Ewan Crawford98156582015-09-04 08:56:52 +0000314 std::map<lldb::addr_t, lldb_renderscript::RSModuleDescriptorSP> m_scriptMappings;
Colin Riley4640cde2015-06-01 18:23:41 +0000315 std::map<lldb::addr_t, RuntimeHookSP> m_runtimeHooks;
Ewan Crawford4f8817c2016-01-20 12:03:29 +0000316 std::map<lldb::user_id_t, std::shared_ptr<uint32_t>> m_conditional_breaks;
Colin Riley4640cde2015-06-01 18:23:41 +0000317
Ewan Crawford7dc77712015-09-10 10:08:48 +0000318 lldb::SearchFilterSP m_filtersp; // Needed to create breakpoints through Target API
319
Colin Rileyef20b082015-04-14 07:39:24 +0000320 bool m_initiated;
Colin Riley4640cde2015-06-01 18:23:41 +0000321 bool m_debuggerPresentFlagged;
Ewan Crawford7dc77712015-09-10 10:08:48 +0000322 bool m_breakAllKernels;
Colin Riley4640cde2015-06-01 18:23:41 +0000323 static const HookDefn s_runtimeHookDefns[];
324 static const size_t s_runtimeHookCount;
Luke Drummond19459582016-07-28 14:21:07 +0000325 LLVMUserExpression::IRPasses *m_ir_passes;
Colin Riley4640cde2015-06-01 18:23:41 +0000326
Eugene Zelenko222b9372015-10-27 00:45:06 +0000327private:
Colin Riley5ec532a2015-04-09 16:49:25 +0000328 RenderScriptRuntime(Process *process); // Call CreateInstance instead.
Luke Drummond19459582016-07-28 14:21:07 +0000329
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000330 static bool
331 HookCallback(void *baton, StoppointCallbackContext *ctx, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
Colin Riley4640cde2015-06-01 18:23:41 +0000332
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000333 static bool
334 KernelBreakpointHit(void *baton, StoppointCallbackContext *ctx, lldb::user_id_t break_id,
335 lldb::user_id_t break_loc_id);
Ewan Crawford018f5a7e2015-10-26 14:04:37 +0000336
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000337 void
338 HookCallback(RuntimeHook *hook_info, ExecutionContext &context);
Colin Riley4640cde2015-06-01 18:23:41 +0000339
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000340 void
341 CaptureScriptInit(RuntimeHook *hook_info, ExecutionContext &context);
Colin Riley4640cde2015-06-01 18:23:41 +0000342
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000343 void
344 CaptureAllocationInit(RuntimeHook *hook_info, ExecutionContext &context);
Ewan Crawforda0f08672015-10-16 08:28:47 +0000345
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000346 void
347 CaptureAllocationDestroy(RuntimeHook *hook_info, ExecutionContext &context);
348
349 void
350 CaptureSetGlobalVar(RuntimeHook *hook_info, ExecutionContext &context);
351
352 void
353 CaptureScriptInvokeForEachMulti(RuntimeHook *hook_info, ExecutionContext &context);
354
355 AllocationDetails *
356 FindAllocByID(Stream &strm, const uint32_t alloc_id);
357
358 std::shared_ptr<uint8_t>
359 GetAllocationData(AllocationDetails *allocation, StackFrame *frame_ptr);
360
361 void
362 SetElementSize(Element &elem);
363
364 static bool
365 GetFrameVarAsUnsigned(const lldb::StackFrameSP, const char *var_name, uint64_t &val);
366
367 void
368 FindStructTypeName(Element &elem, StackFrame *frame_ptr);
369
370 size_t
371 PopulateElementHeaders(const std::shared_ptr<uint8_t> header_buffer, size_t offset, const Element &elem);
372
373 size_t
374 CalculateElementHeaderSize(const Element &elem);
Ewan Crawford26e52a72016-01-07 10:19:09 +0000375
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000376 //
377 // Helper functions for jitting the runtime
378 //
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000379
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000380 bool
381 JITDataPointer(AllocationDetails *allocation, StackFrame *frame_ptr,
382 uint32_t x = 0, uint32_t y = 0, uint32_t z = 0);
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000383
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000384 bool
385 JITTypePointer(AllocationDetails *allocation, StackFrame *frame_ptr);
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000386
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000387 bool
388 JITTypePacked(AllocationDetails *allocation, StackFrame *frame_ptr);
Ewan Crawford15f2bd92015-10-06 08:42:32 +0000389
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000390 bool
391 JITElementPacked(Element &elem, const lldb::addr_t context, StackFrame *frame_ptr);
Ewan Crawford8b244e22015-11-30 10:29:49 +0000392
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000393 bool
394 JITAllocationSize(AllocationDetails *allocation, StackFrame *frame_ptr);
Ewan Crawforda0f08672015-10-16 08:28:47 +0000395
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000396 bool
397 JITSubelements(Element &elem, const lldb::addr_t context, StackFrame *frame_ptr);
398
399 bool
400 JITAllocationStride(AllocationDetails *allocation, StackFrame *frame_ptr);
Ewan Crawforda0f08672015-10-16 08:28:47 +0000401
Ewan Crawford78f339d2015-09-21 10:53:18 +0000402 // Search for a script detail object using a target address.
403 // If a script does not currently exist this function will return nullptr.
404 // If 'create' is true and there is no previous script with this address,
405 // then a new Script detail object will be created for this address and returned.
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000406 ScriptDetails *
407 LookUpScript(lldb::addr_t address, bool create);
Ewan Crawford78f339d2015-09-21 10:53:18 +0000408
409 // Search for a previously saved allocation detail object using a target address.
410 // If an allocation does not exist for this address then nullptr will be returned.
Aidan Doddsb3f7f692016-01-28 16:39:44 +0000411 AllocationDetails *
Luke Drummond5d057632016-08-03 17:31:58 +0000412 LookUpAllocation(lldb::addr_t address);
413
414 // Creates a new allocation with the specified address assigning a new ID and removes
415 // any previous stored allocation which has the same address.
416 AllocationDetails *
417 CreateAllocation(lldb::addr_t address);
Luke Drummond19459582016-07-28 14:21:07 +0000418
419 bool
420 GetOverrideExprOptions(clang::TargetOptions &prototype) override;
421
422 bool
423 GetIRPasses(LLVMUserExpression::IRPasses &passes) override;
Colin Riley5ec532a2015-04-09 16:49:25 +0000424};
425
426} // namespace lldb_private
427
428#endif // liblldb_RenderScriptRuntime_h_