I found an even better way to implement this. Delphi doesn't care too much for special conditionals in the DPR, and it might erase them and make trouble for you without warning. So instead of putting the condition there, just include the unit in your project unconditionally, and add the following to the bottom of the unit, just before the final end. line:

Code:
{$IFDEF DEBUG}
initialization
begin
   RaiseExceptionProc := @DebugExceptionHandler;
end;
{$ENDIF}
This way you can make it work without needing to poke around in the DPR.