lldb-server compatibility

This commit is contained in:
Roy Qu 2024-03-11 20:34:02 +08:00
parent e2d5a18c3f
commit 3e0db148ae
2 changed files with 12 additions and 7 deletions

View File

@ -98,7 +98,7 @@ bool Debugger::startClient(int compilerSetIndex,
else else
setDebuggerType(DebuggerType::GDB); setDebuggerType(DebuggerType::GDB);
// force to lldb-server if using lldb-mi, which creates new console but does not bind inferiors stdio to the new console on Windows. // force to lldb-server if using lldb-mi, which creates new console but does not bind inferiors stdio to the new console on Windows.
setUseDebugServer(pSettings->debugger().useGDBServer()); setUseDebugServer(pSettings->debugger().useGDBServer() || mDebuggerType == DebuggerType::LLDB_MI);
mExecuting = true; mExecuting = true;
QString debuggerPath = compilerSet->debugger(); QString debuggerPath = compilerSet->debugger();
//QFile debuggerProgram(debuggerPath); //QFile debuggerProgram(debuggerPath);
@ -2335,7 +2335,7 @@ void DebugTarget::run()
mGDBServer, mGDBServer,
"gdbserver", "gdbserver",
QString("localhost:%1").arg(mPort), QString("localhost:%1").arg(mPort),
mInferior, //mInferior,
} + mArguments; } + mArguments;
else else
execArgs = QStringList{ execArgs = QStringList{

View File

@ -165,7 +165,7 @@ void GDBMIDebuggerClient::runNextCmd()
if (mCmdQueue.isEmpty()) { if (mCmdQueue.isEmpty()) {
if (debugger()->useDebugServer() && mInferiorRunning && !mAsyncUpdated) { if (debugger()->useDebugServer() && mInferiorRunning && !mAsyncUpdated) {
mAsyncUpdated = true; mAsyncUpdated = true;
QTimer::singleShot(50,this,&GDBMIDebuggerClient::asyncUpdate); QTimer::singleShot(5000,this,&GDBMIDebuggerClient::asyncUpdate);
} }
return; return;
} }
@ -945,7 +945,8 @@ 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);
} }
mAsyncUpdated = false; mAsyncUpdated = false;
} }
@ -974,20 +975,24 @@ void GDBMIDebuggerClient::initialize(const QString& inferior, bool hasSymbols)
} else { } else {
postCommand("-file-exec-file", '"' + inferior + '"'); postCommand("-file-exec-file", '"' + inferior + '"');
} }
if (debugger()->useDebugServer()) {
postCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort()));
}
} }
void GDBMIDebuggerClient::runInferior(bool hasBreakpoints) void GDBMIDebuggerClient::runInferior(bool hasBreakpoints)
{ {
if (debugger()->useDebugServer()) { if (debugger()->useDebugServer()) {
postCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort()));
if (!hasBreakpoints) { if (!hasBreakpoints) {
postCommand("-break-insert","-t main"); postCommand("-break-insert","-t main");
} }
if (pSettings->executor().useParams()) { if (pSettings->executor().useParams()) {
postCommand("-exec-arguments", pSettings->executor().params()); postCommand("-exec-arguments", pSettings->executor().params());
} }
postCommand("-exec-continue",""); if (clientType()==DebuggerType::LLDB_MI) {
postCommand("-exec-run","");
} else
postCommand("-exec-continue","");
} else { } else {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
postCommand("-gdb-set", "new-console on"); postCommand("-gdb-set", "new-console on");