View Issue Details

IDProjectCategoryView StatusLast Update
0020606LazarusIDEpublic2011-11-03 18:28
ReporterBart BroersmaAssigned ToMattias Gaertner 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWinMeOS VersionMS
Product Version0.9.31 (SVN)Product Build33190 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0020606: Codetool failure on "Find procedure"
DescriptionI just updated from 31810 to 33153, and now I have problems with codetools.

I use Find declaration (Ctrl+Click) to jump to a declaration, then I
use "Find procedure method" (Ctrl+Shiff+Down) to jump to the methods
implementation. All is fine.

Now I try to jump back to the procedure definition "Find procedure
definition" (Ctrl+Shift+Up), and I get an error:

H:\Programmas\SvnLaz\lcl\controls.pp(25,14) Error: cursor pos outside of code

(This exact errormsg results from Ctrl+Click on Button1.SetFocus -> Ctrl+Shift+Down -> Ctrl+Shift+Up)

The weird part is that this only happens to me on WinME.
The exact same revision on my Suse 10.0 (same machine) works perfectly fine.
On a Win7 laptop I also cannot reproduce the issue.
Steps To ReproduceOne TButton on a Form
In Button1Click one line of code:
  Button1.SetFocus

1. Ctrl+Click on SetFocus -> opens controls.pp @ procedure SetFocus (TWinControl)
2. Ctrl+Shift+Down on SetFocus -> opens wincontrol.inc @ TWinControl.SetFocus, with cursor on first line after "begin"
3. Ctrl+Click+Up: Error as described above
Additional Information1.
Sometimes, but not always, after step 2, the caret in the then opened file is not visible, and there is no resposn to Ctrl+Shift+Up. You must first click on the source, or switch between tabs to make the cursor visible.
If this is the case the errormsg changes to:

H:\Programmas\SvnLaz\lcl\controls.pp(-1,15) Error: cursor pos outside of code

(Note the cursorposition: -1,15)

2.
After step 2 in the opened wincontrol.inc Ctrl+Click no longer works, that is the words no longer get underlined and do not respond to clicks.

I finally was able to build the IDE with -dCTDEBUG (had to fix some errors though, see 0020605).

This would give me a > 700 K logfile, which I can post if needed.

Here's an excerpt from it:

SetPrimaryConfigPath NewValue="H:\Programmas\SvnLaz" -> "H:\Programmas\SvnLaz"
Adding "--pcp=H:\Programmas\SvnLaz" as a parameter
Adding "--debug-log=H:\Programmas\SvnLaz\Lazarus.log" as a parameter
9
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=F:\LazarusProjecten\u_test.pp
[TCodeToolManager.OnGetCodeToolForBuffer]
  Sender=F:\LazarusProjecten\u_test.pp
[TCodeToolManager.OnGetCodeToolForBuffer]
  Sender=F:\LazarusProjecten\u_test.pp
[TCodeToolManager.OnGetCodeToolForBuffer]
  Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
  TCodeToolManager.FindDeclaration H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp(y=2003,x=15)
  TCodeToolManager.FindDeclaration A F:\LazarusProjecten\u_test.pp x=14 y=39
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\stdctrls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\PROGRAMMAS\SVNLAZ\lcl\lclclasses.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
[TCodeToolManager.OnGetCodeToolForBuffer] Sender=H:\Programmas\fpc\Source\rtl\win32\classes.pp
  TCodeToolManager.FindDeclaration H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp(y=2003,x=15)
  ### TCodeToolManager.HandleException: "cursor pos outside of code" at Line=25 Col=14 in "H:\Programmas\SvnLaz\lcl\controls.pp"
    Unit() Start=1411 "unit " End=1700 "}" Self=0A4577CC P=00000000 NB=0A457D6C Interface Section() Start=1700 "inter" End=112518 "" Self=0A457D6C P=00000000 NB=0B85008C
    
<follows 700 K line (witn no lineendings) like:
    Uses Section() Start=1762 "uses" End=1977 "rces;" Self=0B68AE70 P=0A457D6C NB=0B68AAB0
    use unit() Start=1770 "Class" End=1777 "asses" Self=0ACCF3B8 P=0B68AE70 NB=0B68AED0
    use unit() Start=1779 "SysUt" End=1787 "Utils" Self=0B68AED0 P=0B68AE70 NB=0B68A990

