diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 381b28c4ef0ee99ef66948efddf40aff1c7de079..0641dac2114aeb7bcf20bb2a35ac90c189adf41f 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -112,6 +112,7 @@ enum GdbCommandType GdbExecInterrupt, GdbInfoShared, GdbInfoProc, + GdbInfoThreads, GdbQueryDataDumper1, GdbQueryDataDumper2, @@ -800,6 +801,9 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, case GdbInfoProc: handleInfoProc(record); break; + case GdbInfoThreads: + handleInfoThreads(record); + break; case GdbShowVersion: handleShowVersion(record); @@ -993,6 +997,19 @@ void GdbEngine::handleQuerySources(const GdbResultRecord &record) } } +void GdbEngine::handleInfoThreads(const GdbResultRecord &record) +{ + if (record.resultClass == GdbResultDone) { + // FIXME: use something more robust + // WIN: * 3 Thread 2312.0x4d0 0x7c91120f in ?? () + // LINUX: * 1 Thread 0x7f466273c6f0 (LWP 21455) 0x0000000000404542 in ... + QRegExp re(QLatin1String("Thread (\\d+)\\.0x.* in")); + QString data = record.data.findChild("consolestreamoutput").data(); + if (re.indexIn(data) != -1) + maybeHandleInferiorPidChanged(re.cap(1)); + } +} + void GdbEngine::handleInfoProc(const GdbResultRecord &record) { if (record.resultClass == GdbResultDone) { @@ -1084,13 +1101,15 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) { const QString reason = data.findChild("reason").data(); - bool isFirstStop = data.findChild("bkptno").data() == "1"; - if (isFirstStop && m_waitingForFirstBreakpointToBeHit) { + //MAC: bool isFirstStop = data.findChild("bkptno").data() == "1"; + //!MAC: startSymbolName == data.findChild("frame").findChild("func") + if (m_waitingForFirstBreakpointToBeHit) { + m_waitingForFirstBreakpointToBeHit = false; // // that's the "early stop" // #if defined(Q_OS_WIN) - sendCommand("info proc", GdbInfoProc); + sendCommand("info thread", GdbInfoThreads); #endif #if defined(Q_OS_LINUX) sendCommand("info proc", GdbInfoProc); diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index bf90ad97c992c897ec62911c79cfbcf382b4fbf3..0d710e359cf7139c7f45e3d98448a7fa9090d8c9 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -189,6 +189,7 @@ private: void handleExecRunToFunction(const GdbResultRecord &response); void handleInfoShared(const GdbResultRecord &response); void handleInfoProc(const GdbResultRecord &response); + void handleInfoThreads(const GdbResultRecord &response); void handleShowVersion(const GdbResultRecord &response); void handleQueryPwd(const GdbResultRecord &response); void handleQuerySources(const GdbResultRecord &response);