Back when I was just starting with unix as a student I remember losing connection to the university’s mailserver in the middle of composing a long email. I went over to the helpdesk and asked if I could recover the process in a new login session, I got a few blank looks and not much else. It seems that it’s still not easy.
We were discussing this a few months ago and I came across this post by Andrew Tridgell (of samba fame) shows how this can be done with gdb (as well as some other gdb hacks, turns out there’s all kinds of interesting stuff if you actually read the manual. Who would have thought it!).
We also discovered reptyr, a project that does the same thing using ptrace. I’ve not actually used it but it looks interesting.