[debugger] threaded apps

Stephan Diederich stephan.diederich at googlemail.com
Thu Nov 16 22:47:51 UTC 2006


Hi Volodya,

Kdevelop has the problem that multithreaded apps don't show a correct
callstack for each of the threads. Callstacks of threads after the
first show the callstack of the first. Worse,  information from
different threads is used (e.g. stack-depth) and applied to others.

It seems that
void FramestackWidget::getBacktraceForThread(int threadNo)
{
    unsigned currentThread = controller_->currentThread();
    if (viewedThread_)
    {
        // Switch to the target thread.
        controller_->addCommand(
            new GDBCommand(QString("-thread-select %1")
                           .arg(threadNo).ascii()));

        viewedThread_ = findThread(threadNo);
    }

    getBacktrace();

     if (viewedThread_)
     {
         // Switch back to the original thread.
         controller_->addCommand(
             new GDBCommand(QString("-thread-select %1")
                            .arg(currentThread).ascii()));
     }
}

is buggy.
Problem:
First the thread is switched to the one we want infos from. Then
getBacktrace is called, which queues another command
(-stack-info-depth). And returns immediately. After that
-thread-select is queued.
The actual command to get the backtrace is queued through the
completion handler of -stack-info-depth. But sadly after the above
method was left and after the thread was switched back to the initial
one.

Er, you know what I mean? ;)

HTH,
Stephan




More information about the KDevelop-devel mailing list