Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Stack Trace using JCL in Delphi XE

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

like image 446
John Thomas Avatar asked Feb 20 '26 12:02

John Thomas


1 Answers

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;
like image 127
Lieven Keersmaekers Avatar answered Feb 23 '26 22:02

Lieven Keersmaekers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!