summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
diff options
context:
space:
mode:
authorAidan Dodds <aidan@codeplay.com>2016-11-03 13:20:37 +0000
committerAidan Dodds <aidan@codeplay.com>2016-11-03 13:20:37 +0000
commit21fed052e029f1484b3c11245bbe376737422db7 (patch)
treea2d49db06d17599f41aa103fe3f08aa22fe6d6bb /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
parent8b70e2631c6ab4259a4aa9e797c99132fb66e79b (diff)
downloadbcm5719-llvm-21fed052e029f1484b3c11245bbe376737422db7.tar.gz
bcm5719-llvm-21fed052e029f1484b3c11245bbe376737422db7.zip
[Renderscript] Add commands for scriptgroup interaction.
This commit hooks the nofity function that signals script group compilation. By tracking scriptgroups compiled at runtine, users are able to place breakpoints by script group name. Breakpoints will be placed on the kernels forming the group. llvm-svn: 285902
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
index 41b9d9a0bac..a1211a2814b 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -36,10 +36,13 @@ class RSModuleDescriptor;
struct RSGlobalDescriptor;
struct RSKernelDescriptor;
struct RSReductionDescriptor;
+struct RSScriptGroupDescriptor;
typedef std::shared_ptr<RSModuleDescriptor> RSModuleDescriptorSP;
typedef std::shared_ptr<RSGlobalDescriptor> RSGlobalDescriptorSP;
typedef std::shared_ptr<RSKernelDescriptor> RSKernelDescriptorSP;
+typedef std::shared_ptr<RSScriptGroupDescriptor> RSScriptGroupDescriptorSP;
+
struct RSCoordinate {
uint32_t x, y, z;
@@ -227,6 +230,61 @@ public:
std::string m_resname;
};
+struct RSScriptGroupDescriptor {
+ struct Kernel {
+ ConstString m_name;
+ lldb::addr_t m_addr;
+ };
+ ConstString m_name;
+ std::vector<Kernel> m_kernels;
+};
+
+typedef std::vector<RSScriptGroupDescriptorSP> RSScriptGroupList;
+
+class RSScriptGroupBreakpointResolver : public BreakpointResolver {
+public:
+ RSScriptGroupBreakpointResolver(Breakpoint *bp, const ConstString &name,
+ const RSScriptGroupList &groups,
+ bool stop_on_all)
+ : BreakpointResolver(bp, BreakpointResolver::NameResolver),
+ m_group_name(name), m_script_groups(groups),
+ m_stop_on_all(stop_on_all) {}
+
+ void GetDescription(Stream *strm) override {
+ if (strm)
+ strm->Printf("RenderScript ScriptGroup breakpoint for '%s'",
+ m_group_name.AsCString());
+ }
+
+ void Dump(Stream *s) const override {}
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ Searcher::Depth GetDepth() override { return Searcher::eDepthModule; }
+
+ lldb::BreakpointResolverSP
+ CopyForBreakpoint(Breakpoint &breakpoint) override {
+ lldb::BreakpointResolverSP ret_sp(new RSScriptGroupBreakpointResolver(
+ &breakpoint, m_group_name, m_script_groups, m_stop_on_all));
+ return ret_sp;
+ }
+
+protected:
+ const RSScriptGroupDescriptorSP
+ FindScriptGroup(const ConstString &name) const {
+ for (auto sg : m_script_groups) {
+ if (ConstString::Compare(sg->m_name, name) == 0)
+ return sg;
+ }
+ return RSScriptGroupDescriptorSP();
+ }
+
+ ConstString m_group_name;
+ const RSScriptGroupList &m_script_groups;
+ bool m_stop_on_all;
+};
} // namespace lldb_renderscript
class RenderScriptRuntime : public lldb_private::CPPLanguageRuntime {
@@ -304,6 +362,9 @@ public:
const lldb_renderscript::RSCoordinate *coords = nullptr,
int kernel_types = ~(0));
+ bool PlaceBreakpointOnScriptGroup(lldb::TargetSP target, Stream &strm,
+ const ConstString &name, bool stop_on_all);
+
void SetBreakAllKernels(bool do_break, lldb::TargetSP target);
void Status(Stream &strm) const;
@@ -320,6 +381,18 @@ public:
void Initiate();
+ const lldb_renderscript::RSScriptGroupList &GetScriptGroups() const {
+ return m_scriptGroups;
+ };
+
+ bool IsKnownKernel(const ConstString &name) {
+ for (const auto &module : m_rsmodules)
+ for (const auto &kernel : module->m_kernels)
+ if (kernel.m_name == name)
+ return true;
+ return false;
+ }
+
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
@@ -330,11 +403,15 @@ public:
static bool GetKernelCoordinate(lldb_renderscript::RSCoordinate &coord,
Thread *thread_ptr);
+ bool ResolveKernelName(lldb::addr_t kernel_address, ConstString &name);
+
protected:
struct ScriptDetails;
struct AllocationDetails;
struct Element;
+ lldb_renderscript::RSScriptGroupList m_scriptGroups;
+
void InitSearchFilter(lldb::TargetSP target) {
if (!m_filtersp)
m_filtersp.reset(new SearchFilterForUnconstrainedSearches(target));
@@ -349,6 +426,9 @@ protected:
bool EvalRSExpression(const char *expression, StackFrame *frame_ptr,
uint64_t *result);
+ lldb::BreakpointSP CreateScriptGroupBreakpoint(const ConstString &name,
+ bool multi);
+
lldb::BreakpointSP CreateKernelBreakpoint(const ConstString &name);
lldb::BreakpointSP CreateReductionBreakpoint(const ConstString &name,
@@ -416,6 +496,10 @@ private:
void HookCallback(RuntimeHook *hook_info, ExecutionContext &context);
+ // Callback function when 'debugHintScriptGroup2' executes on the target.
+ void CaptureDebugHintScriptGroup2(RuntimeHook *hook_info,
+ ExecutionContext &context);
+
void CaptureScriptInit(RuntimeHook *hook_info, ExecutionContext &context);
void CaptureAllocationInit(RuntimeHook *hook_info, ExecutionContext &context);
OpenPOWER on IntegriCloud