forked from qt-creator/qt-creator
debugger: fix display of correct thread in the thread combobox
This commit is contained in:
@@ -1362,6 +1362,10 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
|
||||
if (!forced && !isAllowedTransition(oldState, state))
|
||||
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
|
||||
|
||||
const bool running = d->m_state == InferiorRunOk;
|
||||
if (running)
|
||||
threadsHandler()->notifyRunning();
|
||||
|
||||
showMessage(msg, LogDebug);
|
||||
plugin()->updateState(this);
|
||||
}
|
||||
|
||||
@@ -51,10 +51,11 @@
|
||||
#include "threadswindow.h"
|
||||
#include "watchwindow.h"
|
||||
|
||||
#include "watchutils.h"
|
||||
#include "breakhandler.h"
|
||||
#include "snapshothandler.h"
|
||||
#include "sessionengine.h"
|
||||
#include "snapshothandler.h"
|
||||
#include "threadshandler.h"
|
||||
#include "watchutils.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include "shared/peutils.h"
|
||||
@@ -2136,6 +2137,9 @@ void DebuggerPluginPrivate::setInitialState()
|
||||
|
||||
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
||||
{
|
||||
//m_threadBox->setModel(engine->threadsModel());
|
||||
//m_threadBox->setModel(engine->threadsModel());
|
||||
m_threadBox->setCurrentIndex(engine->threadsHandler()->currentThread());
|
||||
m_watchersWindow->setVisible(
|
||||
m_watchersWindow->model()->rowCount(QModelIndex()) > 0);
|
||||
m_returnWindow->setVisible(
|
||||
@@ -2192,16 +2196,11 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
|
||||
|| m_state == InferiorUnrunnable;
|
||||
|
||||
const bool running = m_state == InferiorRunOk;
|
||||
// FIXME ABC
|
||||
// if (running)
|
||||
// threadsHandler()->notifyRunning();
|
||||
const bool stopped = m_state == InferiorStopOk;
|
||||
|
||||
if (stopped)
|
||||
QApplication::alert(mainWindow(), 3000);
|
||||
|
||||
//qDebug() << "FLAGS: " << stoppable << running << stopped;
|
||||
|
||||
m_actions.watchAction1->setEnabled(true);
|
||||
m_actions.watchAction2->setEnabled(true);
|
||||
m_actions.breakAction->setEnabled(true);
|
||||
|
||||
@@ -2913,8 +2913,10 @@ void GdbEngine::handleThreadInfo(const GdbResponse &response)
|
||||
threads.append(thread);
|
||||
}
|
||||
threadsHandler()->setThreads(threads);
|
||||
const int currentThreadId = response.data.findChild("current-thread-id").data().toInt();
|
||||
const int currentThreadId =
|
||||
response.data.findChild("current-thread-id").data().toInt();
|
||||
threadsHandler()->setCurrentThreadId(currentThreadId);
|
||||
plugin()->updateState(this); // Adjust Threads combobox.
|
||||
} else {
|
||||
// Fall back for older versions: Try to get at least a list
|
||||
// of running threads.
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggerengine.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
namespace Debugger {
|
||||
@@ -59,21 +60,6 @@ void ThreadData::notifyRunning()
|
||||
lineNumber = -1;
|
||||
}
|
||||
|
||||
|
||||
int id;
|
||||
QString targetId;
|
||||
QString core;
|
||||
|
||||
// State information when stopped
|
||||
void notifyRunning(); // Clear state information
|
||||
|
||||
int frameLevel;
|
||||
quint64 address;
|
||||
QString function;
|
||||
QString fileName;
|
||||
QString state;
|
||||
int lineNumber;
|
||||
|
||||
static inline QString threadToolTip(const ThreadData &thread)
|
||||
{
|
||||
const char tableRowStartC[] = "<tr><td>";
|
||||
@@ -94,7 +80,7 @@ static inline QString threadToolTip(const ThreadData &thread)
|
||||
str << tableRowStartC << ThreadsHandler::tr("Core:")
|
||||
<< tableRowSeparatorC << thread.core << tableRowEndC;
|
||||
|
||||
if (thread.address) {
|
||||
if (thread.address) {
|
||||
str << tableRowStartC << ThreadsHandler::tr("Stopped at:")
|
||||
<< tableRowSeparatorC;
|
||||
if (!thread.function.isEmpty())
|
||||
@@ -166,7 +152,8 @@ QVariant ThreadsHandler::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
return threadToolTip(thread);
|
||||
case Qt::DecorationRole: // Return icon that indicates whether this is the active stack frame
|
||||
case Qt::DecorationRole:
|
||||
// Return icon that indicates whether this is the active stack frame
|
||||
if (index.column() == 0)
|
||||
return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon;
|
||||
break;
|
||||
@@ -256,8 +243,8 @@ void ThreadsHandler::setThreads(const Threads &threads)
|
||||
{
|
||||
m_threads = threads;
|
||||
if (m_currentIndex >= m_threads.size())
|
||||
m_currentIndex = m_threads.size() - 1;
|
||||
reset();
|
||||
m_currentIndex = -1;
|
||||
layoutChanged();
|
||||
}
|
||||
|
||||
Threads ThreadsHandler::threads() const
|
||||
@@ -269,7 +256,7 @@ void ThreadsHandler::removeAll()
|
||||
{
|
||||
m_threads.clear();
|
||||
m_currentIndex = 0;
|
||||
reset();
|
||||
layoutChanged();
|
||||
}
|
||||
|
||||
void ThreadsHandler::notifyRunning()
|
||||
|
||||
@@ -96,9 +96,10 @@ class ThreadsHandler : public QAbstractTableModel
|
||||
public:
|
||||
explicit ThreadsHandler(DebuggerEngine *engine);
|
||||
|
||||
int currentThread() const { return m_currentIndex; }
|
||||
void setCurrentThread(int index);
|
||||
int currentThreadId() const;
|
||||
void setCurrentThreadId(int id);
|
||||
void setCurrentThread(int index);
|
||||
int indexOf(int threadId) const;
|
||||
|
||||
void selectThread(int index);
|
||||
|
||||
@@ -1347,6 +1347,9 @@ public:
|
||||
//sleep(1);
|
||||
std::cerr << m_id;
|
||||
}
|
||||
if (m_id == 2) {
|
||||
++j;
|
||||
}
|
||||
std::cerr << j;
|
||||
}
|
||||
|
||||
@@ -1937,7 +1940,7 @@ int main(int argc, char *argv[])
|
||||
# endif
|
||||
testQStringList();
|
||||
testStruct();
|
||||
// testQThread();
|
||||
//testQThread();
|
||||
testQVariant1();
|
||||
testQVariant2();
|
||||
testQVariant3();
|
||||
|
||||
Reference in New Issue
Block a user