2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-05-18 12:12:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2010-10-15 10:56:39 +02:00
|
|
|
#include "threaddata.h"
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2015-06-12 11:55:57 +02:00
|
|
|
#include <utils/treemodel.h>
|
2011-10-13 10:17:06 +02:00
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ThreadsHandler
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2011-09-01 16:36:27 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-07-18 12:36:31 +02:00
|
|
|
class DebuggerEngine;
|
2011-09-01 16:36:27 +02:00
|
|
|
class GdbMi;
|
2016-05-04 16:41:15 +02:00
|
|
|
class ThreadItem;
|
2011-09-01 16:36:27 +02:00
|
|
|
|
2016-06-27 13:46:46 +02:00
|
|
|
class ThreadsHandler : public Utils::LeveledTreeModel<Utils::TypedTreeItem<ThreadItem>, ThreadItem>
|
2010-05-18 12:12:22 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2016-07-18 12:36:31 +02:00
|
|
|
explicit ThreadsHandler(DebuggerEngine *engine);
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2013-11-14 13:24:02 +01:00
|
|
|
int currentThreadIndex() const;
|
2012-10-19 16:37:57 +02:00
|
|
|
ThreadId currentThread() const;
|
|
|
|
|
ThreadId threadAt(int index) const;
|
|
|
|
|
void setCurrentThread(ThreadId id);
|
2016-06-07 17:04:53 +02:00
|
|
|
QString pidForGroupId(const QString &groupId) const;
|
2010-07-02 10:58:47 +02:00
|
|
|
|
2015-06-12 11:55:57 +02:00
|
|
|
void updateThread(const ThreadData &threadData);
|
2012-10-19 16:37:57 +02:00
|
|
|
void updateThreads(const GdbMi &data);
|
|
|
|
|
|
|
|
|
|
void removeThread(ThreadId threadId);
|
2010-06-16 11:08:54 +02:00
|
|
|
void setThreads(const Threads &threads);
|
2010-05-18 12:12:22 +02:00
|
|
|
void removeAll();
|
2012-10-19 16:37:57 +02:00
|
|
|
ThreadData thread(ThreadId id) const;
|
2011-10-13 10:17:06 +02:00
|
|
|
QAbstractItemModel *model();
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
void notifyGroupCreated(const QString &groupId, const QString &pid);
|
|
|
|
|
bool notifyGroupExited(const QString &groupId); // Returns true when empty.
|
2015-06-12 15:17:14 +02:00
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
// Clear out all frame information
|
2016-06-07 17:04:53 +02:00
|
|
|
void notifyRunning(const QString &data);
|
2015-06-12 11:55:57 +02:00
|
|
|
void notifyRunning(ThreadId threadId);
|
2012-10-19 16:37:57 +02:00
|
|
|
void notifyAllRunning();
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
void notifyStopped(const QString &data);
|
2015-06-12 11:55:57 +02:00
|
|
|
void notifyStopped(ThreadId threadId);
|
2012-10-19 16:37:57 +02:00
|
|
|
void notifyAllStopped();
|
2010-11-08 17:15:33 +01:00
|
|
|
|
2011-04-18 16:40:59 +02:00
|
|
|
void resetLocation();
|
|
|
|
|
void scheduleResetLocation();
|
|
|
|
|
|
2010-05-18 12:12:22 +02:00
|
|
|
private:
|
2011-09-01 16:36:27 +02:00
|
|
|
void updateThreadBox();
|
2010-05-18 12:12:22 +02:00
|
|
|
|
2015-06-12 11:55:57 +02:00
|
|
|
void sort(int column, Qt::SortOrder order);
|
2016-07-18 12:36:31 +02:00
|
|
|
bool setData(const QModelIndex &idx, const QVariant &data, int role);
|
2011-04-18 16:40:59 +02:00
|
|
|
|
2016-07-18 12:36:31 +02:00
|
|
|
DebuggerEngine *m_engine;
|
2015-06-12 11:55:57 +02:00
|
|
|
ThreadId m_currentId;
|
2011-04-18 16:40:59 +02:00
|
|
|
bool m_resetLocationScheduled;
|
2016-06-07 17:04:53 +02:00
|
|
|
QHash<QString, QString> m_pidForGroupId;
|
2010-05-18 12:12:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|