Fixes: debugger: try to extact pid from 'info threads' on windows

This commit is contained in:
hjk
2009-02-13 17:11:34 +01:00
parent 7c5fa0f06b
commit 373a05af82
2 changed files with 23 additions and 3 deletions

View File

@@ -112,6 +112,7 @@ enum GdbCommandType
GdbExecInterrupt, GdbExecInterrupt,
GdbInfoShared, GdbInfoShared,
GdbInfoProc, GdbInfoProc,
GdbInfoThreads,
GdbQueryDataDumper1, GdbQueryDataDumper1,
GdbQueryDataDumper2, GdbQueryDataDumper2,
@@ -800,6 +801,9 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type,
case GdbInfoProc: case GdbInfoProc:
handleInfoProc(record); handleInfoProc(record);
break; break;
case GdbInfoThreads:
handleInfoThreads(record);
break;
case GdbShowVersion: case GdbShowVersion:
handleShowVersion(record); 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) void GdbEngine::handleInfoProc(const GdbResultRecord &record)
{ {
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
@@ -1084,13 +1101,15 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
{ {
const QString reason = data.findChild("reason").data(); const QString reason = data.findChild("reason").data();
bool isFirstStop = data.findChild("bkptno").data() == "1"; //MAC: bool isFirstStop = data.findChild("bkptno").data() == "1";
if (isFirstStop && m_waitingForFirstBreakpointToBeHit) { //!MAC: startSymbolName == data.findChild("frame").findChild("func")
if (m_waitingForFirstBreakpointToBeHit) {
m_waitingForFirstBreakpointToBeHit = false;
// //
// that's the "early stop" // that's the "early stop"
// //
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
sendCommand("info proc", GdbInfoProc); sendCommand("info thread", GdbInfoThreads);
#endif #endif
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
sendCommand("info proc", GdbInfoProc); sendCommand("info proc", GdbInfoProc);

View File

@@ -189,6 +189,7 @@ private:
void handleExecRunToFunction(const GdbResultRecord &response); void handleExecRunToFunction(const GdbResultRecord &response);
void handleInfoShared(const GdbResultRecord &response); void handleInfoShared(const GdbResultRecord &response);
void handleInfoProc(const GdbResultRecord &response); void handleInfoProc(const GdbResultRecord &response);
void handleInfoThreads(const GdbResultRecord &response);
void handleShowVersion(const GdbResultRecord &response); void handleShowVersion(const GdbResultRecord &response);
void handleQueryPwd(const GdbResultRecord &response); void handleQueryPwd(const GdbResultRecord &response);
void handleQuerySources(const GdbResultRecord &response); void handleQuerySources(const GdbResultRecord &response);