Ok, I found the bug. the sample code is:
void foo(int arg1, int arg2)
{
arg1(
}
you enter the "(" here, and finally, it will call ShowCallTip() function
it seems there are something wrong in this function call (nativeparser.cpp line 1874)
else
{
wxString s;
wxString full;
if(!PrettyPrintToken(full, *token, *tokens))
full = wxT("Error while pretty printing token!");
BreakUpInLines(s, full, chars_per_line);
m_CallTips.Add(s);
}
the *token is actually "arg1", see:
> p *token
$2 = {
<BlockAllocated<Token, 50000u, false>> = {
static allocator = {
allocBlocks = std::vector of length 1, capacity 1 = {0xdaa0020},
first = 0xdb565a0,
ref_count = 0,
max_refs = 0,
total_refs = 0
}
},
members of Token:
m_Type = "int",
m_ActualType = "int",
m_Name = "arg1",
m_Args = "",
m_BaseArgs = "",
m_AncestorsString = "",
m_TemplateArgument = "",
m_FileIdx = 6,
m_Line = 10,
m_ImplFileIdx = 0,
m_ImplLine = 0,
m_ImplLineStart = 0,
m_ImplLineEnd = 0,
m_Scope = tsUndefined,
m_TokenKind = tkVariable,
m_IsOperator = false,
m_IsLocal = false,
m_IsTemp = true,
m_IsConst = false,
m_ParentIndex = 429,
m_Children = std::set with 0 elements,
m_Ancestors = std::set with 0 elements,
m_DirectAncestors = std::set with 0 elements,
m_Descendants = std::set with 0 elements,
m_Aliases = 0 count of wxArrayString,
m_TemplateType = 0 count of wxArrayString,
m_TemplateMap = std::map with 0 elements,
m_TemplateAlias = "",
m_UserData = 0x0,
m_TokensTree = 0x6939f30,
m_Self = 3111,
m_Ticket = 3383
}
But after running this function, the string "full" is below:
> p full
$3 = "void foo(int arg1, int arg2)"
>>>>>>cb_gdb:
So, my guess is there is something wrong with "PrettyPrintToken try to print arg1".