new: dev: Support for basic mod debugging (written by rubenwardy)

Based on https://gist.github.com/rubenwardy/5504537/
This particular revision wasn't tested.