madExcept not catching exceptions in 64bit

delphi package - automated exception handling
Post Reply
ilmara
Posts: 4
Joined: Fri Apr 24, 2015 9:32 am

madExcept not catching exceptions in 64bit

Post by ilmara »

Hello,

madExcept does not seems to be catching exceptions in my main project when it's compiled in 64 bit. I already updated to the latest version and checked that the conditional define is set for all targets. This is both when launched from Delphi or with command line patching.

Basically I added some faulty code (TList.Add() on a non-initialized TList) to trigger an AV, the madExcept window shows up in 32 bit but I get a standard Windows error message (Access violation at address...) in 64 bit.

Any insight on what might prevent it from working or what I should test for?
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not catching exceptions in 64bit

Post by madshi »

Are we talking Delphi or BCB? Which version exactly? Can you try with a brand new almost empty test project?
ilmara
Posts: 4
Joined: Fri Apr 24, 2015 9:32 am

Re: madExcept not catching exceptions in 64bit

Post by ilmara »

My apologies, I forgot to specify, it's for a Delphi project, on XE5+Update2
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not catching exceptions in 64bit

Post by madshi »

Can you try with a brand new almost empty test project?

If you don't initialize a TList, it's possible that it's by random nil, then there will be no crash. It's better to test with a "raise Exception.Create('test')" or with something else which will definitely crash, e.g. "integer(nil^) := 0".
ilmara
Posts: 4
Joined: Fri Apr 24, 2015 9:32 am

Re: madExcept not catching exceptions in 64bit

Post by ilmara »

I manage to find a workaround although I'm not sure if this is a bug or a side effect of my project.

Basically we used madExcept as runtime package. It works in 32 bit mode but not in 64 bit. As soon as I removed madExcept_ from the runtime package list to use (I checked by keeping madBasic_ and madDisAsm_ but only madExcept_ seems to have an effect) the expected dialog box popped up.

Is it a known limitation? Is the best practice to link madExcept statically in the final executable/runtime package/DLL?
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not catching exceptions in 64bit

Post by madshi »

If you can link madExcept into your exe, that's good practice, as long as your runtime packages don't need to have access to any of the madExcept functions/APIs.

Hmmmm... Not sure why it doesn't work. Will put that on my to do list.
ilmara
Posts: 4
Joined: Fri Apr 24, 2015 9:32 am

Re: madExcept not catching exceptions in 64bit

Post by ilmara »

Thank you.

I'll link it statically for now, this is an easy workaround.
Post Reply