Here is a fix for Ubuntu tests fails after the recent change D26497 (https://reviews.llvm.org/D26497). The cause of those fails is in internal call to mmap fuction which destroys completed_plan_stack content which in its turn leads to incorrect stop reason discovering.
The solution is to save/restore completed_plan_stack along with existing ThreadStateCheckpoint functionality.