Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Debugging code completion plugin

<< < (2/4) > >>

Pecan:
ImageCraft Creations has found a quirk in cbProject::CalculateCommonTopLevelPath() that allows root to be set as the common top level path. This in turn causes CodeCompletion to always search the whole of the HD from root when "View: Current file's symbols" is set.
For each open file, this stalls CB for about 7 seconds.

An erroneously specified file, such as "..\..\..\..\iccv8cortex\include\CMSIS\core_cm3.h" where iccv8cortex is actually located at c:\iccv8cortex will cause the top level path to be set to C:\  

ImageCraft proposes the following fix:


--- Code: ---Index: src/sdk/cbproject.cpp
===================================================================
--- src/sdk/cbproject.cpp (revision 9271)
+++ src/sdk/cbproject.cpp (working copy)
@@ -364,6 +364,21 @@
             tmpbase << sep << tmp.Left(pos) << sep;
 
         wxFileName tmpbaseF(tmpbase); tmpbaseF.Normalize(wxPATH_NORM_DOTS);
+
+        // Avoid missing files causing mis-setting of common top level path
+        if (not wxFileExists(f->file.GetFullPath()))
+        {
+            Manager::Get()->GetLogManager()->Log(_T("Non-existent file: ") + f->relativeFilename);
+            continue;
+        }
+        // Don't allow root to be set as common top level search path
+        if ((tmpbaseF.GetFullPath().Mid(1).Lower() == _T(":\\"))
+            or (tmpbaseF.GetFullPath().Lower() == _T("/")))
+        {
+            Manager::Get()->GetLogManager()->Log(_T("Skipped setting root as CommonTopLevelPath from: ") + f->relativeFilename);
+            continue;
+        }
+
         if (   (tmpbaseF.GetDirCount() < base.GetDirCount())
             && (base.GetPath().StartsWith(tmpbaseF.GetPath())) )
         {

--- End code ---



ollydbg:
Hi, pecan, I have two questions:
1, if CC cause the hang/slowness issue, is it possible to fix in CC?
2, I don't find a way that in CC's symbol browser, "View: Current file's symbols" is set" will cause the hang issue, can you give me a hint (maybe call stack?)
Thanks.

Jenna:
If CC really causes the slowdown, than CC should be fixed.

I'm against silently dropping the root-folder as common toplevel path, if it is calculated correctly.

Why should the IDE fix a poor project layout, like e.g. cmake-projects can have, if they add cmake files from below /usr to the project, even if the user is not allowed to do anything with them.

Pecan:
Well, yes, it's a user layout problem that caused CC to scan all files from root.

But the user has no way to find or fix the problem without a message or warning. If we don't want to prevent CC scanning for symbols from root, can we put out the warning messages instead?

Ollydbg:
CC is doing just what it's supposed to do. It's just that when CC calls CalculateCommonTopLevelPath() when dbfFile is set AND the user has specified a project file like "..\..\..\..\iccv8cortex\include\CMSIS\core_cm3.h" where iccv8cortex is actually located at c:\iccv8cortex AND because that specification resolves to a file that actually exists, CC is handed back a top level path of "C:\".

CC wil then scan for all open file's symbols starting at root. It will scan c:\windows and all it subdirectories taking many seconds of time for each open file.

Thats why I called it a quirk, not a bug. But the user suffers....
because with many files, such as in FreeRTOS source, the problem is almost impossible to find.

I'll upload (somewhere) the source that causes this and get back to you.
 

Pecan:
To recreate the CC root scan quirk:

Download:
https://dl.dropboxusercontent.com/u/46870262/iccv8cortexCCRootScan.7z

Unpack and place the folder iccv8cortex at the root of drive c:\

Load the examples project:
c:\iccv8cortex\examples.cortex\examples.workspace

Alt-G to load tasks.c
Alt-G to load croutine.c

close workspace, then reload it.
CC will scan all of the hard disk starting at root C:\
 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version