Fix PT_STEP single-stepping for mips.
Note that GDB at least implements single stepping for MIPS using software
breakpoints explicitly rather than using PT_STEP, so this has only been
tested via tests in ptrace_test which now pass rather than fail.
- Fix several places to use uintptr_t instead of int for virtual addresses.
- Check for errors from ptrace_read_int() when setting a breakpoint for a step.
- Properly check for errors from ptrace_write_int() as it returns non-zero, not negative values on failure.
- Change the error returns for ptrace_read_int() and ptrace_write_int() from ENOMEM to EFAULT.
- Clear a single step breakpoint when it traps rather than waiting for it to be cleared from ptrace(). This matches the behavior of the arm port and in general seems a bit more reliable than waiting for ptrace() to clear it via FIX_SSTEP.
- Drop the PROC_LOCK around ptrace_write_int() in ptrace_clear_single_step() since it can sleep.
- Reorder the breakpoint handler in trap() to only read the instruction if the address matches the current thread's breakpoint address.
- Replace various #if 0'd debugging printfs with KTR_PTRACE traces.
Tested on: mips64