From 99a6d78bba07a40a8407f1b7ba44b57f7da1983e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Feb 2017 17:19:00 +0100 Subject: [PATCH] Debugger: Use (only) -thread-group-started as pid notification The notification exists since GDB 7.4, i.e. no further restriction beyond our current 7.4.1 minimum requirement, so there's no need to read pids from tea leaves. Change-Id: Ibfe14a46059fc1c917ada6ac445b364c958d0b3f Reviewed-by: David Schulz Reviewed-by: Christian Stenger Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 45 +------------------------- src/plugins/debugger/gdb/gdbengine.h | 2 -- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index a907417eae8..152af4cc51c 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -446,24 +446,6 @@ void GdbEngine::handleResponse(const QString &buff) } m_pendingConsoleStreamOutput += data; - // Parse pid from noise. - if (!inferiorPid()) { - // Linux/Mac gdb: [New [Tt]hread 0x545 (LWP 4554)] - static QRegExp re1("New .hread 0x[0-9a-f]+ \\(LWP ([0-9]*)\\)"); - // MinGW 6.8: [New thread 2437.0x435345] - static QRegExp re2("New .hread ([0-9]+)\\.0x[0-9a-f]*"); - // Mac: [Switching to process 9294 local thread 0x2e03] or - // [Switching to process 31773] - static QRegExp re3("Switching to process ([0-9]+)"); - QTC_ASSERT(re1.isValid() && re2.isValid(), return); - if (re1.indexIn(data) != -1) - maybeHandleInferiorPidChanged(re1.cap(1)); - else if (re2.indexIn(data) != -1) - maybeHandleInferiorPidChanged(re2.cap(1)); - else if (re3.indexIn(data) != -1) - maybeHandleInferiorPidChanged(re3.cap(1)); - } - // Show some messages to give the impression something happens. if (data.startsWith("Reading symbols from ")) { showStatusMessage(tr("Reading %1...").arg(data.mid(21)), 1000); @@ -647,8 +629,7 @@ void GdbEngine::handleAsyncOutput(const QString &asyncClass, const GdbMi &result showStatusMessage(tr("Library %1 unloaded").arg(id), 1000); } else if (asyncClass == "thread-group-added") { // 7.1-symbianelf has "{id="i1"}" - } else if (asyncClass == "thread-group-created" - || asyncClass == "thread-group-started") { + } else if (asyncClass == "thread-group-started") { // Archer had only "{id="28902"}" at some point of 6.8.x. // *-started seems to be standard in 7.1, but in early // 7.0.x, there was a *-created instead. @@ -875,20 +856,6 @@ void GdbEngine::handleInterruptDeviceInferior(const QString &error) m_signalOperation.clear(); } -void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0) -{ - const qint64 pid = pid0.toLongLong(); - if (pid == 0) { - showMessage(QString("Cannot parse PID from %1").arg(pid0)); - return; - } - if (pid == inferiorPid()) - return; - - showMessage(QString("FOUND PID %1").arg(pid)); - notifyInferiorPid(pid); -} - void GdbEngine::runCommand(const DebuggerCommand &command) { const int token = ++currentToken(); @@ -1656,16 +1623,6 @@ void GdbEngine::handleStop3() runCommand(cmd); } -void GdbEngine::handleInfoProc(const DebuggerResponse &response) -{ - if (response.resultClass == ResultDone) { - static QRegExp re("\\bprocess ([0-9]+)\n"); - QTC_ASSERT(re.isValid(), return); - if (re.indexIn(response.consoleStreamOutput) != -1) - maybeHandleInferiorPidChanged(re.cap(1)); - } -} - void GdbEngine::handleShowVersion(const DebuggerResponse &response) { showMessage("PARSING VERSION: " + response.toString()); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 718914d02c6..169bef5aba2 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -235,8 +235,6 @@ private: ////////// Inferior Management ////////// void handleExecuteJumpToLine(const DebuggerResponse &response); void handleExecuteRunToLine(const DebuggerResponse &response); - void maybeHandleInferiorPidChanged(const QString &pid); - void handleInfoProc(const DebuggerResponse &response); QString msgPtraceError(DebuggerStartMode sm); private: ////////// View & Data Stuff //////////