forked from qt-creator/qt-creator
Debugger: Move DebugInfoTask handling to plugin
This does not involve the engine (currently). Task-number: QTCREATORBUG-19994 Change-Id: I07a628580bf99c988eb0df165d649d5cc0869c0d Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -124,5 +124,7 @@ QAction *addCheckableAction(QMenu *menu, const QString &display, bool on, bool c
|
||||
// Qt's various build paths for unpatched versions
|
||||
QStringList qtBuildPaths();
|
||||
|
||||
void addDebugInfoTask(unsigned id, const QString &cmd);
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
@@ -92,6 +92,7 @@
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
||||
#include <projectexplorer/devicesupport/deviceprocesslist.h>
|
||||
#include <projectexplorer/itaskhandler.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
@@ -578,6 +579,42 @@ static Kit *findUniversalCdbKit()
|
||||
return KitManager::kit(cdbPredicate());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Debuginfo Taskhandler
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DebugInfoTaskHandler : public ITaskHandler
|
||||
{
|
||||
public:
|
||||
bool canHandle(const Task &task) const final
|
||||
{
|
||||
return m_debugInfoTasks.contains(task.taskId);
|
||||
}
|
||||
|
||||
void handle(const Task &task) final
|
||||
{
|
||||
QString cmd = m_debugInfoTasks.value(task.taskId);
|
||||
QProcess::startDetached(cmd);
|
||||
}
|
||||
|
||||
void addTask(unsigned id, const QString &cmd)
|
||||
{
|
||||
m_debugInfoTasks[id] = cmd;
|
||||
}
|
||||
|
||||
QAction *createAction(QObject *parent) const final
|
||||
{
|
||||
QAction *action = new QAction(DebuggerPlugin::tr("Install &Debug Information"), parent);
|
||||
action->setToolTip(DebuggerPlugin::tr("Tries to install missing debug information."));
|
||||
return action;
|
||||
}
|
||||
|
||||
private:
|
||||
QHash<unsigned, QString> m_debugInfoTasks;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DebuggerPluginPrivate
|
||||
@@ -1028,6 +1065,8 @@ public:
|
||||
CommonOptionsPage *m_commonOptionsPage = 0;
|
||||
DummyEngine *m_dummyEngine = 0;
|
||||
const QSharedPointer<GlobalDebuggerOptions> m_globalDebuggerOptions;
|
||||
|
||||
DebugInfoTaskHandler m_debugInfoTaskHandler;
|
||||
};
|
||||
|
||||
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
|
||||
@@ -2955,6 +2994,11 @@ QMessageBox *showMessageBox(int icon, const QString &title,
|
||||
return mb;
|
||||
}
|
||||
|
||||
void addDebugInfoTask(unsigned id, const QString &cmd)
|
||||
{
|
||||
dd->m_debugInfoTaskHandler.addTask(id, cmd);
|
||||
}
|
||||
|
||||
bool isReverseDebuggingEnabled()
|
||||
{
|
||||
static bool enabled = qEnvironmentVariableIsSet("QTC_DEBUGGER_ENABLE_REVERSE");
|
||||
|
@@ -55,7 +55,6 @@
|
||||
#include <coreplugin/messagebox.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceprocess.h>
|
||||
#include <projectexplorer/itaskhandler.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
@@ -131,52 +130,6 @@ static bool isMostlyHarmlessMessage(const QStringRef &msg)
|
||||
"Invalid argument\\n";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Debuginfo Taskhandler
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DebugInfoTask
|
||||
{
|
||||
public:
|
||||
QString command;
|
||||
};
|
||||
|
||||
class DebugInfoTaskHandler : public ITaskHandler
|
||||
{
|
||||
public:
|
||||
explicit DebugInfoTaskHandler(GdbEngine *engine)
|
||||
: m_engine(engine)
|
||||
{}
|
||||
|
||||
bool canHandle(const Task &task) const override
|
||||
{
|
||||
return m_debugInfoTasks.contains(task.taskId);
|
||||
}
|
||||
|
||||
void handle(const Task &task) override
|
||||
{
|
||||
m_engine->requestDebugInformation(m_debugInfoTasks.value(task.taskId));
|
||||
}
|
||||
|
||||
void addTask(unsigned id, const DebugInfoTask &task)
|
||||
{
|
||||
m_debugInfoTasks[id] = task;
|
||||
}
|
||||
|
||||
QAction *createAction(QObject *parent) const override
|
||||
{
|
||||
QAction *action = new QAction(DebuggerPlugin::tr("Install &Debug Information"), parent);
|
||||
action->setToolTip(DebuggerPlugin::tr("Tries to install missing debug information."));
|
||||
return action;
|
||||
}
|
||||
|
||||
private:
|
||||
GdbEngine *m_engine;
|
||||
QHash<unsigned, DebugInfoTask> m_debugInfoTasks;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GdbEngine
|
||||
@@ -190,9 +143,6 @@ GdbEngine::GdbEngine()
|
||||
m_gdbOutputCodec = QTextCodec::codecForLocale();
|
||||
m_inferiorOutputCodec = QTextCodec::codecForLocale();
|
||||
|
||||
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
|
||||
//ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler);
|
||||
|
||||
m_commandTimer.setSingleShot(true);
|
||||
connect(&m_commandTimer, &QTimer::timeout,
|
||||
this, &GdbEngine::commandTimeout);
|
||||
@@ -222,10 +172,6 @@ GdbEngine::GdbEngine()
|
||||
|
||||
GdbEngine::~GdbEngine()
|
||||
{
|
||||
//ExtensionSystem::PluginManager::removeObject(m_debugInfoTaskHandler);
|
||||
delete m_debugInfoTaskHandler;
|
||||
m_debugInfoTaskHandler = 0;
|
||||
|
||||
// Prevent sending error messages afterwards.
|
||||
disconnect();
|
||||
}
|
||||
@@ -434,10 +380,7 @@ void GdbEngine::handleResponse(const QString &buff)
|
||||
FileName(), 0, Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
|
||||
|
||||
TaskHub::addTask(task);
|
||||
|
||||
DebugInfoTask dit;
|
||||
dit.command = cmd;
|
||||
m_debugInfoTaskHandler->addTask(task.taskId, dit);
|
||||
Internal::addDebugInfoTask(task.taskId, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4177,11 +4120,6 @@ void GdbEngine::scheduleTestResponse(int testCase, const QString &response)
|
||||
m_scheduledTestResponses[token] = response;
|
||||
}
|
||||
|
||||
void GdbEngine::requestDebugInformation(const DebugInfoTask &task)
|
||||
{
|
||||
QProcess::startDetached(task.command);
|
||||
}
|
||||
|
||||
QString GdbEngine::msgGdbStopFailed(const QString &why)
|
||||
{
|
||||
return tr("The gdb process could not be stopped:\n%1").arg(why);
|
||||
|
@@ -381,11 +381,6 @@ private: ////////// General Interface //////////
|
||||
QHash<int, QString> m_scheduledTestResponses;
|
||||
QSet<int> m_testCases;
|
||||
|
||||
// Debug information
|
||||
friend class DebugInfoTaskHandler;
|
||||
void requestDebugInformation(const DebugInfoTask &task);
|
||||
DebugInfoTaskHandler *m_debugInfoTaskHandler;
|
||||
|
||||
bool m_systemDumpersLoaded = false;
|
||||
|
||||
static QString msgGdbStopFailed(const QString &why);
|
||||
|
Reference in New Issue
Block a user