[fpc-devel]Issues with GDB on Mac OS X with mixed case file names
Dr. Rolf Jansen
InstantWare at t-online.de
Sat Aug 28 14:34:55 CEST 2004
Am 27.08.2004 um 22:57 schrieb Peter Vreman:
> At 16:43 26-8-2004, you wrote:
>> Am 26.08.2004 um 15:45 schrieb Florian Klaempfl:
>>
>>> Dr. Rolf Jansen wrote:
>>>
>>>> ...<SNIP>
>>>> 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
>
> Fixed, Thanks
Peter,
Many thanks for the fix. Unfortunately, I discovered too late, that
this enables GDB support on Mac OS X only for the main program file. In
unit files it still includes the lowercase filenames into the .stabs.
However, I found the problem and a possible solution. In globals.pas
there are three FindFile routines, namely: TSearchPathList.FindFile,
FindFile, and FindFilePchar.
All routines contain roughly the same code snippet:
{
Search order for case sensitive systems:
1. lowercase
2. NormalCase
3. UPPERCASE
None case sensitive only lowercase
}
FoundFile:=p.Str+Lower(f);
If FileExists(FoundFile) then
begin
FindFile:=true;
exit;
end;
{$ifdef UNIX}
FoundFile:=p.Str+f;
If FileExists(FoundFile) then
begin
FindFile:=true;
exit;
end;
FoundFile:=p.Str+Upper(f);
If FileExists(FoundFile) then
begin
FindFile:=true;
exit;
end;
{$endif UNIX}
On Mac OS X and on other none case sensitive file systems the sequence
exits always after the first search for the lowercase filename and it
returns this lowercase name which then makes its way into the .stab.
I suggest to change the search order as follows:
{
Search order for case sensitive systems:
1. NormalCase
2. lowercase
3. UPPERCASE
}
FoundFile:=p.Str+f;
If FileExists(FoundFile) then
begin
FindFile:=true;
exit;
end;
FoundFile:=p.Str+Lower(f);
If FileExists(FoundFile) then
begin
FindFile:=true;
exit;
end;
{$ifdef UNIX}
FoundFile:=p.Str+Upper(f);
If FileExists(FoundFile) then
begin
FindFile:=true;
exit;
end;
{$endif UNIX}
I changed it that way on my local copy, and now everything works really
fine. There should be also a little performance gain on case sensitive
file systems by this way, if lots of mixed case filenames are present.
Finally, I am unsure about the effects of the following at line 216 in
file assembler.pas in the routine TAssembler.Create
name:=Lower(current_module.modulename^);
For testing purposes I removed the Lower(), but it made no obvious
difference, so I switched it back to the line given above.
Best regards
Rolf
More information about the fpc-devel
mailing list