Finally followed by: >

  TApplication.HandleException Division by zero
  Stack trace:
  $0064C31D RAISECATCHABLEEXCEPTION, line 358 of fileprocs.pas
  $0065D55F TLINKSCANNER__CONSISTENCYCHECK, line 1616 of linkscanner.pas
  $00657643 TCODEBUFFER__CONSISTENCYCHECK, line 1252 of codecache.pas
  $006565E1 TCODECACHE__CONSISTENCYCHECK, line 931 of codecache.pas
  $0069C9E1 TCODETOOLMANAGER__WRITEDEBUGREPORT, line 5761 of codetoolmanager.pas
  $00691906 TCODETOOLMANAGER__WRITEERROR, line 1782 of codetoolmanager.pas
  $00691719 TCODETOOLMANAGER__HANDLEEXCEPTION, line 1755 of codetoolmanager.pas
  $00691C38 TCODETOOLMANAGER__JUMPTOMETHOD, line 1846 of codetoolmanager.pas
  $00470A24 TMAINIDE__DOJUMPTOOTHERPROCEDURESECTION, line 15192 of main.pp
  $004475AC TMAINIDE__ONPROCESSIDECOMMAND, line 3286 of main.pp
  $007A6362 TSOURCENOTEBOOK__PROCESSPARENTCOMMAND, line 7058 of sourceeditor.pp
  $007995B2 TSOURCEEDITOR__PROCESSUSERCOMMAND, line 3122 of sourceeditor.pp
  $00902DEB TCUSTOMSYNEDIT__DOONPROCESSCOMMAND, line 6735 of synedit.pp
  $00900A82 TCUSTOMSYNEDIT__COMMANDPROCESSOR, line 6105 of synedit.pp
  $008F68E4 TCUSTOMSYNEDIT__KEYDOWN, line 2436 of synedit.pp
  $00571266 TWINCONTROL__KEYDOWNBEFOREINTERFACE, line 5498 of H:/PROGRAMMAS/SVNLAZ/lcl/include/wincontrol.inc
  $005714E4 TWINCONTROL__DOKEYDOWNBEFOREINTERFACE, line 5667 of H:/PROGRAMMAS/SVNLAZ/lcl/include/wincontrol.inc


Things I have tried:
- use a brand new clean profile: no change
- open a different project: no change

