Missing Exception class and message on 64bit builds + UPX

delphi package - automated exception handling
Post Reply
jampeter
Posts: 3
Joined: Wed Nov 21, 2018 8:11 am

Missing Exception class and message on 64bit builds + UPX

Post by jampeter »

Hi!

I am trying to use madexcept (4.0.21) along with my 64bit executable compressed with UPX (v3.95).
My Application is compiled with Delphi 10.2.3 Tokyo.
It seems that MadExcept does not report errors correctly when I raise own exceptions (using an own exception class derived from System.SysUtils.Exception) e.g.:

Code: Select all

interface
  TMyException = class(Exception)
    constructor Create();
  end;

implementation

constructor TMyException.Create();
begin
  inherited Create('Test message ' + self.ClassName);
end;
If I raise this exception in an uncompressed executable, madexcept displays the correct information:
exception class: TMyException
exception message: Test message TMyException.

As soon as I compress the executable with UPX I receive:
exception class: UNKNOWN
exception message: UNKNOWN

For compressed 32bit executables madexcept reports the correct information.
It does not work just for 64bit compressed executables and if I raise own/derived exceptions classes.
Raising exceptions in 64bit compressed executables without using madexcept works correctly (the correct exception message is displayed) so I guess this is a bug in madexcept.
Please let me know if you need futher information.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Missing Exception class and message on 64bit builds + UP

Post by madshi »

Isn't it UPX' job to compress the EXE in such a way that the compression is completely transparent, without any effect on the application? If so, why would it be my fault, if using UPX stops madExcept from working correctly? Obviously, UPX changed something which breaks madExcept. Well, I suppose I could look into it and try to fix it, but I'm quite reluctant to consider this madExcept's fault...

Just to be sure: This problem also occurs in a brand new test project, correct? Or does it only occur in your big real project?
jampeter
Posts: 3
Joined: Wed Nov 21, 2018 8:11 am

Re: Missing Exception class and message on 64bit builds + UP

Post by jampeter »

Yes, you can reproduce the issue with a simple new test project.
Well, I suppose I could look into it and try to fix it, but I'm quite reluctant to consider this madExcept's fault...
Yes, you are right, UPX should not break anything. Nevertheless thank you very much for taking a look at this problem.
Maybe you can fix it in your code.
jampeter
Posts: 3
Joined: Wed Nov 21, 2018 8:11 am

Re: Missing Exception class and message on 64bit builds + UP

Post by jampeter »

Post Reply