Author: ewancrawford Date: Thu Oct 22 04:01:05 2015 New Revision: 251003 URL: http://llvm.org/viewvc/llvm-project?rev=251003&view=rev Log: [RenderScript] Support for mips64 runtime hook
Previously we could not hook the RS runtime on mips64 architectures. Patch implements ABI specific code for inspecting function arguments. Author: Dean De Leo, d...@codeplay.com Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=251003&r1=251002&r2=251003&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Oct 22 04:01:05 2015 @@ -609,25 +609,30 @@ RenderScriptRuntime::GetArgSimple(Execut { const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg); RegisterValue rVal; - reg_ctx->ReadRegister(rArg, rVal); - (*data) = rVal.GetAsUInt32(); - success = true; + success = reg_ctx->ReadRegister(rArg, rVal); + if (success) + { + (*data) = rVal.GetAsUInt32(); + } + else + { + if (log) + log->Printf ("RenderScriptRuntime:: GetArgSimple - error reading ARM register: %d.", arg); + } } else { uint64_t sp = reg_ctx->GetSP(); + uint32_t offset = (arg-4) * sizeof(uint32_t); + process->ReadMemory(sp + offset, &data, sizeof(uint32_t), error); + if (error.Fail()) + { + if (log) + log->Printf ("RenderScriptRuntime:: GetArgSimple - error reading ARM stack: %s.", error.AsCString()); + } + else { - uint32_t offset = (arg-4) * sizeof(uint32_t); - process->ReadMemory(sp + offset, &data, sizeof(uint32_t), error); - if (error.Fail()) - { - if (log) - log->Printf ("RenderScriptRuntime:: GetArgSimple - error reading ARM stack: %s.", error.AsCString()); - } - else - { - success = true; - } + success = true; } } @@ -660,6 +665,44 @@ RenderScriptRuntime::GetArgSimple(Execut } break; } + case llvm::Triple::ArchType::mips64el: + { + // read from the registers + if (arg < 8) + { + const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg + 4); + RegisterValue rVal; + success = reg_ctx->ReadRegister(rArg, rVal); + if (success) + { + (*data) = rVal.GetAsUInt64(); + } + else + { + if (log) + log->Printf("RenderScriptRuntime::GetArgSimple - Mips64 - Error reading the argument #%d", arg); + } + } + + // read from the stack + else + { + uint64_t sp = reg_ctx->GetSP(); + uint32_t offset = (arg - 8) * sizeof(uint64_t); + process->ReadMemory(sp + offset, &data, sizeof(uint64_t), error); + if (error.Fail()) + { + if (log) + log->Printf ("RenderScriptRuntime::GetArgSimple - Mips64 - Error reading Mips64 stack: %s.", error.AsCString()); + } + else + { + success = true; + } + } + + break; + } default: { // invalid architecture @@ -841,10 +884,12 @@ RenderScriptRuntime::LoadRuntimeHooks(ll if (targetArchType != llvm::Triple::ArchType::x86 && targetArchType != llvm::Triple::ArchType::arm - && targetArchType != llvm::Triple::ArchType::aarch64) + && targetArchType != llvm::Triple::ArchType::aarch64 + && targetArchType != llvm::Triple::ArchType::mips64el + ) { if (log) - log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Unable to hook runtime. Only X86, ARM supported currently."); + log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Unable to hook runtime. Only X86, ARM, Mips64 supported currently."); return; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits