Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Debuggergdb.cpp redundant code
AndrewCot:
In src\plugins\contrib-wip\debuggerGDB_MI\debuggergdb.cpp the OnTimer function is:
--- Code: ---void DebuggerGDB::OnTimer(cb_unused wxTimerEvent& event)
{
// send any buffered (previous) output
ParseOutput(wxEmptyString);
CheckIfConsoleIsClosed();
wxWakeUpIdle();
}
--- End code ---
The ParseOutput function is:
--- Code: ---void DebuggerGDB::ParseOutput(const wxString& output)
{
if (!output.IsEmpty() && m_State.HasDriver())
{
m_State.GetDriver()->ParseOutput(output);
}
}
--- End code ---
So my conclusion is that the OnTimer line
--- Code: ---ParseOutput(wxEmptyString);
--- End code ---
is redundant. Have I missed something?
ollydbg:
From my point of view, you are correct.
Pecan:
That's just one of those laughable moments that make me think: "I hope I didn't do that!"
AndrewCot:
Another code snippet to check out, but this one will not slow things down as much as the previous one:
--- Code: --- 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));
--- End code ---
Check the first line and then ask yourself why the last line is not
--- Code: ---cmd->ParseOutput(buffer);
--- End code ---
ollydbg:
--- 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:
--- Code: --- 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));
--- End code ---
Check the first line and then ask yourself why the last line is not
--- Code: ---cmd->ParseOutput(buffer);
--- End code ---
--- End quote ---
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?
Navigation
[0] Message Index
[#] Next page
Go to full version