diff options
author | Friedemann Kleint <[email protected]> | 2012-11-02 16:14:43 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2012-11-02 16:22:12 +0100 |
commit | 41a5461cf2e4bebbe8233ae2974baeca056691ab (patch) | |
tree | 445037d052bfb91c12fee57618ee4963d2caf68b /src | |
parent | 2e40c54ea3422f7a3e8441cf81c0b07e4491f287 (diff) |
Debugger: Log exceptions in build pane.
- Introduce constants for task categories, add "RunTime".
- Log exceptions under "RunTime".
- Clear pane on debugger start.
- Add 'first chance'
Task-number: QTCREATORBUG-8141
Change-Id: Icf68def06c42a0f3bb86dcc2ae74750b5397ca52
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/debugger/cdb/cdbengine.cpp | 16 | ||||
-rw-r--r-- | src/plugins/debugger/cdb/cdbparsehelpers.cpp | 2 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerconstants.h | 4 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerengine.cpp | 8 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerrunner.cpp | 7 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 15 |
6 files changed, 45 insertions, 7 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index bdc0e13168e..fe0b96a7e89 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -62,6 +62,8 @@ #include <texteditor/itexteditor.h> #include <projectexplorer/abi.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/task.h> +#include <projectexplorer/taskhub.h> #include <utils/synchronousprocess.h> #include <utils/winutils.h> @@ -2380,10 +2382,20 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what exception.fromGdbMI(gdbmi); const QString message = exception.toString(true); showStatusMessage(message); -#ifdef Q_OS_WIN // Report C++ exception in application output as well. + // Report C++ exception in application output as well. if (exception.exceptionCode == winExceptionCppException) showMessage(message + QLatin1Char('\n'), AppOutput); -#endif + if (!isDebuggerWinException(exception.exceptionCode)) { + const Task::TaskType type = + isFatalWinException(exception.exceptionCode) ? Task::Error : Task::Warning; + const Utils::FileName fileName = exception.file.isEmpty() ? + Utils::FileName() : + Utils::FileName::fromUserInput(QString::fromLocal8Bit(exception.file)); + const Task task(type, exception.toString(false), + fileName, exception.lineNumber, + Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME)); + taskHub()->addTask(task); + } return; } diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp index cbda20639a9..02afae5abe1 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp @@ -415,6 +415,8 @@ QString WinException::toString(bool includeLocation) const QTextStream str(&rc); formatWindowsException(exceptionCode, exceptionAddress, exceptionFlags, info1, info2, str); + if (firstChance) + str << " (first chance)"; if (includeLocation) { if (lineNumber) { str << " at " << QLatin1String(file) << ':' << lineNumber; diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index 26fa3a88c08..8d06e72ae68 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -75,6 +75,10 @@ const char DOCKWIDGET_WATCHERS[] = "Debugger.Docks.LocalsAndWatchers"; const char DOCKWIDGET_QML_INSPECTOR[] = "Debugger.Docks.QmlInspector"; const char DOCKWIDGET_DEFAULT_AREA[] = "Debugger.Docks.DefaultArea"; + +const char TASK_CATEGORY_DEBUGGER_TEST[] = "DebuggerTest"; +const char TASK_CATEGORY_DEBUGGER_DEBUGINFO[] = "Debuginfo"; +const char TASK_CATEGORY_DEBUGGER_RUNTIME[] = "DebugRuntime"; } // namespace Constants enum DebuggerState diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index aa676f85445..e467a906635 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1929,8 +1929,12 @@ 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")); + m_taskHub->addCategory(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO), + tr("Debug Information")); + m_taskHub->addCategory(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST), + tr("Debugger Test")); + m_taskHub->addCategory(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME), + tr("Debugger Runtime")); } return m_taskHub; } diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 2336740c86b..565462c73ac 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -53,6 +53,7 @@ #include <projectexplorer/project.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/target.h> +#include <projectexplorer/taskhub.h> #include <projectexplorer/toolchain.h> #include <utils/outputformat.h> @@ -596,6 +597,12 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate (const DebuggerStartParameters &sp0, RunConfiguration *rc, QString *errorMessage) { Q_UNUSED(errorMessage); + + TaskHub *th = ProjectExplorerPlugin::instance()->taskHub(); + th->clearTasks(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO)); + th->clearTasks(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_TEST)); + th->clearTasks(Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME)); + DebuggerStartParameters sp = sp0; if (!debuggerCore()->boolSetting(AutoEnrichParameters)) { const QString sysroot = sp.sysRoot; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index e01c595e3f6..73bb0652e5c 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -344,14 +344,18 @@ static void dump(const char *first, const char *middle, const QString & to) // Parse "~:gdb: unknown target exception 0xc0000139 at 0x77bef04e\n" // and return an exception message -static inline QString msgWinException(const QByteArray &data) +static inline QString msgWinException(const QByteArray &data, unsigned *exCodeIn = 0) { + if (exCodeIn) + *exCodeIn = 0; const int exCodePos = data.indexOf("0x"); const int blankPos = exCodePos != -1 ? data.indexOf(' ', exCodePos + 1) : -1; const int addressPos = blankPos != -1 ? data.indexOf("0x", blankPos + 1) : -1; if (addressPos < 0) return GdbEngine::tr("An exception was triggered."); const unsigned exCode = data.mid(exCodePos, blankPos - exCodePos).toUInt(0, 0); + if (exCodeIn) + *exCodeIn = exCode; const quint64 address = data.mid(addressPos).trimmed().toULongLong(0, 0); QString rc; QTextStream str(&rc); @@ -692,8 +696,13 @@ void GdbEngine::handleResponse(const QByteArray &buff) // [Windows, most likely some DLL/Entry point not found]: // "gdb: unknown target exception 0xc0000139 at 0x77bef04e" // This may be fatal and cause the target to exit later - m_lastWinException = msgWinException(data); + unsigned exCode; + m_lastWinException = msgWinException(data, &exCode); showMessage(m_lastWinException, LogMisc); + const Task::TaskType type = isFatalWinException(exCode) ? Task::Error : Task::Warning; + const Task task(type, m_lastWinException, Utils::FileName(), 0, + Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME)); + taskHub()->addTask(task); } if (data.startsWith("QMLBP:")) { @@ -735,7 +744,7 @@ void GdbEngine::handleResponse(const QByteArray &buff) Task task(Task::Warning, tr("Missing debug information for %1\nTry: %2") .arg(m_lastMissingDebugInfo).arg(cmd), - FileName(), 0, Core::Id("Debuginfo")); + FileName(), 0, Core::Id(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO)); taskHub()->addTask(task); |