Debugger: Add our lldb to the system search paths

This way the user doesn't have to manually register lldb.exe

Change-Id: Id0a19de0962d8ba47a66a8d1909dfe2eb5ca0a6f
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Cristian Adam
2023-11-16 12:47:57 +01:00
parent 116798e544
commit 1a37da15c7
6 changed files with 23 additions and 3 deletions

View File

@@ -768,6 +768,14 @@ FilePath ICore::clazyStandaloneExecutable(const FilePath &clangBinDirectory)
return clangBinary("clazy-standalone", clangBinDirectory); return clangBinary("clazy-standalone", clangBinDirectory);
} }
/*!
\internal
*/
FilePath ICore::lldbExecutable(const Utils::FilePath &lldbBinDirectory)
{
return clangBinary("lldb", lldbBinDirectory);
}
static QString compilerString() static QString compilerString()
{ {
#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too #if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too

View File

@@ -148,6 +148,7 @@ public:
static Utils::FilePath clazyStandaloneExecutable(const Utils::FilePath &clangBinDirectory); static Utils::FilePath clazyStandaloneExecutable(const Utils::FilePath &clangBinDirectory);
static Utils::FilePath clangIncludeDirectory(const QString &clangVersion, static Utils::FilePath clangIncludeDirectory(const QString &clangVersion,
const Utils::FilePath &clangFallbackIncludeDir); const Utils::FilePath &clangFallbackIncludeDir);
static Utils::FilePath lldbExecutable(const Utils::FilePath &lldbBinDirectory);
static QStatusBar *statusBar(); static QStatusBar *statusBar();
static void saveSettings(SaveSettingsReason reason); static void saveSettings(SaveSettingsReason reason);

View File

@@ -3,6 +3,8 @@ add_qtc_plugin(Debugger
PLUGIN_DEPENDS Core CppEditor ProjectExplorer QtSupport TextEditor PLUGIN_DEPENDS Core CppEditor ProjectExplorer QtSupport TextEditor
PLUGIN_RECOMMENDS QmakeProjectManager PLUGIN_RECOMMENDS QmakeProjectManager
PLUGIN_TEST_DEPENDS QmakeProjectManager PLUGIN_TEST_DEPENDS QmakeProjectManager
DEFINES
CLANG_BINDIR="${LLVM_TOOLS_BINARY_DIR}"
SOURCES SOURCES
analyzer/analyzerbase.qrc analyzer/analyzerbase.qrc
analyzer/analyzerconstants.h analyzer/analyzerconstants.h

View File

@@ -15,6 +15,7 @@ QtcPlugin {
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" } Depends { name: "QtSupport" }
Depends { name: "TextEditor" } Depends { name: "TextEditor" }
Depends { name: "clang_defines" }
pluginRecommends: ["BinEditor"] pluginRecommends: ["BinEditor"]
pluginTestDepends: ["QmakeProjectManager"] pluginTestDepends: ["QmakeProjectManager"]

View File

@@ -6,6 +6,8 @@
#include "debuggerprotocol.h" #include "debuggerprotocol.h"
#include "debuggertr.h" #include "debuggertr.h"
#include <coreplugin/icore.h>
#include <projectexplorer/abi.h> #include <projectexplorer/abi.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
@@ -148,8 +150,9 @@ void DebuggerItem::reinitializeFromFile(QString *error, Utils::Environment *cust
// Prevent calling lldb on Windows because the lldb from the llvm package is linked against // Prevent calling lldb on Windows because the lldb from the llvm package is linked against
// python but does not contain a python dll. // python but does not contain a python dll.
const bool isAndroidNdkLldb = DebuggerItem::addAndroidLldbPythonEnv(m_command, env); const bool isAndroidNdkLldb = DebuggerItem::addAndroidLldbPythonEnv(m_command, env);
if (HostOsInfo::isWindowsHost() && m_command.fileName().startsWith("lldb") const FilePath qtcreatorLldb = Core::ICore::lldbExecutable(CLANG_BINDIR);
&& !isAndroidNdkLldb) { if (HostOsInfo::isWindowsHost() && m_command.fileName().startsWith("lldb") && !isAndroidNdkLldb
&& qtcreatorLldb != m_command) {
QString errorMessage; QString errorMessage;
m_version = winGetDLLVersion(WinDLLFileVersion, m_version = winGetDLLVersion(WinDLLFileVersion,
m_command.absoluteFilePath().path(), m_command.absoluteFilePath().path(),

View File

@@ -635,9 +635,14 @@ void DebuggerItemModel::autoDetectGdbOrLldbDebuggers(const FilePaths &searchPath
} }
FilePaths paths = searchPaths; FilePaths paths = searchPaths;
if (!searchPaths.front().needsDevice()) if (!searchPaths.front().needsDevice()) {
paths.append(searchGdbPathsFromRegistry()); paths.append(searchGdbPathsFromRegistry());
const FilePath lldb = Core::ICore::lldbExecutable(CLANG_BINDIR);
if (lldb.exists())
suspects.append(lldb);
}
paths = Utils::filteredUnique(paths); paths = Utils::filteredUnique(paths);
const auto addSuspect = [&suspects](const FilePath &entry) { const auto addSuspect = [&suspects](const FilePath &entry) {