forked from qt-creator/qt-creator
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 <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -446,24 +446,6 @@ void GdbEngine::handleResponse(const QString &buff)
|
|||||||
}
|
}
|
||||||
m_pendingConsoleStreamOutput += data;
|
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.
|
// Show some messages to give the impression something happens.
|
||||||
if (data.startsWith("Reading symbols from ")) {
|
if (data.startsWith("Reading symbols from ")) {
|
||||||
showStatusMessage(tr("Reading %1...").arg(data.mid(21)), 1000);
|
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);
|
showStatusMessage(tr("Library %1 unloaded").arg(id), 1000);
|
||||||
} else if (asyncClass == "thread-group-added") {
|
} else if (asyncClass == "thread-group-added") {
|
||||||
// 7.1-symbianelf has "{id="i1"}"
|
// 7.1-symbianelf has "{id="i1"}"
|
||||||
} else if (asyncClass == "thread-group-created"
|
} else if (asyncClass == "thread-group-started") {
|
||||||
|| asyncClass == "thread-group-started") {
|
|
||||||
// Archer had only "{id="28902"}" at some point of 6.8.x.
|
// Archer had only "{id="28902"}" at some point of 6.8.x.
|
||||||
// *-started seems to be standard in 7.1, but in early
|
// *-started seems to be standard in 7.1, but in early
|
||||||
// 7.0.x, there was a *-created instead.
|
// 7.0.x, there was a *-created instead.
|
||||||
@@ -875,20 +856,6 @@ void GdbEngine::handleInterruptDeviceInferior(const QString &error)
|
|||||||
m_signalOperation.clear();
|
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)
|
void GdbEngine::runCommand(const DebuggerCommand &command)
|
||||||
{
|
{
|
||||||
const int token = ++currentToken();
|
const int token = ++currentToken();
|
||||||
@@ -1656,16 +1623,6 @@ void GdbEngine::handleStop3()
|
|||||||
runCommand(cmd);
|
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)
|
void GdbEngine::handleShowVersion(const DebuggerResponse &response)
|
||||||
{
|
{
|
||||||
showMessage("PARSING VERSION: " + response.toString());
|
showMessage("PARSING VERSION: " + response.toString());
|
||||||
|
@@ -235,8 +235,6 @@ private: ////////// Inferior Management //////////
|
|||||||
void handleExecuteJumpToLine(const DebuggerResponse &response);
|
void handleExecuteJumpToLine(const DebuggerResponse &response);
|
||||||
void handleExecuteRunToLine(const DebuggerResponse &response);
|
void handleExecuteRunToLine(const DebuggerResponse &response);
|
||||||
|
|
||||||
void maybeHandleInferiorPidChanged(const QString &pid);
|
|
||||||
void handleInfoProc(const DebuggerResponse &response);
|
|
||||||
QString msgPtraceError(DebuggerStartMode sm);
|
QString msgPtraceError(DebuggerStartMode sm);
|
||||||
|
|
||||||
private: ////////// View & Data Stuff //////////
|
private: ////////// View & Data Stuff //////////
|
||||||
|
Reference in New Issue
Block a user