In src\plugins\contrib-wip\debuggerGDB_MI\debuggergdb.cpp the OnTimer function is:void DebuggerGDB::OnTimer(cb_unused wxTimerEvent& event)
{
// send any buffered (previous) output
ParseOutput(wxEmptyString);
CheckIfConsoleIsClosed();
wxWakeUpIdle();
}
The ParseOutput function is:
void DebuggerGDB::ParseOutput(const wxString& output)
{
if (!output.IsEmpty() && m_State.HasDriver())
{
m_State.GetDriver()->ParseOutput(output);
}
}
So my conclusion is that the OnTimer line ParseOutput(wxEmptyString); is redundant. Have I missed something?
From my point of view, you are correct.
That's just one of those laughable moments that make me think: "I hope I didn't do that!"
Another code snippet to check out, but this one will not slow things down as much as the previous one:
buffer.Remove(idx);
// remove the '>>>>>>' part of the prompt (or whats left of it)
int cnt = 6; // max 6 '>'
while (!buffer.empty() && buffer.Last() == _T('>') && cnt--)
buffer.RemoveLast();
if (!buffer.empty() && buffer.Last() == _T('\n'))
buffer.RemoveLast();
cmd->ParseOutput(buffer.Left(idx));
Check the first line and then ask yourself why the last line is not cmd->ParseOutput(buffer);
Quote from: AndrewCot on March 19, 2022, 06:58:45 AM
Another code snippet to check out, but this one will not slow things down as much as the previous one:
buffer.Remove(idx);
// remove the '>>>>>>' part of the prompt (or whats left of it)
int cnt = 6; // max 6 '>'
while (!buffer.empty() && buffer.Last() == _T('>') && cnt--)
buffer.RemoveLast();
if (!buffer.empty() && buffer.Last() == _T('\n'))
buffer.RemoveLast();
cmd->ParseOutput(buffer.Left(idx));
Check the first line and then ask yourself why the last line is not cmd->ParseOutput(buffer);
The first line is: Removes all characters from the string starting at idx, but it just returned the modified buffer, so the buffer is not changed. Right?
The last line is: Removes all the characters after the idx, and pass to the ParseOutput function.
So, the first line did nothing?
The buffer.Remove(idx); removes the characters in the buffer, so it removed from the idx offset to the end.
The RemoveLast calls remove the '>' if they are there.
So the last line calling with only the Left idx characters is redundant as the first line removed the characters after idx.
Quote from: AndrewCot on March 20, 2022, 01:59:56 AM
The buffer.Remove(idx); removes the characters in the buffer, so it removed from the idx offset to the end.
The RemoveLast calls remove the '>' if they are there.
So the last line calling with only the Left idx characters is redundant as the first line removed the characters after idx.
OK, you are correct!