summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/debugger/breakhandler.h2
-rw-r--r--src/plugins/debugger/debuggercore.h4
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp15
-rw-r--r--src/plugins/debugger/threaddata.h2
-rw-r--r--src/plugins/debugger/threadshandler.cpp41
-rw-r--r--src/plugins/debugger/threadshandler.h9
-rw-r--r--src/plugins/debugger/threadswindow.cpp10
7 files changed, 58 insertions, 25 deletions
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index 24d471ab7f..47917e4649 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -114,7 +114,7 @@ public:
int ignoreCount(BreakpointModelId id) const;
void setIgnoreCount(BreakpointModelId, const int &count);
int threadSpec(BreakpointModelId id) const;
- void setThreadSpec(BreakpointModelId, const int&spec);
+ void setThreadSpec(BreakpointModelId, const int &spec);
QString fileName(BreakpointModelId id) const;
void setFileName(BreakpointModelId, const QString &fileName);
QString functionName(BreakpointModelId id) const;
diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h
index e3e11da70d..c8903d99e0 100644
--- a/src/plugins/debugger/debuggercore.h
+++ b/src/plugins/debugger/debuggercore.h
@@ -105,7 +105,8 @@ public:
virtual bool initialize(const QStringList &arguments, QString *errorMessage) = 0;
virtual QWidget *mainWindow() const = 0;
virtual bool isDockVisible(const QString &objectName) const = 0;
- virtual QString debuggerForAbi(const ProjectExplorer::Abi &abi, DebuggerEngineType et = NoEngineType) const = 0;
+ virtual QString debuggerForAbi(const ProjectExplorer::Abi &abi,
+ DebuggerEngineType et = NoEngineType) const = 0;
virtual void showModuleSymbols(const QString &moduleName,
const QVector<Symbol> &symbols) = 0;
virtual void openMemoryEditor() = 0;
@@ -115,6 +116,7 @@ public:
virtual Utils::SavedAction *action(int code) const = 0;
virtual bool boolSetting(int code) const = 0;
virtual QString stringSetting(int code) const = 0;
+ virtual void setThreads(const QStringList &list, int index) = 0;
virtual DebuggerToolTipManager *toolTipManager() const = 0;
virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const = 0;
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 5effd300f2..89a6a06f83 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -580,6 +580,16 @@ public:
DebuggerEngine *currentEngine() const { return m_currentEngine; }
DebuggerEngine *dummyEngine();
+ void setThreads(const QStringList &list, int index)
+ {
+ const bool state = m_threadBox->blockSignals(true);
+ m_threadBox->clear();
+ foreach (const QString &item, list)
+ m_threadBox->addItem(item);
+ m_threadBox->setCurrentIndex(index);
+ m_threadBox->blockSignals(state);
+ }
+
public slots:
void writeSettings()
{
@@ -1869,8 +1879,8 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine)
m_sourceFilesWindow->setModel(engine->sourceFilesModel());
m_stackWindow->setModel(engine->stackModel());
m_threadsWindow->setModel(engine->threadsModel());
- m_threadBox->setModel(engine->threadsModel());
- m_threadBox->setModelColumn(ThreadData::NameColumn);
+ //m_threadBox->setModel(engine->threadsModel());
+ //m_threadBox->setModelColumn(ThreadData::ComboNameColumn);
m_watchersWindow->setModel(engine->watchersModel());
engine->watchHandler()->rebuildModel();
}
@@ -3120,6 +3130,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
hbox->addWidget(new QLabel(tr("Threads:")));
m_threadBox = new QComboBox;
+ m_threadBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
connect(m_threadBox, SIGNAL(activated(int)), SLOT(selectThread(int)));
hbox->addWidget(m_threadBox);
diff --git a/src/plugins/debugger/threaddata.h b/src/plugins/debugger/threaddata.h
index 750fc4c9c2..0f5c083679 100644
--- a/src/plugins/debugger/threaddata.h
+++ b/src/plugins/debugger/threaddata.h
@@ -60,7 +60,9 @@ struct ThreadData
LineColumn,
StateColumn,
NameColumn,
+ TargetIdColumn,
CoreColumn,
+ ComboNameColumn,
ColumnCount = CoreColumn
};
diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp
index 16b882aba6..5774beaa1c 100644
--- a/src/plugins/debugger/threadshandler.cpp
+++ b/src/plugins/debugger/threadshandler.cpp
@@ -34,6 +34,7 @@
#include "gdb/gdbmi.h"
#include "debuggerconstants.h"
+#include "debuggercore.h"
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
@@ -124,7 +125,7 @@ QVariant ThreadsHandler::data(const QModelIndex &index, int role) const
if (!index.isValid())
return QVariant();
const int row = index.row();
- if (row >= m_threads.size())
+ if (row >= m_threads.size())
return QVariant();
const ThreadData &thread = m_threads.at(row);
@@ -148,14 +149,14 @@ QVariant ThreadsHandler::data(const QModelIndex &index, int role) const
return thread.core;
case ThreadData::StateColumn:
return thread.state;
- case ThreadData::NameColumn: {
- QString s;
- if (!thread.name.isEmpty())
- s += ' ' + thread.name;
- if (!thread.targetId.isEmpty())
- s += ' ' + thread.targetId;
- return s;
- }
+ case ThreadData::TargetIdColumn:
+ if (thread.targetId.startsWith(QLatin1String("Thread ")))
+ return thread.targetId.mid(7);
+ return thread.targetId;
+ case ThreadData::NameColumn:
+ return thread.name;
+ case ThreadData::ComboNameColumn:
+ return QString("#%1 %2").arg(thread.id).arg(thread.name);
}
case Qt::ToolTipRole:
return threadToolTip(thread);
@@ -177,7 +178,7 @@ QVariant ThreadsHandler::headerData
return QVariant();
switch (section) {
case ThreadData::IdColumn:
- return tr("Thread ID");
+ return QString(QLatin1String(" ") + tr("Id"));
case ThreadData::FunctionColumn:
return tr("Function");
case ThreadData::FileColumn:
@@ -190,6 +191,8 @@ QVariant ThreadsHandler::headerData
return tr("Core");
case ThreadData::StateColumn:
return tr("State");
+ case ThreadData::TargetIdColumn:
+ return tr("Target Id");
case ThreadData::NameColumn:
return tr("Name");
}
@@ -219,19 +222,20 @@ void ThreadsHandler::setCurrentThread(int index)
m_currentIndex = index;
- // Emit changed for new frame
+ // Emit changed for new frame.
i = ThreadsHandler::index(m_currentIndex, 0);
emit dataChanged(i, i);
+
+ updateThreadBox();
}
void ThreadsHandler::setCurrentThreadId(int id)
{
const int index = indexOf(id);
- if (index != -1) {
+ if (index != -1)
setCurrentThread(index);
- } else {
+ else
qWarning("ThreadsHandler::setCurrentThreadId: No such thread %d.", id);
- }
}
int ThreadsHandler::indexOf(quint64 threadId) const
@@ -251,6 +255,15 @@ void ThreadsHandler::setThreads(const Threads &threads)
m_resetLocationScheduled = false;
m_contentsValid = true;
reset();
+ updateThreadBox();
+}
+
+void ThreadsHandler::updateThreadBox()
+{
+ QStringList list;
+ foreach (const ThreadData &thread, m_threads)
+ list.append(QString("#%1 %2").arg(thread.id).arg(thread.name));
+ debuggerCore()->setThreads(list, m_currentIndex);
}
Threads ThreadsHandler::threads() const
diff --git a/src/plugins/debugger/threadshandler.h b/src/plugins/debugger/threadshandler.h
index 11737bf53c..183ded7673 100644
--- a/src/plugins/debugger/threadshandler.h
+++ b/src/plugins/debugger/threadshandler.h
@@ -38,15 +38,17 @@
#include "threaddata.h"
-namespace Debugger {
-namespace Internal {
-class GdbMi;
////////////////////////////////////////////////////////////////////////
//
// ThreadsHandler
//
////////////////////////////////////////////////////////////////////////
+namespace Debugger {
+namespace Internal {
+
+class GdbMi;
+
class ThreadsHandler : public QAbstractTableModel
{
Q_OBJECT
@@ -80,6 +82,7 @@ private:
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
+ void updateThreadBox();
Threads m_threads;
int m_currentIndex;
diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp
index 5d1c1de729..643ddc9332 100644
--- a/src/plugins/debugger/threadswindow.cpp
+++ b/src/plugins/debugger/threadswindow.cpp
@@ -79,9 +79,11 @@ void ThreadsWindow::rowActivated(const QModelIndex &index)
void ThreadsWindow::setModel(QAbstractItemModel *model)
{
QTreeView::setModel(model);
- resizeColumnToContents(0); // Id
- resizeColumnToContents(4); // Line
- resizeColumnToContents(6); // Name
+ resizeColumnToContents(ThreadData::IdColumn);
+ resizeColumnToContents(ThreadData::LineColumn);
+ resizeColumnToContents(ThreadData::NameColumn);
+ resizeColumnToContents(ThreadData::StateColumn);
+ resizeColumnToContents(ThreadData::TargetIdColumn);
if (header()) {
bool adjust = debuggerCore()->boolSetting(AlwaysAdjustThreadsColumnWidths);
setAlwaysResizeColumnsToContents(adjust);
@@ -109,7 +111,7 @@ void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
void ThreadsWindow::resizeColumnsToContents()
{
const int columnCount = model()->columnCount();
- for (int c = 0 ; c < columnCount; c++)
+ for (int c = 0 ; c != columnCount; ++c)
resizeColumnToContents(c);
}