forked from qt-creator/qt-creator
debugger: parse build-id-verbose output into tasks
Change-Id: I6bacc697c24185025f3342e43a29109bf75d8196 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -269,6 +269,8 @@ public slots:
|
|||||||
m_disassemblerAgent.resetLocation();
|
m_disassemblerAgent.resetLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TaskHub *taskHub();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerState state() const { return m_state; }
|
DebuggerState state() const { return m_state; }
|
||||||
RemoteSetupState remoteSetupState() const { return m_remoteSetupState; }
|
RemoteSetupState remoteSetupState() const { return m_remoteSetupState; }
|
||||||
@@ -1955,14 +1957,23 @@ void DebuggerEnginePrivate::reportTestError(const QString &msg, int line)
|
|||||||
{
|
{
|
||||||
m_engine->showMessage(_("### Line %1: %2").arg(line).arg(msg));
|
m_engine->showMessage(_("### Line %1: %2").arg(line).arg(msg));
|
||||||
m_foundError = true;
|
m_foundError = true;
|
||||||
|
Task task(Task::Error, msg, Utils::FileName::fromUserInput(m_testFileName), line + 1, Core::Id("DebuggerTest"));
|
||||||
if (!m_taskHub) {
|
taskHub()->addTask(task);
|
||||||
m_taskHub = ProjectExplorerPlugin::instance()->taskHub();
|
|
||||||
m_taskHub->addCategory(Core::Id("DebuggerTest"), tr("Debugger Test"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Task task(Task::Error, msg, Utils::FileName::fromUserInput(m_testFileName), line + 1, Core::Id("DebuggerTest"));
|
TaskHub *DebuggerEnginePrivate::taskHub()
|
||||||
m_taskHub->addTask(task);
|
{
|
||||||
|
if (!m_taskHub) {
|
||||||
|
m_taskHub = ProjectExplorerPlugin::instance()->taskHub();
|
||||||
|
m_taskHub->addCategory(Core::Id("Debuginfo"), tr("Debug Information"));
|
||||||
|
m_taskHub->addCategory(Core::Id("DebuggerTest"), tr("Debugger Test"));
|
||||||
|
}
|
||||||
|
return m_taskHub;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskHub *DebuggerEngine::taskHub()
|
||||||
|
{
|
||||||
|
return d->taskHub();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -47,13 +47,9 @@ class QMessageBox;
|
|||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor { class ITextEditor; }
|
||||||
class ITextEditor;
|
namespace Core { class IOptionsPage; }
|
||||||
}
|
namespace ProjectExplorer { class TaskHub; }
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class IOptionsPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
@@ -201,6 +197,7 @@ public:
|
|||||||
|
|
||||||
virtual void createSnapshot();
|
virtual void createSnapshot();
|
||||||
virtual void updateAll();
|
virtual void updateAll();
|
||||||
|
ProjectExplorer::TaskHub *taskHub();
|
||||||
|
|
||||||
typedef Internal::BreakpointModelId BreakpointModelId;
|
typedef Internal::BreakpointModelId BreakpointModelId;
|
||||||
virtual bool stateAcceptsBreakpointChanges() const { return true; }
|
virtual bool stateAcceptsBreakpointChanges() const { return true; }
|
||||||
|
@@ -72,8 +72,11 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/taskhub.h>
|
||||||
|
#include <projectexplorer/itaskhandler.h>
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -179,6 +182,52 @@ static QByteArray parsePlainConsoleStream(const GdbResponse &response)
|
|||||||
return out.mid(pos + 3);
|
return out.mid(pos + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Debuginfo Taskhandler
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class DebugInfoTask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString command;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DebugInfoTaskHandler : public ProjectExplorer::ITaskHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DebugInfoTaskHandler(GdbEngine *engine)
|
||||||
|
: ITaskHandler(_("Debuginfo")), m_engine(engine)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool canHandle(const Task &task)
|
||||||
|
{
|
||||||
|
return m_debugInfoTasks.contains(task.taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle(const Task &task)
|
||||||
|
{
|
||||||
|
m_engine->requestDebugInformation(m_debugInfoTasks.value(task.taskId));
|
||||||
|
}
|
||||||
|
|
||||||
|
void addTask(unsigned id, const DebugInfoTask &task)
|
||||||
|
{
|
||||||
|
m_debugInfoTasks[id] = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
QAction *createAction(QObject *parent = 0)
|
||||||
|
{
|
||||||
|
QAction *action = new QAction(tr("Install &Debug Information"), parent);
|
||||||
|
action->setToolTip(tr("This tries to install missing debug information."));
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
GdbEngine *m_engine;
|
||||||
|
QHash<unsigned, DebugInfoTask> m_debugInfoTasks;
|
||||||
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// GdbEngine
|
// GdbEngine
|
||||||
@@ -218,6 +267,9 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters,
|
|||||||
|
|
||||||
m_gdbAdapter = createAdapter();
|
m_gdbAdapter = createAdapter();
|
||||||
|
|
||||||
|
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
|
||||||
|
ExtensionSystem::PluginManager::instance()->addObject(m_debugInfoTaskHandler);
|
||||||
|
|
||||||
m_commandTimer.setSingleShot(true);
|
m_commandTimer.setSingleShot(true);
|
||||||
connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
|
connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
|
||||||
|
|
||||||
@@ -239,6 +291,10 @@ AbstractGdbProcess *GdbEngine::gdbProc() const
|
|||||||
|
|
||||||
GdbEngine::~GdbEngine()
|
GdbEngine::~GdbEngine()
|
||||||
{
|
{
|
||||||
|
ExtensionSystem::PluginManager::instance()->removeObject(m_debugInfoTaskHandler);
|
||||||
|
delete m_debugInfoTaskHandler;
|
||||||
|
m_debugInfoTaskHandler = 0;
|
||||||
|
|
||||||
// Prevent sending error messages afterwards.
|
// Prevent sending error messages afterwards.
|
||||||
if (m_gdbAdapter)
|
if (m_gdbAdapter)
|
||||||
disconnect(gdbProc(), 0, this, 0);
|
disconnect(gdbProc(), 0, this, 0);
|
||||||
@@ -618,6 +674,26 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
|| data.trimmed() == "Quit") {
|
|| data.trimmed() == "Quit") {
|
||||||
notifyInferiorExited();
|
notifyInferiorExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From SuSE's gdb: >&"Missing separate debuginfo for ...\n"
|
||||||
|
// ">&"Try: zypper install -C \"debuginfo(build-id)=c084ee5876ed1ac12730181c9f07c3e027d8e943\"\n"
|
||||||
|
if (data.startsWith("Missing separate debuginfo for ")) {
|
||||||
|
m_lastMissingDebugInfo = QString::fromLocal8Bit(data.mid(32));
|
||||||
|
} else if (data.startsWith("Try: zypper")) {
|
||||||
|
QString cmd = QString::fromLocal8Bit(data.mid(4));
|
||||||
|
|
||||||
|
Task task(Task::Warning,
|
||||||
|
tr("Missing debug information for %1\nTry: %2")
|
||||||
|
.arg(m_lastMissingDebugInfo).arg(cmd),
|
||||||
|
Utils::FileName(), 0, Core::Id("Debuginfo"));
|
||||||
|
|
||||||
|
taskHub()->addTask(task);
|
||||||
|
|
||||||
|
DebugInfoTask dit;
|
||||||
|
dit.command = cmd;
|
||||||
|
m_debugInfoTaskHandler->addTask(task.taskId, dit);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1732,6 +1808,8 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
|
|||||||
|
|
||||||
if (startParameters().multiProcess)
|
if (startParameters().multiProcess)
|
||||||
postCommand("set detach-on-fork off", ConsoleCommand);
|
postCommand("set detach-on-fork off", ConsoleCommand);
|
||||||
|
|
||||||
|
postCommand("set build-id-verbose 2", ConsoleCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5233,6 +5311,11 @@ void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response)
|
|||||||
m_scheduledTestResponses[token] = response;
|
m_scheduledTestResponses[token] = response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GdbEngine::requestDebugInformation(const DebugInfoTask &task)
|
||||||
|
{
|
||||||
|
QProcess::startDetached(task.command);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Factory
|
// Factory
|
||||||
//
|
//
|
||||||
|
@@ -57,6 +57,8 @@ namespace Internal {
|
|||||||
|
|
||||||
class AbstractGdbAdapter;
|
class AbstractGdbAdapter;
|
||||||
class AbstractGdbProcess;
|
class AbstractGdbProcess;
|
||||||
|
class DebugInfoTask;
|
||||||
|
class DebugInfoTaskHandler;
|
||||||
class GdbResponse;
|
class GdbResponse;
|
||||||
class GdbMi;
|
class GdbMi;
|
||||||
class GdbToolTipContext;
|
class GdbToolTipContext;
|
||||||
@@ -731,6 +733,7 @@ private: ////////// View & Data Stuff //////////
|
|||||||
// HACK:
|
// HACK:
|
||||||
QByteArray m_currentThread;
|
QByteArray m_currentThread;
|
||||||
QString m_lastWinException;
|
QString m_lastWinException;
|
||||||
|
QString m_lastMissingDebugInfo;
|
||||||
BreakpointResponseId m_qFatalBreakpointResponseId;
|
BreakpointResponseId m_qFatalBreakpointResponseId;
|
||||||
bool m_actingOnExpectedStop;
|
bool m_actingOnExpectedStop;
|
||||||
|
|
||||||
@@ -738,6 +741,11 @@ private: ////////// View & Data Stuff //////////
|
|||||||
|
|
||||||
QHash<int, QByteArray> m_scheduledTestResponses;
|
QHash<int, QByteArray> m_scheduledTestResponses;
|
||||||
QSet<int> m_testCases;
|
QSet<int> m_testCases;
|
||||||
|
|
||||||
|
// Debug information
|
||||||
|
friend class DebugInfoTaskHandler;
|
||||||
|
void requestDebugInformation(const DebugInfoTask &task);
|
||||||
|
DebugInfoTaskHandler *m_debugInfoTaskHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user