[Lldb-commits] [lldb] r254379 - [LLDB][MIPS] Clear bug 25194 - LLDB-Server Assertion raised when single stepping on MIPS

Sagar Thakur via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 30 21:44:18 PST 2015

Author: slthakur
Date: Mon Nov 30 23:44:18 2015
New Revision: 254379

URL: http://llvm.org/viewvc/llvm-project?rev=254379&view=rev
[LLDB][MIPS] Clear bug 25194 - LLDB-Server Assertion raised when single stepping on MIPS

This patch will clear bug 25194 - LLDB-Server Assertion raised when single stepping on MIPS. The problem was that while emulating instructions, old and new pc values would have garbage value in their upper 32 bits. Therefore checking if pc was changed (old_pc == new_pc) would always return false, because of which pc was not getting updated.

/* If we haven't changed the PC, change it here */
if (old_pc == new_pc)
    new_pc += 4;
    Context context;
        return false;

Reviewers: tberghammer, clayborg
Subscribers: dsanders, lldb-commits, mohit.bhakkad, bhushan, jaydeep, nitesh.jain
Differential: http://reviews.llvm.org/D14633


Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp?rev=254379&r1=254378&r2=254379&view=diff
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Mon Nov 30 23:44:18 2015
@@ -1376,6 +1376,9 @@ NativeRegisterContextLinux_mips64::DoRea
     GPR_linux_mips regs;
     ::memset(&regs, 0, sizeof(GPR_linux_mips));
+    // Clear all bits in RegisterValue before writing actual value read from ptrace to avoid garbage value in 32-bit MSB 
+    value.SetBytes((void *)(((unsigned char *)&regs) + offset), 8, GetByteOrder());
     Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(), NULL, &regs, sizeof regs);
     if (error.Success())

More information about the lldb-commits mailing list