This patch enhances the interruption features I added a little while back. There are two main changes. The main one here is that I made a nicer interface to reporting interruption events. I also added a way to ask a debugger if it was using a Module, so that we can query for interruption in Module code where we don't have access to a debugger. I used that to support interrupting debug info reading on a per-module basis - since that's a long-running but - at least on a module boundary - resumable operation.
The current method of checking "Does this module one belong to a debugger requesting interruption" is quick and dirty here. IMO, a better solution would be to have Modules keep a list of the Debuggers (or maybe Targets) using them. But we should figure out all the ways we want to use that and design something nice for the purpose.
I think it would make more sense to have cur_func and formatv be of type llvm::StringRef. Concretely, if you construct a std::string from nullptr (like you're doing below when you make an InterruptionReport object), you will crash.
I know the recommendation is to use INTERRUPT_REQUESTED instead of filling this manually, but inevitably somebody will go against the advice and make a mistake.