From 5cde121aaa5ebe110bb397c1ffba7b5b90f82782 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 29 Oct 2021 15:10:03 +0200 Subject: [PATCH] Debugger: Enable detection of Android Studio's lldb frontend Android Studio (at least on Windows) ships an LLDBFrontend(.exe) which differs in file name and version output, so that the code in DebuggerItem::reinitializeFromFile needs to be tweakd a bit. Fixes: QTCREATORBUG-26504 Change-Id: Ic989a6110e03088148c28a7fe6248e5f836ea2ea Reviewed-by: hjk --- src/plugins/debugger/debuggeritem.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/debuggeritem.cpp b/src/plugins/debugger/debuggeritem.cpp index 3a5060cbe5c..e759d1889e7 100644 --- a/src/plugins/debugger/debuggeritem.cpp +++ b/src/plugins/debugger/debuggeritem.cpp @@ -150,7 +150,8 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *erro // except for the experimental LLDB-MI which insists on --version. QString version = "-version"; m_lastModified = m_command.lastModified(); - if (m_command.baseName().toLower().contains("lldb-mi")) + if (m_command.baseName().toLower().contains("lldb-mi") + || m_command.baseName().startsWith("LLDBFrontend")) // Comes with Android Studio version = "--version"; // We don't need to start the uVision executable to @@ -229,15 +230,16 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *erro //! \note If unable to determine the GDB ABI, no ABI is appended to m_abis here. return; } - if (output.startsWith("lldb") || output.startsWith("LLDB")) { + if (output.contains("lldb") || output.startsWith("LLDB")) { m_engineType = LldbEngineType; m_abis = Abi::abisOfBinary(m_command); // Version // Self-build binaries also emit clang and llvm revision. const QString line = output.split('\n')[0]; - if (line.startsWith(("lldb version "))) { // Linux typically. - int pos1 = int(strlen("lldb version ")); + const QString nonMacOSPrefix = "lldb version "; + if (line.contains(nonMacOSPrefix)) { // Linux typically, or some Windows builds. + int pos1 = line.indexOf(nonMacOSPrefix) + nonMacOSPrefix.length(); int pos2 = line.indexOf(' ', pos1); m_version = line.mid(pos1, pos2 - pos1); } else if (line.startsWith("lldb-") || line.startsWith("LLDB-")) { // Mac typically.