Split virtual-mem-related code into its own files.
Revert "Fix libpfm linkage."

This reverts commit 9555f95bbfd30f5118a5ed40425d2543644c89a5.
Convert remote-syscall code into an RAII helper, AutoRemoteSyscalls.

Also rename restore_mem to AutoRestoreMem.
Ignore gdb register writes that don't actually change register values.

gdb is observed to (sometimes) try to set orig_eax to -1 when
restarting.

Resolves #1236.