#1 2023-09-04 22:48:09

igors233
Member
Registered: 2012-09-10
Posts: 234

Embed mab file in exe

Is there an equivalent of map2mab in mORMot2?
Using one from mORMot1 seems to generate mab file and embed it but doesn't give detailed results (stack traces for exceptions) in logs as it does if .map file is present in application dir.

Offline

#2 2023-09-05 10:08:45

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

Re: Embed mab file in exe

Offline

#3 2023-09-05 12:27:08

Márcio Baroni
Member
From: Brasil
Registered: 2015-10-07
Posts: 28

Re: Embed mab file in exe

ab, I think there is a problem..

at line 3134 GenerateFromMapOrDbg(DebugToConsole); unit mormot.core.log is getting infinite loop
I'm passing the executable path.

1

Offline

#4 2023-09-05 13:12:12

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

Re: Embed mab file in exe

You are passing the executable name as map file name.
It should not work for sure.

This would be now properly detected
https://github.com/synopse/mORMot2/commit/3f985b32

Offline

#5 2023-09-05 13:42:18

Márcio Baroni
Member
From: Brasil
Registered: 2015-10-07
Posts: 28

Re: Embed mab file in exe

ab, I'm passing the exe path as a parameter to embed the ".map" in the ".exe"

ex: mab.exe "c:\test.exe"

there is the "test.map" inside the same folder...

this doesn't work anymore, in mormot1 I used it that way.

actually passed the exe path as a parameter, it tries to read the exe as a map.

I made an adjustment on line 3123:

    begin
      ExeFile := ChangeFileExt(ExpandFileName(aExeName), '.exe');
      fDebugFile := ChangeFileExt(ExpandFileName(aExeName), '.map');
    end;

Offline

#6 2023-09-05 15:02:38

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

Re: Embed mab file in exe

Your change breaks the function if you supply an exe with an embedded mab content, I am afraid.

The behavior changed in mORMot 2 because we now support FPC dwarf information, which may be embedded within the executable, not as .map external file.

Perhaps https://github.com/synopse/mORMot2/commit/f6bef24d is a better option.

Offline

#7 2023-09-05 18:16:52

Márcio Baroni
Member
From: Brasil
Registered: 2015-10-07
Posts: 28

Re: Embed mab file in exe

thanks

Offline

#8 2023-09-12 14:52:45

igors233
Member
Registered: 2012-09-10
Posts: 234

Re: Embed mab file in exe

I've tried new mab.exe file and it does embed map info in the exe and give details for the exception.

In case of exception when map file is present, log includes details about unit name and line number but that's missing in case of embeded mab file, it only gives name of procedures.

Same happens if only mab file is present (not embedded), so I guess mab info doesn't include that level of details, is there an option to include it or that's as far as it can go?

Offline

Board footer

Powered by FluxBB