Add callback argument to track completion of dump

While fine, this is pretty much the same logic as what's in src/platform-posix.cc.  Seems like a good candidate for sharing.