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();
|
||||
}
|
||||
|
||||
TaskHub *taskHub();
|
||||
|
||||
public:
|
||||
DebuggerState state() const { return m_state; }
|
||||
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_foundError = true;
|
||||
Task task(Task::Error, msg, Utils::FileName::fromUserInput(m_testFileName), line + 1, Core::Id("DebuggerTest"));
|
||||
taskHub()->addTask(task);
|
||||
}
|
||||
|
||||
TaskHub *DebuggerEnginePrivate::taskHub()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
Task task(Task::Error, msg, Utils::FileName::fromUserInput(m_testFileName), line + 1, Core::Id("DebuggerTest"));
|
||||
m_taskHub->addTask(task);
|
||||
TaskHub *DebuggerEngine::taskHub()
|
||||
{
|
||||
return d->taskHub();
|
||||
}
|
||||
|
||||
} // namespace Debugger
|
||||
|
@@ -47,13 +47,9 @@ class QMessageBox;
|
||||
class QAbstractItemModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditor;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
class IOptionsPage;
|
||||
}
|
||||
namespace TextEditor { class ITextEditor; }
|
||||
namespace Core { class IOptionsPage; }
|
||||
namespace ProjectExplorer { class TaskHub; }
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
@@ -201,6 +197,7 @@ public:
|
||||
|
||||
virtual void createSnapshot();
|
||||
virtual void updateAll();
|
||||
ProjectExplorer::TaskHub *taskHub();
|
||||
|
||||
typedef Internal::BreakpointModelId BreakpointModelId;
|
||||
virtual bool stateAcceptsBreakpointChanges() const { return true; }
|
||||
|
@@ -72,8 +72,11 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <projectexplorer/itaskhandler.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -179,6 +182,52 @@ static QByteArray parsePlainConsoleStream(const GdbResponse &response)
|
||||
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
|
||||
@@ -218,6 +267,9 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters,
|
||||
|
||||
m_gdbAdapter = createAdapter();
|
||||
|
||||
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
|
||||
ExtensionSystem::PluginManager::instance()->addObject(m_debugInfoTaskHandler);
|
||||
|
||||
m_commandTimer.setSingleShot(true);
|
||||
connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
|
||||
|
||||
@@ -239,6 +291,10 @@ AbstractGdbProcess *GdbEngine::gdbProc() const
|
||||
|
||||
GdbEngine::~GdbEngine()
|
||||
{
|
||||
ExtensionSystem::PluginManager::instance()->removeObject(m_debugInfoTaskHandler);
|
||||
delete m_debugInfoTaskHandler;
|
||||
m_debugInfoTaskHandler = 0;
|
||||
|
||||
// Prevent sending error messages afterwards.
|
||||
if (m_gdbAdapter)
|
||||
disconnect(gdbProc(), 0, this, 0);
|
||||
@@ -618,6 +674,26 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
||||
|| data.trimmed() == "Quit") {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1732,6 +1808,8 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
|
||||
|
||||
if (startParameters().multiProcess)
|
||||
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;
|
||||
}
|
||||
|
||||
void GdbEngine::requestDebugInformation(const DebugInfoTask &task)
|
||||
{
|
||||
QProcess::startDetached(task.command);
|
||||
}
|
||||
|
||||
//
|
||||
// Factory
|
||||
//
|
||||
|
@@ -57,6 +57,8 @@ namespace Internal {
|
||||
|
||||
class AbstractGdbAdapter;
|
||||
class AbstractGdbProcess;
|
||||
class DebugInfoTask;
|
||||
class DebugInfoTaskHandler;
|
||||
class GdbResponse;
|
||||
class GdbMi;
|
||||
class GdbToolTipContext;
|
||||
@@ -731,6 +733,7 @@ private: ////////// View & Data Stuff //////////
|
||||
// HACK:
|
||||
QByteArray m_currentThread;
|
||||
QString m_lastWinException;
|
||||
QString m_lastMissingDebugInfo;
|
||||
BreakpointResponseId m_qFatalBreakpointResponseId;
|
||||
bool m_actingOnExpectedStop;
|
||||
|
||||
@@ -738,6 +741,11 @@ private: ////////// View & Data Stuff //////////
|
||||
|
||||
QHash<int, QByteArray> m_scheduledTestResponses;
|
||||
QSet<int> m_testCases;
|
||||
|
||||
// Debug information
|
||||
friend class DebugInfoTaskHandler;
|
||||
void requestDebugInformation(const DebugInfoTask &task);
|
||||
DebugInfoTaskHandler *m_debugInfoTaskHandler;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user