@Josh,
Thank you for the suggestion. I tried it, made no difference. Definitely was worth a shot.
The big question is, can it be reproduced, with a freshly started IDE? I.e, is it always reproducible?
At least the answer to that is definitive and it is a definite _yes_, always reproducible and, in the particular case I'm going to describe, the behavior is always exactly the same. I will refer to the attached screenshots.
Step 1. the first screenshot, ProcJump_00 shows exactly what I'm doing. Right click on "OutputSegments" and select the first menu option "Find Declaration of ..."
The second screenshot, ProcJump_01, shows where I land. It also shows there is a codetools error. I followed your suggestion, I added some junk on line 4335 (the line above where codetools complains about an error), recompiled, got an (expected) error from FPC, removed the junk to cause the error to go away, recompiled, no FPC errors, attempted "step 1." again and landed exactly in the same place.
The third screenshot, shows
where I landed where I started from and where I should have landed. It shows the two places are more than a thousand lines apart.
I performed the test multiple times, some times with a freshly started IDE and a freshly and successfully recompiled program. The result was _exactly_ the same. codetools gave the same error and jumped to the same place. This problem is as repeatable as repeatable gets: exactly the same way, nothing changes.
One interesting thing, refer to the ProcJump_01 screenshot. Attempting to go where "LABEL_CONVERT" is defined/declared works as expected and interestingly enough, hovering over that identifier results in a little yellow popup showing information about it. OTH, hovering over "ZYDIS_INSTRUCTION_ENCODING_XOP" (or any of those) does not show a popup window and attempting to go to where the identifier is declared causes the caret to jump back to line 4336. It always jumps to that line, that's also always repeatable.
Also, when it happens, check the "messages window" => is there a message from codetools, claiming there is an error in the source ? (even if the source is fine).
Yes, the ProcJump_01 screenshot shows the error.
If codetool believes there is an error in that source, then it may jump there (there is a setting to turn that off, but then it will just print the error and do nothing else).
And if codetool believes there is an error, it may not be able to provide the hint either.
That's exactly what is happening.
If that is the case, the workaround (without restarting the IDE) is:
Edit the code one or two lines above the claimed error, and introduce a real error there. Attempt to "Jump to declaration" from the word after the edit you done. (will fail). Undo the edit, and do the "jump to declaration" from the word after the edit again.
After that codetool should be fine again.
Tried that more than once, it did _not_ make the problem go away.
If that is the issue that you have
- It is really old, and so far evaded any attempt of locating it.
- If you have a case that can always reproduce it => great. (include your IDE config, just in case).
It definitely sounds like the issue I am experiencing. As far as IDE config, what files would you like me to include ?
Just for completeness I was going to check how v3.2 behaved. When I first started v3.2 the second editor window was in the wrong place and with the wrong dimensions, I moved the editor window and resized it. Once that done, I quit for it to save the settings and restarted it. To my surprise all source editor windows (both of them) were gone. No editor windows. I selected "View->Source Editor" and got what you see in screenshot ProcJump_04_lv32 (lv32 = Lazarus v3.2). That was a surprise and now that's all I get. I can quit and restart Lazarus and I get NO editor window until I "View->Source Editor" and then I get that blank window. That's repeatable too but, I don't know if the original cause is repeatable because I cannot repeat that part.
NOTE: I just noticed that I skipped number "02". IOW, there is no "ProcJump_02".
Also, with v3.2, if I open a different project then I get the "Source Editor" window as expected but, when I re-open that project, the editor window is gone again until I do "View->Source Editor" and get a blank (no text) window. Fortunately, that problem does _not_ exist in v3.99. V3.99 shows both editor windows correctly.