[fpc-devel]Issues with GDB on Mac OS X with mixed case file names

Florian Klaempfl F.Klaempfl at gmx.de
Thu Aug 26 15:45:54 CEST 2004


Dr. Rolf Jansen wrote:

> The following smal pascal program is stored in file named 
> TestProgram.pas in the current working directory.
> 
> program TestProgamm;
>    var
>       i : Integer;
> 
> begin
>    for i := 1 to 5 do
>       writeln('Test');
> end.
> 
> 
> It compiles successfully with:
> 
>   fpc -g TestProgram.pas
> 
> An object file named TestProgram.o and an executable named TestProgram 
> is produced in the cwd.
> 
> Invoking GDB with
> 
>   gdb TestProgram
> 
> yields:
> 
> GNU gdb 5.3-20030128 (Apple version gdb-330.1) (Fri Jul 16 21:42:28 GMT 
> 2004) ...BLAH...BLAH...
> (gdb)
> 
> That is fine so far. But here is the issue:
> 
>     (gdb) break TestProgram.pas:6
> 
> gives the error message:
> 
>     No source file named TestProgram.pas.
> 
> while
> 
>     (gdb) break testprogram.pas:6
> 
> gives the success confirmation:
> 
>     Breakpoint 1 at 0x1fc08: file testprogram.pas, line 6.
> 
> 
> (gdb) run
> Starting program: 
> /Users/Rolf/Programmieren/Xcode/Pascal/TestProgram/TestProgram
> Reading symbols for shared libraries . done
> 
> Breakpoint 1, P$TESTPROGAMM_main () at testprogram.pas:6
> 6          for i := 1 to 5 do
> 
> 
> This is not a really big issue when using GDB from the command line. I 
> simply have to remember to input the filenames in lower case letters for 
> setting breakpoints.
> 
> However, setting breakpoints that do work by the way of Xcodes GUI is 
> not possible, because Xcode insists on using the original mixed case 
> file name. I searched for hours to no avail to tell either Xcode to use 
> lower case letters or to say GDB to ignore the case ("set case-sensitive 
> off" in GDB does NOT do the trick).
> 
> The lowercase filename comes into the .stabs of the TestProgram due to 
> the routine TGNUAssembler.WriteFileLineInfo of aggas.pas at line 237 of 
> the fpc compiler. If I change that line from:
> 
>    AsmWriteLn(#9'.stabs "'+lower(FixFileName(infile.name^))+'",'+
> 
> to
> 
>    AsmWriteLn(#9'.stabs "'+FixFileName(infile.name^)+'",'+
> 
> and compile fpc first and then again my TestProgram, then GDB happily 
> accepts the mixed case file name for seting breakpoints, and all the 
> features of Xcode can be used to source level debug fpc programs.
> 
> So, PLEASE, PLEASE, PLEASE, can someone change line 237 in aggas.pas as 
> indicated. It would be OK, to make the change conditional for the target 
> Darwin.
> 
> Just for my curiosity, how does this work with case sensitive 
> filesystems. My understanding of what´s going on tells me that setting 
> breakpoints in mixed case files e.g. in Linux does´t work even when 
> using lower case letters for the breakpoint, as long as line 237 of 
> aggas.pas is not changed.
> 
> Best regards
> 

We simply decided for fpc that on case sensitive systems, all source 
names should be lower case else you get case sensitiveness into the 
pascal language when working with units.

MyUnit.pas:
unit MyUnit;
...
end.

test.pas:
uses
   MyUnit; <--- case sensitive identifier in pascal; myunit wouldn't be 
found and being case sensitive here would cause a lot of trouble.





More information about the fpc-devel mailing list