[Lldb-commits] [lldb] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (PR #135536)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/135536 Both the `CPlusPlusLanguage` plugins and the Swift language plugin already assume the `sc != nullptr`. And all `FormatEntity` callsites of `GetFunctionDisplayName` already check for nullptr before passing `sc`. This patch makes this pre-condition explicit by changing the parameter to `const SymbolContext &`. This will help with some upcoming changes in this area. >From bad7ab11a89d82bc3d5090f84a17695daf91482c Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 13 Apr 2025 11:08:09 +0100 Subject: [PATCH] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference --- lldb/include/lldb/Target/Language.h | 2 +- lldb/source/Core/FormatEntity.cpp | 7 --- lldb/source/Target/Language.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index b699a90aff8e4..da2c2cc451dae 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -268,7 +268,7 @@ class Language : public PluginInterface { // the reference has never been assigned virtual bool IsUninitializedReference(ValueObject &valobj); - virtual bool GetFunctionDisplayName(const SymbolContext *sc, + virtual bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index a9370595c11e7..7130248100c6f 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1719,7 +1719,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); if (language_plugin_handled) { s << ss.GetString(); @@ -1754,7 +1754,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, ss); if (language_plugin_handled) { @@ -1789,7 +1789,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, + ss); if (language_plugin_handled) { s << ss.GetString(); diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index a75894ffa4b3b..86754c251cd93 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -510,7 +510,7 @@ bool Language::IsNilReference(ValueObject &valobj) { return false; } bool Language::IsUninitializedReference(ValueObject &valobj) { return false; } -bool Language::GetFunctionDisplayName(const SymbolContext *sc, +bool Language::GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (PR #135536)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes Both the `CPlusPlusLanguage` plugins and the Swift language plugin already assume the `sc != nullptr`. And all `FormatEntity` callsites of `GetFunctionDisplayName` already check for nullptr before passing `sc`. This patch makes this pre-condition explicit by changing the parameter to `const SymbolContext &`. This will help with some upcoming changes in this area. --- Full diff: https://github.com/llvm/llvm-project/pull/135536.diff 3 Files Affected: - (modified) lldb/include/lldb/Target/Language.h (+1-1) - (modified) lldb/source/Core/FormatEntity.cpp (+4-3) - (modified) lldb/source/Target/Language.cpp (+1-1) ``diff diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index b699a90aff8e4..da2c2cc451dae 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -268,7 +268,7 @@ class Language : public PluginInterface { // the reference has never been assigned virtual bool IsUninitializedReference(ValueObject &valobj); - virtual bool GetFunctionDisplayName(const SymbolContext *sc, + virtual bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index a9370595c11e7..7130248100c6f 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1719,7 +1719,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); if (language_plugin_handled) { s << ss.GetString(); @@ -1754,7 +1754,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, ss); if (language_plugin_handled) { @@ -1789,7 +1789,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, + ss); if (language_plugin_handled) { s << ss.GetString(); diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index a75894ffa4b3b..86754c251cd93 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -510,7 +510,7 @@ bool Language::IsNilReference(ValueObject &valobj) { return false; } bool Language::IsUninitializedReference(ValueObject &valobj) { return false; } -bool Language::GetFunctionDisplayName(const SymbolContext *sc, +bool Language::GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) { `` https://github.com/llvm/llvm-project/pull/135536 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (PR #135536)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/135536 >From e156553442b071e842e97bbad0ad89d03d2183ca Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 13 Apr 2025 11:08:09 +0100 Subject: [PATCH] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference --- lldb/include/lldb/Target/Language.h| 2 +- lldb/source/Core/FormatEntity.cpp | 7 --- .../Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 2 +- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h | 2 +- lldb/source/Target/Language.cpp| 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index b699a90aff8e4..da2c2cc451dae 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -268,7 +268,7 @@ class Language : public PluginInterface { // the reference has never been assigned virtual bool IsUninitializedReference(ValueObject &valobj); - virtual bool GetFunctionDisplayName(const SymbolContext *sc, + virtual bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index a9370595c11e7..7130248100c6f 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1719,7 +1719,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); if (language_plugin_handled) { s << ss.GetString(); @@ -1754,7 +1754,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, ss); if (language_plugin_handled) { @@ -1789,7 +1789,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, + ss); if (language_plugin_handled) { s << ss.GetString(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a6fdf66f13e4d..ae9d6ea64d0ff 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1757,7 +1757,7 @@ static bool PrintFunctionNameWithArgs(Stream &s, } bool CPlusPlusLanguage::GetFunctionDisplayName( -const SymbolContext *sc, const ExecutionContext *exe_ctx, +const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) { switch (representation) { case FunctionNameRepresentation::eNameWithArgs: { diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h index 623d481bf117f..54f5a94388b92 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -138,7 +138,7 @@ class CPlusPlusLanguage : public Language { ConstString GetDemangledFunctionNameWithoutArguments(Mangled mangled) const override; - bool GetFunctionDisplayName(const SymbolContext *sc, + bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) override; diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index a75894ffa4b3b..86754c251cd93 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -510,7 +510,7 @@ bool Language::IsNilReference(ValueObject &valobj) { return false; } bool Language::IsUninitializedReference(ValueObject &valobj) { return false; } -bool Language::GetFunctionDisplayName(const SymbolContext *sc, +bool Language::GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation,
[Lldb-commits] [lldb] [lldb][lldb-dap] explicitly set the expr as an alias for expression. (PR #134562)
https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/134562 >From be69e129667cac2ab75597bb3ed02f7d6da39bce Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 6 Apr 2025 01:36:12 +0100 Subject: [PATCH 1/3] [lldb][lldb-dap] explicitly set the expr as an alias for expression. dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI --- lldb/source/Interpreter/CommandInterpreter.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 112d2f20fda41..a4071f5f0a602 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -444,6 +444,7 @@ void CommandInterpreter::Initialize() { if (cmd_obj_sp) { // Ensure `e` runs `expression`. AddAlias("e", cmd_obj_sp); +AddAlias("expr", cmd_obj_sp); AddAlias("call", cmd_obj_sp, "--")->SetHelpLong(""); CommandAlias *parray_alias = AddAlias("parray", cmd_obj_sp, "--element-count %1 --"); @@ -1376,7 +1377,9 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(cmd) != m_alias_dict.end(); + std::string alias_name; + return GetAliasFullName(cmd, alias_name); + // return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { >From 7deb08ff1cf11e854f45f6dfaad30a640eb6b3c3 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 6 Apr 2025 23:02:04 +0100 Subject: [PATCH 2/3] [lldb][lldb-dap] explicitly set the expr as an alias for expression. dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI --- lldb/source/Interpreter/CommandInterpreter.cpp | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index a4071f5f0a602..2e4c40ca53176 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1377,9 +1377,14 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - std::string alias_name; - return GetAliasFullName(cmd, alias_name); - // return m_alias_dict.find(cmd) != m_alias_dict.end(); + const bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); + if (exact_match) +return true; + + StringList matches; + const int num_cmd_matches = + AddNamesMatchingPartialString(m_command_dict, cmd, matches); + return num_cmd_matches > 0; } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { >From ea645d2a4964f5b7f5cbd77f0b1e9bd07699ac23 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sun, 13 Apr 2025 15:16:30 +0100 Subject: [PATCH 3/3] [lldb][lldb-dap] Revert matching alias partial string --- lldb/source/Interpreter/CommandInterpreter.cpp | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 2e4c40ca53176..0e063924388a4 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1377,14 +1377,7 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - const bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); - if (exact_match) -return true; - - StringList matches; - const int num_cmd_matches = - AddNamesMatchingPartialString(m_command_dict, cmd, matches); - return num_cmd_matches > 0; + return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][lldb-dap] explicitly set the expr as an alias for expression. (PR #134562)
da-viper wrote: > So we need a better solution to this DAP problem than just adding aliases. How about for aliases that are mentioned in the documentation, we explicitly set those as aliases. https://github.com/llvm/llvm-project/pull/134562 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/135499 >From 70021811ab6551ed38d04a2f740b9e6b330e3290 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 12 Apr 2025 12:57:08 -0300 Subject: [PATCH] [CI] monolithic-linux improvements Some improvements to monolithic-linux CI: 1) Add correct configuration and dependencies for LLDB testing which is actually relevant for clang changes. 2) Skip clang installation and separate configuration for runtimes. They will be build with just built clang either way. This helps in avoiding building the runtimes twice in case LLDB is tested. 3) Make sure any generated clang reproducers end up as artifacts. 4) Set up llvm-symbolizer environment variable so that its preferred over any symbolizer just built, as even if it probably works correctly, it can be much slower when built for debugging. 5) Add all projects as dependencies of `.ci`, to make sure everything is tested when it changes. --- .ci/compute_projects.py | 10 +++-- .ci/compute_projects_test.py | 13 +++ .ci/monolithic-linux.sh | 72 lldb/test/requirements.txt | 2 + 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py index ff43547c9bbe5..17a2136a270d5 100644 --- a/.ci/compute_projects.py +++ b/.ci/compute_projects.py @@ -52,6 +52,9 @@ "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"}, "clang-tools-extra": {"libc"}, "mlir": {"flang"}, +# Test everything if ci scripts are changed. +# FIXME: Figure out what is missing and add here. +".ci": {"llvm", "clang", "lld", "lldb"}, } DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}} @@ -130,12 +133,11 @@ def _add_dependencies(projects: Set[str]) -> Set[str]: def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]: projects_to_test = set() for modified_project in modified_projects: -# Skip all projects where we cannot run tests. -if modified_project not in PROJECT_CHECK_TARGETS: -continue if modified_project in RUNTIMES: continue -projects_to_test.add(modified_project) +# Skip all projects where we cannot run tests. +if modified_project in PROJECT_CHECK_TARGETS: +projects_to_test.add(modified_project) if modified_project not in DEPENDENTS_TO_TEST: continue for dependent_project in DEPENDENTS_TO_TEST[modified_project]: diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py index e787fd8133c86..1ab1c82498932 100644 --- a/.ci/compute_projects_test.py +++ b/.ci/compute_projects_test.py @@ -188,6 +188,19 @@ def test_exclude_gn(self): self.assertEqual(env_variables["runtimes_to_build"], "") self.assertEqual(env_variables["runtimes_check_targets"], "") + def test_ci(self): +env_variables = compute_projects.get_env_variables( +[".ci/compute_projects.py"], "Linux" +) +self.assertEqual(env_variables["projects_to_build"], + "clang;lld;llvm;lldb") +self.assertEqual(env_variables["project_check_targets"], "check-clang + check-lld check-llvm check-lldb") +self.assertEqual(env_variables["runtimes_to_build"], + "libcxx;libcxxabi;libunwind") +self.assertEqual(env_variables["runtimes_check_targets"], "check-cxx + check-cxxabi check-unwind") + if __name__ == "__main__": unittest.main() diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 13c7a93c364db..d7c9ac147677d 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -18,7 +18,6 @@ set -o pipefail MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}" BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}" -INSTALL_DIR="${BUILD_DIR}/install" rm -rf "${BUILD_DIR}" ccache --zero-stats @@ -28,10 +27,14 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then ccache --clear fi +mkdir -p artifacts/reproducers + +# Make sure any clang reproducers will end up as artifacts. +export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers` + function at-exit { retcode=$? - mkdir -p artifacts ccache --print-stats > artifacts/ccache_stats.txt # If building fails there will be no results files. @@ -49,17 +52,28 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" + export PIP_BREAK_SYSTEM_PACKAGES=1 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# Set the system llvm-symbolizer as prefer
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Matheus Izvekov (mizvekov) Changes Some improvements to monolithic-linux CI: 1) Add correct configuration and dependencies for LLDB testing which is actually relevant for clang changes. 2) Skip clang installation and separate configuration for runtimes. They will be built with the just built clang either way. This avoids building the runtimes twice when LLDB is also tested. 3) Make sure any generated clang reproducers end up as artifacts. 4) Set up llvm-symbolizer environment variable so that its preferred over any symbolizer just built, as it can be much slower when built for debugging. 5) Add all projects as dependencies of `.ci`, to make sure everything is tested when it changes. --- Full diff: https://github.com/llvm/llvm-project/pull/135499.diff 4 Files Affected: - (modified) .ci/compute_projects.py (+6-4) - (modified) .ci/compute_projects_test.py (+13) - (modified) .ci/monolithic-linux.sh (+32-40) - (modified) lldb/test/requirements.txt (+2) ``diff diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py index ff43547c9bbe5..17a2136a270d5 100644 --- a/.ci/compute_projects.py +++ b/.ci/compute_projects.py @@ -52,6 +52,9 @@ "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"}, "clang-tools-extra": {"libc"}, "mlir": {"flang"}, +# Test everything if ci scripts are changed. +# FIXME: Figure out what is missing and add here. +".ci": {"llvm", "clang", "lld", "lldb"}, } DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}} @@ -130,12 +133,11 @@ def _add_dependencies(projects: Set[str]) -> Set[str]: def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]: projects_to_test = set() for modified_project in modified_projects: -# Skip all projects where we cannot run tests. -if modified_project not in PROJECT_CHECK_TARGETS: -continue if modified_project in RUNTIMES: continue -projects_to_test.add(modified_project) +# Skip all projects where we cannot run tests. +if modified_project in PROJECT_CHECK_TARGETS: +projects_to_test.add(modified_project) if modified_project not in DEPENDENTS_TO_TEST: continue for dependent_project in DEPENDENTS_TO_TEST[modified_project]: diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py index e787fd8133c86..1ab1c82498932 100644 --- a/.ci/compute_projects_test.py +++ b/.ci/compute_projects_test.py @@ -188,6 +188,19 @@ def test_exclude_gn(self): self.assertEqual(env_variables["runtimes_to_build"], "") self.assertEqual(env_variables["runtimes_check_targets"], "") + def test_ci(self): +env_variables = compute_projects.get_env_variables( +[".ci/compute_projects.py"], "Linux" +) +self.assertEqual(env_variables["projects_to_build"], + "clang;lld;llvm;lldb") +self.assertEqual(env_variables["project_check_targets"], "check-clang + check-lld check-llvm check-lldb") +self.assertEqual(env_variables["runtimes_to_build"], + "libcxx;libcxxabi;libunwind") +self.assertEqual(env_variables["runtimes_check_targets"], "check-cxx + check-cxxabi check-unwind") + if __name__ == "__main__": unittest.main() diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 13c7a93c364db..d7c9ac147677d 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -18,7 +18,6 @@ set -o pipefail MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}" BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}" -INSTALL_DIR="${BUILD_DIR}/install" rm -rf "${BUILD_DIR}" ccache --zero-stats @@ -28,10 +27,14 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then ccache --clear fi +mkdir -p artifacts/reproducers + +# Make sure any clang reproducers will end up as artifacts. +export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers` + function at-exit { retcode=$? - mkdir -p artifacts ccache --print-stats > artifacts/ccache_stats.txt # If building fails there will be no results files. @@ -49,17 +52,28 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" + export PIP_BREAK_SYSTEM_PACKAGES=1 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# Set the system llvm-symbolizer as preferred. +export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` +[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!" + +# Set up all runtimes either way. libcxx is a
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
@@ -130,12 +132,11 @@ def _add_dependencies(projects: Set[str]) -> Set[str]: def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]: projects_to_test = set() for modified_project in modified_projects: -# Skip all projects where we cannot run tests. -if modified_project not in PROJECT_CHECK_TARGETS: -continue if modified_project in RUNTIMES: continue -projects_to_test.add(modified_project) +# Skip all projects where we cannot run tests. mizvekov wrote: I added a test for '.ci'. https://github.com/llvm/llvm-project/pull/135499 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
https://github.com/eronnen created https://github.com/llvm/llvm-project/pull/135544 the argument is written as `debugAdapterHostname` in package.json but used as `debugAdapterHost` >From 2428391183090dd68a5433b8c3a89bf8ad326625 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 13 Apr 2025 14:33:17 +0200 Subject: [PATCH] fix inconsistent debugAdapterHostname parameter name --- lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts| 2 +- lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts index e23d717a70101..3a86d1f3f418f 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts @@ -211,7 +211,7 @@ export class LLDBDapDescriptorFactory if (session.configuration.debugAdapterPort) { return new vscode.DebugAdapterServer( session.configuration.debugAdapterPort, -session.configuration.debugAdapterHost, +session.configuration.debugAdapterHostname, ); } diff --git a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts index 0272509ee55f7..8d92139c02a00 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts @@ -32,11 +32,11 @@ export class LLDBDapConfigurationProvider ): Promise { try { if ( -"debugAdapterHost" in debugConfiguration && +"debugAdapterHostname" in debugConfiguration && !("debugAdapterPort" in debugConfiguration) ) { throw new ErrorWithNotification( - "A debugAdapterPort must be provided when debugAdapterHost is set. Please update your launch configuration.", + "A debugAdapterPort must be provided when debugAdapterHostname is set. Please update your launch configuration.", new ConfigureButton(), ); } @@ -83,7 +83,7 @@ export class LLDBDapConfigurationProvider // and list of arguments. delete debugConfiguration.debugAdapterExecutable; delete debugConfiguration.debugAdapterArgs; - debugConfiguration.debugAdapterHost = serverInfo.host; + debugConfiguration.debugAdapterHostname = serverInfo.host; debugConfiguration.debugAdapterPort = serverInfo.port; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ely Ronnen (eronnen) Changes the argument is written as `debugAdapterHostname` in package.json but used as `debugAdapterHost` --- Full diff: https://github.com/llvm/llvm-project/pull/135544.diff 2 Files Affected: - (modified) lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts (+1-1) - (modified) lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts (+3-3) ``diff diff --git a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts index e23d717a70101..3a86d1f3f418f 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts @@ -211,7 +211,7 @@ export class LLDBDapDescriptorFactory if (session.configuration.debugAdapterPort) { return new vscode.DebugAdapterServer( session.configuration.debugAdapterPort, -session.configuration.debugAdapterHost, +session.configuration.debugAdapterHostname, ); } diff --git a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts index 0272509ee55f7..8d92139c02a00 100644 --- a/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/debug-configuration-provider.ts @@ -32,11 +32,11 @@ export class LLDBDapConfigurationProvider ): Promise { try { if ( -"debugAdapterHost" in debugConfiguration && +"debugAdapterHostname" in debugConfiguration && !("debugAdapterPort" in debugConfiguration) ) { throw new ErrorWithNotification( - "A debugAdapterPort must be provided when debugAdapterHost is set. Please update your launch configuration.", + "A debugAdapterPort must be provided when debugAdapterHostname is set. Please update your launch configuration.", new ConfigureButton(), ); } @@ -83,7 +83,7 @@ export class LLDBDapConfigurationProvider // and list of arguments. delete debugConfiguration.debugAdapterExecutable; delete debugConfiguration.debugAdapterArgs; - debugConfiguration.debugAdapterHost = serverInfo.host; + debugConfiguration.debugAdapterHostname = serverInfo.host; debugConfiguration.debugAdapterPort = serverInfo.port; } } `` https://github.com/llvm/llvm-project/pull/135544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] fix inconsistent debugAdapterHostname argument name (PR #135544)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/135544 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [CI] monolithic-linux improvements (PR #135499)
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/135499 >From 456d2fd5f7341eaee6278231b8024b4608d7dc53 Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sat, 12 Apr 2025 12:57:08 -0300 Subject: [PATCH] [CI] monolithic-linux improvements Some improvements to monolithic-linux CI: 1) Add correct configuration and dependencies for LLDB testing which is actually relevant for clang changes. 2) Skip clang installation and separate configuration for runtimes. They will be build with just built clang either way. This helps in avoiding building the runtimes twice in case LLDB is tested. 3) Make sure any generated clang reproducers end up as artifacts. 4) Set up llvm-symbolizer environment variable so that its preferred over any symbolizer just built, as even if it probably works correctly, it can be much slower when built for debugging. 5) Add all projects as dependencies of `.ci`, to make sure everything is tested when it changes. --- .ci/compute_projects.py | 10 +++-- .ci/compute_projects_test.py | 13 +++ .ci/monolithic-linux.sh | 72 lldb/test/requirements.txt | 2 + 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py index ff43547c9bbe5..17a2136a270d5 100644 --- a/.ci/compute_projects.py +++ b/.ci/compute_projects.py @@ -52,6 +52,9 @@ "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"}, "clang-tools-extra": {"libc"}, "mlir": {"flang"}, +# Test everything if ci scripts are changed. +# FIXME: Figure out what is missing and add here. +".ci": {"llvm", "clang", "lld", "lldb"}, } DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}} @@ -130,12 +133,11 @@ def _add_dependencies(projects: Set[str]) -> Set[str]: def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]: projects_to_test = set() for modified_project in modified_projects: -# Skip all projects where we cannot run tests. -if modified_project not in PROJECT_CHECK_TARGETS: -continue if modified_project in RUNTIMES: continue -projects_to_test.add(modified_project) +# Skip all projects where we cannot run tests. +if modified_project in PROJECT_CHECK_TARGETS: +projects_to_test.add(modified_project) if modified_project not in DEPENDENTS_TO_TEST: continue for dependent_project in DEPENDENTS_TO_TEST[modified_project]: diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py index e787fd8133c86..1ab1c82498932 100644 --- a/.ci/compute_projects_test.py +++ b/.ci/compute_projects_test.py @@ -188,6 +188,19 @@ def test_exclude_gn(self): self.assertEqual(env_variables["runtimes_to_build"], "") self.assertEqual(env_variables["runtimes_check_targets"], "") + def test_ci(self): +env_variables = compute_projects.get_env_variables( +[".ci/compute_projects.py"], "Linux" +) +self.assertEqual(env_variables["projects_to_build"], + "clang;lld;llvm;lldb") +self.assertEqual(env_variables["project_check_targets"], "check-clang + check-lld check-llvm check-lldb") +self.assertEqual(env_variables["runtimes_to_build"], + "libcxx;libcxxabi;libunwind") +self.assertEqual(env_variables["runtimes_check_targets"], "check-cxx + check-cxxabi check-unwind") + if __name__ == "__main__": unittest.main() diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 13c7a93c364db..d7c9ac147677d 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -18,7 +18,6 @@ set -o pipefail MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}" BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}" -INSTALL_DIR="${BUILD_DIR}/install" rm -rf "${BUILD_DIR}" ccache --zero-stats @@ -28,10 +27,14 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then ccache --clear fi +mkdir -p artifacts/reproducers + +# Make sure any clang reproducers will end up as artifacts. +export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers` + function at-exit { retcode=$? - mkdir -p artifacts ccache --print-stats > artifacts/ccache_stats.txt # If building fails there will be no results files. @@ -49,17 +52,28 @@ trap at-exit EXIT projects="${1}" targets="${2}" +runtimes="${3}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" echo "--- cmake" + export PIP_BREAK_SYSTEM_PACKAGES=1 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt + +# Set the system llvm-symbolizer as prefer
[Lldb-commits] [lldb] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (PR #135536)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/135536 >From e156553442b071e842e97bbad0ad89d03d2183ca Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 13 Apr 2025 11:08:09 +0100 Subject: [PATCH 1/2] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference --- lldb/include/lldb/Target/Language.h| 2 +- lldb/source/Core/FormatEntity.cpp | 7 --- .../Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 2 +- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h | 2 +- lldb/source/Target/Language.cpp| 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index b699a90aff8e4..da2c2cc451dae 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -268,7 +268,7 @@ class Language : public PluginInterface { // the reference has never been assigned virtual bool IsUninitializedReference(ValueObject &valobj); - virtual bool GetFunctionDisplayName(const SymbolContext *sc, + virtual bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index a9370595c11e7..7130248100c6f 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1719,7 +1719,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); if (language_plugin_handled) { s << ss.GetString(); @@ -1754,7 +1754,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, ss); if (language_plugin_handled) { @@ -1789,7 +1789,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, + ss); if (language_plugin_handled) { s << ss.GetString(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a6fdf66f13e4d..ae9d6ea64d0ff 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1757,7 +1757,7 @@ static bool PrintFunctionNameWithArgs(Stream &s, } bool CPlusPlusLanguage::GetFunctionDisplayName( -const SymbolContext *sc, const ExecutionContext *exe_ctx, +const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) { switch (representation) { case FunctionNameRepresentation::eNameWithArgs: { diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h index 623d481bf117f..54f5a94388b92 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -138,7 +138,7 @@ class CPlusPlusLanguage : public Language { ConstString GetDemangledFunctionNameWithoutArguments(Mangled mangled) const override; - bool GetFunctionDisplayName(const SymbolContext *sc, + bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) override; diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index a75894ffa4b3b..86754c251cd93 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -510,7 +510,7 @@ bool Language::IsNilReference(ValueObject &valobj) { return false; } bool Language::IsUninitializedReference(ValueObject &valobj) { return false; } -bool Language::GetFunctionDisplayName(const SymbolContext *sc, +bool Language::GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation,
[Lldb-commits] [lldb] 52e45a7 - [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (#135536)
Author: Michael Buch Date: 2025-04-13T23:19:26+01:00 New Revision: 52e45a79ad24f8a2347a5566e6abaa207918df62 URL: https://github.com/llvm/llvm-project/commit/52e45a79ad24f8a2347a5566e6abaa207918df62 DIFF: https://github.com/llvm/llvm-project/commit/52e45a79ad24f8a2347a5566e6abaa207918df62.diff LOG: [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (#135536) Both the `CPlusPlusLanguage` plugins and the Swift language plugin already assume the `sc != nullptr`. And all `FormatEntity` callsites of `GetFunctionDisplayName` already check for nullptr before passing `sc`. This patch makes this pre-condition explicit by changing the parameter to `const SymbolContext &`. This will help with some upcoming changes in this area. Added: Modified: lldb/include/lldb/Target/Language.h lldb/source/Core/FormatEntity.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h lldb/source/Target/Language.cpp Removed: diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index b699a90aff8e4..da2c2cc451dae 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -268,7 +268,7 @@ class Language : public PluginInterface { // the reference has never been assigned virtual bool IsUninitializedReference(ValueObject &valobj); - virtual bool GetFunctionDisplayName(const SymbolContext *sc, + virtual bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index a9370595c11e7..7130248100c6f 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1719,7 +1719,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss); if (language_plugin_handled) { s << ss.GetString(); @@ -1754,7 +1754,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs, ss); if (language_plugin_handled) { @@ -1789,7 +1789,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s, if (language_plugin) language_plugin_handled = language_plugin->GetFunctionDisplayName( - sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss); + *sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, + ss); if (language_plugin_handled) { s << ss.GetString(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a6fdf66f13e4d..8c05f092dec71 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1757,20 +1757,18 @@ static bool PrintFunctionNameWithArgs(Stream &s, } bool CPlusPlusLanguage::GetFunctionDisplayName( -const SymbolContext *sc, const ExecutionContext *exe_ctx, +const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s) { switch (representation) { case FunctionNameRepresentation::eNameWithArgs: { -assert(sc); - // Print the function name with arguments in it -if (sc->function) - return PrintFunctionNameWithArgs(s, exe_ctx, *sc); +if (sc.function) + return PrintFunctionNameWithArgs(s, exe_ctx, sc); -if (!sc->symbol) +if (!sc.symbol) return false; -const char *cstr = sc->symbol->GetName().AsCString(nullptr); +const char *cstr = sc.symbol->GetName().AsCString(nullptr); if (!cstr) return false; diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h index 623d481bf117f..54f5a94388b92 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -138,7 +138,7 @@ class CPlusPlusLanguage : public Language { ConstString GetDemangledFunctionNameWithoutArguments(Mangled mangled) const override; - bool GetFunctionDisplayName(const SymbolContext *sc, + bool GetFunctionDis
[Lldb-commits] [lldb] 1e153b7 - [lldb][Format] Display only the inlined frame name in backtraces if available (#135343)
Author: Michael Buch Date: 2025-04-13T23:21:52+01:00 New Revision: 1e153b782ea3054c02dd0016314fca11a5d781da URL: https://github.com/llvm/llvm-project/commit/1e153b782ea3054c02dd0016314fca11a5d781da DIFF: https://github.com/llvm/llvm-project/commit/1e153b782ea3054c02dd0016314fca11a5d781da.diff LOG: [lldb][Format] Display only the inlined frame name in backtraces if available (#135343) When a frame is inlined, LLDB will display its name in backtraces as follows: ``` * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.3 * frame #0: 0x00010398 a.out`func() [inlined] baz(x=10) at inline.cpp:1:42 frame #1: 0x00010398 a.out`func() [inlined] bar() at inline.cpp:2:37 frame #2: 0x00010398 a.out`func() at inline.cpp:4:15 frame #3: 0x000103c0 a.out`main at inline.cpp:7:5 frame #4: 0x00026eb29ab8 dyld`start + 6812 ``` The longer the names get the more confusing this gets because the first function name that appears is the parent frame. My assumption (which may need some more surveying) is that for the majority of cases we only care about the actual frame name (not the parent). So this patch removes all the special logic that prints the parent frame. Another quirk of the current format is that the inlined frame name does not abide by the `${function.name-XXX}` format variables. We always just print the raw demangled name. With this patch, we would format the inlined frame name according to the `frame-format` setting (see the test-cases). If we really want to have the `parentFrame [inlined] inlinedFrame` format, we could expose it through a new `frame-format` variable (e..g., `${function.inlined-at-name}` and let the user decide where to place things. Added: Modified: lldb/include/lldb/Symbol/SymbolContext.h lldb/source/Core/FormatEntity.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Symbol/SymbolContext.cpp lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp lldb/test/Shell/Recognizer/verbose_trap-in-stl-max-depth.test lldb/test/Shell/Settings/TestFrameFormatName.test Removed: diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 8b6317c6f33c2..4f8405f1f0db5 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -307,6 +307,13 @@ class SymbolContext { SymbolContext &next_frame_sc, Address &inlined_frame_addr) const; + /// If available, will return the function name according to the specified + /// mangling preference. If this object represents an inlined function, + /// returns the name of the inlined function. Returns nullptr if no function + /// name could be determined. + const char *GetPossiblyInlinedFunctionName( + Mangled::NamePreference mangling_preference) const; + // Member variables lldb::TargetSP target_sp; ///< The Target for a given query lldb::ModuleSP module_sp; ///< The Module for a given query diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 7130248100c6f..2392edb78d2ce 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1147,19 +1147,6 @@ static void PrettyPrintFunctionNameWithArgs(Stream &out_stream, out_stream.PutChar(')'); } -static void FormatInlinedBlock(Stream &out_stream, Block *block) { - if (!block) -return; - Block *inline_block = block->GetContainingInlinedBlock(); - if (inline_block) { -if (const InlineFunctionInfo *inline_info = -inline_block->GetInlinedFunctionInfo()) { - out_stream.PutCString(" [inlined] "); - inline_info->GetName().Dump(&out_stream); -} - } -} - static VariableListSP GetFunctionVariableList(const SymbolContext &sc) { assert(sc.function); @@ -1170,22 +1157,6 @@ static VariableListSP GetFunctionVariableList(const SymbolContext &sc) { return sc.function->GetBlock(true).GetBlockVariableList(true); } -static char const *GetInlinedFunctionName(const SymbolContext &sc) { - if (!sc.block) -return nullptr; - - const Block *inline_block = sc.block->GetContainingInlinedBlock(); - if (!inline_block) -return nullptr; - - const InlineFunctionInfo *inline_info = - inline_block->GetInlinedFunctionInfo(); - if (!inline_info) -return nullptr; - - return inline_info->GetName().AsCString(nullptr); -} - static bool PrintFunctionNameWithArgs(Stream &s, const ExecutionContext *exe_ctx, const SymbolContext &sc) { @@ -1194,16 +1165,11 @@ static bool PrintFunctionNameWithArgs(Stream &s, ExecutionContextScope *exe_scope =
[Lldb-commits] [lldb] a3f8359 - [lldb][test] Fix NativePDB/inline_sites_live.cpp inlined frame format
Author: Michael Buch Date: 2025-04-14T06:31:50+01:00 New Revision: a3f8359410eb7e14c4a52b47f36e433af40c05e9 URL: https://github.com/llvm/llvm-project/commit/a3f8359410eb7e14c4a52b47f36e433af40c05e9 DIFF: https://github.com/llvm/llvm-project/commit/a3f8359410eb7e14c4a52b47f36e433af40c05e9.diff LOG: [lldb][test] Fix NativePDB/inline_sites_live.cpp inlined frame format Adjust after https://github.com/llvm/llvm-project/pull/135343 Added: Modified: lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp Removed: diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp index 906f3d7dff0a5..4a06e6350b00d 100644 --- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp +++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp @@ -23,11 +23,11 @@ int main(int argc, char** argv) { } // CHECK: * thread #1, {{.*}}stop reason = breakpoint 1 -// CHECK-NEXT:frame #0: {{.*}}`main [inlined] bar(param=2) +// CHECK-NEXT:frame #0: {{.*}}`bar(param=2) // CHECK: (lldb) expression param // CHECK-NEXT: (int) $0 = 2 // CHECK: * thread #1, {{.*}}stop reason = breakpoint 2 -// CHECK-NEXT:frame #0: {{.*}}`main [inlined] foo(param=1) +// CHECK-NEXT:frame #0: {{.*}}`foo(param=1) // CHECK: (lldb) expression param // CHECK-NEXT: (int) $1 = 1 // CHECK-NEXT: (lldb) expression local ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
https://github.com/labath approved this pull request. I was looking at this code as well, and I've (also) came to the conclusion that `TrySetRunning` is a problem. https://github.com/llvm/llvm-project/pull/135455 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
@@ -29,8 +29,13 @@ class ProcessRunLock { bool ReadTryLock(); bool ReadUnlock(); + + /// Set the process to running. Returns true if the process was stopped. + /// Return false if the process was running. bool SetRunning(); - bool TrySetRunning(); + + /// Set the process to stopped. Returns true if the process was stopped. + /// Returns false if the process was running. labath wrote: ```suggestion /// Set the process to stopped. Returns true if the process was running. /// Returns false if the process was stopped. ``` (at least, that's what the windows implementation does -- and I think it makes sense) https://github.com/llvm/llvm-project/pull/135455 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Display only the inlined frame name in backtraces if available (PR #135343)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/135343 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/135455 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
@@ -60,6 +49,7 @@ bool ProcessRunLock::SetStopped() { ::pthread_rwlock_unlock(&m_rwlock); labath wrote: This should also do the `was_running` dance. https://github.com/llvm/llvm-project/pull/135455 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
https://github.com/eronnen created https://github.com/llvm/llvm-project/pull/135565 - Adding `max_return_elements` field to `CompletionRequest`. - adding maximum checks to `SymbolCompleter` and `SourceFileCompleter`. Fixes #135553 >From 1b45ab684446f2ff67c8ab89d00422ffcf2f7734 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 13 Apr 2025 20:46:56 +0200 Subject: [PATCH] [lldb] returning command completions up to a maximum - Adding `max_return_elements` field to `CompletionRequest`. - adding maximum checks to `SymbolCompleter` and `SourceFileCompleter`. --- lldb/include/lldb/Utility/CompletionRequest.h | 38 +++ lldb/source/API/SBCommandInterpreter.cpp | 6 ++- lldb/source/Commands/CommandCompletions.cpp | 14 +-- lldb/source/Utility/CompletionRequest.cpp | 9 - 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/lldb/include/lldb/Utility/CompletionRequest.h b/lldb/include/lldb/Utility/CompletionRequest.h index 865d6db576298..ae35c6a015649 100644 --- a/lldb/include/lldb/Utility/CompletionRequest.h +++ b/lldb/include/lldb/Utility/CompletionRequest.h @@ -115,6 +115,25 @@ class CompletionRequest { CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, CompletionResult &result); + /// Constructs a completion request. + /// + /// \param [in] command_line + /// The command line the user has typed at this point. + /// + /// \param [in] raw_cursor_pos + /// The position of the cursor in the command line string. Index 0 means + /// the cursor is at the start of the line. The completion starts from + /// this cursor position. + /// + /// \param [in] max_return_elements + /// The maximum number of completions that should be returned. + /// + /// \param [out] result + /// The CompletionResult that will be filled with the results after this + /// request has been handled. + CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, +size_t max_return_elements, CompletionResult &result); + /// Returns the raw user input used to create this CompletionRequest cut off /// at the cursor position. The cursor will be at the end of the raw line. llvm::StringRef GetRawLine() const { @@ -157,6 +176,23 @@ class CompletionRequest { size_t GetCursorIndex() const { return m_cursor_index; } + size_t GetMaxReturnElements() const { return m_max_return_elements; } + + /// Returns true if the maximum number of completions has been reached + /// already. + bool ShouldStopAddingResults() const { +return m_result.GetNumberOfResults() >= m_max_return_elements; + } + + /// Returns the maximum number of completions that need to be added + /// until reaching the maximum + size_t GetMaxNumberOfResultsToAdd() const { +const size_t number_of_results = m_result.GetNumberOfResults(); +if (number_of_results >= m_max_return_elements) + return 0; +return m_max_return_elements - number_of_results; + } + /// Adds a possible completion string. If the completion was already /// suggested before, it will not be added to the list of results. A copy of /// the suggested completion is stored, so the given string can be free'd @@ -231,6 +267,8 @@ class CompletionRequest { size_t m_cursor_index; /// The cursor position in the argument indexed by m_cursor_index. size_t m_cursor_char_position; + /// The maximum number of completions that should be returned. + size_t m_max_return_elements; /// The result this request is supposed to fill out. /// We keep this object private to ensure that no backend can in any way diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index de22a9dd96bd8..6baf214f75b2d 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -263,9 +263,13 @@ int SBCommandInterpreter::HandleCompletionWithDescriptions( if (!IsValid()) return 0; + if (0 >= max_return_elements) +return 0; + lldb_private::StringList lldb_matches, lldb_descriptions; CompletionResult result; - CompletionRequest request(current_line, cursor - current_line, result); + CompletionRequest request(current_line, cursor - current_line, +static_cast(max_return_elements), result); m_opaque_ptr->HandleCompletion(request); result.GetMatches(lldb_matches); result.GetDescriptions(lldb_descriptions); diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 216aaf9abce6c..11cb94d4eda15 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -91,7 +91,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks( nullptr} // This one has to be last in the list. }; - for (int i = 0;; i++) { + for (int i = 0; !request.ShouldStopAddingResults(); i++) { if (common_compl
[Lldb-commits] [lldb] 99df442 - Skip test on Darwin
Author: Adrian Prantl Date: 2025-04-13T14:40:41-07:00 New Revision: 99df442df1f88c1078c433618c75ee62f3dd8512 URL: https://github.com/llvm/llvm-project/commit/99df442df1f88c1078c433618c75ee62f3dd8512 DIFF: https://github.com/llvm/llvm-project/commit/99df442df1f88c1078c433618c75ee62f3dd8512.diff LOG: Skip test on Darwin Added: Modified: lldb/test/API/python_api/target/read-instructions-flavor/TestTargetReadInstructionsFlavor.py Removed: diff --git a/lldb/test/API/python_api/target/read-instructions-flavor/TestTargetReadInstructionsFlavor.py b/lldb/test/API/python_api/target/read-instructions-flavor/TestTargetReadInstructionsFlavor.py index 12805985798de..f488d4f421c93 100644 --- a/lldb/test/API/python_api/target/read-instructions-flavor/TestTargetReadInstructionsFlavor.py +++ b/lldb/test/API/python_api/target/read-instructions-flavor/TestTargetReadInstructionsFlavor.py @@ -7,6 +7,7 @@ class TargetReadInstructionsFlavor(TestBase): +@skipIfDarwin @skipIfWindows @skipIf(archs=no_match(["x86_64", "x86", "i386"])) def test_read_instructions_with_flavor(self): ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/135565 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (PR #135536)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/135536 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Display only the inlined frame name in backtraces if available (PR #135343)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/135343 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ely Ronnen (eronnen) Changes - Adding `max_return_elements` field to `CompletionRequest`. - adding maximum checks to `SymbolCompleter` and `SourceFileCompleter`. Fixes #135553 --- Full diff: https://github.com/llvm/llvm-project/pull/135565.diff 4 Files Affected: - (modified) lldb/include/lldb/Utility/CompletionRequest.h (+38) - (modified) lldb/source/API/SBCommandInterpreter.cpp (+5-1) - (modified) lldb/source/Commands/CommandCompletions.cpp (+11-3) - (modified) lldb/source/Utility/CompletionRequest.cpp (+8-1) ``diff diff --git a/lldb/include/lldb/Utility/CompletionRequest.h b/lldb/include/lldb/Utility/CompletionRequest.h index 865d6db576298..ae35c6a015649 100644 --- a/lldb/include/lldb/Utility/CompletionRequest.h +++ b/lldb/include/lldb/Utility/CompletionRequest.h @@ -115,6 +115,25 @@ class CompletionRequest { CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, CompletionResult &result); + /// Constructs a completion request. + /// + /// \param [in] command_line + /// The command line the user has typed at this point. + /// + /// \param [in] raw_cursor_pos + /// The position of the cursor in the command line string. Index 0 means + /// the cursor is at the start of the line. The completion starts from + /// this cursor position. + /// + /// \param [in] max_return_elements + /// The maximum number of completions that should be returned. + /// + /// \param [out] result + /// The CompletionResult that will be filled with the results after this + /// request has been handled. + CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, +size_t max_return_elements, CompletionResult &result); + /// Returns the raw user input used to create this CompletionRequest cut off /// at the cursor position. The cursor will be at the end of the raw line. llvm::StringRef GetRawLine() const { @@ -157,6 +176,23 @@ class CompletionRequest { size_t GetCursorIndex() const { return m_cursor_index; } + size_t GetMaxReturnElements() const { return m_max_return_elements; } + + /// Returns true if the maximum number of completions has been reached + /// already. + bool ShouldStopAddingResults() const { +return m_result.GetNumberOfResults() >= m_max_return_elements; + } + + /// Returns the maximum number of completions that need to be added + /// until reaching the maximum + size_t GetMaxNumberOfResultsToAdd() const { +const size_t number_of_results = m_result.GetNumberOfResults(); +if (number_of_results >= m_max_return_elements) + return 0; +return m_max_return_elements - number_of_results; + } + /// Adds a possible completion string. If the completion was already /// suggested before, it will not be added to the list of results. A copy of /// the suggested completion is stored, so the given string can be free'd @@ -231,6 +267,8 @@ class CompletionRequest { size_t m_cursor_index; /// The cursor position in the argument indexed by m_cursor_index. size_t m_cursor_char_position; + /// The maximum number of completions that should be returned. + size_t m_max_return_elements; /// The result this request is supposed to fill out. /// We keep this object private to ensure that no backend can in any way diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index de22a9dd96bd8..6baf214f75b2d 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -263,9 +263,13 @@ int SBCommandInterpreter::HandleCompletionWithDescriptions( if (!IsValid()) return 0; + if (0 >= max_return_elements) +return 0; + lldb_private::StringList lldb_matches, lldb_descriptions; CompletionResult result; - CompletionRequest request(current_line, cursor - current_line, result); + CompletionRequest request(current_line, cursor - current_line, +static_cast(max_return_elements), result); m_opaque_ptr->HandleCompletion(request); result.GetMatches(lldb_matches); result.GetDescriptions(lldb_descriptions); diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 216aaf9abce6c..11cb94d4eda15 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -91,7 +91,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks( nullptr} // This one has to be last in the list. }; - for (int i = 0;; i++) { + for (int i = 0; !request.ShouldStopAddingResults(); i++) { if (common_completions[i].type == lldb::eTerminatorCompletion) break; else if ((common_completions[i].type & completion_mask) == @@ -167,7 +167,9 @@ class SourceFileCompleter : public Completer { m_matching_files.AppendIfUnique(context.comp_unit->GetPrimaryFile());
[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
https://github.com/eronnen updated https://github.com/llvm/llvm-project/pull/135565 >From 66333e243f22ca68e85dea1fe3c26b02203df975 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sun, 13 Apr 2025 20:46:56 +0200 Subject: [PATCH] [lldb] returning command completions up to a maximum - Adding `max_return_elements` field to `CompletionRequest`. - adding maximum checks to `SymbolCompleter` and `SourceFileCompleter`. --- lldb/include/lldb/Utility/CompletionRequest.h | 24 +++ lldb/source/API/SBCommandInterpreter.cpp | 2 ++ lldb/source/Commands/CommandCompletions.cpp | 14 --- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lldb/include/lldb/Utility/CompletionRequest.h b/lldb/include/lldb/Utility/CompletionRequest.h index 865d6db576298..2d3f0a8a44a0a 100644 --- a/lldb/include/lldb/Utility/CompletionRequest.h +++ b/lldb/include/lldb/Utility/CompletionRequest.h @@ -115,6 +115,11 @@ class CompletionRequest { CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, CompletionResult &result); + /// Sets the maximum number of completions that should be returned. + void SetMaxReturnElements(size_t max_return_elements) { +m_max_return_elements = max_return_elements; + } + /// Returns the raw user input used to create this CompletionRequest cut off /// at the cursor position. The cursor will be at the end of the raw line. llvm::StringRef GetRawLine() const { @@ -157,6 +162,23 @@ class CompletionRequest { size_t GetCursorIndex() const { return m_cursor_index; } + size_t GetMaxReturnElements() const { return m_max_return_elements; } + + /// Returns true if the maximum number of completions has been reached + /// already. + bool ShouldStopAddingResults() const { +return m_result.GetNumberOfResults() >= m_max_return_elements; + } + + /// Returns the maximum number of completions that need to be added + /// until reaching the maximum + size_t GetMaxNumberOfResultsToAdd() const { +const size_t number_of_results = m_result.GetNumberOfResults(); +if (number_of_results >= m_max_return_elements) + return 0; +return m_max_return_elements - number_of_results; + } + /// Adds a possible completion string. If the completion was already /// suggested before, it will not be added to the list of results. A copy of /// the suggested completion is stored, so the given string can be free'd @@ -231,6 +253,8 @@ class CompletionRequest { size_t m_cursor_index; /// The cursor position in the argument indexed by m_cursor_index. size_t m_cursor_char_position; + /// The maximum number of completions that should be returned. + size_t m_max_return_elements = SIZE_MAX; /// The result this request is supposed to fill out. /// We keep this object private to ensure that no backend can in any way diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index de22a9dd96bd8..ad3cc3c556fd4 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -266,6 +266,8 @@ int SBCommandInterpreter::HandleCompletionWithDescriptions( lldb_private::StringList lldb_matches, lldb_descriptions; CompletionResult result; CompletionRequest request(current_line, cursor - current_line, result); + if (max_return_elements >= 0) +request.SetMaxReturnElements(max_return_elements); m_opaque_ptr->HandleCompletion(request); result.GetMatches(lldb_matches); result.GetDescriptions(lldb_descriptions); diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 216aaf9abce6c..11cb94d4eda15 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -91,7 +91,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks( nullptr} // This one has to be last in the list. }; - for (int i = 0;; i++) { + for (int i = 0; !request.ShouldStopAddingResults(); i++) { if (common_completions[i].type == lldb::eTerminatorCompletion) break; else if ((common_completions[i].type & completion_mask) == @@ -167,7 +167,9 @@ class SourceFileCompleter : public Completer { m_matching_files.AppendIfUnique(context.comp_unit->GetPrimaryFile()); } } -return Searcher::eCallbackReturnContinue; +return m_matching_files.GetSize() >= m_request.GetMaxNumberOfResultsToAdd() + ? Searcher::eCallbackReturnStop + : Searcher::eCallbackReturnContinue; } void DoCompletion(SearchFilter *filter) override { @@ -230,6 +232,10 @@ class SymbolCompleter : public Completer { // Now add the functions & symbols to the list - only add if unique: for (const SymbolContext &sc : sc_list) { +if (m_match_set.size() >= m_request.GetMaxNumberOfResultsToAdd()) { + break; +} + ConstString func_name = sc.GetFunctionName(Mangled:
[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Marcel Laverdet (laverdet) Changes This architecture implements SSVE but does not implement SVE. More information is included in #121693 cc: @DavidSpickett --- Full diff: https://github.com/llvm/llvm-project/pull/135563.diff 1 Files Affected: - (modified) lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp (+11-11) ``diff diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp index 884c7d4b9e359..f540a160c901a 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -107,19 +107,19 @@ NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux( if (NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, native_thread.GetID(), ®set, &ioVec, sizeof(sve_header)) -.Success()) { +.Success()) opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSVE); - // We may also have the Scalable Matrix Extension (SME) which adds a - // streaming SVE mode. - ioVec.iov_len = sizeof(sve_header); - regset = NT_ARM_SSVE; - if (NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, -native_thread.GetID(), ®set, -&ioVec, sizeof(sve_header)) - .Success()) -opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSSVE); -} +// We may also have the Scalable Matrix Extension (SME) which adds +// a streaming SVE mode. Note that SVE and SSVE may implemented +// independently, which is true on Apple's M4 architecture. +ioVec.iov_len = sizeof(sve_header); +regset = NT_ARM_SSVE; +if (NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, + native_thread.GetID(), ®set, + &ioVec, sizeof(sve_header)) +.Success()) + opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSSVE); sve::user_za_header za_header; ioVec.iov_base = &za_header; `` https://github.com/llvm/llvm-project/pull/135563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)
https://github.com/laverdet created https://github.com/llvm/llvm-project/pull/135563 This architecture implements SSVE but does not implement SVE. More information is included in #121693 cc: @DavidSpickett >From 5c85083f41230ec83bd862ebf2723d03d9bcfb65 Mon Sep 17 00:00:00 2001 From: Marcel Laverdet Date: Sun, 13 Apr 2025 15:41:56 -0500 Subject: [PATCH] [lldb][AArch64] Fix Apple M4 on Linux This architecture implements SSVE but does not implement SVE. --- .../NativeRegisterContextLinux_arm64.cpp | 22 +-- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp index 884c7d4b9e359..f540a160c901a 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -107,19 +107,19 @@ NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux( if (NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, native_thread.GetID(), ®set, &ioVec, sizeof(sve_header)) -.Success()) { +.Success()) opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSVE); - // We may also have the Scalable Matrix Extension (SME) which adds a - // streaming SVE mode. - ioVec.iov_len = sizeof(sve_header); - regset = NT_ARM_SSVE; - if (NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, -native_thread.GetID(), ®set, -&ioVec, sizeof(sve_header)) - .Success()) -opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSSVE); -} +// We may also have the Scalable Matrix Extension (SME) which adds +// a streaming SVE mode. Note that SVE and SSVE may implemented +// independently, which is true on Apple's M4 architecture. +ioVec.iov_len = sizeof(sve_header); +regset = NT_ARM_SSVE; +if (NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, + native_thread.GetID(), ®set, + &ioVec, sizeof(sve_header)) +.Success()) + opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSSVE); sve::user_za_header za_header; ioVec.iov_base = &za_header; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/135563 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove ProcessRunLock::TrySetRunning (PR #135455)
labath wrote: Thanks for looking into this. https://github.com/llvm/llvm-project/pull/135455 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION (PR #135528)
https://github.com/labath created https://github.com/llvm/llvm-project/pull/135528 I *think* this was the reason behind the failures in 2fd860c1f559c0b0be66cc000e38270a04d0a1a3: the clang include tool showed the Config.h headers as unused, and because the macro was referenced through an `#ifdef`, its removal didn't cause build failures. Switching to `#cmakedefine01` + `#if` should make sure this does not happen again. According to D48977, the `#ifndef`+`#cmakedefine` patterns is due to some files redefining the macro themselves. I no longer see any such files in the source tree (there also were no files like that in the source tree at the revision mentioned, but the macro *was* defined in the hand-maintained XCode project we had at the time). >From 159824c4385c727b40125892df2b275652b5f208 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sun, 13 Apr 2025 09:23:29 +0200 Subject: [PATCH] [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION I *think* this was the reason behind the failures in 2fd860c1f559c0b0be66cc000e38270a04d0a1a3: the clang include tool showed the Config.h headers as unused, and because the macro was referenced through an `#ifdef`, its removal didn't cause build failures. Switching to `#cmakedefine01` + `#if` should make sure this does not happen again. According to D48977, the `#ifndef`+`#cmakedefine` patterns is due to some files redefining the macro themselves. I no longer see any such files in the source tree (there also were no files like that in the source tree at the revision mentioned, but the macro *was* defined in the hand-maintained XCode project we had at the time). --- lldb/include/lldb/Host/Config.h.cmake| 4 +--- .../Process/gdb-remote/GDBRemoteCommunication.cpp| 6 +++--- .../Process/gdb-remote/GDBRemoteCommunication.h | 2 +- .../gdb-remote/GDBRemoteCommunicationClient.cpp | 12 +++- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake index 9e538534086a2..46e9a95781c32 100644 --- a/lldb/include/lldb/Host/Config.h.cmake +++ b/lldb/include/lldb/Host/Config.h.cmake @@ -23,9 +23,7 @@ #cmakedefine01 HAVE_NR_PROCESS_VM_READV -#ifndef HAVE_LIBCOMPRESSION -#cmakedefine HAVE_LIBCOMPRESSION -#endif +#cmakedefine01 HAVE_LIBCOMPRESSION #cmakedefine01 LLDB_ENABLE_POSIX diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 77eadfc8c9f6c..ed9a0dad48eb9 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -46,7 +46,7 @@ #define DEBUGSERVER_BASENAME "lldb-server" #endif -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION #include #endif @@ -77,7 +77,7 @@ GDBRemoteCommunication::~GDBRemoteCommunication() { Disconnect(); } -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (m_decompression_scratch) free (m_decompression_scratch); #endif @@ -514,7 +514,7 @@ bool GDBRemoteCommunication::DecompressPacket() { } } -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (m_compression_type == CompressionType::ZlibDeflate || m_compression_type == CompressionType::LZFSE || m_compression_type == CompressionType::LZ4 || diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 107c0896c4e61..45688d24bc5c2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -227,7 +227,7 @@ class GDBRemoteCommunication : public Communication { HostThread m_listen_thread; std::string m_listen_url; -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION CompressionType m_decompression_scratch_type = CompressionType::None; void *m_decompression_scratch = nullptr; #endif diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 501670d62e75b..748f95c61cd3c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -41,7 +41,7 @@ #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB #include "llvm/Support/JSON.h" -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION #include #endif @@ -1104,7 +1104,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( CompressionType avail_type = CompressionType::None; llvm::StringRef avail_name; -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "lzfse") { @@ -1114,9 +1114,
[Lldb-commits] [lldb] [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION (PR #135528)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Pavel Labath (labath) Changes I *think* this was the reason behind the failures in 2fd860c1f559c0b0be66cc000e38270a04d0a1a3: the clang include tool showed the Config.h headers as unused, and because the macro was referenced through an `#ifdef`, its removal didn't cause build failures. Switching to `#cmakedefine01` + `#if` should make sure this does not happen again. According to D48977, the `#ifndef`+`#cmakedefine` patterns is due to some files redefining the macro themselves. I no longer see any such files in the source tree (there also were no files like that in the source tree at the revision mentioned, but the macro *was* defined in the hand-maintained XCode project we had at the time). --- Full diff: https://github.com/llvm/llvm-project/pull/135528.diff 4 Files Affected: - (modified) lldb/include/lldb/Host/Config.h.cmake (+1-3) - (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (+3-3) - (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (+1-1) - (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (+3-9) ``diff diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake index 9e538534086a2..46e9a95781c32 100644 --- a/lldb/include/lldb/Host/Config.h.cmake +++ b/lldb/include/lldb/Host/Config.h.cmake @@ -23,9 +23,7 @@ #cmakedefine01 HAVE_NR_PROCESS_VM_READV -#ifndef HAVE_LIBCOMPRESSION -#cmakedefine HAVE_LIBCOMPRESSION -#endif +#cmakedefine01 HAVE_LIBCOMPRESSION #cmakedefine01 LLDB_ENABLE_POSIX diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 77eadfc8c9f6c..ed9a0dad48eb9 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -46,7 +46,7 @@ #define DEBUGSERVER_BASENAME "lldb-server" #endif -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION #include #endif @@ -77,7 +77,7 @@ GDBRemoteCommunication::~GDBRemoteCommunication() { Disconnect(); } -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (m_decompression_scratch) free (m_decompression_scratch); #endif @@ -514,7 +514,7 @@ bool GDBRemoteCommunication::DecompressPacket() { } } -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (m_compression_type == CompressionType::ZlibDeflate || m_compression_type == CompressionType::LZFSE || m_compression_type == CompressionType::LZ4 || diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 107c0896c4e61..45688d24bc5c2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -227,7 +227,7 @@ class GDBRemoteCommunication : public Communication { HostThread m_listen_thread; std::string m_listen_url; -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION CompressionType m_decompression_scratch_type = CompressionType::None; void *m_decompression_scratch = nullptr; #endif diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 501670d62e75b..748f95c61cd3c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -41,7 +41,7 @@ #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB #include "llvm/Support/JSON.h" -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION #include #endif @@ -1104,7 +1104,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( CompressionType avail_type = CompressionType::None; llvm::StringRef avail_name; -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "lzfse") { @@ -1114,9 +1114,6 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( } } } -#endif - -#if defined(HAVE_LIBCOMPRESSION) if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "zlib-deflate") { @@ -1140,7 +1137,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( } #endif -#if defined(HAVE_LIBCOMPRESSION) +#if HAVE_LIBCOMPRESSION if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "lz4") { @@ -1150,9 +1147,6 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression( } } } -#endif - -#if defined(HAVE_LIBCOMPRESSION) if (avail_type == CompressionType::None)
[Lldb-commits] [lldb] 1c5ce2d - Reapply "[lldb] ProcessGdbRemote header gardning"
Author: Pavel Labath Date: 2025-04-13T09:52:30+02:00 New Revision: 1c5ce2d74fa3ee15d1cb2e092cce0754c8ce19fa URL: https://github.com/llvm/llvm-project/commit/1c5ce2d74fa3ee15d1cb2e092cce0754c8ce19fa DIFF: https://github.com/llvm/llvm-project/commit/1c5ce2d74fa3ee15d1cb2e092cce0754c8ce19fa.diff LOG: Reapply "[lldb] ProcessGdbRemote header gardning" This reverts commit 68ab45f0533f3bbfc1c96bddd53de7e769180219, reapplying 2fd860c1f559c0b0be66cc000e38270a04d0a1a3. The only change is keeping "lldb/Host/Config.h", which I believe was the cause of the failures. Added: Modified: lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp Removed: diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h index b47fee76a2ab5..af2abdf4da5cf 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h @@ -10,8 +10,13 @@ #define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECLIENTBASE_H #include "GDBRemoteCommunication.h" - +#include "lldb/Utility/Broadcaster.h" +#include "llvm/ADT/STLFunctionalExtras.h" +#include "llvm/ADT/StringRef.h" +#include #include +#include +#include namespace lldb_private { namespace process_gdb_remote { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 77eadfc8c9f6c..abdc3da047dc7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -7,14 +7,8 @@ //===--===// #include "GDBRemoteCommunication.h" - -#include -#include -#include -#include - +#include "ProcessGDBRemoteLog.h" #include "lldb/Host/Config.h" -#include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" @@ -30,13 +24,14 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/StreamString.h" -#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB #include "llvm/Support/ScopedPrinter.h" - -#include "ProcessGDBRemoteLog.h" +#include +#include +#include +#include #if defined(__APPLE__) #define DEBUGSERVER_BASENAME "debugserver" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 107c0896c4e61..3565a73f19586 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -10,28 +10,17 @@ #define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATION_H #include "GDBRemoteCommunicationHistory.h" - -#include -#include -#include -#include -#include -#include - #include "lldb/Core/Communication.h" #include "lldb/Host/Config.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Socket.h" #include "lldb/Utility/Args.h" -#include "lldb/Utility/Listener.h" -#include "lldb/Utility/Predicate.h" #include "lldb/Utility/StringExtractorGDBRemote.h" -#include "lldb/lldb-public.h" +#include +#include +#include namespace lldb_private { -namespace repro { -class PacketRecorder; -} namespace process_gdb_remote { enum GDBStoppointType { @@ -162,8 +151,6 @@ class GDBRemoteCommunication : public Communication { void DumpHistory(Stream &strm); - void SetPacketRecorder(repro::PacketRecorder *recorder); - static llvm::Error ConnectLocally(GDBRemoteCommunication &client, GDBRemoteCommunication &server); diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp index 99d1e12359e72..ed77e86ac3701 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp @@ -5,16 +5,20 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--===// -#include +#include "Plugins/Process/gdb-remote/GDBRemoteClientBase.h" #include "GDBRemoteTestUtils.h" - #include "Plugins/Process/Utility/LinuxSignals.h" -#include "Plugins/Process/gdb-remote/GDBRemoteClientBase.h" #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h" #include "lldb/Utility/GDBRemote.h