Homebrew/homebrew — pull request #32366 by jacknagel (2014-09-17 18:00:52+00:00)
Title: Debugger improvements

The formula debugger is very useful, but the implementation has some problems:

* I dislike the use of `call/cc` as it adds some unnecessary conceptual overhead, and requires unrelated code be aware that it can be invoked multiple times if the continuation is resumed (e.g. [`ensure` blocks](https://github.com/Homebrew/homebrew/blob/190aaef308e2effaa7a7daacc38f86f5db44311b/Library/Homebrew/formula.rb#L550-L551)).

* `require "debrew"` monkeypatches `raise` and adds methods to `Exception`, side effects which make it less than ideal to load in the main Homebrew process. However, we need these constants loaded to properly support passing exceptions between the build process and main process.

This PR addresses these issues by removing the use of `call/cc` and reducing the monkeypatches to a simple wrapper around `raise`.

As a bonus, this makes it simple to add `brew test --debug`, addressing #25844.