aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhjk <[email protected]>2012-03-30 17:36:44 +0200
committerhjk <[email protected]>2012-03-30 19:34:45 +0200
commitc1e7a06e9f022842999557ac57babf55f798ea4e (patch)
tree5b7b29f23950fd25ee65c0a6e7d37beb187d5ef7 /src
parentf3fc5b12eba8341ce4a43c84d8481c3dda2a14ea (diff)
debugger: parse build-id-verbose output into tasks
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/debuggerengine.cpp15
-rw-r--r--src/plugins/debugger/debuggerengine.h11
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp83
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h8
4 files changed, 108 insertions, 9 deletions
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index a335902fb0d..fea2566bff7 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -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
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 40cbf27c3bc..8665edd9544 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -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; }
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index a6e39724999..0eaec5cc218 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -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>
@@ -181,6 +184,52 @@ static QByteArray parsePlainConsoleStream(const GdbResponse &response)
///////////////////////////////////////////////////////////////////////
//
+// 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
//
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index ee3afea9eb8..48551cd6820 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -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