You are not logged in.
Pages: 1
To compile the LoggingTest.dpr project with debug information and generate a .map file with the FPC, followed by executing the program, a .mab debug file will be created. The log file will display the source line number during the initial execution. However, upon running the program a second time, it loads the .mab file but does not include the line numbers in the log file. This suggests there may be an issue with the .mab file. I have traced the problem for some time but have not found anything conclusive; the following statement consistently returns -1:
u := debug.FindUnit(offset, Line)
Offline
Yeah, you're right! I tried it on Linux and it worked fine. The issue only popped up on my Windows 11.
But I'm curious, why did it work the first time I ran it?
Last edited by zen010101 (2025-01-30 11:56:45)
Offline
Supplementary Note:
The information I provided earlier was incorrect. Through today's testing, I found that whether on Windows or Linux, only the first run can obtain the program's line number information. As long as the .mab file is generated, in subsequent runs, the program will not be able to find the line number information as long as the .mab is loaded.
Offline
Wired.
Here is my environment:
OS: Windows 11
Compiler: Free Pascal Compiler version 3.2.3-1404-g57e84ef714 [2024/11/20] for aarch64
Target: Linux aarch64 (and Dwarf3 debug info)
Every time I delete the .mab file, I can see line number information in the Log.
How can I find some more useful information?
Offline
I finally know the reason. My FPC + Linux combination doesn't work is because:
The .mab file I generated relies on the .dbg file, and the SmartLink option is automatically disabled during its creation. However, after generating the .mab file and subsequently switching to Release Mode (which explicitly enables SmartLink), the previously created .mab file becomes invalid. This occurs even when using the -Xm compilation flag to generate the .map file – the map2mab tool appears incompatible with Free Pascal Compiler (FPC)-generated .map files, throwing an "Error: EInOutError Read past end of file" during processing.
The root cause has been identified - SmartLink optimization invalidates the .mab file. This leads to another question:
Could we make TDebugFile to extract line number and symbol information directly from FPC-generated .map files (created via the -Xm compilation flag)? or make map2mab work?
Offline
Pages: 1