This test (TestExpressionInSyscall.py) checks if we are able to evaluate expressions when the inferior is blocked in a syscall.
As a part of expression evaluation LLDB checks for memory allocation on target (by executing mmap).
So we setup call to mmap by setting argument registers and PC.
Now the process is stopped in the syscall and when it continue to allocate memory, the system call is restarted.
In MIPS, to restart a syscall, kernel decreases the PC by 4 so the resulting PC now points to mmap-4
and also register R7 that provides 'flags' argument to mmap gets clobbered to 0 and hence mmap fails.
A fix to this issue is to postpone the syscall restart until the expression is evaluated.
In MIPS, register R0 controls syscall restart. This patch writes 0 into register R0 when preparing call to mmap.
This setting avoids a syscall restart and prevents automatic decrement of the PC so that expression can be evaluated correctly.
Once the expression completes the registers are restored and program resumes the interrupted syscall when the continue command is issued.
This fixes TestExpressionInSyscall.py and solves bug 23659 for MIPS.