Revert "Revert "Add a callback on crash""

This reverts commit 818d43e96e348afec79226e061f7eedd8e06c130.