3

We have a project which we converted from Delphi 2007 to Delphi XE. In the 2007 version we used the JCL's debugging features to have a stack trace when an Exception appears. In fact we used the JCL's standard ExceptionDlg wizard, which relies on the following line to get the Stack Trace:

StackList := JclLastExceptStackList;

This thing used to work in Delphi 2007 but not anymore in XE (it throws a 'blank' stack).

If we replace that thing with a classical

   StackList := JclCreateStackList(false,0,Caller(0,false));
   lTemp := TStringList.Create;
   StackList.AddToStrings(lTemp,true,true,true,true);
   ShowMessage(lTemp.Text);
   lTemp.Free;
   Stacklist.Free;

...it works (hence we have the correct setings WRT to maps etc.), but (unfortunatelly) it shows the present stack trace (which, of course, leads to the exception dialog) and not to the stack trace of the last exception.

Any ideas how to fix this?

TIA

dsolimano
  • 8,870
  • 3
  • 48
  • 63
John Thomas
  • 4,075
  • 3
  • 29
  • 41

1 Answers1

3

Did you call JclStartExceptionTracking?

It seems this method is responsible for hooking up exceptions in the first place and adding a notifier.

function JclStartExceptionTracking: Boolean;
begin
  if TrackingActive then
    Result := False
  else
  begin
    Result := JclHookExceptions and JclAddExceptNotifier(DoExceptNotify, npFirstChain);
    TrackingActive := Result;
  end;
end;
Lieven Keersmaekers
  • 57,207
  • 13
  • 112
  • 146