fix: async refreshing not correctly started in lldb-server

This commit is contained in:
Roy Qu 2024-03-14 16:39:13 +08:00
parent ba9bbca010
commit a3e6d111f8
1 changed files with 15 additions and 12 deletions

View File

@ -178,7 +178,7 @@ void GDBMIDebuggerClient::runNextCmd()
if (mCmdQueue.isEmpty()) { if (mCmdQueue.isEmpty()) {
if (debugger()->useDebugServer() && mInferiorRunning && !mAsyncUpdated) { if (debugger()->useDebugServer() && mInferiorRunning && !mAsyncUpdated) {
mAsyncUpdated = true; mAsyncUpdated = true;
//We must force refresh the response from the lldb-server.... //We must force refresh the running state response from the lldb-server....
QTimer::singleShot(500,this,&GDBMIDebuggerClient::asyncUpdate); QTimer::singleShot(500,this,&GDBMIDebuggerClient::asyncUpdate);
} }
return; return;
@ -791,17 +791,14 @@ void GDBMIDebuggerClient::processExecAsyncRecord(const QByteArray &line)
} }
runInferiorStoppedHook(); runInferiorStoppedHook();
if (reason.isEmpty()) { if (reason.isEmpty()) {
QMutexLocker locker(&mCmdQueueMutex); return;
foreach (const PGDBMICommand& cmd, mCmdQueue) { // QMutexLocker locker(&mCmdQueueMutex);
//gdb-server connected, just ignore it // foreach (const PGDBMICommand& cmd, mCmdQueue) {
if (cmd->command=="-exec-continue") // //gdb-server connected, just ignore it
return; // if (cmd->command=="-exec-continue")
} // return;
// }
} }
// if (mCurrentCmd && mCurrentCmd->source == DebugCommandSource::Console)
// emit inferiorStopped(mCurrentFile, mCurrentLine, false);
// else
// emit inferiorStopped(mCurrentFile, mCurrentLine, true);
emit inferiorStopped(mCurrentFile, mCurrentLine, false); emit inferiorStopped(mCurrentFile, mCurrentLine, false);
} }
} }
@ -836,6 +833,9 @@ void GDBMIDebuggerClient::processResultRecord(const QByteArray &line)
} }
if (line.startsWith("^done") if (line.startsWith("^done")
|| line.startsWith("^running")) { || line.startsWith("^running")) {
if (line.startsWith("^running")) {
mInferiorRunning = true;
}
int pos = line.indexOf(','); int pos = line.indexOf(',');
if (pos>=0) { if (pos>=0) {
QByteArray result = line.mid(pos+1); QByteArray result = line.mid(pos+1);
@ -962,7 +962,10 @@ void GDBMIDebuggerClient::asyncUpdate()
QMutexLocker locker(&mCmdQueueMutex); QMutexLocker locker(&mCmdQueueMutex);
if (mCmdQueue.isEmpty()) { if (mCmdQueue.isEmpty()) {
//postCommand("-var-update"," --all-values *",DebugCommandSource::HeartBeat); //postCommand("-var-update"," --all-values *",DebugCommandSource::HeartBeat);
postCommand("-stack-info-frame","",DebugCommandSource::HeartBeat); if (clientType() == DebuggerType::GDB)
postCommand("-gdb-show","annotate",DebugCommandSource::HeartBeat);
else
postCommand("-stack-info-depth","annotate",DebugCommandSource::HeartBeat);
} }
mAsyncUpdated = false; mAsyncUpdated = false;
} }