... JCL ...
In your application ... You need to configure some information to get the necessary framework for the hook ...
Project → Compiler-> Stack Frames ... I also checked all the debugging and add the following ... Project-> Options-> Linker -> Map file (select Details) / Enable TD32 debugging information
In my Logger block ... I have this ... You must have your own TLogger ... which stores the information for you ...
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);
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);
JclStartExceptionTracking;
JclAddExceptNotifier(HookGlobalException, npFirstChain);
JclHookExceptions;
finalization
JclUnhookExceptions;
JclStopExceptionTracking;
Lock.Free;
end.
source
share