diff options
author | Luke Drummond <luke.drummond@codeplay.com> | 2016-10-05 19:10:47 +0000 |
---|---|---|
committer | Luke Drummond <luke.drummond@codeplay.com> | 2016-10-05 19:10:47 +0000 |
commit | b3bbcb122904b55ae3a5906bc107cc356ca1123d (patch) | |
tree | fbc867aa3ce8cede536db236e0cb2fb76f416dcc /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h | |
parent | a40c479fe910faad8f36226dbc9380ab897202fd (diff) | |
download | bcm5719-llvm-b3bbcb122904b55ae3a5906bc107cc356ca1123d.tar.gz bcm5719-llvm-b3bbcb122904b55ae3a5906bc107cc356ca1123d.zip |
Add the ability to set breakpoints on named RenderScript reductions
- Add new `lldb_private::lldb_renderscript::RSReduceBreakpointResolver`
class that can set breakpoints on kernels that are constituent
functions of named reduction groups. Also support debugging of subsets
of the the reduction group with the `-t, --function-role` flag which
takes a comma-separated list of reduction function types
outconverter,combiner,initializer,accumulator (defaults to all)
- Add 2 new helper methods to `RenderScriptRuntime`,
1. `CreateReductionBreakpoint(name, types)`: instantiates a new
RSReduceBreakpointResolver and inserts that resolver into the running
process.
2. `PlaceBreakpointOnReduction`: which is a public helper function.
- hook up the above functionality to the command-line with new
`CommandObject*` classes that handle parsing of function roles and
dispatch to the runtime. These are namespaced under the snappy
`language renderscript reduction breakpoint ...` subcommand
- [incidental] Factor multiple common uses of
`FindFirstSymbolWithNameAndType(ConstString(".rs.info")` into static
`IsRenderScriptScriptModule(ModuleSP module)` function, and replace
original uses.
llvm-svn: 283362
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h')
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index a699ad8a8dc..41b9d9a0bac 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -84,6 +84,58 @@ protected: ConstString m_kernel_name; }; +class RSReduceBreakpointResolver : public BreakpointResolver { +public: + enum ReduceKernelTypeFlags { + eKernelTypeAll = ~(0), + eKernelTypeNone = 0, + eKernelTypeAccum = (1 << 0), + eKernelTypeInit = (1 << 1), + eKernelTypeComb = (1 << 2), + eKernelTypeOutC = (1 << 3), + eKernelTypeHalter = (1 << 4) + }; + + RSReduceBreakpointResolver( + Breakpoint *breakpoint, ConstString reduce_name, + std::vector<lldb_renderscript::RSModuleDescriptorSP> *rs_modules, + int kernel_types = eKernelTypeAll) + : BreakpointResolver(breakpoint, BreakpointResolver::NameResolver), + m_reduce_name(reduce_name), m_rsmodules(rs_modules), + m_kernel_types(kernel_types) { + // The reduce breakpoint resolver handles adding breakpoints for named + // reductions. + // Breakpoints will be resolved for all constituent kernels in the named + // reduction + } + + void GetDescription(Stream *strm) override { + if (strm) + strm->Printf("RenderScript reduce breakpoint for '%s'", + m_reduce_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 RSReduceBreakpointResolver( + &breakpoint, m_reduce_name, m_rsmodules, m_kernel_types)); + return ret_sp; + } + +private: + ConstString m_reduce_name; // The name of the reduction + std::vector<lldb_renderscript::RSModuleDescriptorSP> *m_rsmodules; + int m_kernel_types; +}; + struct RSKernelDescriptor { public: RSKernelDescriptor(const RSModuleDescriptor *module, llvm::StringRef name, @@ -247,6 +299,11 @@ public: lldb::TargetSP target, Stream &messages, const char *name, const lldb_renderscript::RSCoordinate *coords = nullptr); + bool PlaceBreakpointOnReduction( + lldb::TargetSP target, Stream &messages, const char *reduce_name, + const lldb_renderscript::RSCoordinate *coords = nullptr, + int kernel_types = ~(0)); + void SetBreakAllKernels(bool do_break, lldb::TargetSP target); void Status(Stream &strm) const; @@ -294,6 +351,9 @@ protected: lldb::BreakpointSP CreateKernelBreakpoint(const ConstString &name); + lldb::BreakpointSP CreateReductionBreakpoint(const ConstString &name, + int kernel_types); + void BreakOnModuleKernels( const lldb_renderscript::RSModuleDescriptorSP rsmodule_sp); |