Fix restart bugs (DON'T MERGE)

This causes `call_function` to fail because its final "cont" command does not return to the replay session. I haven't figured that out yet, but I wanted to post my work and get some advice.

The test included in this PR currently fails for two main reasons:
1) calling `atomic_printf("hello%s", "kitty")` fails. Actually the simpler version `atomic_printf("hello")` also fails, because gdb rigs a call to `malloc()` to allocate space for the string, and after that call we end the diversion session; gdb does more set-reg and set-mem calls to set up the `atomic_printf`, which are ignored, then its `vCont` resumes the replay session.
2) gdb "restart" and "run" commands during a diversion session cause an rr assertion failure.

#2 is the real bug I was trying to fix. The fix for that is trivial. But along the way I discovered bug #1.