From d68f258754d4e677b53186f28145749579b88cdc Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 26 Jul 2017 09:33:26 +0200 Subject: [PATCH] Debugger: Avoid crash when attach to process fails If attaching to the current's project running executable fails due crashing inferior the run tool is cleaned up already when trying to fetch its run parameters. Circumvent by checking whether run tool is still accessible. Change-Id: I56f3d841d77d0513806a2b91357841f160f74ed3 Reviewed-by: Orgad Shaneh --- src/plugins/debugger/gdb/gdbengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 580749f2f16..fd3f8892f3d 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4034,7 +4034,10 @@ void GdbEngine::reloadDebuggingHelpers() void GdbEngine::handleGdbError(QProcess::ProcessError error) { - QString program = runParameters().debugger.executable; + QString program; + // avoid accessing invalid memory if the process crashed + if (runTool()) + program = runParameters().debugger.executable; QString msg = RunWorker::userMessageForProcessError(error, program); QString errorString = m_gdbProc.errorString(); if (!errorString.isEmpty())