On 12/7/05, <b class="gmail_sendername">Alexander Neundorf</b> <<a href="mailto:neundorf@kde.org">neundorf@kde.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I'm sending this again with a better subject, maybe this way it draws more<br>attention :-)</blockquote><div><br>well done! <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tuesday 06 December 2005 17:58, Andreas Pakulat wrote:<br>> On 06.12.05 17:20:27, Tommaso Massimi wrote:<br>> > Hi all,<br>> ><br>> > a KDevelop's strange behavoiur (maybe a bug) is annoing me,<br>
> > so in the paste weeks I digged a bit about it.<br>> ><br>> > I found the fault already listed here,<br>> > <a href="http://bugs.kde.org/show_bug.cgi?id=113379">http://bugs.kde.org/show_bug.cgi?id=113379
</a><br>> > I added some details and a question about the source code<br>> > where I think the problems is, but I had no answer.<br>><br>> ?? What do you mean? Amilcar do Carmo Lucas added a comment.<br>
<br>He wasn't exactly very verbose ;-)<br><br>So this might be the reason too why closing a file is so slow in kdevelop ?<br><br>void ProblemReporter::closedFile(const KURL &fileName)<br>{<br>   QValueList<Problem> problems =
<br>m_cppSupport->backgroundParser()->problems( fileName.path() , true , true);<br>}<br><br>It seems this is done in order to remove the problems reported from this file<br>from the problem view if the file is closed.
<br>I just tried with the call to problems() commented out, the FIXME from the<br>closed file still disappears from the problem view. So this seems not to be<br>the reason.</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Anybody else knows why problems() is called there ?<br>Is it required at all ?<br>Would m_cppSupport->backgroundParser()->remove(fileName.path()); also do the<br>job ?</blockquote><div><br>finally I got the time to get a deeper look to the source code:
<br>
<br>
it seems that the BackgroundParser needs to be called because <br>
it is also in charge to manage some other stuff like m_manager;<br>
m_manager is an istance of the class KDevDriver which needs to be informed <br>
of the file closure events because is storing info about the macros found in the source file.<br>
<br>
This means that deleting that line doesn't seems to be the right way to go.<br>
<br>
In my opinion the best way to skip the trouble would be<br>to avoid to add wrong files to the background parser:<br>
<br>this is the function used to add a file to the list of files to be parsed:<br><br>void BackgroundParser::addFile( const QString& fileName, bool readFromDisk )<br>{<br>        QString fn = deepCopy( fileName );<br>
<br>        bool added = false;<br>        if ( !m_fileList->contains( fn ) )<br>        {<br>                m_fileList->push_back( fn, readFromDisk );<br>                added = true;<br>        }<br><br>        if ( added )
<br>                m_canParse.wakeAll();<br>}<br><br>It seems it is only checking for duplicate files <br>(I hope m_fileList->contains( fn ) doesn't implement strange behavoiur...).<br><br><br>before add a file it could be possible to implement some more checks like:
<br> <br>- file size: <br>probably a big file is not a source file: <br>my troubles are coming out when I check the .dmp file generated by objdump<br>(I'm developing an embedded application, <br>so quite often I have to check the assembler code stored in a big file)
<br>It could be possible to add some limit to the size of the file (1 MByte?).<br><br>- file type<br>why an assembler file needs to be checked by a cpp parser?<br>some others IDE are able to open  hex files too,<br>looking at this code it seems that Kdevelop is cpp-parsing each file
<br>is opened when a project is cpp based (NB: I could be wrong on this point). <br><br> Any comment from Kdevelop experts?<br><br></div>bye<br>Tom<br></div>