正如其他人所指出... JCL有一些不錯的功能...
在你的應用程序...你需要設置一些信息,以獲得必要的堆棧幀鉤...
項目 - >編譯器 - >堆棧幀...我也有所有的調試檢查,並添加以下...項目 - >選項 - >連接器 - >地圖文件(選擇詳細)/包括TD32調試信息
在我的記錄器單元中...我有這個...你必須有你自己的TLogger ...它可以爲你節省信息...
use
JclDebug, JclHookExcept;
procedure HookGlobalException(ExceptObj: TObject; ExceptAddr: Pointer; OSException: Boolean);
var
a_List: TStringList;
a_Error: string;
begin
if Assigned(TLogger._Instance) then
begin
a_List := TStringList.Create;
try
a_List.Add(cStar);
a_Error := Exception(ExceptObj).Message;
a_List.Add(Format('{ Exception - %s }', [a_Error]));
JclLastExceptStackListToStrings(a_List, False, True, True, False);
a_List.Add(cStar);
// save the error with stack log to file
TLogger._Instance.AddError(a_List);
finally
a_List.Free;
Raise Exception.Create(a_Error);
end;
end;
end;
initialization
Lock := TCriticalSection.Create;
Include(JclStackTrackingOptions, stTraceAllExceptions);
Include(JclStackTrackingOptions, stRawMode);
// Initialize Exception tracking
JclStartExceptionTracking;
JclAddExceptNotifier(HookGlobalException, npFirstChain);
JclHookExceptions;
finalization
JclUnhookExceptions;
JclStopExceptionTracking;
Lock.Free;
end.
[我怎樣才能找出哪個程序在Delphi中拋出異常?](http://stackoverflow.com/questions/347365/how-can-i-find-out-which-procedure-threw-an - 在delphi中的錯誤) – 2010-11-10 23:08:37
看看這個問題http://stackoverflow.com/questions/347365/unhandled-exceptions-in-delphi – 2010-11-10 20:17:22