diff options
author | Aidan Dodds <aidan@codeplay.com> | 2016-03-10 17:27:41 +0000 |
---|---|---|
committer | Aidan Dodds <aidan@codeplay.com> | 2016-03-10 17:27:41 +0000 |
commit | 17e07c0ab4820b33df2dd12f2330875d547e8af7 (patch) | |
tree | b1d66fe7715984873b4468897896ba05814539d4 /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp | |
parent | 8433fdbedfad67239b7658089b3974b3e516d487 (diff) | |
download | bcm5719-llvm-17e07c0ab4820b33df2dd12f2330875d547e8af7.tar.gz bcm5719-llvm-17e07c0ab4820b33df2dd12f2330875d547e8af7.zip |
[Renderscript] Add stack argument reading code for Mipsel
This commit implements the reading of stack spilled function arguments for little endian MIPS targets.
Committed on behalf of: Dean De Leo <dean@codeplay.com>
llvm-svn: 263130
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index bad04d81433..d636178d47e 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -184,6 +184,8 @@ GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) 4, // eBool, }}; + Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); // step over the return address @@ -227,7 +229,6 @@ GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) // read the argument from memory arg.value = 0; // note: due to little endian layout reading 4 or 8 bytes will give the correct value. - Error error; size_t read = ctx.process->ReadMemory(sp, &arg.value, size, error); success = (error.Success() && read==size); // advance past this argument @@ -237,7 +238,8 @@ GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) if (!success) { if (log) - log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); + log->Printf("%s - error reading argument: %" PRIu64", reason: %s", + __FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } @@ -252,6 +254,8 @@ GetArgsArm(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -275,7 +279,6 @@ GetArgsArm(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) // clear all 64bits arg.value = 0; // read this argument from memory - Error error; size_t bytes_read = ctx.process->ReadMemory(sp, &arg.value, arg_size, error); success = (error.Success() && bytes_read == arg_size); // advance the stack pointer @@ -285,7 +288,8 @@ GetArgsArm(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) if (!success) { if (log) - log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); + log->Printf("%s - error reading argument: %" PRIu64", reason: %s", + __FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } @@ -340,6 +344,11 @@ GetArgsMipsel(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Error error; + + // find offset to arguments on the stack (+16 to skip over a0-a3 shadow space) + uint64_t sp = ctx.reg_ctx->GetSP() + 16; + for (size_t i = 0; i < num_args; ++i) { bool success = false; @@ -379,6 +388,8 @@ GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -402,7 +413,6 @@ GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) // clear all 64bits arg.value = 0; // read this argument from memory - Error error; size_t bytes_read = ctx.process->ReadMemory(sp, &arg.value, arg_size, error); success = (error.Success() && bytes_read == arg_size); // advance the stack pointer @@ -412,7 +422,8 @@ GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) if (!success) { if (log) - log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); + log->Printf("%s - error reading argument: %" PRIu64", reason: %s", + __FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } |