madExcept 

Content /...
www.madshi.net

Do you know this box? ;-) Well, nobody is perfect. So it happens from time to time that we programmers ship a product, which is not totally bug free. That's okay (more or less), you might say. As long as your product has less bugs than Windows, it's fine.

But what do your customers say? Let's say a customer mails you that he gets this "invalid pointer operation" box quite often and that he either wants his money back or a new version which fixes this bug. He's willing to help you finding the bug, he even sends you a screen shot of the exception box. But does that really help much? I don't think so. There's absolutely *NO* useful information in that box. And on your computer this bug simply doesn't occur, no idea why. So what can you do now?

What you would really need is more information - a *lot* more information. You would need the exact source code location where the exception occured, and - also important - how the program got to that location. In other words: You need the exception callstack, with unit name, function name and line number for each item. THEN you would have good hope to find the bug. Right?

Okay, the package "madExcept" was exactly build for that purpose, namely to replace Delphi's standard exception handling with a new logic, which finds out the full callstack with as much details and infos as possible. The exact behaviour of madExcept's exception handling can be totally customized. You can choose whether you want to see an exception box or not, how the box should look like, which buttons it should have, how the buttons should be labeled and so on. If you don't do any customization, the default box looks like this:

The usual customer doesn't really want to read madExcept's detailed bug report. He just wants to send the bug report to the programmer, hoping that this will lead to a corrected new version. So in the default settings madExcept's box doesn't show any exception information, not even the exception message itself. The customer can just mail the bug report, or he can continue, restart or close the application.

One thing should be mentioned here: madExcept's exception box is *not* using any VCL stuff, instead it's build on pure win32 API calls. It's no fun designing a nice box with bitmap buttons and so on with win32 APIs only, but in this case it was absolutely necessary. The VCL is not thread safe, but our exception box must be able to show up in the context of each thread - thus it has to be thread safe, thus it must not use the VCL.

Apart from pure exception handling madExcept does one more thing (if you want it to), namely checking whether the main thread is frozen or not. Sometimes your program doesn't react anymore, although no exception occured. That can happen e.g. if your main thread runs in an infinite loop or if there's a bug in the synchronization of multiple threads, with the result of a dead lock. Such a bug can be *very* difficult to find, because your program is just frozen, without showing an exception. But with madExcept the situation is not that hopeless anymore: If your main thread doesn't react on messages for a specified time, madExcept raises an exception in the context of the main thread. In the resulting bug report you can see what the main thread was doing exactly and also what all other threads were doing at that time. That should help a lot finding infinite loop and dead lock bugs.

Okay, I've talked enough. If you now just want this extended exception handling, then (after having downloaded and installed the package) please read How To Use madExcept. Customization details can be found on the madExcept Settings page. The madExcept FAQ page answers some frequently asked question. If you want to know how "madExcept" works internally in all details, you can head on over to the madExcept Internals. If you're interested in a little demo that shows "madExcept" in action when working with an application & dll combo, continue here. Finally, you may be interested to read something about the different Stack Tracing Methods available on the market.

Topics
What Is New How To Use Settings Configuration Internals Demo Stack Tracing Methods FAQ

A full list of what is contained in the package "madExcept" can be found in the madExcept Reference. In case you want to explore the seperate units and what else you can do with them, you can find documentation about them here:

Units
madMapFile madStackTrace madExcept madExceptVcl madLinkDisAsm madNVBitmap madNVAssistant madNVPrgrAlert

madExcept is free for non-commercial usage (only).

You can find more information including the full download at http://www.madExcept.com.