summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-06-21 15:25:52 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-06-21 14:49:06 +0000
commite3f27b3d53e94aa81088edb019f2b6383fcdc170 (patch)
treeb137e29630caa72aab7be88c6b666204fe0cd6ed /src
parent627f6a2916f1a53cc2d5a775818b0d610d1dd9c0 (diff)
downloadqt-creator-e3f27b3d53e94aa81088edb019f2b6383fcdc170.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp34
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h1
2 files changed, 22 insertions, 13 deletions
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 1fd3aef4aa..6dc3cb9d80 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -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,
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index a8dd2882e0..49a090951a 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -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();