Index: finddeclarationtool.pas
===================================================================
--- finddeclarationtool.pas	(revision 13143)
+++ finddeclarationtool.pas	(working copy)
@@ -53,21 +53,21 @@
 { $DEFINE MEM_CHECK}
 
 // verbosity
-{ $DEFINE CTDEBUG}
-{ $DEFINE ShowTriedFiles}
-{ $DEFINE ShowTriedContexts}
-{ $DEFINE ShowTriedBaseContexts}
-{ $DEFINE ShowTriedParentContexts}
-{ $DEFINE ShowTriedIdentifiers}
-{ $DEFINE ShowTriedUnits}
-{ $DEFINE ShowExprEval}
-{ $DEFINE ShowFoundIdentifier}
-{ $DEFINE ShowInterfaceCache}
-{ $DEFINE ShowNodeCache}
-{ $DEFINE ShowBaseTypeCache}
-{ $DEFINE ShowCacheDependencies}
-{ $DEFINE ShowCollect}
-{ $DEFINE ShowProcSearch}
+{$DEFINE CTDEBUG}
+{$DEFINE ShowTriedFiles}
+{$DEFINE ShowTriedContexts}
+{$DEFINE ShowTriedBaseContexts}
+{$DEFINE ShowTriedParentContexts}
+{$DEFINE ShowTriedIdentifiers}
+{$DEFINE ShowTriedUnits}
+{$DEFINE ShowExprEval}
+{$DEFINE ShowFoundIdentifier}
+{$DEFINE ShowInterfaceCache}
+{$DEFINE ShowNodeCache}
+{$DEFINE ShowBaseTypeCache}
+{$DEFINE ShowCacheDependencies}
+{$DEFINE ShowCollect}
+{$DEFINE ShowProcSearch}
 
 {$IFDEF CTDEBUG}{$DEFINE DebugPrefix}{$ENDIF}
 {$IFDEF ShowTriedIdentifiers}{$DEFINE DebugPrefix}{$ENDIF}
@@ -1737,6 +1737,7 @@
   {$IFDEF ShowTriedFiles}
   DebugLn('TFindDeclarationTool.FindUnitSource A AnUnitName="',AnUnitName,'" AnUnitInFilename="',AnUnitInFilename,'" Self="',MainFilename,'"');
   {$ENDIF}
+DebugLn('TFindDeclarationTool.FindUnitSource A AnUnitName="'+AnUnitName+'" AnUnitInFilename="'+AnUnitInFilename+'" Self="'+MainFilename+'"');
   Result:=nil;
   if (AnUnitName='') or (Scanner=nil) or (Scanner.MainCode=nil)
   or (not (TObject(Scanner.MainCode) is TCodeBuffer))
@@ -1748,8 +1749,11 @@
   
   NewUnitName:=AnUnitName;
   NewInFilename:=AnUnitInFilename;
+DebugLn('FindUnitSourceInCompletePath:NewUnitName=[%s],NewInFilename=[%s]',[NewUnitName,NewInFilename]);
   AFilename:=DirectoryCache.FindUnitSourceInCompletePath(
                                                NewUnitName,NewInFilename,false);
+DebugLn('FindUnitSourceInCompletePath:Result=[%s]',[AFilename]);
+
   Result:=TCodeBuffer(Scanner.OnLoadSource(Self,AFilename,true));
 
   if (Result=nil) and Assigned(OnFindUsedUnit) then begin
@@ -1759,6 +1763,7 @@
   
   if Result=nil then begin
     // search .ppu
+DebugLn('Search PPU');
     NewCompiledUnitname:=AnUnitName+'.ppu';
     CompiledFilename:=DirectoryCache.FindCompiledUnitInCompletePath(
                                                      NewCompiledUnitname,false);
@@ -1766,6 +1771,8 @@
     CompiledFilename:='';
   end;
 
+DebugLn('Not found');
+
   if (Result=nil) and ExceptionOnNotFound then begin
     if CompiledFilename<>'' then begin
       // there is a compiled unit, only the source was not found
