Hmm. Is it possible to take a snapshot of the stack at the time that one of our exception classes is constructed and then later return it in the what() function? Keep in mind, we don't need to translate addresses into file names and line number unless and until what() is called. We can just keep the addresses. Also, we can allocate a fixed-length array of them (say, 20), so we don't have to worry about unbounded memory requirements.
I realize that non-fatal exceptions may be thrown in the course of aMule's operation. So, this is a bad idea if gathering the stack trace snapshot is very expensive.
Anyway, just an idea. I'd write it myself, but stack traces aren't available on the Mac.
P.S. Maybe it could/should be broken out to a where() function, instead of the what() function.