Using these feature (Find declaration/Find procedure method) in my own libs/programs (with or without include-files) does not trigger the issue.
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files
  • lazarus-codetools-log.zip (1,645 bytes)
  • lazarus-codetools-log2.zip (1,450 bytes)
  • directorycacher.diff (922 bytes)
    Index: components/codetools/directorycacher.pas
    ===================================================================
    --- components/codetools/directorycacher.pas	(revision 33255)
    +++ components/codetools/directorycacher.pas	(working copy)
    @@ -1598,7 +1598,7 @@
     
     function TCTDirectoryCachePool.FindDiskFilename(const Filename: string
       ): string;
    -{$IFDEF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
    +{$IF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
     var
       ADirectory: String;
       Cache: TCTDirectoryCache;
    @@ -1607,7 +1607,7 @@
     begin
       Result:=ChompPathDelim(TrimFilename(Filename));
       if Result='' then exit;
    -  {$IFDEF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
    +  {$IF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
       ADirectory:=ExtractFilePath(Result);
       if ADirectory=Result then
         exit; // e.g. / under Linux
    
    directorycacher.diff (922 bytes)
  • lazarus-codetools-log3.zip (1,457 bytes)

Activities

Bart Broersma

2011-11-01 13:40

developer   ~0053716

I can make this error go away, but only it seems for one session if I do the following.
In environmentoptions.xml change this:

    <LazarusDirectory Value="H:\PROGRAMMAS\SVNLAZ">
      <History Count="1">
        <Item1 Value="H:\Programmas\SvnLaz\"/>
      </History>

into:

    <LazarusDirectory Value="H:\Programmas\SvnLaz">
      <History Count="1">
        <Item1 Value="H:\Programmas\SvnLaz\"/>
      </History>

The latter form is how the directory actually is named on disk.
Lazarus itself seems to change it back to a capitalized name.

On my Suse (same machine) and a Win7 laptop the path to Lazarus dir is in all lowercase.

On my Win7 I have Lazarus (r33199) installed in
C:\devel\lazarus

Now I have renamed that folder to
C:\devel\Lazarus (note the capital L)

This should on Windows not make any difference at all.
Now the same error can be reproduce on my Win7 laptop too.

Mattias Gaertner

2011-11-01 21:00

manager   ~0053726

Thanks. Other users has also seen similar things, but were not able reproduce it or didn't give much information.
The change of LazarusDirectory case can mean that there might be a place where a file name is not searched/compared case insensitive under Windows.
Please backup your lazarus.exe and do the following:

*Compile a new IDE with -dVerboseUpdateNeeded.
*Start the IDE with --debug-log=log.txt
*Reproduce the error Button1.SetFocus, Ctrl+Click, Ctrl+Shift+Down, Ctrl+Shift+Up.
*Quit IDE

Attach the log.txt zipped to the bug report.

2011-11-02 13:10

 

lazarus-codetools-log.zip (1,645 bytes)

Bart Broersma

2011-11-02 13:16

developer   ~0053744

I attached the log.
I've tried to format the text (it was mostly one long line without linebreaks), hope that's OK with you.

For the record, normalized directories on my disk are:
- LazarusDir: H:\Programmas\SvnLaz
- FpcSourceDir: H:\Programmas\fpc\Source
- Current project dir: F:\LazarusProjecten\bugs\CodeTools
- Current projectsources: ct.lpi, ct.lpr, main.pp, main.lfm
I started out with only main.pp opened in SourceEditor

Mattias Gaertner

2011-11-02 14:53

manager   ~0053749

Thanks.
There are several suspicious things in the log.
Please test with svn revision 33219 and attach the log.

2011-11-02 16:22

 

lazarus-codetools-log2.zip (1,450 bytes)

Bart Broersma

2011-11-02 16:27

developer   ~0053751

I updated to r33219 and rebuilt.
The problem seems to have gone.

I even went as far as to change the LazarusDir filename on disk from
H:\Programmas\SvnLaz
into
H:\Programmas\SvnLaZ (capital Z on the end)

Then ran lazarus again.
Still all fine.

I attached new logfile, from the scenario with the changed directoryname.

I saw 1 suspicious item now:

TMainIDE.DoOpenEditorFile Fixing file case: H:\Programmas\SvnLaZ\lcl\controls.pp -> H:\PROGRAMMAS\SVNLAZ\lcl\controls.pp

Mattias Gaertner

2011-11-02 17:54

manager   ~0053755

Please test with 33224.

2011-11-03 12:50

 

directorycacher.diff (922 bytes)
Index: components/codetools/directorycacher.pas
===================================================================
--- components/codetools/directorycacher.pas	(revision 33255)
+++ components/codetools/directorycacher.pas	(working copy)
@@ -1598,7 +1598,7 @@
 
 function TCTDirectoryCachePool.FindDiskFilename(const Filename: string
   ): string;
-{$IFDEF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
+{$IF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
 var
   ADirectory: String;
   Cache: TCTDirectoryCache;
@@ -1607,7 +1607,7 @@
 begin
   Result:=ChompPathDelim(TrimFilename(Filename));
   if Result='' then exit;
-  {$IFDEF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
+  {$IF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}
   ADirectory:=ExtractFilePath(Result);
   if ADirectory=Result then
     exit; // e.g. / under Linux
directorycacher.diff (922 bytes)

2011-11-03 12:50

 

lazarus-codetools-log3.zip (1,457 bytes)

Bart Broersma

2011-11-03 12:56

developer   ~0053768

I tested with 33224.

It behaved fine (no erros with jumping), but in the log I saw all references to H:\Programmas\SvnLaz\SomeFile being uppercased to H:\PROGRAMMAS\SVNLAZ\SomeFile

I noticed what seemed to be a typo in directorycaher.pas:

function TCTDirectoryCachePool.FindDiskFilename(const Filename: string): string;
{$IFDEF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}

I changed that into

{$IF defined(NotLiteralFilenames) or defined(CaseInsensitiveFilenames)}

Now I rebuild and in the log all filenames were now as on disk (see attached log3).

A also attached a patch for direcorycacher.pas.

Mattias Gaertner

2011-11-03 13:28

manager   ~0053772

Thanks for testing.
You are right about the IFDEF. I changed it in svn.

Bart Broersma

2011-11-03 18:28

developer   ~0053782

Fixed. Thanks.

Issue History

Date Modified Username Field Change
2011-11-01 12:31 Bart Broersma New Issue
2011-11-01 12:31 Bart Broersma LazTarget => -
2011-11-01 12:48 Bart Broersma Description Updated
2011-11-01 12:48 Bart Broersma Additional Information Updated
2011-11-01 12:49 Bart Broersma Product Version 0.9.30.1 (SVN) => 0.9.31 (SVN)
2011-11-01 13:40 Bart Broersma Note Added: 0053716
2011-11-01 21:00 Mattias Gaertner Note Added: 0053726
2011-11-01 21:15 Mattias Gaertner Status new => assigned
2011-11-01 21:15 Mattias Gaertner Assigned To => Mattias Gaertner
2011-11-02 09:51 Mattias Gaertner Status assigned => feedback
2011-11-02 13:10 Bart Broersma File Added: lazarus-codetools-log.zip
2011-11-02 13:16 Bart Broersma Note Added: 0053744
2011-11-02 14:53 Mattias Gaertner Note Added: 0053749
2011-11-02 16:22 Bart Broersma File Added: lazarus-codetools-log2.zip
2011-11-02 16:27 Bart Broersma Note Added: 0053751
2011-11-02 17:54 Mattias Gaertner Note Added: 0053755
2011-11-03 12:50 Bart Broersma File Added: directorycacher.diff
2011-11-03 12:50 Bart Broersma File Added: lazarus-codetools-log3.zip
2011-11-03 12:56 Bart Broersma Note Added: 0053768
2011-11-03 13:28 Mattias Gaertner Note Added: 0053772
2011-11-03 13:28 Mattias Gaertner Status feedback => resolved
2011-11-03 13:28 Mattias Gaertner Resolution open => fixed
2011-11-03 18:28 Bart Broersma Status resolved => closed
2011-11-03 18:28 Bart Broersma Note Added: 0053782
2011-11-03 18:28 Bart Broersma Fixed in Version => 0.9.31 (SVN)