如何制作Delphi的Debug Version? (100分)

  • 主题发起人 主题发起人 KYOz
  • 开始时间 开始时间
K

KYOz

Unregistered / Unconfirmed
GUEST, unregistred user!
FlashFXP的 Debug Version 做得很好,像:
1. Access violation at address xxxxxxx. Read of address xxxxxxxx
2. FileList index out of bounds [3]
3. Object class: TFont (像这一个还可以获得出错的class名字)
等等这样的错误发生时,不是像通常那样跳出一个对话框等着你按确定,而是直接将错误信息
放入到其目录下的"Debug.log"文件中,请问这是如何做到的?

附FlashFXP的Debug.log文件内容例子:
---------------------------2002-2-17 21:39:04---------------------------
Version: 1.4.2 (build 831)
Compiled on: Jan 25, 2002
Object class: TFont
Access violation at address 004FAA91 in module 'FLASHFXP.EXE'. Read of address 000040CC

---------------------------01:59:21 13/05/2002---------------------------
Version: 1.4.4 (build 850)
Compiled on: May 11, 2002
OS Ver: 5.1 (build 2600)

Exception 'EAccessViolation' in module FlashFXP.exe at 73656479
Access violation at address 73657479. Read of address 73657479

Source file: UNKNOWN, Line UNKNOWN
Error within Try/Except

---------------------------08:39:58 29/05/2002---------------------------
Version: 1.4.4 (build 850)
Compiled on: May 11, 2002
OS Ver: 5.1 (build 2600)

Exception 'EFileListError' in module FlashFXP.exe at 000BD0CB
FileList index out of bounds [3]

Source file: UNKNOWN, Line UNKNOWN
Error within Try/Except

Call stack:
:004BE0CB [FlashFXP.exe]
:00534334 [FlashFXP.exe]
:0052F939 [FlashFXP.exe]
:00513C6A [FlashFXP.exe]
:0050F8A3 [FlashFXP.exe]
:00449B2C [FlashFXP.exe]
:00436CEA [FlashFXP.exe]
:0044BF93 [FlashFXP.exe]
:0043403E [FlashFXP.exe]
:77D43A5F [user32.dll]
:77D43B2E [user32.dll]
:77D47419 [user32.dll]
:77D47438 [user32.dll]
:77341C2D [comctl32.dll]
:77341D02 [comctl32.dll]
:77341C0B [comctl32.dll]
:7738923D [comctl32.dll]
:77341D02 [comctl32.dll]
:77341C72 [comctl32.dll]
:77D43A5F [user32.dll]
:77D43B2E [user32.dll]
:77D43D6A [user32.dll]
:77D441FD [user32.dll]
:00544663 [FlashFXP.exe]
:77E7EB69 [kernel32.dll]


 
Application.OnException:=你设置的出错句柄。
然后使用宏定义
$DEFINE

$IFDEF
$ELSE
$ENDIF
就可以了,
然后在出错处理句柄函数里面判断。
 
出错信息可以得到,但是具体的Call Track就不知道了。
 
得到出错信息之后,写入文本文件之中。
 
后退
顶部