First steps towards record-replay

 - Fixes in xlib wrapper code to store the return values
 - Addition of code in main file to replay the calls
 - New helper functions in virtualization class