Internal linker corrupts object stab information when main program is compiled for dwarf.
Original Reporter info from Mantis: ludob
-
Reporter name: Ludo Brands
Original Reporter info from Mantis: ludob
- Reporter name: Ludo Brands
Description:
When compiling a program with -gw2, stab information in linked in .o objects is lacking the necessary information to build the full path of the source file. Debuggers or other tools using debug info aren't able to find the source file.
Using the external linker the problem does not occur.
Comparing stab information it appears that the linker removes N_SourceFile stab information and issues only N_IncludeFile stab info omitting the base directory.
Steps to reproduce:
Attached a small testcase. Put project1.pas and project2.pas in the same dir. Unit1.pas and unit2.inc in a completely different location.
fpc.exe -B -gs -gl -FuPathToUnits project1.pas
With GDB check "info func TEST". Test and Test2 are found in sources
fpc.exe -gw2 -gl -FuPathToUnits project2.pas
With GDB check "info func TEST". Test and Test2 are found but no sources
fpc.exe -gw2 -gl -s -a -FuPathToUnits project2.pas
ppas.bat
With GDB check "info func TEST". Test and Test2 are found in sources
Additional information:
Since recent lazarus trunk defaults now to dwarf, the issue pops up frequently when using RTL or LCL with stab debug info or when linking with gcc compiled objects or libraries (stabs is also default for gcc on windows).
Mantis conversion info:
- Mantis ID: 20344
- OS: Windows
- OS Build: XP
- Build: 18901
- Platform: i386
- Version: 2.7.1
- Monitored by: » BigChimp (Reinier Olislagers), » Cyrax (Cyrax)