When a page fault is thrown, you can figure out what page needs to be loaded since the offending instruction's logical address is stored in BadVAddrReg. It's set to the correct address in ExceptionHandler in machine.cc. Use it to get the page number.
This could be lots of things, but one common error is the following. Say Process A page faults and your PRA picks a frame from Process B as the victim. You then need to go to Process B's pagetable and search it so you can change the appropriate page table entry to invalid. When you do the search, be sure to search for an entry where both the frame number is the victim frame and the valid bit is TRUE. If you just search for the victim frame #, that frame # may appear multiple times in a table (since for some entries, the frame # will be associated with an invalid page). You need both conditions in order to change the correct page table entry. If you change the wrong page table entry, then when process B starts up again, the page table entry that should have been made invalid will still say 'valid', and the CPU will merrily go to that frame and try to run what's there (even though it's a Process A page now). At that point, a seg fault is a definite possibility.
Sure can. Just use the redirect (>) operator. So
nachos -x ../test/halt > foo
will save the output into a file called "foo". Then use any editor to view the file.