diff options
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript')
8 files changed, 67 insertions, 50 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp index b396781e6726..6858c7134d33 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp @@ -1,4 +1,4 @@ -//===-- RenderScriptExpressionOpts.cpp --------------------------*- C++ -*-===// +//===-- RenderScriptExpressionOpts.cpp ------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -86,7 +86,7 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) { llvm::StringRef real_triple = m_process_ptr->GetTarget().GetArchitecture().GetTriple().getTriple(); const llvm::Target *target_info = - llvm::TargetRegistry::lookupTarget(real_triple, err); + llvm::TargetRegistry::lookupTarget(std::string(real_triple), err); if (!target_info) { if (log) log->Warning("couldn't determine real target architecture: '%s'", diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h index 3ec4e37b6db0..52da677128e2 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_RENDERSCRIPT_EXPROPTS_H -#define LLDB_RENDERSCRIPT_EXPROPTS_H +#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H +#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H #include "llvm/IR/Module.h" #include "llvm/Support/TargetRegistry.h" diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 4edb8dec6082..dd9312234d8b 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -1,4 +1,4 @@ -//===-- RenderScriptRuntime.cpp ---------------------------------*- C++ -*-===// +//===-- RenderScriptRuntime.cpp -------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -46,6 +46,8 @@ using namespace lldb; using namespace lldb_private; using namespace lldb_renderscript; +LLDB_PLUGIN_DEFINE(RenderScriptRuntime) + #define FMT_COORD "(%" PRIu32 ", %" PRIu32 ", %" PRIu32 ")" char RenderScriptRuntime::ID = 0; @@ -791,6 +793,9 @@ RenderScriptRuntime::CreateInstance(Process *process, Searcher::CallbackReturn RSBreakpointResolver::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *) { + BreakpointSP breakpoint_sp = GetBreakpoint(); + assert(breakpoint_sp); + ModuleSP module = context.module_sp; if (!module || !IsRenderScriptScriptModule(module)) @@ -811,7 +816,7 @@ RSBreakpointResolver::SearchCallback(SearchFilter &filter, if (kernel_sym) { Address bp_addr = kernel_sym->GetAddress(); if (filter.AddressPasses(bp_addr)) - m_breakpoint->AddLocation(bp_addr); + breakpoint_sp->AddLocation(bp_addr); } return Searcher::eCallbackReturnContinue; @@ -821,6 +826,9 @@ Searcher::CallbackReturn RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter, lldb_private::SymbolContext &context, Address *) { + BreakpointSP breakpoint_sp = GetBreakpoint(); + assert(breakpoint_sp); + // We need to have access to the list of reductions currently parsed, as // reduce names don't actually exist as symbols in a module. They are only // identifiable by parsing the .rs.info packet, or finding the expand symbol. @@ -867,7 +875,7 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter, if (!SkipPrologue(module, address)) { LLDB_LOGF(log, "%s: Error trying to skip prologue", __FUNCTION__); } - m_breakpoint->AddLocation(address, &new_bp); + breakpoint_sp->AddLocation(address, &new_bp); LLDB_LOGF(log, "%s: %s reduction breakpoint on %s in %s", __FUNCTION__, new_bp ? "new" : "existing", kernel_name.GetCString(), @@ -882,7 +890,8 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter, Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback( SearchFilter &filter, SymbolContext &context, Address *addr) { - if (!m_breakpoint) + BreakpointSP breakpoint_sp = GetBreakpoint(); + if (!breakpoint_sp) return eCallbackReturnContinue; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); @@ -892,7 +901,8 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback( return Searcher::eCallbackReturnContinue; std::vector<std::string> names; - m_breakpoint->GetNames(names); + Breakpoint& breakpoint = *breakpoint_sp; + breakpoint.GetNames(names); if (names.empty()) return eCallbackReturnContinue; @@ -932,7 +942,7 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback( } bool new_bp; - m_breakpoint->AddLocation(address, &new_bp); + breakpoint.AddLocation(address, &new_bp); LLDB_LOGF(log, "%s: Placed %sbreakpoint on %s", __FUNCTION__, new_bp ? "new " : "", k.m_name.AsCString()); @@ -1029,8 +1039,8 @@ bool RenderScriptRuntime::CouldHaveDynamicValue(ValueObject &in_value) { } lldb::BreakpointResolverSP -RenderScriptRuntime::CreateExceptionResolver(Breakpoint *bp, bool catch_bp, - bool throw_bp) { +RenderScriptRuntime::CreateExceptionResolver(const lldb::BreakpointSP &bp, + bool catch_bp, bool throw_bp) { BreakpointResolverSP resolver_sp; return resolver_sp; } @@ -1513,7 +1523,7 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook, script->type = ScriptDetails::eScriptC; script->cache_dir = cache_dir; script->res_name = res_name; - script->shared_lib = strm.GetString(); + script->shared_lib = std::string(strm.GetString()); script->context = addr_t(args[eRsContext]); } @@ -3129,7 +3139,7 @@ void RenderScriptRuntime::DumpKernels(Stream &strm) const { strm.Printf("Resource '%s':", module->m_resname.c_str()); strm.EOL(); for (const auto &kernel : module->m_kernels) { - strm.Indent(kernel.m_name.AsCString()); + strm.Indent(kernel.m_name.GetStringRef()); strm.EOL(); } } @@ -3939,9 +3949,10 @@ void RSModuleDescriptor::Dump(Stream &strm) const { } void RSGlobalDescriptor::Dump(Stream &strm) const { - strm.Indent(m_name.AsCString()); + strm.Indent(m_name.GetStringRef()); VariableList var_list; - m_module->m_module->FindGlobalVariables(m_name, nullptr, 1U, var_list); + m_module->m_module->FindGlobalVariables(m_name, CompilerDeclContext(), 1U, + var_list); if (var_list.GetSize() == 1) { auto var = var_list.GetVariableAtIndex(0); auto type = var->GetType(); @@ -3964,12 +3975,12 @@ void RSGlobalDescriptor::Dump(Stream &strm) const { } void RSKernelDescriptor::Dump(Stream &strm) const { - strm.Indent(m_name.AsCString()); + strm.Indent(m_name.GetStringRef()); strm.EOL(); } void RSReductionDescriptor::Dump(lldb_private::Stream &stream) const { - stream.Indent(m_reduce_name.AsCString()); + stream.Indent(m_reduce_name.GetStringRef()); stream.IndentMore(); stream.EOL(); stream.Indent(); diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index c3740ba55a11..5e3726548369 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_RenderScriptRuntime_h_ -#define liblldb_RenderScriptRuntime_h_ +#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTRUNTIME_H +#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTRUNTIME_H #include <array> #include <map> @@ -24,6 +24,10 @@ #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h" +namespace clang { +class TargetOptions; +} + namespace lldb_private { namespace lldb_renderscript { @@ -54,7 +58,7 @@ struct RSCoordinate { // for .expand kernels as a fallback. class RSBreakpointResolver : public BreakpointResolver { public: - RSBreakpointResolver(Breakpoint *bp, ConstString name) + RSBreakpointResolver(const lldb::BreakpointSP &bp, ConstString name) : BreakpointResolver(bp, BreakpointResolver::NameResolver), m_kernel_name(name) {} @@ -73,9 +77,9 @@ public: lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } lldb::BreakpointResolverSP - CopyForBreakpoint(Breakpoint &breakpoint) override { + CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override { lldb::BreakpointResolverSP ret_sp( - new RSBreakpointResolver(&breakpoint, m_kernel_name)); + new RSBreakpointResolver(breakpoint, m_kernel_name)); return ret_sp; } @@ -96,7 +100,7 @@ public: }; RSReduceBreakpointResolver( - Breakpoint *breakpoint, ConstString reduce_name, + const lldb::BreakpointSP &breakpoint, ConstString reduce_name, std::vector<lldb_renderscript::RSModuleDescriptorSP> *rs_modules, int kernel_types = eKernelTypeAll) : BreakpointResolver(breakpoint, BreakpointResolver::NameResolver), @@ -123,9 +127,9 @@ public: lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } lldb::BreakpointResolverSP - CopyForBreakpoint(Breakpoint &breakpoint) override { + CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override { lldb::BreakpointResolverSP ret_sp(new RSReduceBreakpointResolver( - &breakpoint, m_reduce_name, m_rsmodules, m_kernel_types)); + breakpoint, m_reduce_name, m_rsmodules, m_kernel_types)); return ret_sp; } @@ -246,7 +250,8 @@ typedef std::vector<RSScriptGroupDescriptorSP> RSScriptGroupList; class RSScriptGroupBreakpointResolver : public BreakpointResolver { public: - RSScriptGroupBreakpointResolver(Breakpoint *bp, ConstString name, + RSScriptGroupBreakpointResolver(const lldb::BreakpointSP &bp, + ConstString name, const RSScriptGroupList &groups, bool stop_on_all) : BreakpointResolver(bp, BreakpointResolver::NameResolver), @@ -268,9 +273,9 @@ public: lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } lldb::BreakpointResolverSP - CopyForBreakpoint(Breakpoint &breakpoint) override { + CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override { lldb::BreakpointResolverSP ret_sp(new RSScriptGroupBreakpointResolver( - &breakpoint, m_group_name, m_script_groups, m_stop_on_all)); + breakpoint, m_group_name, m_script_groups, m_stop_on_all)); return ret_sp; } @@ -343,9 +348,9 @@ public: bool CouldHaveDynamicValue(ValueObject &in_value) override; - lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bp, - bool catch_bp, - bool throw_bp) override; + lldb::BreakpointResolverSP + CreateExceptionResolver(const lldb::BreakpointSP &bp, + bool catch_bp, bool throw_bp) override; bool LoadModule(const lldb::ModuleSP &module_sp); @@ -402,6 +407,8 @@ public: return false; } + bool GetOverrideExprOptions(clang::TargetOptions &prototype); + // PluginInterface protocol lldb_private::ConstString GetPluginName() override; @@ -421,7 +428,8 @@ protected: void InitSearchFilter(lldb::TargetSP target) { if (!m_filtersp) - m_filtersp.reset(new SearchFilterForUnconstrainedSearches(target)); + m_filtersp = + std::make_shared<SearchFilterForUnconstrainedSearches>(target); } void FixupScriptDetails(lldb_renderscript::RSModuleDescriptorSP rsmodule_sp); @@ -577,11 +585,9 @@ private: // any previous stored allocation which has the same address. AllocationDetails *CreateAllocation(lldb::addr_t address); - bool GetOverrideExprOptions(clang::TargetOptions &prototype) override; - bool GetIRPasses(LLVMUserExpression::IRPasses &passes) override; }; } // namespace lldb_private -#endif // liblldb_RenderScriptRuntime_h_ +#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTRUNTIME_H diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp index 45d0d028d047..b6f8b20c90c3 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp @@ -1,4 +1,4 @@ -//===-- RenderScriptScriptGroup.cpp -----------------------------*- C++ -*-===// +//===-- RenderScriptScriptGroup.cpp ---------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.h index c25e240f6d52..03d3a7823a98 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_RenderScriptScriptGroup_h_ -#define liblldb_RenderScriptScriptGroup_h_ +#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTSCRIPTGROUP_H +#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTSCRIPTGROUP_H #include "lldb/Interpreter/CommandInterpreter.h" lldb::CommandObjectSP NewCommandObjectRenderScriptScriptGroup( lldb_private::CommandInterpreter &interpreter); -#endif // liblldb_RenderScriptScriptGroup_h_ +#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTSCRIPTGROUP_H diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp index 4ddff3ad9c4c..f51190e0c82c 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -1,4 +1,4 @@ -//===-- RenderScriptx86ABIFixups.cpp ----------------------------*- C++ -*-===// +//===-- RenderScriptx86ABIFixups.cpp --------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,6 @@ #include "llvm/ADT/StringRef.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h" @@ -158,12 +157,11 @@ bool fixupX86StructRetCalls(llvm::Module &module) { assert(new_func_type && "failed to clone functionType for Renderscript ABI fixup"); - llvm::CallSite call_site(call_inst); llvm::Function *func = call_inst->getCalledFunction(); assert(func && "cannot resolve function in RenderScriptRuntime"); // Copy the original call arguments - std::vector<llvm::Value *> new_call_args(call_site.arg_begin(), - call_site.arg_end()); + std::vector<llvm::Value *> new_call_args(call_inst->arg_begin(), + call_inst->arg_end()); // Allocate enough space to store the return value of the original function // we pass a pointer to this allocation as the StructRet param, and then @@ -189,15 +187,17 @@ bool fixupX86StructRetCalls(llvm::Module &module) { ->setName("new_func_ptr_load_cast"); // load the new function address ready for a jump llvm::LoadInst *new_func_addr_load = - new llvm::LoadInst(new_func_ptr, "load_func_pointer", call_inst); + new llvm::LoadInst(new_func_ptr->getType()->getPointerElementType(), + new_func_ptr, "load_func_pointer", call_inst); // and create a callinstruction from it llvm::CallInst *new_call_inst = llvm::CallInst::Create(new_func_type, new_func_addr_load, new_call_args, "new_func_call", call_inst); new_call_inst->setCallingConv(call_inst->getCallingConv()); new_call_inst->setTailCall(call_inst->isTailCall()); - llvm::LoadInst *lldb_save_result_address = - new llvm::LoadInst(return_value_alloc, "save_return_val", call_inst); + llvm::LoadInst *lldb_save_result_address = new llvm::LoadInst( + return_value_alloc->getType()->getPointerElementType(), + return_value_alloc, "save_return_val", call_inst); // Now remove the old broken call call_inst->replaceAllUsesWith(lldb_save_result_address); diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.h index a5efc999aea4..7836fff4a3a9 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_RENDERSCRIPT_X86_H -#define LLDB_RENDERSCRIPT_X86_H +#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTX86ABIFIXUPS_H +#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTX86ABIFIXUPS_H #include "llvm/IR/Module.h" |