Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Macro expansion infinite loop.
ollydbg:
--- Quote from: oBFusCATed on March 03, 2015, 11:28:28 pm ---Any progress with this branch?
Do you plan committing fixes any time soon?
--- End quote ---
This is a big change, but I don't have much time to test this branch, sorry, so I think it won't happen soon.
oBFusCATed:
I'm testing it every day. For me it is better than the old infinite-loop version.
MortenMacFly:
--- Quote from: oBFusCATed on March 05, 2015, 01:15:20 am ---I'm testing it every day. For me it is better than the old infinite-loop version.
--- End quote ---
Same for me until the changes in trunk were no longer compatible with the branch.
A rebase and merge would help to continue testing. However, what I noticed was that many methods of base classes were missing. That's what the wx replacements were for, for example.
Huki:
--- Quote from: ollydbg on January 23, 2015, 03:16:19 pm ---I see infinite loop too. :(
Bug located. Patch here:
--- Code: --- src/plugins/codecompletion/parser/tokenizer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/plugins/codecompletion/parser/tokenizer.cpp b/src/plugins/codecompletion/parser/tokenizer.cpp
index 764bcbe..6202eda 100644
--- a/src/plugins/codecompletion/parser/tokenizer.cpp
+++ b/src/plugins/codecompletion/parser/tokenizer.cpp
@@ -1794,6 +1794,10 @@ bool Tokenizer::ReplaceBufferText(const wxString& target)
m_TokenIndex = m_BufferLen - m_FirstRemainingLength;
m_PeekAvailable = false;
SkipToEOL(false);
+ SkipToOneOfChars(_T(",;}"), true, false, false);
+ m_SavedTokenIndex = m_UndoTokenIndex = m_TokenIndex;
+ m_SavedLineNumber = m_UndoLineNumber = m_LineNumber;
+ m_SavedNestingLevel = m_UndoNestLevel = m_NestLevel;
return false;
}
else
--- End code ---
It is a workaround patch and will cause parsing the Test class body wrongly, you will notice one extra member in the symbol tree :). But it works around a bug that macro replacement cause infinite loop when parsing. The fundamental solution is to ONLY do macro replacement in the Tokenizer level. (We currently do in both ParserThread and Tokenizer).
--- End quote ---
From this patch I see the bug is due to incorrect handling when the expansion limit (s_MaxRepeatReplaceCount) is reached. I remember we added this commit in r9933 (see diff):
--- Quote ---CC: disable the sanity check when expanding the macro usage, this try to work around an issue reported here: http://forums.codeblocks.org/index.php/topic,19661.msg134291.html#msg134291. We still have a expansion limit to avoid the infinite loop.
--- End quote ---
See the bolded part in the above quote. Our commit removed the sanity check, so we depend on the expansion limit handling to avoid infinite loop. But we now know the expansion limit is not handled properly and needed to be hacked (by ollydbg's patch) when it's reached. Can someone confirm whether reverting commit 9933 (i.e., adding back the sanity check) solves the issue?
oBFusCATed:
You can try it yourself, I've posted a minimal project that reproduces the problem.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version