forked from qt-creator/qt-creator
GdbEngine: Don't call blocking waitForStarted()
Connect to started() signal instead and continue setup in its handler. Handle failed to start case inside done() signal handler. Change-Id: Iaf184ed3e934b1bd5f8128a6aa9c72e9f27e0f56 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -169,6 +169,8 @@ GdbEngine::GdbEngine()
|
||||
connect(&s.useDynamicType, &BaseAspect::changed,
|
||||
this, &GdbEngine::reloadLocals);
|
||||
|
||||
connect(&m_gdbProc, &QtcProcess::started,
|
||||
this, &GdbEngine::handleGdbStarted);
|
||||
connect(&m_gdbProc, &QtcProcess::done,
|
||||
this, &GdbEngine::handleGdbDone);
|
||||
connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput,
|
||||
@@ -3865,20 +3867,10 @@ void GdbEngine::setupEngine()
|
||||
m_gdbProc.setWorkingDirectory(rp.debugger.workingDirectory);
|
||||
m_gdbProc.setEnvironment(gdbEnv);
|
||||
m_gdbProc.start();
|
||||
}
|
||||
|
||||
if (!m_gdbProc.waitForStarted()) {
|
||||
handleGdbStartFailed();
|
||||
QString msg;
|
||||
FilePath wd = m_gdbProc.workingDirectory();
|
||||
if (!wd.isReadableDir())
|
||||
msg = failedToStartMessage() + ' ' + tr("The working directory \"%1\" is not usable.")
|
||||
.arg(wd.toUserOutput());
|
||||
else
|
||||
msg = RunWorker::userMessageForProcessError(QProcess::FailedToStart, rp.debugger.command.executable());
|
||||
handleAdapterStartFailed(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
void GdbEngine::handleGdbStarted()
|
||||
{
|
||||
showMessage("GDB STARTED, INITIALIZING IT");
|
||||
runCommand({"show version", CB(handleShowVersion)});
|
||||
runCommand({"show debug-file-directory", CB(handleDebugInfoLocation)});
|
||||
@@ -3938,6 +3930,7 @@ void GdbEngine::setupEngine()
|
||||
|
||||
showStatusMessage(tr("Setting up inferior..."));
|
||||
|
||||
const DebuggerRunParameters &rp = runParameters();
|
||||
// Addint executable to modules list.
|
||||
Module module;
|
||||
module.startAddress = 0;
|
||||
@@ -4079,6 +4072,21 @@ void GdbEngine::reloadDebuggingHelpers()
|
||||
|
||||
void GdbEngine::handleGdbDone()
|
||||
{
|
||||
if (m_gdbProc.result() == ProcessResult::StartFailed) {
|
||||
handleGdbStartFailed();
|
||||
QString msg;
|
||||
const FilePath wd = m_gdbProc.workingDirectory();
|
||||
if (!wd.isReadableDir()) {
|
||||
msg = failedToStartMessage() + ' ' + tr("The working directory \"%1\" is not usable.")
|
||||
.arg(wd.toUserOutput());
|
||||
} else {
|
||||
msg = RunWorker::userMessageForProcessError(QProcess::FailedToStart,
|
||||
runParameters().debugger.command.executable());
|
||||
}
|
||||
handleAdapterStartFailed(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
const QProcess::ProcessError error = m_gdbProc.error();
|
||||
if (error != QProcess::UnknownError) {
|
||||
QString msg = RunWorker::userMessageForProcessError(error,
|
||||
|
@@ -111,6 +111,7 @@ private: ////////// General Interface //////////
|
||||
// The engine is still running just fine, but it failed to acquire a debuggee.
|
||||
void notifyInferiorSetupFailedHelper(const QString &msg);
|
||||
|
||||
void handleGdbStarted();
|
||||
void handleGdbDone();
|
||||
void readGdbStandardOutput();
|
||||
void readGdbStandardError();
|
||||
|
Reference in New Issue
Block a user