How can I find out which procedure threw an exception in Delphi?

后端 未结 3 1448
南笙
南笙 2020-12-15 09:03

I am using Delphi TApplication.OnException Event to catch unhandled exceptions

This works well but does not give sufficient information about where the exception hap

3条回答
  •  一生所求
    2020-12-15 10:01

    The simplest and quickest way would be to use the JCL exception and debugging support. After installing the JCL, make sure to insert the debug symbols into the binary (Projects -> JCL debug expert -> Insert JDBG data for this binary -> Enabled) and add a JCL exception dialog to the project (File -> New... -> Dialogs -> Exception dialog).

    If the JCL installer fails to add that dialog to the object repository and it doesn't appear (happened to me a few times), either add it manually by copying the .pas and .dpr file from jcl-install-dir\experts\debug\dialog into your project and adding them manually, or close Delphi, edit %DELHPIDIR%\bin\delphi32.dro in a text editor and add something like this to it (adjusting the paths of course:)

    [P:\DELPHI11\EXTERNALLIB\JCL\EXPERTS\DEBUG\DIALOG\EXCEPTDLG]
    Type=FormTemplate
    Name=Exception Dialog
    Page=Dialogs
    Icon=P:\DELPHI11\EXTERNALLIB\JCL\EXPERTS\DEBUG\DIALOG\EXCEPTDLG.ICO
    Description=JCL Application exception dialog
    Author=Project JEDI
    DefaultMainForm=0
    DefaultNewForm=0
    Ancestor=
    
    [P:\DELPHI11\EXTERNALLIB\JCL\EXPERTS\DEBUG\DIALOG\EXCEPTDLGMAIL]
    Type=FormTemplate
    Name=Exception Dialog with Send
    Page=Dialogs
    Icon=P:\DELPHI11\EXTERNALLIB\JCL\EXPERTS\DEBUG\DIALOG\EXCEPTDLGMAIL.ICO
    Description=JCL Application exception dialog
    Author=Project JEDI
    DefaultMainForm=0
    DefaultNewForm=0
    Ancestor=
    

提交回复
热议问题