upx/upx

Missing exception class and message on 64bit builds when using madexcept.

Open

#251 opened on Feb 20, 2019

View on GitHub
 (46 comments) (0 reactions) (0 assignees)C++ (1,279 forks)batch import
enhancementhelp wantedos:Windows

Repository metrics

Stars
 (12,842 stars)
PR merge metrics
 (Avg merge 23h 25m) (18 merged PRs in 30d)

Description

What's the problem (or question)?

Executables using MadExcept do not display the correct exception classes and messages in case of an exception when the executable is compressed with upx using Embarcadero Rad Studio. I am trying to use madexcept (4.0.21) along with my 64bit executable compressed with UPX (v3.95). The 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.:

`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).

What should have happened?

The exceptions classes and messages should be displayed in the madexcept exception dialog.

Do you have an idea for a solution?

No.

How can we reproduce the issue?

  1. Create a simple VCL application with Embarcadero Rad Studio 10.x.
  2. Include MadExcept: http://www.madshi.net/madExceptDescription.htm
  3. create an own Exception class like: interface TMyException = class(Exception) constructor Create(); end;

implementation

constructor TMyException.Create(); begin inherited Create('Test message ' + self.ClassName); end;

  1. Raise the exception in your application.

Please tell us details about your environment.

  • UPX version used (upx --version): 3.95
  • Host Operating System and version: Windows 10 latest updates
  • Host CPU architecture: x64
  • Target Operating System and version: Windows 10
  • Target CPU architecture: x64 example-exe.zip example.zip

Contributor guide