madExceptPatch.exe -> patch all bpl's or just the exe?

delphi package - automated exception handling
Post Reply
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

madExceptPatch.exe -> patch all bpl's or just the exe?

Post by santiago »

Hi there,

When compiling from the IDE madExcept works fine.
When we use our MSBUILD script madExcept was not showing the exception box.
So I patched the .exe using the madExceptPatch.exe as part of our build script and now the madExcept box shows. Call stack info is displaying properly.

However I am unsure about the following.

Our project is structured as follows:

Lib1.bpl
Lib2.bpl
Lib3.bpl
Lib....bpl (we have many libs. each lib generates a bpl which is needed at runtime)
OurApp.exe (OurApp.exe requieres all these libs).

Only our OurApp.exe has an mes file.

Is it necessary to run madExceptPatch.exe on all bpl files? If so, I would use the OurApp.mes file (since it is the only one we have), I guess.

For the moment I am patching only the exe and so far everything seems to be working fine.

Is this correct? Or do all bpl files need to be patched as well?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by madshi »

I suppose the EXE is using the BPL version of RTL and VCL instead of linking the RTL/VCL code into the EXE? In that case just adding the madExcept *code* to the EXE should do all that is needed. However, you probably want the callstacks to also cover your BPLs, don't you? In that case you need the map file information (function names, line numbers etc) to be added to the BPLs. You can do that by calling madExceptPatch on the BPLs without any MES file. In that case only the map file information is added into the BPLs' resource section, without doing anything else.

Alternatively you could leave the BPLs alone and just distribute the BPLs' map files with the BPLs. But that's "ugly", costs more space, and requires madExcept to parse the map files every time an exception occurs. So it's much "nicer" IMHO to have the map file information trimmed down to what madExcept needs exactly and have that stored compressed in the BPLs' resource section.
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by santiago »

Thanks madshi!

I made a sample app to figure this out. I want it all to work properly :-)

I have a project group with 3 projects. Two LIBS and the EXE.
I only enabled madExcept on the EXE. But I do use madExcept in one of the Libs -> None of the Libs has a MES file.

The EXE uses the BPL versions of the Libs. The callstack information for the Libs does show up in the madExcept box.

There is only one .map file in the output directory. It is the exe's .map file.
If I look at the .map file it does contain information about the libs in it.

Based on your reply I would have expected the callstack info for the Libs to be missing.

Or am I wrong?

Here is a link to the very simple project. It is was made with Delphi 10 Seattle.
Both the debug and release configurations should compile just fine.

https://www.dropbox.com/s/hg3juz5upv8u3 ... o.zip?dl=0

It would be fantastic if you could take a quick look and just make sure that it is setup properly. I will then move on and try to incorporate madExcept into our product to continue our evaluation.

Thanks a million!
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by madshi »

I'm kinda confused. If you use LIBs and link them into your EXE then the EXE's map file should contain unit and function names for those LIBs, and everything should be fine and easy. However, if you use BPLs then your EXE's map file should *not* contain information for those LIBs and then you'd need the map files for the BPLs.

Before I go to the hassle of digging into your code: Can you please post the crash report you get? Maybe I can already answer based on that.
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by santiago »

Thanks Madschi!!

Here is the link to the bug report:

https://www.dropbox.com/s/9npfcxqh58q9d ... 1.zip?dl=0
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by santiago »

I finally figured it out.

I enabled madExcept for the bpl packages.
In the madExcept project options for these BPL packages I only checked 'link in function names and line numbers'.

In my sample project I now have a MES file for every BPL package.

When I build via MSBUILD and manually call madExceptPatch.exe I can leave out specifying the MES file for BPL projects, correct? If I were to specify the MES file it would result in the same (since the MES file ONLY 'links in function names and line numbers'. Correct?

THANK YOU!
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by santiago »

Madschi,

I got it working as I need it to. I did end up using a MES file for the BPL projects though.

You had written:
You can do that by calling madExceptPatch on the BPLs without any MES file. In that case only the map file information is added into the BPLs' resource section, without doing anything else.
When I did that it appended the map file info, but the command line output also said something about using default settings from the registry and the behaviour (box settings, etc..) was different to when running from the IDE.

After I specified the MES file to madExceptPatch.exe it all worked out well.

THANKS!
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExceptPatch.exe -> patch all bpl's or just the exe?

Post by madshi »

Glad to hear you figured it out! Less work for me... :D

Yeah, I suppose it's better to use the MES file for the BPLs instead of using no MES file (= default settings).
Post Reply