Move record-event helpers to Task.
Include null terminator in string recorded by Task::record_remote_str.

This fixes a regression introduced by commit 2ccd42.
Merge pull request #1063 from rocallahan/string-length

Include null terminator in string recorded by Task::record_remote_str.