diff --git a/debugger/framestack/framestackmodel.h b/debugger/framestack/framestackmodel.h --- a/debugger/framestack/framestackmodel.h +++ b/debugger/framestack/framestackmodel.h @@ -85,6 +85,8 @@ void fetchMoreFrames() override; + void setCrashedThreadIndex(int index); + private Q_SLOTS: void stateChanged(KDevelop::IDebugSession::DebuggerState state); @@ -94,6 +96,8 @@ void update(); QModelIndex indexForThreadNumber(int threadNumber); + int m_crashedThreadIndex; + int m_currentThread; int m_currentFrame; // used to count how often a user has scrolled down and more frames needed to be fetched; diff --git a/debugger/framestack/framestackmodel.cpp b/debugger/framestack/framestackmodel.cpp --- a/debugger/framestack/framestackmodel.cpp +++ b/debugger/framestack/framestackmodel.cpp @@ -40,6 +40,7 @@ , m_currentFrame(-1) , m_subsequentFrameFetchOperations(0) , m_updateCurrentFrameOnNextFetch(false) + , m_crashedThreadIndex(-1) { connect(session, &IDebugSession::stateChanged, this, &FrameStackModel::stateChanged); } @@ -142,10 +143,15 @@ //thread if (m_threads.count() <= index.row()) return QVariant(); const ThreadItem &thread = m_threads.at(index.row()); + if (index.column() == 0) { if (role == Qt::DisplayRole) { return i18nc("#thread-id at function-name or address", "#%1 at %2", thread.nr, thread.name); } + else if (role == Qt::TextColorRole) { + if ( thread.nr == m_crashedThreadIndex) + return QColor(Qt::red); + } } } else { //frame @@ -263,6 +269,10 @@ setCurrentThread(m_threads[index.row()].nr); } +void FrameStackModel::setCrashedThreadIndex(int index) +{ + m_crashedThreadIndex = index; +} int FrameStackModel::currentThread() const { diff --git a/debugger/framestack/framestackwidget.cpp b/debugger/framestack/framestackwidget.cpp --- a/debugger/framestack/framestackwidget.cpp +++ b/debugger/framestack/framestackwidget.cpp @@ -169,6 +169,8 @@ m_threadsWidget->setVisible(model->rowCount() > 1); m_frames->setRootIndex(idx); m_frames->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); + + idx.data(Qt::TextColorRole); } else { m_threadsWidget->hide(); m_threads->selectionModel()->clear();