Using QApplication::processEvents
Vladimir Prus
ghost at cs.msu.su
Tue May 2 17:06:06 UTC 2006
Hello!
At the moment, the debugger code works like this:
- A command is sent to gdb
- When response arrives back, the slot that does the parsing is
called
- Callback specified when sending the command is called
Using callbacks for all commands makes the overall control flow a little bit
tricky, so I was thinking if the following approach is feasible:
GDBMI::ResultRecord* result = 0;
GDBMI::ResultRecord* send_command(QString& command)
{
// send the command
while(result == 0)
QApplication::processEvents();
return result;
}
The output of gdb will still be forwarded to a slot that will do the parsing
and set the 'result' variable. With this arrangement, the rest of debugger
code will be written is a simple imperative style, without any callbacks
whatsoever.
Are there any downsides to this approach? The one I see is that it's only
possible to use this trick only once in entire program -- if there are two
such places one will never get a chance to execute. But I'm not sure if
that's the case with KDevelop? Any other drawbacks?
- Volodya
More information about the KDevelop-devel
mailing list