#1 2016-10-07 16:35:50

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,544
Website

TSynLog and x64 dll _TExitDllException muting

Delphi compiler throw a _TExitDllException during load/unload a x64 dll compiled by delphi (as far as I understand from System.pas sources - to set correct exitcode).
This exception is catches inside system.pas, but TSynLog put it to log, so I got many EXC log entries during executable terminates.
I can't use a TSynLog.ExceptionIgnore because there is no exception class for such errors and on the TSynLog level I see it as EExternalException
May be someone know a workaround?

Offline

#2 2016-10-07 19:23:44

Chaa
Member
Registered: 2011-03-26
Posts: 245

Re: TSynLog and x64 dll _TExitDllException muting

Yes, it's a problem for me too, for x64.

Offline

#3 2016-10-08 10:11:46

oz
Member
Registered: 2015-09-02
Posts: 95

Re: TSynLog and x64 dll _TExitDllException muting

If EExternalException is all you can get out of those exceptions, then there is no way to use current ExceptionIgnore implementation without breaking existing code. But this feature could easily be implemented, based on Exception.Message parsing. Following idea is for discussion:

- Problem is that EExternalException is all you have over here.
- Adding EExternalException to TSynLogFamily.ExceptionIgnore is a bad idea because we want to exclude some special EExternalExceptions, not all.
- I'd suggest to add following public function to TSynLogFamily:

procedure AddExceptionIgnoreWithCallback(const aExceptionClass: TClass; const aIgnoreCallback: TSynLogIgnoreExceptionCallback);

with TSynLogIgnoreExceptionCallback being defined as:

TSynLogIgnoreExceptionCallback=function(const aMessage: string):boolean;

AddExceptionIgnoreDetailed can use some kind of DynArray for storing records with Callback function pointer and Exception fields. That private DynArray can be easisly checked for EExternalException class matches, then function(aMessage:String):boolean callback will be called to check for exclusion. Your custom function would look like:

function MyExceptionTextMatch(const aMessage:string):boolean;
begin
  result:=aMessage='whatever, leftstr(), ....';
end;

What do you think?

Last edited by oz (2016-10-08 10:13:57)

Offline

#4 2016-10-08 11:32:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: TSynLog and x64 dll _TExitDllException muting

Please try http://synopse.info/fossil/info/898216c88a

Edit: perhaps http://synopse.info/fossil/info/d79d2be862 is better...

Note that this issue does not exist any more since Delphi XE6, which get rid of this _TExitDllExecption, which made a memory leak!

Offline

#5 2016-10-08 14:07:18

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,544
Website

Re: TSynLog and x64 dll _TExitDllException muting

Arnaud, you're a magician! Now my log files is clean from errors. Thanks a lot!
The x64 Delphi project is a big pain for me: XE2 can't debug x64 under Win8, lucky me, we already had bought one license for XE4, so I can use it for debugging x64 BUT regular expressions (TRegExp) is broken in XE4 (we try to use a PCRE directly). And now you note about a memory leak up to XE5....
Looks like the time for me to switch to the Free Pascal (or spend $1,405.00 for Delphi 10.1 Berlin)

Offline

#6 2016-10-08 19:05:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: TSynLog and x64 dll _TExitDllException muting

If the starter edition would allow to create 64-bit binaries under Windows, it should be a good alternative!
smile

Offline

Board footer

Powered by FluxBB