summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2016-02-08 04:35:51 +0000
committerBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2016-02-08 04:35:51 +0000
commitb4fd8bb27ed60106f359264ae13137a9bc8f412b (patch)
tree266928fd95f64d958cb35859b8f840c994c57bee
parent163333f9122b259f1f09ca8814b119a3ecb24262 (diff)
downloadbcm5719-llvm-b4fd8bb27ed60106f359264ae13137a9bc8f412b.tar.gz
bcm5719-llvm-b4fd8bb27ed60106f359264ae13137a9bc8f412b.zip
[LLDB][MIPS] Fix TestExpressionInSyscall.py for MIPS
SUMMARY: This patch fixes TestExpressionInSyscall.py and solves bug 23659 for MIPS. Corrected indentation at couple of places. Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits Differential Revision: http://reviews.llvm.org/D16916 llvm-svn: 260072
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp15
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp15
2 files changed, 26 insertions, 4 deletions
diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
index 3c7e9495d6c..1b77946c1d1 100644
--- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -242,16 +242,27 @@ ABISysV_mips::PrepareTrivialCall (Thread &thread,
const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
+ const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
if (log)
- log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+ log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0);
+
+ /* Write r0 with 0, in case we are stopped in syscall,
+ * such setting prevents automatic decrement of the PC.
+ * This clears the bug 23659 for MIPS.
+ */
+ if (!reg_ctx->WriteRegisterFromUnsigned (r0_info, (uint64_t)0))
+ return false;
+
+ if (log)
+ log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
// Set "sp" to the requested value
if (!reg_ctx->WriteRegisterFromUnsigned (sp_reg_info, sp))
return false;
if (log)
- log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
+ log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
// Set "ra" to the return address
if (!reg_ctx->WriteRegisterFromUnsigned (ra_reg_info, return_addr))
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
index e3da3631723..8226ef15f49 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -207,16 +207,27 @@ ABISysV_mips64::PrepareTrivialCall (Thread &thread,
const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
+ const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
if (log)
- log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+ log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0);
+
+ /* Write r0 with 0, in case we are stopped in syscall,
+ * such setting prevents automatic decrement of the PC.
+ * This clears the bug 23659 for MIPS.
+ */
+ if (!reg_ctx->WriteRegisterFromUnsigned (r0_info, (uint64_t)0))
+ return false;
+
+ if (log)
+ log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
// Set "sp" to the requested value
if (!reg_ctx->WriteRegisterFromUnsigned (sp_reg_info, sp))
return false;
if (log)
- log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
+ log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
// Set "ra" to the return address
if (!reg_ctx->WriteRegisterFromUnsigned (ra_reg_info, return_addr))
OpenPOWER on IntegriCloud