[Lldb-commits] [lldb] r260072 - [LLDB][MIPS] Fix TestExpressionInSyscall.py for MIPS

Bhushan Attarde via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 9 01:40:08 PST 2016


Hi Hans,

Could you please add this (r260072) to the release branch?

Thanks,
Bhushan


-----Original Message-----
From: lldb-commits [mailto:lldb-commits-bounces at lists.llvm.org] On Behalf Of Bhushan D. Attarde via lldb-commits
Sent: 08 February 2016 10:06
To: lldb-commits at lists.llvm.org
Subject: [Lldb-commits] [lldb] r260072 - [LLDB][MIPS] Fix TestExpressionInSyscall.py for MIPS

Author: bhushan.attarde
Date: Sun Feb  7 22:35:51 2016
New Revision: 260072

URL: http://llvm.org/viewvc/llvm-project?rev=260072&view=rev
Log:
[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

Modified:
    lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
    lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=260072&r1=260071&r2=260072&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Sun Feb  7 22:35:51 2016
@@ -242,16 +242,27 @@ ABISysV_mips::PrepareTrivialCall (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))

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=260072&r1=260071&r2=260072&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Sun Feb  7 22:35:51 2016
@@ -207,16 +207,27 @@ ABISysV_mips64::PrepareTrivialCall (Thre
     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))


_______________________________________________
lldb-commits mailing list
lldb-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list