[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Hemang Gadhavi (HemangGadhavi) Changes This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 - Added skeleton for Registercontext file for AIX. (Later we will add implementation respectively) @labath @DhruvSrivastavaX @DavidSpickett --- Full diff: https://github.com/llvm/llvm-project/pull/144645.diff 3 Files Affected: - (modified) lldb/source/Plugins/Process/AIX/CMakeLists.txt (+1) - (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp (+66) - (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h (+74) ``diff diff --git a/lldb/source/Plugins/Process/AIX/CMakeLists.txt b/lldb/source/Plugins/Process/AIX/CMakeLists.txt index 6b3151edbd1ef..3a6d9ec118e60 100644 --- a/lldb/source/Plugins/Process/AIX/CMakeLists.txt +++ b/lldb/source/Plugins/Process/AIX/CMakeLists.txt @@ -1,6 +1,7 @@ add_lldb_library(lldbPluginProcessAIX NativeProcessAIX.cpp NativeThreadAIX.cpp + NativeRegisterContextAIX.cpp LINK_COMPONENTS Support diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp new file mode 100644 index 0..0cb993110bf78 --- /dev/null +++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp @@ -0,0 +1,66 @@ +//===-- NativeRegisterContextAIX.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "NativeRegisterContextAIX.h" +#include "Plugins/Process/AIX/NativeProcessAIX.h" + +using namespace lldb_private; +using namespace lldb_private::process_aix; + +lldb::ByteOrder NativeRegisterContextAIX::GetByteOrder() const { + return m_thread.GetProcess().GetByteOrder(); +} + +Status NativeRegisterContextAIX::ReadRegisterRaw(uint32_t reg_index, + RegisterValue ®_value) { + return Status("unimplemented"); +} + +Status +NativeRegisterContextAIX::WriteRegisterRaw(uint32_t reg_index, + const RegisterValue ®_value) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::ReadGPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteGPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadFPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteFPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadVMX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteVMX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadVSX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteVSX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadRegisterSet(void *buf, size_t buf_size, + unsigned int regset) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::WriteRegisterSet(void *buf, size_t buf_size, + unsigned int regset) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::DoReadRegisterValue(uint32_t offset, + const char *reg_name, + uint32_t size, + RegisterValue &value) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::DoWriteRegisterValue( +uint32_t offset, const char *reg_name, const RegisterValue &value) { + return Status("unimplemented"); +} diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h new file mode 100644 index 0..2a22c45ce008c --- /dev/null +++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h @@ -0,0 +1,74 @@ +//===-- NativeRegisterContextAIX.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef lldb_NativeRegisterContextAIX_h +#define lldb_NativeRegisterContextAIX_h + +#include "Plugins/Process/Utility/NativeRegisterContextR
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/144731 >From fdff64cca23ab113c80ed431949d7a58bdedb8c7 Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Wed, 18 Jun 2025 16:41:40 +0100 Subject: [PATCH 1/2] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 266 -- 1 file changed, 110 insertions(+), 156 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 0f18abb47591d..1810c07652a2b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Charles Zablit (charles-zablit) Changes Upgrade the callees of `HandleFrameFormatVariable` (`GetDemangledTemplateArguments`, etc), to return a `llvm::Expected` instead of an `std::optional`. This patch also bundles the logic of validating the demangled name and information into a single reusable function to reduce code duplication. --- Full diff: https://github.com/llvm/llvm-project/pull/144731.diff 1 Files Affected: - (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+110-156) ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 0f18abb47591d..1810c07652a2b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangl
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
DavidSpickett wrote: > Added a new type summary kind CXXCompositeSummaryFormat. It holds a list of > child summaries paired with a validator function that checks if a ValueObject > can be formatted by a child. This feels like it should be done in another PR, > but there aren't any tests for it other than the STL formatters (since it's > only in C++ it can't be used in Python). I had a similar problem with another formatting option, so I added https://github.com/llvm/llvm-project/blob/main/lldb/unittests/ValueObject/DumpValueObjectOptionsTests.cpp. Maybe you could extend or take inspiration from that. https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
https://github.com/Michael137 commented: Thanks for working on this! The general idea of having composite formats seems reasonable to me (though others, CC @jimingham, might have opinions). If libc++ ever decided to majorly overhaul some types we might be able to provide backwards compatibility for old layouts this way. Will give it a more thorough review later though. https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins (PR #142480)
@@ -0,0 +1,184 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple powerpc64le-linux-unknown -target-cpu future \ +// RUN: -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-linux-unknown -target-cpu pwr10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-linux-unknown -target-cpu pwr9 \ +// RUN: -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-linux-unknown -target-cpu pwr8 \ +// RUN: -emit-llvm -o - %s | FileCheck %s lei137 wrote: Since DMR is future specific, do we need run lines on cpu targets that it won't be valid for? https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins (PR #142480)
@@ -0,0 +1,94 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -O3 -triple powerpc64le-unknown-unknown -target-cpu future \ +// RUN: -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O3 -triple powerpc64-ibm-aix -target-cpu future \ +// RUN: -emit-llvm %s -o - | FileCheck %s lei137 wrote: do we need testing for aix 32bit? https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins (PR #142480)
https://github.com/lei137 approved this pull request. In general this LGTM. Just a few nits. Please also update your descripton and PR title as it says you are dding `__dmr` type, but you are actually adding type `__dmr1024`. Thx! https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins (PR #142480)
@@ -2,12 +2,110 @@ // RUN: -target-cpu pwr10 %s -verify lei137 wrote: maybe we should move these to a different test file -> ppc-dmr-types.c https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins (PR #142480)
@@ -3455,6 +3455,7 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx, case BuiltinType::BFloat16: case BuiltinType::VectorQuad: case BuiltinType::VectorPair: +case BuiltinType::VectorDmr1024: lei137 wrote: nit: Maybe we can do this since DMR is an acronym and to match the actual new type name defined? ```suggestion case BuiltinType::DMR1024: ``` https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins (PR #142480)
https://github.com/lei137 edited https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add negative number parsing to DIL (PR #144557)
https://github.com/kuilpd updated https://github.com/llvm/llvm-project/pull/144557 >From 49a615d48433dabc6f05848f40e38601222efe38 Mon Sep 17 00:00:00 2001 From: Ilia Kuklin Date: Tue, 17 Jun 2025 21:06:49 +0500 Subject: [PATCH 1/2] [LLDB] Add negative number parsing to DIL --- lldb/source/ValueObject/DILParser.cpp | 11 +-- .../ArraySubscript/TestFrameVarDILArraySubscript.py | 6 +- .../frame/var-dil/basics/ArraySubscript/main.cpp | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lldb/source/ValueObject/DILParser.cpp b/lldb/source/ValueObject/DILParser.cpp index 32af0820acb98..146ef8154283e 100644 --- a/lldb/source/ValueObject/DILParser.cpp +++ b/lldb/source/ValueObject/DILParser.cpp @@ -348,8 +348,15 @@ void DILParser::BailOut(const std::string &error, uint32_t loc, //? Integer constant ? // std::optional DILParser::ParseIntegerConstant() { - auto spelling = CurToken().GetSpelling(); - llvm::StringRef spelling_ref = spelling; + std::string number_spelling; + if (CurToken().GetKind() == Token::minus) { +// StringRef::getAsInteger<>() can parse negative numbers. +// Remove this once unary minus operator is added. +number_spelling = "-"; +m_dil_lexer.Advance(); + } + number_spelling.append(CurToken().GetSpelling()); + llvm::StringRef spelling_ref = number_spelling; int64_t raw_value; if (!spelling_ref.getAsInteger(0, raw_value)) { m_dil_lexer.Advance(); diff --git a/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py b/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py index c90e0eaa63638..c0ef29fab8597 100644 --- a/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py +++ b/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py @@ -60,11 +60,7 @@ def test_subscript(self): self.expect_var_path("*(&int_arr[1])", value="2") # Test for negative index. -self.expect( -"frame var 'int_arr[-1]'", -error=True, -substrs=["failed to parse integer constant"], -) +self.expect_var_path("int_ptr_1[-1]", True, value="1") # Test for floating point index self.expect( diff --git a/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp b/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp index 485666ae46c20..a9a3612dfae5a 100644 --- a/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp +++ b/lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp @@ -3,6 +3,7 @@ int main(int argc, char **argv) { int int_arr[] = {1, 2, 3}; int *int_ptr = int_arr; + int *int_ptr_1 = &int_arr[1]; int(&int_arr_ref)[3] = int_arr; void *p_void = (void *)int_arr; >From 3054ed8b4ee91e3804a412feb0a6cb7a985758fa Mon Sep 17 00:00:00 2001 From: Ilia Kuklin Date: Wed, 18 Jun 2025 20:33:14 +0500 Subject: [PATCH 2/2] Add a FIXME --- lldb/source/ValueObject/DILParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/ValueObject/DILParser.cpp b/lldb/source/ValueObject/DILParser.cpp index 146ef8154283e..5abbfeabcea3d 100644 --- a/lldb/source/ValueObject/DILParser.cpp +++ b/lldb/source/ValueObject/DILParser.cpp @@ -351,7 +351,7 @@ std::optional DILParser::ParseIntegerConstant() { std::string number_spelling; if (CurToken().GetKind() == Token::minus) { // StringRef::getAsInteger<>() can parse negative numbers. -// Remove this once unary minus operator is added. +// FIXME: Remove this once unary minus operator is added. number_spelling = "-"; m_dil_lexer.Advance(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/144731 Upgrade the callees of `HandleFrameFormatVariable` (`GetDemangledTemplateArguments`, etc), to return a `llvm::Expected` instead of an `std::optional`. This patch also bundles the logic of validating the demangled name and information into a single reusable function to reduce code duplication. >From fdff64cca23ab113c80ed431949d7a58bdedb8c7 Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Wed, 18 Jun 2025 16:41:40 +0100 Subject: [PATCH] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 266 -- 1 file changed, 110 insertions(+), 156 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 0f18abb47591d..1810c07652a2b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt;
[Lldb-commits] [lldb] [lldb-dap] Refactoring DebugCommunication to improve test consistency. (PR #143818)
da-viper wrote: Relevant PR https://github.com/python/cpython/pull/27663 https://github.com/llvm/llvm-project/pull/143818 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Make connection URLs match lldb (PR #144770)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/144770 >From adea12ff55b0a8259fc4c4470726cde8d35f4ffa Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 18 Jun 2025 13:03:51 -0500 Subject: [PATCH] [lldb-dap] Make connection URLs match lldb Use the same scheme as ConnectionFileDescriptor::Connect and use "listen" and "accept". Addresses feedback from a Pavel in a different PR [1]. [1] https://github.com/llvm/llvm-project/pull/143628#discussion_r2152225200 --- lldb/include/lldb/Host/Socket.h | 9 ++ lldb/source/Host/common/Socket.cpp| 32 +-- .../tools/lldb-dap/server/TestDAP_server.py | 6 ++-- lldb/tools/lldb-dap/Options.td| 4 +-- lldb/tools/lldb-dap/tool/lldb-dap.cpp | 27 ++-- 5 files changed, 61 insertions(+), 17 deletions(-) diff --git a/lldb/include/lldb/Host/Socket.h b/lldb/include/lldb/Host/Socket.h index 4585eac12efb9..c313aa4f6d26b 100644 --- a/lldb/include/lldb/Host/Socket.h +++ b/lldb/include/lldb/Host/Socket.h @@ -74,6 +74,11 @@ class Socket : public IOObject { ProtocolUnixAbstract }; + enum SocketMode { +ModeAccept, +ModeConnect, + }; + struct HostAndPort { std::string hostname; uint16_t port; @@ -83,6 +88,10 @@ class Socket : public IOObject { } }; + using ProtocolModePair = std::pair; + static std::optional + GetProtocolAndMode(llvm::StringRef scheme); + static const NativeSocket kInvalidSocketValue; ~Socket() override; diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 76f74401ac4d0..5c5cd653c3d9e 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -271,7 +271,8 @@ Socket::UdpConnect(llvm::StringRef host_and_port) { return UDPSocket::CreateConnected(host_and_port); } -llvm::Expected Socket::DecodeHostAndPort(llvm::StringRef host_and_port) { +llvm::Expected +Socket::DecodeHostAndPort(llvm::StringRef host_and_port) { static llvm::Regex g_regex("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)"); HostAndPort ret; llvm::SmallVector matches; @@ -347,8 +348,8 @@ Status Socket::Write(const void *buf, size_t &num_bytes) { ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", static_cast(this), static_cast(m_socket), buf, - static_cast(src_len), - static_cast(bytes_sent), error.AsCString()); + static_cast(src_len), static_cast(bytes_sent), + error.AsCString()); } return error; @@ -476,3 +477,28 @@ llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS, const Socket::HostAndPort &HP) { return OS << '[' << HP.hostname << ']' << ':' << HP.port; } + +std::optional +Socket::GetProtocolAndMode(llvm::StringRef scheme) { + // Keep in sync with ConnectionFileDescriptor::Connect. + return llvm::StringSwitch>(scheme) + .Case("listen", ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeAccept}) + .Cases("accept", "unix-accept", + ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeAccept}) + .Case("unix-abstract-accept", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeAccept}) + .Cases("connect", "tcp-connect", + ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeConnect}) + .Case("udp", ProtocolModePair{SocketProtocol::ProtocolTcp, +SocketMode::ModeConnect}) + .Case("unix-connect", ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeConnect}) + .Case("unix-abstract-connect", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeConnect}) + .Default(std::nullopt); +} diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index ed17044a220d4..592a4cfb0a88b 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -54,7 +54,7 @@ def test_server_port(self): Test launching a binary with a lldb-dap in server mode on a specific port. """ self.build() -(_, connection) = self.start_server(connection="tcp://localhost:0") +(_, connection) = self.start_server(connection="listen://localhost:0") self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") @@ -72,7 +72,7 @@ def cleanup(): self.addTearDownHook(cleanup) self.build() -(_, connection) = self.start_server(connection="unix://"
[Lldb-commits] [lldb] [lldb] Support non-blocking reads in JSONRPCTransport (PR #144610)
JDevlieghere wrote: Alright, I'll update my MCP patch to use Pavel's suggestion. If we're able to get non-blocking I/O working with the JSONTransport class, I can adopt it there again. https://github.com/llvm/llvm-project/pull/144610 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Disable TestTargetWatchAddress on Windows x86_64 (PR #144779)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dmitry Vasilyev (slydiman) Changes See #144777 for details. --- Full diff: https://github.com/llvm/llvm-project/pull/144779.diff 1 Files Affected: - (modified) lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (+10) ``diff diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py index 37fa911b3714c..f1c7a60300df5 100644 --- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -21,6 +21,11 @@ def setUp(self): # This is for verifying that watch location works. self.violating_func = "do_bad_thing_with_location" +@skipIf( +oslist=["windows"], +archs=["x86_64"], +bugnumber="github.com/llvm/llvm-project/issues/144777", +) def test_watch_create_by_address(self): """Exercise SBTarget.WatchpointCreateByAddress() API to set a watchpoint.""" self.build() @@ -88,6 +93,11 @@ def test_watch_create_by_address(self): # This finishes our test. +@skipIf( +oslist=["windows"], +archs=["x86_64"], +bugnumber="github.com/llvm/llvm-project/issues/144777", +) def test_watch_address(self): """Exercise SBTarget.WatchAddress() API to set a watchpoint. Same as test_watch_create_by_address, but uses the simpler API. `` https://github.com/llvm/llvm-project/pull/144779 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Disable TestTargetWatchAddress on Windows x86_64 (PR #144779)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/144779 See #144777 for details. >From 5bdc9d7ae0ff06e29d9ac25f1c0b459edc87719e Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 18 Jun 2025 22:46:09 +0400 Subject: [PATCH] [lldb] Disable TestTargetWatchAddress on Windows x86_64 See #144777 for details. --- .../watchpoint/watchlocation/TestTargetWatchAddress.py | 10 ++ 1 file changed, 10 insertions(+) diff --git a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py index 37fa911b3714c..f1c7a60300df5 100644 --- a/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -21,6 +21,11 @@ def setUp(self): # This is for verifying that watch location works. self.violating_func = "do_bad_thing_with_location" +@skipIf( +oslist=["windows"], +archs=["x86_64"], +bugnumber="github.com/llvm/llvm-project/issues/144777", +) def test_watch_create_by_address(self): """Exercise SBTarget.WatchpointCreateByAddress() API to set a watchpoint.""" self.build() @@ -88,6 +93,11 @@ def test_watch_create_by_address(self): # This finishes our test. +@skipIf( +oslist=["windows"], +archs=["x86_64"], +bugnumber="github.com/llvm/llvm-project/issues/144777", +) def test_watch_address(self): """Exercise SBTarget.WatchAddress() API to set a watchpoint. Same as test_watch_create_by_address, but uses the simpler API. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
@@ -33,6 +33,37 @@ static void EmplaceSafeString(llvm::json::Object &obj, llvm::StringRef key, obj.try_emplace(key, llvm::json::fixUTF8(str)); } +static void UpdateDwoFileCounts(SymbolFile *sym_file, +uint32_t &total_dwo_file_count, +uint32_t &total_loaded_dwo_file_count) { + // Count DWO files from this symbol file using GetSeparateDebugInfo + // For DWP files, this increments counts for both total and successfully + // loaded DWO CUs. For non split-dwarf files, these counts should not change + StructuredData::Dictionary separate_debug_info; + if (sym_file->GetSeparateDebugInfo(separate_debug_info, + /*errors_only=*/false, + /*load_all_debug_info=*/false)) { +llvm::StringRef type; +if (separate_debug_info.GetValueForKeyAsString("type", type) && +type == "dwo") { + StructuredData::Array *files; + if (separate_debug_info.GetValueForKeyAsArray("separate-debug-info-files", +files)) { +files->ForEach([&](StructuredData::Object *obj) { + if (auto dict = obj->GetAsDictionary()) { +total_dwo_file_count++; + +bool loaded = false; +if (dict->GetValueForKeyAsBoolean("loaded", loaded) && loaded) jeffreytan81 wrote: I am not sure this is correct for dwp. In dwp scenario, there is one dwp file for the entire module (instead of one dwo for each compile unit), so if you check the code here https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L4185-L4194, it will mark that dwo as "loaded if `SymbolFileDWARFDwo` exists, which will happen for all dwo files during dwp scenarios which can be wrong -- if you have .debug_names, lldb won't need to parse all debug info during startup but parse/load lazily so only partial of dwp are parsed while the current implementation reports all parsed/loaded. This is probably a bug in original `SymbolFileDWARF::GetSeparateDebugInfo` implementation though, cc @zhyty https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
https://github.com/jeffreytan81 edited https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
@@ -33,6 +33,37 @@ static void EmplaceSafeString(llvm::json::Object &obj, llvm::StringRef key, obj.try_emplace(key, llvm::json::fixUTF8(str)); } +static void UpdateDwoFileCounts(SymbolFile *sym_file, +uint32_t &total_dwo_file_count, +uint32_t &total_loaded_dwo_file_count) { + // Count DWO files from this symbol file using GetSeparateDebugInfo + // For DWP files, this increments counts for both total and successfully + // loaded DWO CUs. For non split-dwarf files, these counts should not change + StructuredData::Dictionary separate_debug_info; + if (sym_file->GetSeparateDebugInfo(separate_debug_info, qxy11 wrote: Makes sense, I'll make a separate API for getting the counts here without constructing `StructuredData::Dictionary`. https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/medismailben edited https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/medismailben approved this pull request. Cool! LGTM with comment addressed. https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
@@ -3546,6 +3546,8 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + std::unique_ptr attach_progress; + attach_progress = std::make_unique("Waiting to attach to process"); medismailben wrote: This could just be a local variable, no need to make it a unique per https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (PR #142516)
@@ -72,14 +72,24 @@ inline const size_t __datasizeof_v = template struct __lldb_is_final : public integral_constant {}; -template class __compressed_pair_padding { - char __padding_[((is_empty<_ToPad>::value && -!__lldb_is_final<_ToPad>::value) || - is_reference<_ToPad>::value) - ? 0 - : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; +template +inline const bool __is_reference_or_unpadded_object = +(std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || +sizeof(_ToPad) == __datasizeof_v<_ToPad>; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &> = true; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &&> = true; + +template > +class __compressed_pair_padding { + char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {}; }; +template class __compressed_pair_padding<_ToPad, true> {}; frederick-vs-ja wrote: Sorry for late replying. I'll do this soon, although this seems unnecessary as there doesn't seem any case where the layout will change. https://github.com/llvm/llvm-project/pull/142516 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support non-blocking reads in JSONRPCTransport (PR #144610)
ashgti wrote: > @ashgti Do you think we would adopt non-blocking I/O in `lldb-dap`? Since > we're using separate threads there, we can afford using long timeouts, but > maybe we'd like to use the main loop there too with non-blocking I/O. If not, > and if I were to implement the non-blocking support in MCP directly using > Pavel's snippet, would you want to move the `JSONTransport` back into > lldb-dap (and drop the JSON RPC variant) or keep it in Host? lldb-dap today is most often used by communicating over stdin/stdout. When adding support for lldb-dap to have a server mode, the clients connect over a socket (unix or tcp). I wanted to be able to gracefully disconnect the clients if the server is interrupted. We don't strictly need to have non-blocking IO for lldb-dap to work in both cases, but it helps for the graceful disconnects. Right now, we sort of ignore the fact that the Transport never times out on Windows when running over stdin/stdout. In an ideal world we'd have uniform support for this, but from my understanding of Win32 and the APIs we're using, I wasn't able to figure out a solution for reading from stdin with a timeout. There are ways we could work around this, like always connecting over a socket on Windows instead of stdin/stdout but that would be a pretty big change and I'm not sure how many users there are of the lldb-dap binary on Windows that would be affected by the change. I can try to take another look at the Win32 APIs to see if there is an alternative because it would be nice if we had a uniform API surface for this. https://github.com/llvm/llvm-project/pull/144610 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
@@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; - - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; + if (info.QualifiersRange.second < info.QualifiersRange.first) +return llvm::createStringError("Qualifiers range is invalid."); - if (info->QualifiersRange.second < info->QualifiersRange.first) -return std::nullopt; - - return demangled_name.slice(info->QualifiersRange.first, - info->QualifiersRange.second); + return demangled_name.slice(info.QualifiersRange.first, + info.QualifiersRange.second); } -static std::optional +static llvm::Expected GetDemangledReturnTypeRHS(con
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
@@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; - - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; + if (info.QualifiersRange.second < info.QualifiersRange.first) +return llvm::createStringError("Qualifiers range is invalid."); - if (info->QualifiersRange.second < info->QualifiersRange.first) -return std::nullopt; - - return demangled_name.slice(info->QualifiersRange.first, - info->QualifiersRange.second); + return demangled_name.slice(info.QualifiersRange.first, + info.QualifiersRange.second); } -static std::optional +static llvm::Expected GetDemangledReturnTypeRHS(con
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
https://github.com/Michael137 commented: Seems reasonable, modulo the logging comment https://github.com/llvm/llvm-project/pull/144731 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Correctly invalidate svg when vg is written (PR #140875)
https://github.com/jasonmolenda approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/140875 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
@@ -282,6 +282,11 @@ class SymbolFileDWARF : public SymbolFileCommon { bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only) override; + // Gets a pair of loaded and total dwo file counts. + // For DWP files, this reports the counts for successfully loaded DWO CUs jeffreytan81 wrote: "For DWP files", do you mean "For split dwarf files"? Otherwise, you need to mention "dwo files" in addition to "dwp files". https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
https://github.com/jeffreytan81 approved this pull request. https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
https://github.com/qxy11 edited https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
https://github.com/qxy11 updated https://github.com/llvm/llvm-project/pull/144424 >From 57483ee0f44f8bbed325268e7d1d40b1a0403aa1 Mon Sep 17 00:00:00 2001 From: Janet Yang Date: Mon, 16 Jun 2025 11:06:24 -0700 Subject: [PATCH 1/6] Add counter for number of DWO files loaded in statistics --- lldb/include/lldb/Symbol/SymbolFile.h | 5 +++ .../Python/lldbsuite/test/builders/builder.py | 25 ++- .../Python/lldbsuite/test/make/Makefile.rules | 4 +++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 1 + .../SymbolFile/DWARF/SymbolFileDWARF.h| 9 ++ .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp | 2 +- lldb/source/Target/Statistics.cpp | 5 +++ .../commands/statistics/basic/TestStats.py| 31 +++ .../API/commands/statistics/basic/baz.cpp | 12 +++ .../API/commands/statistics/basic/third.cpp | 7 + 10 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 lldb/test/API/commands/statistics/basic/baz.cpp create mode 100644 lldb/test/API/commands/statistics/basic/third.cpp diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 75c7f230ddf3d..42fbc2508889a 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -425,6 +425,11 @@ class SymbolFile : public PluginInterface { /// Reset the statistics for the symbol file. virtual void ResetStatistics() {} + /// Get the number of loaded DWO files for this symbol file. + /// This is used for statistics gathering and will return 0 for most + /// symbol file implementations except DWARF symbol files. + virtual uint32_t GetLoadedDwoFileCount() const { return 0; } + /// Get the additional modules that this symbol file uses to parse debug info. /// /// Some debug info is stored in stand alone object files that are represented diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index de05732469448..572abf590345c 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,13 +247,24 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] -if debug_info == "dwarf": -return ["MAKE_DSYM=NO"] -if debug_info == "dwo": -return ["MAKE_DSYM=NO", "MAKE_DWO=YES"] -if debug_info == "gmodules": -return ["MAKE_DSYM=NO", "MAKE_GMODULES=YES"] -return None + +debug_options = debug_info if isinstance(debug_info, list) else [debug_info] +option_flags = { +"dwarf": {"MAKE_DSYM": "NO"}, +"dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"}, +"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"}, +"debug_names": {"MAKE_DEBUG_NAMES": "YES"}, +} + +# Collect all flags, with later options overriding earlier ones +flags = {} + +for option in debug_options: +if not option or option not in option_flags: +return None # Invalid options +flags.update(option_flags[option]) + +return [f"{key}={value}" for key, value in flags.items()] def getBuildCommand( self, diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 06959f226066a..58833e1b0cc78 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -276,6 +276,10 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif +ifeq "$(MAKE_DEBUG_NAMES)" "YES" + CFLAGS += -gpubnames +endif + ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES" THE_CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/private-module-cache else diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 71f204c03a42a..acd9d2230c201 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4358,6 +4358,7 @@ StatsDuration::Duration SymbolFileDWARF::GetDebugInfoIndexTime() { void SymbolFileDWARF::ResetStatistics() { m_parse_time.reset(); + m_loaded_dwo_file_count = 0; if (m_index) return m_index->ResetStatistics(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index d2d30d7decb16..d695961bbfc1d 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -315,6 +315,11 @@ class SymbolFileDWARF : public SymbolFileCommon { void ResetStatistics() override; + /// Get the number of loaded DWO files for this symbol file + uint32_t GetLoadedD
[Lldb-commits] [lldb] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (PR #142516)
https://github.com/frederick-vs-ja updated https://github.com/llvm/llvm-project/pull/142516 >From 3e8a4bf23deadbeac4faeab6e9dd1e5bd006cdef Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Tue, 3 Jun 2025 10:00:54 +0800 Subject: [PATCH 1/3] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ --- .../compressed_pair.h | 22 ++- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h index 6dc53a4e88ffd..3f305bdcb4d54 100644 --- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h +++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h @@ -72,14 +72,24 @@ inline const size_t __datasizeof_v = template struct __lldb_is_final : public integral_constant {}; -template class __compressed_pair_padding { - char __padding_[((is_empty<_ToPad>::value && -!__lldb_is_final<_ToPad>::value) || - is_reference<_ToPad>::value) - ? 0 - : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; +template +inline const bool __is_reference_or_unpadded_object = +(std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || +sizeof(_ToPad) == __datasizeof_v<_ToPad>; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &> = true; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &&> = true; + +template > +class __compressed_pair_padding { + char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {}; }; +template class __compressed_pair_padding<_ToPad, true> {}; + #define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ [[__gnu__::__aligned__( \ alignof(T2))]] _LLDB_NO_UNIQUE_ADDRESS T1 Initializer1; \ >From a755d83e90849d9ec61660bf6d9096a39565c0a1 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Thu, 19 Jun 2025 01:11:59 +0800 Subject: [PATCH 2/3] Bump `COMPRESSED_PAIR_REV` --- .../libcxx-simulators-common/compressed_pair.h| 15 +-- .../libcxx-simulators/invalid-vector/main.cpp | 2 +- .../TestDataFormatterLibcxxStringSimulator.py | 2 +- .../libcxx-simulators/string/main.cpp | 6 +++--- .../TestDataFormatterLibcxxUniquePtrSimulator.py | 2 +- .../libcxx-simulators/unique_ptr/main.cpp | 3 ++- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h index 3f305bdcb4d54..ef04a9ad76185 100644 --- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h +++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h @@ -58,7 +58,7 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, _T1 &first() { return static_cast<_Base1 &>(*this).__get(); } }; -#elif COMPRESSED_PAIR_REV == 1 +#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2 // From libc++ datasizeof.h template struct _FirstPaddingByte { _LLDB_NO_UNIQUE_ADDRESS _Tp __v_; @@ -72,6 +72,16 @@ inline const size_t __datasizeof_v = template struct __lldb_is_final : public integral_constant {}; +// The legacy layout has been patched, see +// https://github.com/llvm/llvm-project/pull/142516. +#if COMPRESSED_PAIR_REV == 1 +template class __compressed_pair_padding { + char __padding_[((is_empty<_ToPad>::value && +!__lldb_is_final<_ToPad>::value) || + is_reference<_ToPad>::value) + ? 0 + : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; +#else template inline const bool __is_reference_or_unpadded_object = (std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || @@ -89,6 +99,7 @@ class __compressed_pair_padding { }; template class __compressed_pair_padding<_ToPad, true> {}; +#endif #define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ [[__gnu__::__aligned__( \ @@ -106,7 +117,7 @@ template class __compressed_pair_padding<_ToPad, true> {}; _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding __padding2_; \ _LLDB_NO_UNIQUE_ADDRESS T3 Initializer3; \ _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding __padding3_; -#elif COMPRESSED_PAIR_REV == 2 +#elif COMPRESSED_PAIR_REV == 3 #define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ _LLDB_NO_UNIQUE_ADDRESS T1 Name1; \ _LLDB_NO_UNIQUE_ADDRESS T2 Name2 diff --git a/lldb/te
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr1024 type and DMF integer calculation builtins (PR #142480)
@@ -0,0 +1,94 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -O3 -triple powerpc64le-unknown-unknown -target-cpu future \ +// RUN: -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O3 -triple powerpc64-ibm-aix -target-cpu future \ +// RUN: -emit-llvm %s -o - | FileCheck %s maryammo wrote: PC_VECTOR_MMA_TYPE is only defined for PPC64 https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/143177 >From 570732bf36b9f80c090ce077f55632b932c1a0b3 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Wed, 18 Jun 2025 21:49:16 +0200 Subject: [PATCH] [LLDB] Add type summaries for MSVC STL strings --- .../lldb/DataFormatters/StringPrinter.h | 15 ++ .../Python/lldbsuite/test/configuration.py| 2 + lldb/packages/Python/lldbsuite/test/dotest.py | 23 +++ .../Python/lldbsuite/test/dotest_args.py | 6 + .../Python/lldbsuite/test/test_categories.py | 1 + .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 139 + .../Plugins/Language/CPlusPlus/LibStdcpp.cpp | 38 + .../Plugins/Language/CPlusPlus/LibStdcpp.h| 8 + .../Plugins/Language/CPlusPlus/MsvcStl.cpp| 146 ++ .../Plugins/Language/CPlusPlus/MsvcStl.h | 35 + .../msvcstl/string/Makefile | 4 + .../string/TestDataFormatterStdString.py | 118 ++ .../msvcstl/string/main.cpp | 40 + .../msvcstl/u8string/Makefile | 4 + .../u8string/TestDataFormatterStdU8String.py | 31 .../msvcstl/u8string/main.cpp | 14 ++ lldb/test/API/lit.cfg.py | 3 + 18 files changed, 597 insertions(+), 31 deletions(-) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.cpp create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterStdString.py create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterStdU8String.py create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp diff --git a/lldb/include/lldb/DataFormatters/StringPrinter.h b/lldb/include/lldb/DataFormatters/StringPrinter.h index 4169f53e63f38..4ebe712be60e1 100644 --- a/lldb/include/lldb/DataFormatters/StringPrinter.h +++ b/lldb/include/lldb/DataFormatters/StringPrinter.h @@ -152,6 +152,21 @@ class StringPrinter { template static bool ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options); + + template + static constexpr uint64_t ElementByteSize() { +switch (element_type) { +case StringElementType::ASCII: +case StringElementType::UTF8: + return 1; +case StringElementType::UTF16: + return 2; +case StringElementType::UTF32: + return 3; +default: + return 0; +} + } }; } // namespace formatters diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py index b2d91fd211477..4ec892bef69f9 100644 --- a/lldb/packages/Python/lldbsuite/test/configuration.py +++ b/lldb/packages/Python/lldbsuite/test/configuration.py @@ -134,6 +134,8 @@ libcxx_include_target_dir = None libcxx_library_dir = None +target_triple = None + # A plugin whose tests will be enabled, like intel-pt. enabled_plugins = [] diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index d7f274ac4f60e..dd6fbdf8daed4 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs(): configuration.libcxx_library_dir = args.libcxx_library_dir configuration.cmake_build_type = args.cmake_build_type.lower() +configuration.target_triple = args.target_triple + if args.channels: lldbtest_config.channels = args.channels @@ -831,6 +833,26 @@ def checkLibstdcxxSupport(): configuration.skip_categories.append("libstdcxx") +def canRunMsvcStlTests(): +if "windows-msvc" in configuration.target_triple: +return True, "MSVC STL is present on *windows-msvc*" +return ( +False, +f"Don't know how to build with MSVC's STL on {configuration.target_triple}", +) + + +def checkMsvcStlSupport(): +result, reason = canRunMsvcStlTests() +if result: +return # msvcstl supported +if "msvcstl" in configuration.categories_list: +return # msvcstl category explicitly requested, let it run. +if configuration.verbose: +print(f"msvcstl tests will not be run because: {reason}") +configuration.skip_categories.append("msvcstl") + + def canRunWatchpointTests(): from lldbsuite.test import lldbplatformutil @@ -1044,6 +1066,7 @@ def run_suite(): checkLibcxxSupport() checkLi
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/3] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr1024 type and DMF integer calculation builtins (PR #142480)
https://github.com/maryammo updated https://github.com/llvm/llvm-project/pull/142480 >From 5ef7a4ca7c2a838a6b2100968d5023e0797b2848 Mon Sep 17 00:00:00 2001 From: Maryam Moghadas Date: Mon, 2 Jun 2025 19:54:57 + Subject: [PATCH 1/4] [Clang][PowerPC] Add __dmr type and DMF integer calculation builtins Define the __dmr type used to manipulate the new DMR registers introduced by the Dense Math Facility (DMF) on PowerPC, and add six Clang builtins that correspond to the integer outer-product accumulate to ACC instructions: __builtin_mma_dmxvi8gerx4, __builtin_mma_pmdmxvi8gerx4, __builtin_mma_dmxvi8gerx4pp, __builtin_mma_pmdmxvi8gerx4pp, __builtin_mma_dmxvi8gerx4spp, and __builtin_mma_pmdmxvi8gerx4spp. --- clang/include/clang/Basic/BuiltinsPPC.def | 12 ++ clang/include/clang/Basic/PPCTypes.def| 1 + clang/lib/AST/ASTContext.cpp | 1 + clang/test/AST/ast-dump-ppc-types.c | 13 +- .../CodeGen/PowerPC/builtins-ppc-mmaplus.c| 94 + .../PowerPC/ppc-future-mma-builtin-err.c | 21 ++ ...ppc-future-paired-vec-memops-builtin-err.c | 20 ++ .../test/CodeGen/PowerPC/ppc-mmaplus-types.c | 184 ++ .../test/CodeGenCXX/ppc-mangle-mma-types.cpp | 5 + clang/test/Sema/ppc-pair-mma-types.c | 98 ++ .../TypeSystem/Clang/TypeSystemClang.cpp | 1 + 11 files changed, 447 insertions(+), 3 deletions(-) create mode 100644 clang/test/CodeGen/PowerPC/builtins-ppc-mmaplus.c create mode 100644 clang/test/CodeGen/PowerPC/ppc-future-mma-builtin-err.c create mode 100644 clang/test/CodeGen/PowerPC/ppc-future-paired-vec-memops-builtin-err.c create mode 100644 clang/test/CodeGen/PowerPC/ppc-mmaplus-types.c diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index bb7d54bbb793e..099500754a0e0 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -1134,6 +1134,18 @@ UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2np, "vW512*VVi15i15i3", true, "mma,paired-vector-memops") UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2nn, "vW512*VVi15i15i3", true, "mma,paired-vector-memops") +UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4, "vW1024*W256V", false, + "mma,paired-vector-memops") +UNALIASED_CUSTOM_BUILTIN(mma_pmdmxvi8gerx4, "vW1024*W256Vi255i15i15", false, + "mma,paired-vector-memops") +UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4pp, "vW1024*W256V", true, + "mma,paired-vector-memops") +UNALIASED_CUSTOM_BUILTIN(mma_pmdmxvi8gerx4pp, "vW1024*W256Vi255i15i15", true, + "mma,paired-vector-memops") +UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4spp, "vW1024*W256V", true, + "mma,paired-vector-memops") +UNALIASED_CUSTOM_BUILTIN(mma_pmdmxvi8gerx4spp, "vW1024*W256Vi255i15i15", true, + "mma,paired-vector-memops") // FIXME: Obviously incomplete. diff --git a/clang/include/clang/Basic/PPCTypes.def b/clang/include/clang/Basic/PPCTypes.def index 9e2cb2aedc9fc..cfc9de3a473d4 100644 --- a/clang/include/clang/Basic/PPCTypes.def +++ b/clang/include/clang/Basic/PPCTypes.def @@ -30,6 +30,7 @@ #endif +PPC_VECTOR_MMA_TYPE(__dmr, VectorDmr, 1024) PPC_VECTOR_MMA_TYPE(__vector_quad, VectorQuad, 512) PPC_VECTOR_VSX_TYPE(__vector_pair, VectorPair, 256) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 45f9602856840..ffb4ca61b00c4 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -3455,6 +3455,7 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx, case BuiltinType::BFloat16: case BuiltinType::VectorQuad: case BuiltinType::VectorPair: +case BuiltinType::VectorDmr: OS << "?"; return; diff --git a/clang/test/AST/ast-dump-ppc-types.c b/clang/test/AST/ast-dump-ppc-types.c index 26ae5441f20d7..a430268284413 100644 --- a/clang/test/AST/ast-dump-ppc-types.c +++ b/clang/test/AST/ast-dump-ppc-types.c @@ -1,9 +1,11 @@ +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu future \ +// RUN: -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \ -// RUN: -ast-dump -ast-dump-filter __vector %s | FileCheck %s +// RUN: -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr9 \ -// RUN: -ast-dump -ast-dump-filter __vector %s | FileCheck %s +// RUN: -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr8 \ -// RUN: -ast-dump -ast-dump-filter __vector %s | FileCheck %s +// RUN: -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck %s \ // RUN: --check-prefix=CHECK-X86_64 // RUN: %clang_cc1 -triple arm-unknown-unknown -ast-dump %s | FileCheck %s \ @@ -15,16 +17,21 @@
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jacob Lalonde (Jlalond) Changes @dmpots and I were investigating a crash when he was developing LLDB earlier. When I loaded the core I was surprised to see LLDB didn't have information for the SI_CODE. Upon inspection we had an si_code of `128`, which is the decimal of SI_KERNEL at `0x80`. These were overlooked in my last addition of the negative si_codes, and this patch adds SI_USER and SI_KERNEL to the list, covering us for all the codes available to all signals. [Linux reference link](https://github.com/torvalds/linux/blob/74b4cc9b8780bfe8a3992c9ac0033bf22ac01f19/include/uapi/asm-generic/siginfo.h#L175)  I kept the code naming the same as what is defined in the Linux source code. SI_KERNEL to my understanding usually indicates something went awry in the Kernel itself, but I think adding that additional detail would not be helpful to most users. @DavidSpickett I'd appreciate your insight into that. --- Full diff: https://github.com/llvm/llvm-project/pull/144800.diff 1 Files Affected: - (modified) lldb/source/Plugins/Process/Utility/LinuxSignals.cpp (+4) ``diff diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..ef3d2f2f845da 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "Sent by kernel", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ `` https://github.com/llvm/llvm-project/pull/144800 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
https://github.com/Jlalond created https://github.com/llvm/llvm-project/pull/144800 @dmpots and I were investigating a crash when he was developing LLDB earlier. When I loaded the core I was surprised to see LLDB didn't have information for the SI_CODE. Upon inspection we had an si_code of `128`, which is the decimal of SI_KERNEL at `0x80`. These were overlooked in my last addition of the negative si_codes, and this patch adds SI_USER and SI_KERNEL to the list, covering us for all the codes available to all signals. [Linux reference link](https://github.com/torvalds/linux/blob/74b4cc9b8780bfe8a3992c9ac0033bf22ac01f19/include/uapi/asm-generic/siginfo.h#L175)  I kept the code naming the same as what is defined in the Linux source code. SI_KERNEL to my understanding usually indicates something went awry in the Kernel itself, but I think adding that additional detail would not be helpful to most users. @DavidSpickett I'd appreciate your insight into that. >From 0b55d63aea27df34c5ac5b3d8db30d1bc99b1dd3 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Wed, 18 Jun 2025 14:35:37 -0700 Subject: [PATCH] Add SI_USER and SI_KERNEL to Linux signals --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 4 1 file changed, 4 insertions(+) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..ef3d2f2f845da 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "Sent by kernel", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/144800 >From 157b5a5177784bc2ce4e8bf952c812aedd5be258 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Wed, 18 Jun 2025 14:35:37 -0700 Subject: [PATCH] Add SI_USER and SI_KERNEL to Linux signals --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 4 1 file changed, 4 insertions(+) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..4c49bde936965 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 51aa6a4 - [lldb-dap] Use protocol types for ReadMemory request (#144552)
Author: Ebuka Ezike Date: 2025-06-18T22:48:24+01:00 New Revision: 51aa6a4993ea18c968a087352d1cf569c840c41f URL: https://github.com/llvm/llvm-project/commit/51aa6a4993ea18c968a087352d1cf569c840c41f DIFF: https://github.com/llvm/llvm-project/commit/51aa6a4993ea18c968a087352d1cf569c840c41f.diff LOG: [lldb-dap] Use protocol types for ReadMemory request (#144552) Read memory from process instead of target. Added: Modified: lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py lldb/tools/lldb-dap/Handler/ReadMemoryRequestHandler.cpp lldb/tools/lldb-dap/Handler/RequestHandler.h lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp lldb/tools/lldb-dap/Protocol/ProtocolRequests.h lldb/unittests/DAP/ProtocolTypesTest.cpp Removed: diff --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py index 74062f3ab2164..55fb4a961e783 100644 --- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py +++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py @@ -111,8 +111,17 @@ def test_readMemory(self): # VS Code sends those in order to check if a `memoryReference` can actually be dereferenced. mem = self.dap_server.request_readMemory(memref, 0, 0) self.assertEqual(mem["success"], True) -self.assertEqual(mem["body"]["data"], "") +self.assertNotIn( +"data", mem["body"], f"expects no data key in response: {mem!r}" +) + +# Reads at offset 0x0 return unreadable bytes +bytes_to_read = 6 +mem = self.dap_server.request_readMemory("0x0", 0, bytes_to_read) +self.assertEqual(mem["body"]["unreadableBytes"], bytes_to_read) + +# Reads with invalid address fails. +mem = self.dap_server.request_readMemory("-3204", 0, 10) +self.assertFalse(mem["success"], "expect fail on reading memory.") -# Reads at offset 0x0 fail -mem = self.dap_server.request_readMemory("0x0", 0, 6) -self.assertEqual(mem["success"], False) +self.continue_to_exit() diff --git a/lldb/tools/lldb-dap/Handler/ReadMemoryRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ReadMemoryRequestHandler.cpp index 891c2af4f2f28..7065b6a24b554 100644 --- a/lldb/tools/lldb-dap/Handler/ReadMemoryRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/ReadMemoryRequestHandler.cpp @@ -7,136 +7,47 @@ //===--===// #include "DAP.h" -#include "EventHelper.h" #include "JSONUtils.h" #include "RequestHandler.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/Support/Base64.h" namespace lldb_dap { -// "ReadMemoryRequest": { -// "allOf": [ { "$ref": "#/definitions/Request" }, { -// "type": "object", -// "description": "Reads bytes from memory at the provided location. Clients -// should only call this request if the corresponding -// capability `supportsReadMemoryRequest` is true.", -// "properties": { -// "command": { -// "type": "string", -// "enum": [ "readMemory" ] -// }, -// "arguments": { -// "$ref": "#/definitions/ReadMemoryArguments" -// } -// }, -// "required": [ "command", "arguments" ] -// }] -// }, -// "ReadMemoryArguments": { -// "type": "object", -// "description": "Arguments for `readMemory` request.", -// "properties": { -// "memoryReference": { -// "type": "string", -// "description": "Memory reference to the base location from which data -// should be read." -// }, -// "offset": { -// "type": "integer", -// "description": "Offset (in bytes) to be applied to the reference -// location before reading data. Can be negative." -// }, -// "count": { -// "type": "integer", -// "description": "Number of bytes to read at the specified location and -// offset." -// } -// }, -// "required": [ "memoryReference", "count" ] -// }, -// "ReadMemoryResponse": { -// "allOf": [ { "$ref": "#/definitions/Response" }, { -// "type": "object", -// "description": "Response to `readMemory` request.", -// "properties": { -// "body": { -// "type": "object", -// "properties": { -// "address": { -// "type": "string", -// "description": "The address of the first byte of data returned. -// Treated as a hex value if prefixed with `0x`, or -// as a decimal value otherwise." -// }, -// "unreadableBytes": { -// "type": "integer", -// "description": "The number of unreadable bytes encountered after -// the last successfully read byte.\nThis can be -//
[Lldb-commits] [lldb] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (PR #142516)
https://github.com/frederick-vs-ja updated https://github.com/llvm/llvm-project/pull/142516 >From 3e8a4bf23deadbeac4faeab6e9dd1e5bd006cdef Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Tue, 3 Jun 2025 10:00:54 +0800 Subject: [PATCH 1/2] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ --- .../compressed_pair.h | 22 ++- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h index 6dc53a4e88ffd..3f305bdcb4d54 100644 --- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h +++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h @@ -72,14 +72,24 @@ inline const size_t __datasizeof_v = template struct __lldb_is_final : public integral_constant {}; -template class __compressed_pair_padding { - char __padding_[((is_empty<_ToPad>::value && -!__lldb_is_final<_ToPad>::value) || - is_reference<_ToPad>::value) - ? 0 - : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; +template +inline const bool __is_reference_or_unpadded_object = +(std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || +sizeof(_ToPad) == __datasizeof_v<_ToPad>; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &> = true; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &&> = true; + +template > +class __compressed_pair_padding { + char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {}; }; +template class __compressed_pair_padding<_ToPad, true> {}; + #define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ [[__gnu__::__aligned__( \ alignof(T2))]] _LLDB_NO_UNIQUE_ADDRESS T1 Initializer1; \ >From a755d83e90849d9ec61660bf6d9096a39565c0a1 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Thu, 19 Jun 2025 01:11:59 +0800 Subject: [PATCH 2/2] Bump `COMPRESSED_PAIR_REV` --- .../libcxx-simulators-common/compressed_pair.h| 15 +-- .../libcxx-simulators/invalid-vector/main.cpp | 2 +- .../TestDataFormatterLibcxxStringSimulator.py | 2 +- .../libcxx-simulators/string/main.cpp | 6 +++--- .../TestDataFormatterLibcxxUniquePtrSimulator.py | 2 +- .../libcxx-simulators/unique_ptr/main.cpp | 3 ++- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h index 3f305bdcb4d54..ef04a9ad76185 100644 --- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h +++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h @@ -58,7 +58,7 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, _T1 &first() { return static_cast<_Base1 &>(*this).__get(); } }; -#elif COMPRESSED_PAIR_REV == 1 +#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2 // From libc++ datasizeof.h template struct _FirstPaddingByte { _LLDB_NO_UNIQUE_ADDRESS _Tp __v_; @@ -72,6 +72,16 @@ inline const size_t __datasizeof_v = template struct __lldb_is_final : public integral_constant {}; +// The legacy layout has been patched, see +// https://github.com/llvm/llvm-project/pull/142516. +#if COMPRESSED_PAIR_REV == 1 +template class __compressed_pair_padding { + char __padding_[((is_empty<_ToPad>::value && +!__lldb_is_final<_ToPad>::value) || + is_reference<_ToPad>::value) + ? 0 + : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; +#else template inline const bool __is_reference_or_unpadded_object = (std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || @@ -89,6 +99,7 @@ class __compressed_pair_padding { }; template class __compressed_pair_padding<_ToPad, true> {}; +#endif #define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ [[__gnu__::__aligned__( \ @@ -106,7 +117,7 @@ template class __compressed_pair_padding<_ToPad, true> {}; _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding __padding2_; \ _LLDB_NO_UNIQUE_ADDRESS T3 Initializer3; \ _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding __padding3_; -#elif COMPRESSED_PAIR_REV == 2 +#elif COMPRESSED_PAIR_REV == 3 #define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ _LLDB_NO_UNIQUE_ADDRESS T1 Name1; \ _LLDB_NO_UNIQUE_ADDRESS T2 Name2 diff --git a/lldb/te
[Lldb-commits] [lldb] [lldb-dap] Make connection URLs match lldb (PR #144770)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/144770 Use the same scheme as ConnectionFileDescriptor::Connect and use "listen" and "accept". Addresses feedback from a Pavel in a different PR [1]. [1] https://github.com/llvm/llvm-project/pull/143628#discussion_r2152225200 >From ef08badff2ade1cd4bfcb457d4c32daf732ac300 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 18 Jun 2025 13:03:51 -0500 Subject: [PATCH] [lldb-dap] Make connection URLs match lldb Use the same scheme as ConnectionFileDescriptor::Connect and use "listen" and "accept". Addresses feedback from a Pavel in a different PR [1]. [1] https://github.com/llvm/llvm-project/pull/143628#discussion_r2152225200 --- lldb/include/lldb/Host/Socket.h | 9 ++ lldb/source/Host/common/Socket.cpp| 25 .../tools/lldb-dap/server/TestDAP_server.py | 6 ++-- lldb/tools/lldb-dap/Options.td| 4 +-- lldb/tools/lldb-dap/tool/lldb-dap.cpp | 29 +-- 5 files changed, 59 insertions(+), 14 deletions(-) diff --git a/lldb/include/lldb/Host/Socket.h b/lldb/include/lldb/Host/Socket.h index 4585eac12efb9..9af0e6f3fef08 100644 --- a/lldb/include/lldb/Host/Socket.h +++ b/lldb/include/lldb/Host/Socket.h @@ -74,6 +74,11 @@ class Socket : public IOObject { ProtocolUnixAbstract }; + enum SocketMode { +ModeAccept, +ModeConnect, + }; + struct HostAndPort { std::string hostname; uint16_t port; @@ -83,6 +88,10 @@ class Socket : public IOObject { } }; + using ProtocolModePair = std::pair; + static llvm::Expected + GetProtocolAndMode(llvm::StringRef scheme); + static const NativeSocket kInvalidSocketValue; ~Socket() override; diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 76f74401ac4d0..373e700c490ab 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -476,3 +476,28 @@ llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS, const Socket::HostAndPort &HP) { return OS << '[' << HP.hostname << ']' << ':' << HP.port; } + +llvm::Expected +Socket::GetProtocolAndMode(llvm::StringRef scheme) { + // Keep in sync with ConnectionFileDescriptor::Connect. + return llvm::StringSwitch>(scheme) + .Case("listen", ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeAccept}) + .Cases("accept", "unix-accept", + ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeAccept}) + .Case("unix-abstract-accept", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeAccept}) + .Cases("connect", "tcp-connect", + ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeConnect}) + .Case("udp", ProtocolModePair{SocketProtocol::ProtocolTcp, +SocketMode::ModeConnect}) + .Case("unix-connect", ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeConnect}) + .Case("unix-abstract-connect", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeConnect}) + .Default(llvm::createStringError("unsupported scheme")); +} diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index ed17044a220d4..592a4cfb0a88b 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -54,7 +54,7 @@ def test_server_port(self): Test launching a binary with a lldb-dap in server mode on a specific port. """ self.build() -(_, connection) = self.start_server(connection="tcp://localhost:0") +(_, connection) = self.start_server(connection="listen://localhost:0") self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") @@ -72,7 +72,7 @@ def cleanup(): self.addTearDownHook(cleanup) self.build() -(_, connection) = self.start_server(connection="unix://" + name) +(_, connection) = self.start_server(connection="accept://" + name) self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") @@ -82,7 +82,7 @@ def test_server_interrupt(self): Test launching a binary with lldb-dap in server mode and shutting down the server while the debug session is still active. """ self.build() -(process, connection) = self.start_server(connection="tcp://localhost:0") +(process, connection) = self.start_server(connection="listen://localhost:0") self.dap_server = dap_se
[Lldb-commits] [lldb] [lldb-dap] Make connection URLs match lldb (PR #144770)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Use the same scheme as ConnectionFileDescriptor::Connect and use "listen" and "accept". Addresses feedback from a Pavel in a different PR [1]. [1] https://github.com/llvm/llvm-project/pull/143628#discussion_r2152225200 --- Full diff: https://github.com/llvm/llvm-project/pull/144770.diff 5 Files Affected: - (modified) lldb/include/lldb/Host/Socket.h (+9) - (modified) lldb/source/Host/common/Socket.cpp (+25) - (modified) lldb/test/API/tools/lldb-dap/server/TestDAP_server.py (+3-3) - (modified) lldb/tools/lldb-dap/Options.td (+2-2) - (modified) lldb/tools/lldb-dap/tool/lldb-dap.cpp (+20-9) ``diff diff --git a/lldb/include/lldb/Host/Socket.h b/lldb/include/lldb/Host/Socket.h index 4585eac12efb9..9af0e6f3fef08 100644 --- a/lldb/include/lldb/Host/Socket.h +++ b/lldb/include/lldb/Host/Socket.h @@ -74,6 +74,11 @@ class Socket : public IOObject { ProtocolUnixAbstract }; + enum SocketMode { +ModeAccept, +ModeConnect, + }; + struct HostAndPort { std::string hostname; uint16_t port; @@ -83,6 +88,10 @@ class Socket : public IOObject { } }; + using ProtocolModePair = std::pair; + static llvm::Expected + GetProtocolAndMode(llvm::StringRef scheme); + static const NativeSocket kInvalidSocketValue; ~Socket() override; diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 76f74401ac4d0..373e700c490ab 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -476,3 +476,28 @@ llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS, const Socket::HostAndPort &HP) { return OS << '[' << HP.hostname << ']' << ':' << HP.port; } + +llvm::Expected +Socket::GetProtocolAndMode(llvm::StringRef scheme) { + // Keep in sync with ConnectionFileDescriptor::Connect. + return llvm::StringSwitch>(scheme) + .Case("listen", ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeAccept}) + .Cases("accept", "unix-accept", + ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeAccept}) + .Case("unix-abstract-accept", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeAccept}) + .Cases("connect", "tcp-connect", + ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeConnect}) + .Case("udp", ProtocolModePair{SocketProtocol::ProtocolTcp, +SocketMode::ModeConnect}) + .Case("unix-connect", ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeConnect}) + .Case("unix-abstract-connect", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeConnect}) + .Default(llvm::createStringError("unsupported scheme")); +} diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index ed17044a220d4..592a4cfb0a88b 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -54,7 +54,7 @@ def test_server_port(self): Test launching a binary with a lldb-dap in server mode on a specific port. """ self.build() -(_, connection) = self.start_server(connection="tcp://localhost:0") +(_, connection) = self.start_server(connection="listen://localhost:0") self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") @@ -72,7 +72,7 @@ def cleanup(): self.addTearDownHook(cleanup) self.build() -(_, connection) = self.start_server(connection="unix://" + name) +(_, connection) = self.start_server(connection="accept://" + name) self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") @@ -82,7 +82,7 @@ def test_server_interrupt(self): Test launching a binary with lldb-dap in server mode and shutting down the server while the debug session is still active. """ self.build() -(process, connection) = self.start_server(connection="tcp://localhost:0") +(process, connection) = self.start_server(connection="listen://localhost:0") self.dap_server = dap_server.DebugAdapterServer( connection=connection, ) diff --git a/lldb/tools/lldb-dap/Options.td b/lldb/tools/lldb-dap/Options.td index aecf91797ac70..867753e9294a6 100644 --- a/lldb/tools/lldb-dap/Options.td +++ b/lldb/tools/lldb-dap/Options.td @@ -28,8 +28,8 @@ def connection MetaVarName<"">, HelpText< "Communicate with the lldb-da
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
@@ -16,6 +17,37 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +self.build() +target = self.dbg.CreateTarget(None) + +# Wait attach to a process, then check to see that a progress report was created +# and that its message is correct for waiting to attach to a process. +class AttachThread(threading.Thread): +def __init__(self, target): +threading.Thread.__init__(self) +self.target = target + +def run(self): +self.target.AttachToProcessWithName( +lldb.SBListener(), "a.out", True, lldb.SBError() +) + +thread = AttachThread(target) +thread.start() + +event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster) +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +self.assertGreater(len(message), 0) bulbazord wrote: nit: Checking for `len(message) > 0` is redundant with the `assertEqual` below. https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/144731 >From fdff64cca23ab113c80ed431949d7a58bdedb8c7 Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Wed, 18 Jun 2025 16:41:40 +0100 Subject: [PATCH 1/3] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 266 -- 1 file changed, 110 insertions(+), 156 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 0f18abb47591d..1810c07652a2b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::
[Lldb-commits] [lldb] [lldb/cmake][WIP] Plugin layering enforcement mechanism (PR #144543)
https://github.com/bulbazord commented: LGTM as well. In terms of "Tolerated" vs "Acceptable", I would argue every dependency should be "tolerated" by default and "acceptable" should be the one that requires justification. https://github.com/llvm/llvm-project/pull/144543 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Use protocol types for ReadMemory request (PR #144552)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/144552 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/medismailben edited https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Use protocol types for ReadMemory request (PR #144552)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/144552 ___ 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 source references (PR #144364)
https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/144364 >From 8b79cd751c70d3e8aec78df0cc39e9779493adf1 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Mon, 16 Jun 2025 11:00:05 +0100 Subject: [PATCH 1/4] [lldb-dap] Fix source references The protocol expects that `sourceReference` be less than `(2^31)-1`, but we currently represent memory address as source reference, this can be truncated either when sending through json or by the client. Instead, generate new source references based on the memory address. Make the `CreateSource` function return an optional source. # Conflicts: # lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp --- .../TestDAP_breakpointAssembly.py | 14 ++--- lldb/tools/lldb-dap/Breakpoint.cpp| 7 ++- lldb/tools/lldb-dap/DAP.cpp | 19 +++ lldb/tools/lldb-dap/DAP.h | 7 ++- .../Handler/DisassembleRequestHandler.cpp | 16 +++--- .../Handler/LocationsRequestHandler.cpp | 22 +++- .../lldb-dap/Handler/SourceRequestHandler.cpp | 32 +++- .../Handler/StackTraceRequestHandler.cpp | 2 +- lldb/tools/lldb-dap/JSONUtils.cpp | 12 +++-- lldb/tools/lldb-dap/JSONUtils.h | 5 +- .../lldb-dap/Protocol/ProtocolRequests.h | 2 +- .../tools/lldb-dap/Protocol/ProtocolTypes.cpp | 2 +- lldb/tools/lldb-dap/Protocol/ProtocolTypes.h | 3 +- lldb/tools/lldb-dap/ProtocolUtils.cpp | 51 --- lldb/tools/lldb-dap/ProtocolUtils.h | 13 +++-- lldb/tools/lldb-dap/SourceBreakpoint.cpp | 8 ++- 16 files changed, 152 insertions(+), 63 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py b/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py index 8bccc2bcf4156..674bfe4199b4a 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py +++ b/lldb/test/API/tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py @@ -67,19 +67,19 @@ def test_break_on_invalid_source_reference(self): "Invalid sourceReference.", ) -# Verify that setting a breakpoint on a source reference without a symbol also fails +# Verify that setting a breakpoint on a source reference that is not created fails response = self.dap_server.request_setBreakpoints( -Source(source_reference=0), [1] +Source(source_reference=200), [1] ) self.assertIsNotNone(response) breakpoints = response["body"]["breakpoints"] self.assertEqual(len(breakpoints), 1) -breakpoint = breakpoints[0] +break_point = breakpoints[0] self.assertFalse( -breakpoint["verified"], "Expected breakpoint to not be verified" +break_point["verified"], "Expected breakpoint to not be verified" ) -self.assertIn("message", breakpoint, "Expected message to be present") +self.assertIn("message", break_point, "Expected message to be present") self.assertEqual( -breakpoint["message"], -"Breakpoints in assembly without a valid symbol are not supported yet.", +break_point["message"], +"Invalid sourceReference.", ) diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp b/lldb/tools/lldb-dap/Breakpoint.cpp index ef5646c4c3d16..e1b073405ebb2 100644 --- a/lldb/tools/lldb-dap/Breakpoint.cpp +++ b/lldb/tools/lldb-dap/Breakpoint.cpp @@ -64,8 +64,11 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() { "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget())); breakpoint.instructionReference = formatted_addr; -auto source = CreateSource(bp_addr, m_dap.target); -if (!IsAssemblySource(source)) { +std::optional source = +CreateSource(bp_addr, m_dap.target, [this](lldb::addr_t addr) { + return m_dap.CreateSourceReference(addr); +}); +if (source && !IsAssemblySource(*source)) { auto line_entry = bp_addr.GetLineEntry(); const auto line = line_entry.GetLine(); if (line != LLDB_INVALID_LINE_NUMBER) diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index 9fe8227cd2d6f..56bb5903080dc 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -510,6 +510,25 @@ DAP::SendFormattedOutput(OutputType o, const char *format, ...) { o, llvm::StringRef(buffer, std::min(actual_length, sizeof(buffer; } +int32_t DAP::CreateSourceReference(lldb::addr_t address) { + auto iter = llvm::find(source_references, address); + if (iter != source_references.end()) +return std::distance(source_references.begin(), iter) + 1; + + source_references.emplace_back(address); + return static_cast(source_references.size()); +} + +std::optional DAP::GetSourceReferenceAddress(int32_t reference) { + if (reference <= LLDB_DAP_IN
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
@@ -33,6 +33,37 @@ static void EmplaceSafeString(llvm::json::Object &obj, llvm::StringRef key, obj.try_emplace(key, llvm::json::fixUTF8(str)); } +static void UpdateDwoFileCounts(SymbolFile *sym_file, +uint32_t &total_dwo_file_count, +uint32_t &total_loaded_dwo_file_count) { + // Count DWO files from this symbol file using GetSeparateDebugInfo + // For DWP files, this increments counts for both total and successfully + // loaded DWO CUs. For non split-dwarf files, these counts should not change + StructuredData::Dictionary separate_debug_info; + if (sym_file->GetSeparateDebugInfo(separate_debug_info, jeffreytan81 wrote: I would not recommend calling `GetSeparateDebugInfo` API for this task. `GetSeparateDebugInfo` API constructs `StructuredData::Dictionary` JSON style objects internally which is not cheap (I have seen profile traces that indicate constructing `StructuredData::Dictionary` as hot paths). This can get worse considering we are using `statistics dump` in lldb session logging by default. (means we are paying the cost every time). If we want to reuse it, I would suggest refactoring and reuse the necessary underlying implementation without extra expensive burdens. https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add Model Context Protocol (MCP) support to LLDB (PR #143628)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/143628 >From 56c23f6a76a253ada29af7339453f2c336fca7a7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 12 Jun 2025 16:33:55 -0700 Subject: [PATCH 1/2] [lldb] Add MCP support to LLDB https://discourse.llvm.org/t/rfc-adding-mcp-support-to-lldb/86798 --- lldb/cmake/modules/LLDBConfig.cmake | 1 + lldb/include/lldb/Core/Debugger.h | 6 + lldb/include/lldb/Core/PluginManager.h| 11 + lldb/include/lldb/Core/ProtocolServer.h | 39 +++ .../Interpreter/CommandOptionArgumentTable.h | 1 + lldb/include/lldb/lldb-enumerations.h | 1 + lldb/include/lldb/lldb-forward.h | 3 +- lldb/include/lldb/lldb-private-interfaces.h | 2 + lldb/source/Commands/CMakeLists.txt | 1 + .../Commands/CommandObjectProtocolServer.cpp | 186 +++ .../Commands/CommandObjectProtocolServer.h| 25 ++ lldb/source/Core/CMakeLists.txt | 1 + lldb/source/Core/Debugger.cpp | 24 ++ lldb/source/Core/PluginManager.cpp| 32 ++ lldb/source/Core/ProtocolServer.cpp | 21 ++ .../source/Interpreter/CommandInterpreter.cpp | 2 + lldb/source/Plugins/CMakeLists.txt| 4 + lldb/source/Plugins/Protocol/CMakeLists.txt | 1 + .../Plugins/Protocol/MCP/CMakeLists.txt | 13 + lldb/source/Plugins/Protocol/MCP/MCPError.cpp | 34 ++ lldb/source/Plugins/Protocol/MCP/MCPError.h | 33 ++ lldb/source/Plugins/Protocol/MCP/Protocol.cpp | 214 lldb/source/Plugins/Protocol/MCP/Protocol.h | 128 .../Protocol/MCP/ProtocolServerMCP.cpp| 309 ++ .../Plugins/Protocol/MCP/ProtocolServerMCP.h | 94 ++ lldb/source/Plugins/Protocol/MCP/Tool.cpp | 81 + lldb/source/Plugins/Protocol/MCP/Tool.h | 56 lldb/unittests/CMakeLists.txt | 4 + lldb/unittests/DAP/ProtocolTypesTest.cpp | 38 +-- lldb/unittests/Protocol/CMakeLists.txt| 12 + .../Protocol/ProtocolMCPServerTest.cpp| 290 lldb/unittests/Protocol/ProtocolMCPTest.cpp | 135 lldb/unittests/TestingSupport/TestUtilities.h | 9 + 33 files changed, 1788 insertions(+), 23 deletions(-) create mode 100644 lldb/include/lldb/Core/ProtocolServer.h create mode 100644 lldb/source/Commands/CommandObjectProtocolServer.cpp create mode 100644 lldb/source/Commands/CommandObjectProtocolServer.h create mode 100644 lldb/source/Core/ProtocolServer.cpp create mode 100644 lldb/source/Plugins/Protocol/CMakeLists.txt create mode 100644 lldb/source/Plugins/Protocol/MCP/CMakeLists.txt create mode 100644 lldb/source/Plugins/Protocol/MCP/MCPError.cpp create mode 100644 lldb/source/Plugins/Protocol/MCP/MCPError.h create mode 100644 lldb/source/Plugins/Protocol/MCP/Protocol.cpp create mode 100644 lldb/source/Plugins/Protocol/MCP/Protocol.h create mode 100644 lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp create mode 100644 lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h create mode 100644 lldb/source/Plugins/Protocol/MCP/Tool.cpp create mode 100644 lldb/source/Plugins/Protocol/MCP/Tool.h create mode 100644 lldb/unittests/Protocol/CMakeLists.txt create mode 100644 lldb/unittests/Protocol/ProtocolMCPServerTest.cpp create mode 100644 lldb/unittests/Protocol/ProtocolMCPTest.cpp diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 37b823feb584b..8c30b6e09d2c7 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -67,6 +67,7 @@ add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support in option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON) option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF) +option(LLDB_ENABLE_PROTOCOL_SERVERS "Enable protocol servers (e.g. MCP) in LLDB" ON) option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF) option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF) option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing lldb." OFF) diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index d73aba1e3ce58..0f6659d1a0bf7 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -598,6 +598,10 @@ class Debugger : public std::enable_shared_from_this, void FlushProcessOutput(Process &process, bool flush_stdout, bool flush_stderr); + void AddProtocolServer(lldb::ProtocolServerSP protocol_server_sp); + void RemoveProtocolServer(lldb::ProtocolServerSP protocol_server_sp); + lldb::ProtocolServerSP GetProtocolServer(llvm::StringRef protocol) const; + SourceManager::SourceFileCache &GetSourceFileCache() { return m_source_file_cache; } @@ -768,6 +772,8 @@ c
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/chelcassanova closed https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Make connection URLs match lldb (PR #144770)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/144770 >From adea12ff55b0a8259fc4c4470726cde8d35f4ffa Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 18 Jun 2025 13:03:51 -0500 Subject: [PATCH 1/2] [lldb-dap] Make connection URLs match lldb Use the same scheme as ConnectionFileDescriptor::Connect and use "listen" and "accept". Addresses feedback from a Pavel in a different PR [1]. [1] https://github.com/llvm/llvm-project/pull/143628#discussion_r2152225200 --- lldb/include/lldb/Host/Socket.h | 9 ++ lldb/source/Host/common/Socket.cpp| 32 +-- .../tools/lldb-dap/server/TestDAP_server.py | 6 ++-- lldb/tools/lldb-dap/Options.td| 4 +-- lldb/tools/lldb-dap/tool/lldb-dap.cpp | 27 ++-- 5 files changed, 61 insertions(+), 17 deletions(-) diff --git a/lldb/include/lldb/Host/Socket.h b/lldb/include/lldb/Host/Socket.h index 4585eac12efb9..c313aa4f6d26b 100644 --- a/lldb/include/lldb/Host/Socket.h +++ b/lldb/include/lldb/Host/Socket.h @@ -74,6 +74,11 @@ class Socket : public IOObject { ProtocolUnixAbstract }; + enum SocketMode { +ModeAccept, +ModeConnect, + }; + struct HostAndPort { std::string hostname; uint16_t port; @@ -83,6 +88,10 @@ class Socket : public IOObject { } }; + using ProtocolModePair = std::pair; + static std::optional + GetProtocolAndMode(llvm::StringRef scheme); + static const NativeSocket kInvalidSocketValue; ~Socket() override; diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 76f74401ac4d0..5c5cd653c3d9e 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -271,7 +271,8 @@ Socket::UdpConnect(llvm::StringRef host_and_port) { return UDPSocket::CreateConnected(host_and_port); } -llvm::Expected Socket::DecodeHostAndPort(llvm::StringRef host_and_port) { +llvm::Expected +Socket::DecodeHostAndPort(llvm::StringRef host_and_port) { static llvm::Regex g_regex("([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)"); HostAndPort ret; llvm::SmallVector matches; @@ -347,8 +348,8 @@ Status Socket::Write(const void *buf, size_t &num_bytes) { ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)", static_cast(this), static_cast(m_socket), buf, - static_cast(src_len), - static_cast(bytes_sent), error.AsCString()); + static_cast(src_len), static_cast(bytes_sent), + error.AsCString()); } return error; @@ -476,3 +477,28 @@ llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS, const Socket::HostAndPort &HP) { return OS << '[' << HP.hostname << ']' << ':' << HP.port; } + +std::optional +Socket::GetProtocolAndMode(llvm::StringRef scheme) { + // Keep in sync with ConnectionFileDescriptor::Connect. + return llvm::StringSwitch>(scheme) + .Case("listen", ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeAccept}) + .Cases("accept", "unix-accept", + ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeAccept}) + .Case("unix-abstract-accept", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeAccept}) + .Cases("connect", "tcp-connect", + ProtocolModePair{SocketProtocol::ProtocolTcp, + SocketMode::ModeConnect}) + .Case("udp", ProtocolModePair{SocketProtocol::ProtocolTcp, +SocketMode::ModeConnect}) + .Case("unix-connect", ProtocolModePair{SocketProtocol::ProtocolUnixDomain, + SocketMode::ModeConnect}) + .Case("unix-abstract-connect", +ProtocolModePair{SocketProtocol::ProtocolUnixAbstract, + SocketMode::ModeConnect}) + .Default(std::nullopt); +} diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index ed17044a220d4..592a4cfb0a88b 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -54,7 +54,7 @@ def test_server_port(self): Test launching a binary with a lldb-dap in server mode on a specific port. """ self.build() -(_, connection) = self.start_server(connection="tcp://localhost:0") +(_, connection) = self.start_server(connection="listen://localhost:0") self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") @@ -72,7 +72,7 @@ def cleanup(): self.addTearDownHook(cleanup) self.build() -(_, connection) = self.start_server(connection="unix
[Lldb-commits] [lldb] 03bdc0a - [lldb][target] Add progress report for wait-attaching to process (#144768)
Author: Chelsea Cassanova Date: 2025-06-18T13:51:59-07:00 New Revision: 03bdc0a1f68adcddef80a4e7931dbfae914e5652 URL: https://github.com/llvm/llvm-project/commit/03bdc0a1f68adcddef80a4e7931dbfae914e5652 DIFF: https://github.com/llvm/llvm-project/commit/03bdc0a1f68adcddef80a4e7931dbfae914e5652.diff LOG: [lldb][target] Add progress report for wait-attaching to process (#144768) This commit adds a progress report when wait-attaching to a process as well as a test for this. Added: Modified: lldb/source/Target/Target.cpp lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py Removed: diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 45a9e1196a049..8f8d2ef21cc5f 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3546,6 +3546,7 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + Progress attach_progress("Waiting to attach to process"); m_stats.SetLaunchOrAttachTime(); auto state = eStateInvalid; auto process_sp = GetProcessSP(); diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 9af53845ca1b7..8198c50a5ff0d 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -2,6 +2,7 @@ Test that we are able to broadcast and receive progress events from lldb """ import lldb +import threading import lldbsuite.test.lldbutil as lldbutil @@ -16,6 +17,36 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +self.build() +target = self.dbg.CreateTarget(None) + +# Wait attach to a process, then check to see that a progress report was created +# and that its message is correct for waiting to attach to a process. +class AttachThread(threading.Thread): +def __init__(self, target): +threading.Thread.__init__(self) +self.target = target + +def run(self): +self.target.AttachToProcessWithName( +lldb.SBListener(), "a.out", True, lldb.SBError() +) + +thread = AttachThread(target) +thread.start() + +event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster) +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +self.assertEqual(message, "Waiting to attach to process") + +# Interrupt the process attach to keep the test from stalling. +target.process.SendAsyncInterrupt() + +thread.join() + def test_dwarf_symbol_loading_progress_report(self): """Test that we are able to fetch dwarf symbol loading progress events""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
@@ -621,22 +623,25 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, } Environment &proc_env = process_info.GetEnvironment(); + bool is_simulator = false; while ((cstr = data.GetCStr(&offset))) { if (cstr[0] == '\0') break; -if (check_for_ios_simulator) { - if (strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == - 0) -process_info.GetArchitecture().GetTriple().setOS( -llvm::Triple::IOS); - else -process_info.GetArchitecture().GetTriple().setOS( -llvm::Triple::MacOSX); -} +if (check_for_ios_simulator && +strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == +0) clayborg wrote: ``` if (check_for_ios_simulator && env_var.starts_with("SIMULATOR_UDID=")) ``` https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
https://github.com/clayborg requested changes to this pull request. https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
@@ -621,22 +623,25 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, } Environment &proc_env = process_info.GetEnvironment(); + bool is_simulator = false; while ((cstr = data.GetCStr(&offset))) { clayborg wrote: Lets use llvm::StringRef here, you will see why below: ``` while (true) { llvm::StringRef env_var(data.GetCStr(&offset)); if (env_var.empty()) break; ``` https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/chelcassanova created https://github.com/llvm/llvm-project/pull/144768 This commit adds a progress report when wait-attaching to a process as well as a test for this. >From 211e0e2e18002da509e29d2bc46eb2fb8658c499 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Wed, 18 Jun 2025 09:26:08 -0700 Subject: [PATCH] [lldb][target] Add progress report for wait-attaching to process This commit adds a progress report when wait-attaching to a process as well as a test for this. --- lldb/source/Target/Target.cpp | 2 ++ .../TestProgressReporting.py | 32 +++ 2 files changed, 34 insertions(+) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 45a9e1196a049..8819651378791 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3546,6 +3546,8 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + std::unique_ptr attach_progress; + attach_progress = std::make_unique("Waiting to attach to process"); m_stats.SetLaunchOrAttachTime(); auto state = eStateInvalid; auto process_sp = GetProcessSP(); diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 9af53845ca1b7..b0ca3939c551b 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -2,6 +2,7 @@ Test that we are able to broadcast and receive progress events from lldb """ import lldb +import threading import lldbsuite.test.lldbutil as lldbutil @@ -16,6 +17,37 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +self.build() +target = self.dbg.CreateTarget(None) + +# Wait attach to a process, then check to see that a progress report was created +# and that its message is correct for waiting to attach to a process. +class AttachThread(threading.Thread): +def __init__(self, target): +threading.Thread.__init__(self) +self.target = target + +def run(self): +self.target.AttachToProcessWithName( +lldb.SBListener(), "a.out", True, lldb.SBError() +) + +thread = AttachThread(target) +thread.start() + +event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster) +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +self.assertGreater(len(message), 0) +self.assertEqual(message, "Waiting to attach to process") + +# Interrupt the process attach to keep the test from stalling. +target.process.SendAsyncInterrupt() + +thread.join() + def test_dwarf_symbol_loading_progress_report(self): """Test that we are able to fetch dwarf symbol loading progress events""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) Changes This commit adds a progress report when wait-attaching to a process as well as a test for this. --- Full diff: https://github.com/llvm/llvm-project/pull/144768.diff 2 Files Affected: - (modified) lldb/source/Target/Target.cpp (+2) - (modified) lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py (+32) ``diff diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 45a9e1196a049..8819651378791 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3546,6 +3546,8 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + std::unique_ptr attach_progress; + attach_progress = std::make_unique("Waiting to attach to process"); m_stats.SetLaunchOrAttachTime(); auto state = eStateInvalid; auto process_sp = GetProcessSP(); diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 9af53845ca1b7..b0ca3939c551b 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -2,6 +2,7 @@ Test that we are able to broadcast and receive progress events from lldb """ import lldb +import threading import lldbsuite.test.lldbutil as lldbutil @@ -16,6 +17,37 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +self.build() +target = self.dbg.CreateTarget(None) + +# Wait attach to a process, then check to see that a progress report was created +# and that its message is correct for waiting to attach to a process. +class AttachThread(threading.Thread): +def __init__(self, target): +threading.Thread.__init__(self) +self.target = target + +def run(self): +self.target.AttachToProcessWithName( +lldb.SBListener(), "a.out", True, lldb.SBError() +) + +thread = AttachThread(target) +thread.start() + +event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster) +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +self.assertGreater(len(message), 0) +self.assertEqual(message, "Waiting to attach to process") + +# Interrupt the process attach to keep the test from stalling. +target.process.SendAsyncInterrupt() + +thread.join() + def test_dwarf_symbol_loading_progress_report(self): """Test that we are able to fetch dwarf symbol loading progress events""" self.build() `` https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
https://github.com/qxy11 updated https://github.com/llvm/llvm-project/pull/144424 >From 57483ee0f44f8bbed325268e7d1d40b1a0403aa1 Mon Sep 17 00:00:00 2001 From: Janet Yang Date: Mon, 16 Jun 2025 11:06:24 -0700 Subject: [PATCH 1/5] Add counter for number of DWO files loaded in statistics --- lldb/include/lldb/Symbol/SymbolFile.h | 5 +++ .../Python/lldbsuite/test/builders/builder.py | 25 ++- .../Python/lldbsuite/test/make/Makefile.rules | 4 +++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 1 + .../SymbolFile/DWARF/SymbolFileDWARF.h| 9 ++ .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp | 2 +- lldb/source/Target/Statistics.cpp | 5 +++ .../commands/statistics/basic/TestStats.py| 31 +++ .../API/commands/statistics/basic/baz.cpp | 12 +++ .../API/commands/statistics/basic/third.cpp | 7 + 10 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 lldb/test/API/commands/statistics/basic/baz.cpp create mode 100644 lldb/test/API/commands/statistics/basic/third.cpp diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 75c7f230ddf3d..42fbc2508889a 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -425,6 +425,11 @@ class SymbolFile : public PluginInterface { /// Reset the statistics for the symbol file. virtual void ResetStatistics() {} + /// Get the number of loaded DWO files for this symbol file. + /// This is used for statistics gathering and will return 0 for most + /// symbol file implementations except DWARF symbol files. + virtual uint32_t GetLoadedDwoFileCount() const { return 0; } + /// Get the additional modules that this symbol file uses to parse debug info. /// /// Some debug info is stored in stand alone object files that are represented diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index de05732469448..572abf590345c 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,13 +247,24 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] -if debug_info == "dwarf": -return ["MAKE_DSYM=NO"] -if debug_info == "dwo": -return ["MAKE_DSYM=NO", "MAKE_DWO=YES"] -if debug_info == "gmodules": -return ["MAKE_DSYM=NO", "MAKE_GMODULES=YES"] -return None + +debug_options = debug_info if isinstance(debug_info, list) else [debug_info] +option_flags = { +"dwarf": {"MAKE_DSYM": "NO"}, +"dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"}, +"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"}, +"debug_names": {"MAKE_DEBUG_NAMES": "YES"}, +} + +# Collect all flags, with later options overriding earlier ones +flags = {} + +for option in debug_options: +if not option or option not in option_flags: +return None # Invalid options +flags.update(option_flags[option]) + +return [f"{key}={value}" for key, value in flags.items()] def getBuildCommand( self, diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 06959f226066a..58833e1b0cc78 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -276,6 +276,10 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif +ifeq "$(MAKE_DEBUG_NAMES)" "YES" + CFLAGS += -gpubnames +endif + ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES" THE_CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/private-module-cache else diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 71f204c03a42a..acd9d2230c201 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4358,6 +4358,7 @@ StatsDuration::Duration SymbolFileDWARF::GetDebugInfoIndexTime() { void SymbolFileDWARF::ResetStatistics() { m_parse_time.reset(); + m_loaded_dwo_file_count = 0; if (m_index) return m_index->ResetStatistics(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index d2d30d7decb16..d695961bbfc1d 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -315,6 +315,11 @@ class SymbolFileDWARF : public SymbolFileCommon { void ResetStatistics() override; + /// Get the number of loaded DWO files for this symbol file + uint32_t GetLoadedD
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/144768 >From daae7e75e5181643c5cf027c8623ee52edf052fc Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Wed, 18 Jun 2025 09:26:08 -0700 Subject: [PATCH] [lldb][target] Add progress report for wait-attaching to process This commit adds a progress report when wait-attaching to a process as well as a test for this. --- lldb/source/Target/Target.cpp | 1 + .../TestProgressReporting.py | 31 +++ 2 files changed, 32 insertions(+) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 45a9e1196a049..8f8d2ef21cc5f 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3546,6 +3546,7 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + Progress attach_progress("Waiting to attach to process"); m_stats.SetLaunchOrAttachTime(); auto state = eStateInvalid; auto process_sp = GetProcessSP(); diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 9af53845ca1b7..8198c50a5ff0d 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -2,6 +2,7 @@ Test that we are able to broadcast and receive progress events from lldb """ import lldb +import threading import lldbsuite.test.lldbutil as lldbutil @@ -16,6 +17,36 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +self.build() +target = self.dbg.CreateTarget(None) + +# Wait attach to a process, then check to see that a progress report was created +# and that its message is correct for waiting to attach to a process. +class AttachThread(threading.Thread): +def __init__(self, target): +threading.Thread.__init__(self) +self.target = target + +def run(self): +self.target.AttachToProcessWithName( +lldb.SBListener(), "a.out", True, lldb.SBError() +) + +thread = AttachThread(target) +thread.start() + +event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster) +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +self.assertEqual(message, "Waiting to attach to process") + +# Interrupt the process attach to keep the test from stalling. +target.process.SendAsyncInterrupt() + +thread.join() + def test_dwarf_symbol_loading_progress_report(self): """Test that we are able to fetch dwarf symbol loading progress events""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/143177 >From 87f304cc15702fe5924990bf4f3f9a45e79ad869 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Wed, 18 Jun 2025 21:49:16 +0200 Subject: [PATCH] [LLDB] Add type summaries for MSVC STL strings --- .../lldb/DataFormatters/StringPrinter.h | 15 ++ .../Python/lldbsuite/test/configuration.py| 2 + lldb/packages/Python/lldbsuite/test/dotest.py | 23 +++ .../Python/lldbsuite/test/dotest_args.py | 6 + .../Python/lldbsuite/test/test_categories.py | 1 + .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 139 + .../Plugins/Language/CPlusPlus/LibStdcpp.cpp | 38 + .../Plugins/Language/CPlusPlus/LibStdcpp.h| 8 + .../Plugins/Language/CPlusPlus/MsvcStl.cpp| 146 ++ .../Plugins/Language/CPlusPlus/MsvcStl.h | 35 + .../msvcstl/string/Makefile | 4 + .../string/TestDataFormatterStdString.py | 118 ++ .../msvcstl/string/main.cpp | 40 + .../msvcstl/u8string/Makefile | 4 + .../u8string/TestDataFormatterStdU8String.py | 31 .../msvcstl/u8string/main.cpp | 14 ++ lldb/test/API/lit.cfg.py | 3 + 18 files changed, 597 insertions(+), 31 deletions(-) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.cpp create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/Makefile create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/TestDataFormatterStdString.py create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/string/main.cpp create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/Makefile create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/TestDataFormatterStdU8String.py create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/msvcstl/u8string/main.cpp diff --git a/lldb/include/lldb/DataFormatters/StringPrinter.h b/lldb/include/lldb/DataFormatters/StringPrinter.h index 4169f53e63f38..4ebe712be60e1 100644 --- a/lldb/include/lldb/DataFormatters/StringPrinter.h +++ b/lldb/include/lldb/DataFormatters/StringPrinter.h @@ -152,6 +152,21 @@ class StringPrinter { template static bool ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options); + + template + static constexpr uint64_t ElementByteSize() { +switch (element_type) { +case StringElementType::ASCII: +case StringElementType::UTF8: + return 1; +case StringElementType::UTF16: + return 2; +case StringElementType::UTF32: + return 3; +default: + return 0; +} + } }; } // namespace formatters diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py index b2d91fd211477..4ec892bef69f9 100644 --- a/lldb/packages/Python/lldbsuite/test/configuration.py +++ b/lldb/packages/Python/lldbsuite/test/configuration.py @@ -134,6 +134,8 @@ libcxx_include_target_dir = None libcxx_library_dir = None +target_triple = None + # A plugin whose tests will be enabled, like intel-pt. enabled_plugins = [] diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index d7f274ac4f60e..dd6fbdf8daed4 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs(): configuration.libcxx_library_dir = args.libcxx_library_dir configuration.cmake_build_type = args.cmake_build_type.lower() +configuration.target_triple = args.target_triple + if args.channels: lldbtest_config.channels = args.channels @@ -831,6 +833,26 @@ def checkLibstdcxxSupport(): configuration.skip_categories.append("libstdcxx") +def canRunMsvcStlTests(): +if "windows-msvc" in configuration.target_triple: +return True, "MSVC STL is present on *windows-msvc*" +return ( +False, +f"Don't know how to build with MSVC's STL on {configuration.target_triple}", +) + + +def checkMsvcStlSupport(): +result, reason = canRunMsvcStlTests() +if result: +return # msvcstl supported +if "msvcstl" in configuration.categories_list: +return # msvcstl category explicitly requested, let it run. +if configuration.verbose: +print(f"msvcstl tests will not be run because: {reason}") +configuration.skip_categories.append("msvcstl") + + def canRunWatchpointTests(): from lldbsuite.test import lldbplatformutil @@ -1044,6 +1066,7 @@ def run_suite(): checkLibcxxSupport() checkLi
[Lldb-commits] [lldb] a630ca6 - [lldb][breakpoint] Grey out disabled breakpoints (#91404)
Author: Chelsea Cassanova Date: 2025-06-18T13:06:20-07:00 New Revision: a630ca6f6c4727d852d60076d1179c3e9830ca2f URL: https://github.com/llvm/llvm-project/commit/a630ca6f6c4727d852d60076d1179c3e9830ca2f DIFF: https://github.com/llvm/llvm-project/commit/a630ca6f6c4727d852d60076d1179c3e9830ca2f.diff LOG: [lldb][breakpoint] Grey out disabled breakpoints (#91404) This commit adds colour settings to the list of breakpoints in order to grey out breakpoints that have been disabled. Added: lldb/test/API/terminal/TestDisabledBreakpoints.py Modified: lldb/include/lldb/Core/Debugger.h lldb/source/Breakpoint/Breakpoint.cpp lldb/source/Core/CoreProperties.td lldb/source/Core/Debugger.cpp Removed: diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index d73aba1e3ce58..2087ef2a11562 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -307,6 +307,10 @@ class Debugger : public std::enable_shared_from_this, llvm::StringRef GetShowProgressAnsiSuffix() const; + llvm::StringRef GetDisabledAnsiPrefix() const; + + llvm::StringRef GetDisabledAnsiSuffix() const; + bool GetUseAutosuggestion() const; llvm::StringRef GetAutosuggestionAnsiPrefix() const; diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 337c1a4ac401f..2ed0c9314e3e1 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -15,6 +15,7 @@ #include "lldb/Breakpoint/BreakpointResolver.h" #include "lldb/Breakpoint/BreakpointResolverFileLine.h" #include "lldb/Core/Address.h" +#include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/SearchFilter.h" @@ -26,6 +27,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" +#include "lldb/Utility/AnsiTerminal.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" @@ -838,6 +840,13 @@ void Breakpoint::GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_locations) { assert(s != nullptr); + const bool dim_breakpoint_description = + !IsEnabled() && s->AsRawOstream().colors_enabled(); + if (dim_breakpoint_description) +s->Printf("%s", ansi::FormatAnsiTerminalCodes( +GetTarget().GetDebugger().GetDisabledAnsiPrefix()) +.c_str()); + if (!m_kind_description.empty()) { if (level == eDescriptionLevelBrief) { s->PutCString(GetBreakpointKind()); @@ -934,6 +943,12 @@ void Breakpoint::GetDescription(Stream *s, lldb::DescriptionLevel level, } s->IndentLess(); } + + // Reset the colors back to normal if they were previously greyed out. + if (dim_breakpoint_description) +s->Printf("%s", ansi::FormatAnsiTerminalCodes( +GetTarget().GetDebugger().GetDisabledAnsiSuffix()) +.c_str()); } void Breakpoint::GetResolverDescription(Stream *s) { diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 4d1ea5dfec2eb..53dd333f045c9 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -191,6 +191,22 @@ let Definition = "debugger" in { "${separator}${thread.stop-reason}}{ " "${separator}{${progress.count} }${progress.message}}">, Desc<"The default statusline format string.">; + + def ShowDisabledAnsiPrefix + : Property<"disable-ansi-prefix", "String">, +Global, +DefaultStringValue<"${ansi.faint}">, +Desc<"If something has been disabled in a color-enabled terminal, use " + "the ANSI terminal code specified immediately before whatever has " + "been disabled.">; + def ShowDisabledAnsiSuffix + : Property<"disable-ansi-suffix", "String">, +Global, +DefaultStringValue<"${ansi.normal}">, +Desc<"When somehing has been disabled in a color-enabled terminal, use " + "the ANSI terminal code specified immediately after whatever has " + "been disabled.">; + def UseSourceCache: Property<"use-source-cache", "Boolean">, Global, DefaultTrue, diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 81037d3def811..c9935f2d745fa 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -510,6 +510,18 @@ llvm::StringRef Debugger::GetSeparator() const { idx, g_debugger_properties[idx].default_cstr_value); } +llvm::StringRef Debugger::GetDisabledAnsiPrefix() const { + const uint32_t idx = ePropertyShowDisabledAnsiPrefix; + return GetPropertyAtIndexAs( + idx, g_debugger_properties[idx].default_cstr_value); +} + +llvm::StringRef Debugg
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
https://github.com/chelcassanova closed https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)
chelcassanova wrote: @bulbazord @medismailben Updated this patch to add both of your suggestions https://github.com/llvm/llvm-project/pull/144768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr1024 type and DMF integer calculation builtins (PR #142480)
https://github.com/maryammo edited https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr1024 type and DMF integer calculation builtins (PR #142480)
https://github.com/maryammo edited https://github.com/llvm/llvm-project/pull/142480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
Nerixyz wrote: > The composite formats are not an _un_reasonable idea, but I can't help but > wonder if we even need to touch the generic data formatter infrastructure. I > mean we already have the ability to do callback-based summaries, so what if > we just did the stl switch inside the callback? Being able to do this > declaratively is sort of nice, but this already isn't completely declarative > since you have callbacks for type validation. That's a good point. I removed the `CXXCompositeSummaryFormat` and implemented the selection in a lambda. > Implementing `${var._M_dataplus._M_p}` in c++ is not that hard, and this is > probably one of our more complex summaries (containers just say > `size=#children`), which doesn't even need to be customized for different > STLs. Right, I did that at the beginning, but then saw more types using string summaries without looking at what they're doing, so I wanted to support both. Without the new summary type this PR is much more manageable. https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
https://github.com/Nerixyz edited https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] add has methods to all DemangledNameInfo attributes (PR #144549)
https://github.com/adrian-prantl approved this pull request. It would be nice if these were at least unit-tested on llvm.org, but given how trivial the implementation is, make not strictly necessary. https://github.com/llvm/llvm-project/pull/144549 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
@@ -621,22 +623,25 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, } Environment &proc_env = process_info.GetEnvironment(); + bool is_simulator = false; while ((cstr = data.GetCStr(&offset))) { royitaqi wrote: Updated the PR, but not exactly as you suggested (I tried a `for` loop, not a `while`). LMK if that's better or worse. https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Zyn (zyn-li) Changes The `__iter__` method in `SBMemoryRegionInfoListExtensions` reused the same `SBMemoryRegionInfo` object reference across all iterations, only updating its content in each loop. This caused all yielded objects to be references to the same instance. Moved the object creation inside the loop to ensure each iteration yields a unique instance: ### Testing Updated the existing test in `**TestFindInMemory.py**` to: 1. **Iterator vs Index Access Comparison**: Collects regions via iteration and compares their data with regions accessed by index to ensure they match 2. **Data Integrity Verification**: Confirms that different regions have different base addresses (would fail before the fix since all collected regions had the same data) The test validates both that the iterator works correctly and that each yielded object contains the correct data for its respective memory region. --- Full diff: https://github.com/llvm/llvm-project/pull/144815.diff 2 Files Affected: - (modified) lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i (+1-1) - (modified) lldb/test/API/python_api/find_in_memory/TestFindInMemory.py (+21-3) ``diff diff --git a/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i b/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i index 29c0179c0ffe3..f565f45880119 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i @@ -9,8 +9,8 @@ '''Iterate over all the memory regions in a lldb.SBMemoryRegionInfoList object.''' import lldb size = self.GetSize() - region = lldb.SBMemoryRegionInfo() for i in range(size): +region = lldb.SBMemoryRegionInfo() self.GetMemoryRegionAtIndex(i, region) yield region %} diff --git a/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py b/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py index 1ef37d2ec9898..4eabbb6e46774 100644 --- a/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py +++ b/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py @@ -154,14 +154,32 @@ def test_find_in_memory_unaligned(self): self.assertEqual(addr, lldb.LLDB_INVALID_ADDRESS) def test_memory_info_list_iterable(self): -"""Make sure the SBMemoryRegionInfoList is iterable""" +"""Make sure the SBMemoryRegionInfoList is iterable and each yielded object is unique""" self.assertTrue(self.process, PROCESS_IS_VALID) self.assertState(self.process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) info_list = self.process.GetMemoryRegions() self.assertTrue(info_list.GetSize() > 0) + +collected_info = [] try: -for info in info_list: -pass +for region in info_list: +collected_info.append(region) except Exception: self.fail("SBMemoryRegionInfoList is not iterable") + +self.assertTrue(len(collected_info) >= 2, "Need at least 2 items") +self.assertEqual(len(collected_info), info_list.GetSize(), "Should have collected all items") + +for i in range(len(collected_info)): +region = lldb.SBMemoryRegionInfo() +info_list.GetMemoryRegionAtIndex(i, region) + +self.assertEqual(collected_info[i].GetRegionBase(), region.GetRegionBase(), + f"items {i}: iterator data should match index access data") +self.assertEqual(collected_info[i].GetRegionEnd(), region.GetRegionEnd(), + f"items {i}: iterator data should match index access data") + +if len(collected_info) >= 2: +self.assertNotEqual(collected_info[0].GetRegionBase(), collected_info[1].GetRegionBase(), + "Different items should have different base addresses") `` https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
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/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
zyn-li wrote: Could you please review this. @dmpots @Jlalond @aperez https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
https://github.com/zyn-li edited https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
https://github.com/royitaqi edited https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
https://github.com/royitaqi edited https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
https://github.com/royitaqi edited https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/139174 >From d98210b81f7b49f5384e968b1a18e00e432aaf2c Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Thu, 8 May 2025 16:21:53 -0700 Subject: [PATCH 1/5] Fix macOS FindProcessImpl() --- lldb/source/Host/macosx/objcxx/Host.mm | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index e187bf98188ae..e8a1c597eea53 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -595,7 +595,9 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, const llvm::Triple::ArchType triple_arch = triple.getArch(); const bool check_for_ios_simulator = (triple_arch == llvm::Triple::x86 || - triple_arch == llvm::Triple::x86_64); + triple_arch == llvm::Triple::x86_64 || + triple_arch == llvm::Triple::aarch64); + const char *cstr = data.GetCStr(&offset); if (cstr) { process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native); @@ -621,22 +623,25 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, } Environment &proc_env = process_info.GetEnvironment(); + bool is_simulator = false; while ((cstr = data.GetCStr(&offset))) { if (cstr[0] == '\0') break; -if (check_for_ios_simulator) { - if (strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == - 0) -process_info.GetArchitecture().GetTriple().setOS( -llvm::Triple::IOS); - else -process_info.GetArchitecture().GetTriple().setOS( -llvm::Triple::MacOSX); -} +if (check_for_ios_simulator && +strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == +0) + is_simulator = true; proc_env.insert(cstr); } + llvm::Triple &triple = process_info.GetArchitecture().GetTriple(); + if (is_simulator) { +triple.setOS(llvm::Triple::IOS); +triple.setEnvironment(llvm::Triple::Simulator); + } else { +triple.setOS(llvm::Triple::MacOSX); + } return true; } } >From 8377bc3b61fb30c003d1d188d6e8d879baea58ab Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Mon, 16 Jun 2025 11:06:47 -0700 Subject: [PATCH 2/5] Add test --- lldb/test/API/macosx/simulator/TestSimulatorPlatform.py | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py index 74ba0ee6c83bb..8406ee45479fd 100644 --- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py +++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -39,7 +39,7 @@ def check_debugserver(self, log, expected_platform, expected_version): if expected_version: self.assertEqual(aout_info["min_version_os_sdk"], expected_version) -def run_with(self, arch, os, vers, env, expected_load_command): +def run_with(self, arch, os, vers, env, expected_load_command, expected_platform=None): env_list = [env] if env else [] triple = "-".join([arch, "apple", os + vers] + env_list) sdk = lldbutil.get_xcode_sdk(os, env) @@ -75,6 +75,11 @@ def run_with(self, arch, os, vers, env, expected_load_command): self, "break here", lldb.SBFileSpec("hello.c") ) triple_re = "-".join([arch, "apple", os + vers + ".*"] + env_list) +if expected_platform is not None: +# The current platform should be expected +self.expect("platform status", patterns=[r"Platform: " + expected_platform]) +# Should be able to list processes on the current platform +self.expect("platform process list", patterns=[r"\d+ matching processes were found on \"%s\"" % expected_platform]) self.expect("image list -b -t", patterns=[r"a\.out " + triple_re]) self.check_debugserver(log, os + env, vers) @@ -90,6 +95,7 @@ def test_ios(self): vers="", env="simulator", expected_load_command="LC_BUILD_VERSION", +expected_platform="ios-simulator", ) @skipIfAsan >From 2c31b44d01a7a8bc0fece27fed8162c599aa8387 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Mon, 16 Jun 2025 15:02:56 -0700 Subject: [PATCH 3/5] Fix format --- .../API/macosx/simulator/TestSimulatorPlatform.py | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py index 8406ee45479fd..44a5a942ab513 100644 --- a/lldb/test/API/macosx/simula
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/139174 >From d98210b81f7b49f5384e968b1a18e00e432aaf2c Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Thu, 8 May 2025 16:21:53 -0700 Subject: [PATCH 1/5] Fix macOS FindProcessImpl() --- lldb/source/Host/macosx/objcxx/Host.mm | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index e187bf98188ae..e8a1c597eea53 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -595,7 +595,9 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, const llvm::Triple::ArchType triple_arch = triple.getArch(); const bool check_for_ios_simulator = (triple_arch == llvm::Triple::x86 || - triple_arch == llvm::Triple::x86_64); + triple_arch == llvm::Triple::x86_64 || + triple_arch == llvm::Triple::aarch64); + const char *cstr = data.GetCStr(&offset); if (cstr) { process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native); @@ -621,22 +623,25 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size, } Environment &proc_env = process_info.GetEnvironment(); + bool is_simulator = false; while ((cstr = data.GetCStr(&offset))) { if (cstr[0] == '\0') break; -if (check_for_ios_simulator) { - if (strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == - 0) -process_info.GetArchitecture().GetTriple().setOS( -llvm::Triple::IOS); - else -process_info.GetArchitecture().GetTriple().setOS( -llvm::Triple::MacOSX); -} +if (check_for_ios_simulator && +strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) == +0) + is_simulator = true; proc_env.insert(cstr); } + llvm::Triple &triple = process_info.GetArchitecture().GetTriple(); + if (is_simulator) { +triple.setOS(llvm::Triple::IOS); +triple.setEnvironment(llvm::Triple::Simulator); + } else { +triple.setOS(llvm::Triple::MacOSX); + } return true; } } >From 8377bc3b61fb30c003d1d188d6e8d879baea58ab Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Mon, 16 Jun 2025 11:06:47 -0700 Subject: [PATCH 2/5] Add test --- lldb/test/API/macosx/simulator/TestSimulatorPlatform.py | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py index 74ba0ee6c83bb..8406ee45479fd 100644 --- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py +++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -39,7 +39,7 @@ def check_debugserver(self, log, expected_platform, expected_version): if expected_version: self.assertEqual(aout_info["min_version_os_sdk"], expected_version) -def run_with(self, arch, os, vers, env, expected_load_command): +def run_with(self, arch, os, vers, env, expected_load_command, expected_platform=None): env_list = [env] if env else [] triple = "-".join([arch, "apple", os + vers] + env_list) sdk = lldbutil.get_xcode_sdk(os, env) @@ -75,6 +75,11 @@ def run_with(self, arch, os, vers, env, expected_load_command): self, "break here", lldb.SBFileSpec("hello.c") ) triple_re = "-".join([arch, "apple", os + vers + ".*"] + env_list) +if expected_platform is not None: +# The current platform should be expected +self.expect("platform status", patterns=[r"Platform: " + expected_platform]) +# Should be able to list processes on the current platform +self.expect("platform process list", patterns=[r"\d+ matching processes were found on \"%s\"" % expected_platform]) self.expect("image list -b -t", patterns=[r"a\.out " + triple_re]) self.check_debugserver(log, os + env, vers) @@ -90,6 +95,7 @@ def test_ios(self): vers="", env="simulator", expected_load_command="LC_BUILD_VERSION", +expected_platform="ios-simulator", ) @skipIfAsan >From 2c31b44d01a7a8bc0fece27fed8162c599aa8387 Mon Sep 17 00:00:00 2001 From: Roy Shi Date: Mon, 16 Jun 2025 15:02:56 -0700 Subject: [PATCH 3/5] Fix format --- .../API/macosx/simulator/TestSimulatorPlatform.py | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py index 8406ee45479fd..44a5a942ab513 100644 --- a/lldb/test/API/macosx/simula
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
https://github.com/zyn-li created https://github.com/llvm/llvm-project/pull/144815 The `__iter__` method in `SBMemoryRegionInfoListExtensions` reused the same `SBMemoryRegionInfo` object reference across all iterations, only updating its content in each loop. This caused all yielded objects to be references to the same instance. Moved the object creation inside the loop to ensure each iteration yields a unique instance: ### Testing Updated the existing test in `**TestFindInMemory.py**` to: 1. **Iterator vs Index Access Comparison**: Collects regions via iteration and compares their data with regions accessed by index to ensure they match 2. **Data Integrity Verification**: Confirms that different regions have different base addresses (would fail before the fix since all collected regions had the same data) The test validates both that the iterator works correctly and that each yielded object contains the correct data for its respective memory region. >From 16792f7dffae9ef95a3a09c2dbaa6731b07e0ea7 Mon Sep 17 00:00:00 2001 From: Zhiyuan Li Date: Wed, 18 Jun 2025 16:49:12 -0700 Subject: [PATCH] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique references --- .../SBMemoryRegionInfoListExtensions.i| 2 +- .../find_in_memory/TestFindInMemory.py| 24 --- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i b/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i index 29c0179c0ffe3..f565f45880119 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i @@ -9,8 +9,8 @@ '''Iterate over all the memory regions in a lldb.SBMemoryRegionInfoList object.''' import lldb size = self.GetSize() - region = lldb.SBMemoryRegionInfo() for i in range(size): +region = lldb.SBMemoryRegionInfo() self.GetMemoryRegionAtIndex(i, region) yield region %} diff --git a/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py b/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py index 1ef37d2ec9898..4eabbb6e46774 100644 --- a/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py +++ b/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py @@ -154,14 +154,32 @@ def test_find_in_memory_unaligned(self): self.assertEqual(addr, lldb.LLDB_INVALID_ADDRESS) def test_memory_info_list_iterable(self): -"""Make sure the SBMemoryRegionInfoList is iterable""" +"""Make sure the SBMemoryRegionInfoList is iterable and each yielded object is unique""" self.assertTrue(self.process, PROCESS_IS_VALID) self.assertState(self.process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) info_list = self.process.GetMemoryRegions() self.assertTrue(info_list.GetSize() > 0) + +collected_info = [] try: -for info in info_list: -pass +for region in info_list: +collected_info.append(region) except Exception: self.fail("SBMemoryRegionInfoList is not iterable") + +self.assertTrue(len(collected_info) >= 2, "Need at least 2 items") +self.assertEqual(len(collected_info), info_list.GetSize(), "Should have collected all items") + +for i in range(len(collected_info)): +region = lldb.SBMemoryRegionInfo() +info_list.GetMemoryRegionAtIndex(i, region) + +self.assertEqual(collected_info[i].GetRegionBase(), region.GetRegionBase(), + f"items {i}: iterator data should match index access data") +self.assertEqual(collected_info[i].GetRegionEnd(), region.GetRegionEnd(), + f"items {i}: iterator data should match index access data") + +if len(collected_info) >= 2: +self.assertNotEqual(collected_info[0].GetRegionBase(), collected_info[1].GetRegionBase(), + "Different items should have different base addresses") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
@@ -154,14 +154,32 @@ def test_find_in_memory_unaligned(self): self.assertEqual(addr, lldb.LLDB_INVALID_ADDRESS) def test_memory_info_list_iterable(self): -"""Make sure the SBMemoryRegionInfoList is iterable""" +"""Make sure the SBMemoryRegionInfoList is iterable and each yielded object is unique""" self.assertTrue(self.process, PROCESS_IS_VALID) self.assertState(self.process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) info_list = self.process.GetMemoryRegions() self.assertTrue(info_list.GetSize() > 0) + +collected_info = [] try: -for info in info_list: -pass +for region in info_list: +collected_info.append(region) except Exception: self.fail("SBMemoryRegionInfoList is not iterable") + +self.assertTrue(len(collected_info) >= 2, "Need at least 2 items") +self.assertEqual(len(collected_info), info_list.GetSize(), "Should have collected all items") + +for i in range(len(collected_info)): +region = lldb.SBMemoryRegionInfo() +info_list.GetMemoryRegionAtIndex(i, region) + +self.assertEqual(collected_info[i].GetRegionBase(), region.GetRegionBase(), Jlalond wrote: Nit: We should just add an equality method to SBMemoryRegionInfo and call that. https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
https://github.com/Jlalond requested changes to this pull request. Mostly nits, I think we should expand the scope of the fix and add an equality operator for the SBMemoryRegionInfo. Cleans up your test and will save a lot of developer time because this is a very popular SB API https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/test/API/python_api/find_in_memory/TestFindInMemory.py `` View the diff from darker here. ``diff --- TestFindInMemory.py 2025-06-18 23:49:12.00 + +++ TestFindInMemory.py 2025-06-19 00:51:36.148357 + @@ -165,21 +165,32 @@ try: for region in info_list: collected_info.append(region) except Exception: self.fail("SBMemoryRegionInfoList is not iterable") - + self.assertTrue(len(collected_info) >= 2, "Need at least 2 items") -self.assertEqual(len(collected_info), info_list.GetSize(), "Should have collected all items") +self.assertEqual( +len(collected_info), info_list.GetSize(), "Should have collected all items" +) for i in range(len(collected_info)): region = lldb.SBMemoryRegionInfo() info_list.GetMemoryRegionAtIndex(i, region) - -self.assertEqual(collected_info[i].GetRegionBase(), region.GetRegionBase(), - f"items {i}: iterator data should match index access data") -self.assertEqual(collected_info[i].GetRegionEnd(), region.GetRegionEnd(), - f"items {i}: iterator data should match index access data") - + +self.assertEqual( +collected_info[i].GetRegionBase(), +region.GetRegionBase(), +f"items {i}: iterator data should match index access data", +) +self.assertEqual( +collected_info[i].GetRegionEnd(), +region.GetRegionEnd(), +f"items {i}: iterator data should match index access data", +) + if len(collected_info) >= 2: -self.assertNotEqual(collected_info[0].GetRegionBase(), collected_info[1].GetRegionBase(), - "Different items should have different base addresses") +self.assertNotEqual( +collected_info[0].GetRegionBase(), +collected_info[1].GetRegionBase(), +"Different items should have different base addresses", +) `` https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)
@@ -154,14 +154,32 @@ def test_find_in_memory_unaligned(self): self.assertEqual(addr, lldb.LLDB_INVALID_ADDRESS) def test_memory_info_list_iterable(self): -"""Make sure the SBMemoryRegionInfoList is iterable""" +"""Make sure the SBMemoryRegionInfoList is iterable and each yielded object is unique""" self.assertTrue(self.process, PROCESS_IS_VALID) self.assertState(self.process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) info_list = self.process.GetMemoryRegions() self.assertTrue(info_list.GetSize() > 0) + +collected_info = [] try: -for info in info_list: -pass +for region in info_list: +collected_info.append(region) except Exception: self.fail("SBMemoryRegionInfoList is not iterable") + +self.assertTrue(len(collected_info) >= 2, "Need at least 2 items") Jlalond wrote: Why 2? We know the number of emmeory regions from `info_list`, compare to the underlying collection https://github.com/llvm/llvm-project/pull/144815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (PR #142516)
https://github.com/frederick-vs-ja edited https://github.com/llvm/llvm-project/pull/142516 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
@@ -33,6 +33,37 @@ static void EmplaceSafeString(llvm::json::Object &obj, llvm::StringRef key, obj.try_emplace(key, llvm::json::fixUTF8(str)); } +static void UpdateDwoFileCounts(SymbolFile *sym_file, +uint32_t &total_dwo_file_count, +uint32_t &total_loaded_dwo_file_count) { + // Count DWO files from this symbol file using GetSeparateDebugInfo + // For DWP files, this increments counts for both total and successfully + // loaded DWO CUs. For non split-dwarf files, these counts should not change + StructuredData::Dictionary separate_debug_info; + if (sym_file->GetSeparateDebugInfo(separate_debug_info, + /*errors_only=*/false, + /*load_all_debug_info=*/false)) { +llvm::StringRef type; +if (separate_debug_info.GetValueForKeyAsString("type", type) && +type == "dwo") { + StructuredData::Array *files; + if (separate_debug_info.GetValueForKeyAsArray("separate-debug-info-files", +files)) { +files->ForEach([&](StructuredData::Object *obj) { + if (auto dict = obj->GetAsDictionary()) { +total_dwo_file_count++; + +bool loaded = false; +if (dict->GetValueForKeyAsBoolean("loaded", loaded) && loaded) qxy11 wrote: This should work for DWP and correctly report the # of parsed CUs (see the unit test added `test_dwp_dwo_file_count` [here](https://github.com/llvm/llvm-project/blob/9b966482264b1c0188d474b013d1db7236da1448/lldb/test/API/commands/statistics/basic/TestStats.py#L618). My understanding is that each CU has its own `m_dwo` shared_ptr [object](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L973) rather than there being a global DWP reference that's shared. It looks like the DWP file first gets loaded [here](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L87), the specific DWO unit gets indexed [here](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L92), and then only after the specific DWO data for the CU is parsed does `m_dwo` get [set](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L146). So in the code for `GetSeparateDebugInfo` it should get the correct per-unit counts. https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
https://github.com/qxy11 edited https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)
@@ -236,199 +236,140 @@ static bool PrettyPrintFunctionNameWithArgs(Stream &out_stream, return true; } -static std::optional -GetDemangledBasename(const SymbolContext &sc) { +static llvm::Expected> +GetAndValidateInfo(const SymbolContext &sc) { Mangled mangled = sc.GetPossiblyInlinedFunctionName(); if (!mangled) -return std::nullopt; +return llvm::createStringError("Function does not have a mangled name."); auto demangled_name = mangled.GetDemangledName().GetStringRef(); if (demangled_name.empty()) -return std::nullopt; +return llvm::createStringError("Function does not have a demangled name."); const std::optional &info = mangled.GetDemangledInfo(); if (!info) -return std::nullopt; +return llvm::createStringError("Function does not have demangled info."); // Function without a basename is nonsense. if (!info->hasBasename()) -return std::nullopt; +return llvm::createStringError("Info do not have basename range."); - return demangled_name.slice(info->BasenameRange.first, - info->BasenameRange.second); + return std::make_pair(demangled_name, *info); } -static std::optional -GetDemangledTemplateArguments(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; +static llvm::Expected +GetDemangledBasename(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + return demangled_name.slice(info.BasenameRange.first, + info.BasenameRange.second); +} - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; +static llvm::Expected +GetDemangledTemplateArguments(const SymbolContext &sc) { + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); + + auto [demangled_name, info] = *info_or_err; - if (info->ArgumentsRange.first < info->BasenameRange.second) -return std::nullopt; + if (info.ArgumentsRange.first < info.BasenameRange.second) +return llvm::createStringError("Arguments in info are invalid."); - return demangled_name.slice(info->BasenameRange.second, - info->ArgumentsRange.first); + return demangled_name.slice(info.BasenameRange.second, + info.ArgumentsRange.first); } -static std::optional +static llvm::Expected GetDemangledReturnTypeLHS(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; + if (info.ScopeRange.first >= demangled_name.size()) +return llvm::createStringError("Scope range is invalid."); - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; - - if (info->ScopeRange.first >= demangled_name.size()) -return std::nullopt; - - return demangled_name.substr(0, info->ScopeRange.first); + return demangled_name.substr(0, info.ScopeRange.first); } -static std::optional +static llvm::Expected GetDemangledFunctionQualifiers(const SymbolContext &sc) { - Mangled mangled = sc.GetPossiblyInlinedFunctionName(); - if (!mangled) -return std::nullopt; + auto info_or_err = GetAndValidateInfo(sc); + if (!info_or_err) +return info_or_err.takeError(); - auto demangled_name = mangled.GetDemangledName().GetStringRef(); - if (demangled_name.empty()) -return std::nullopt; + auto [demangled_name, info] = *info_or_err; - const std::optional &info = mangled.GetDemangledInfo(); - if (!info) -return std::nullopt; - - // Function without a basename is nonsense. - if (!info->hasBasename()) -return std::nullopt; + if (info.QualifiersRange.second < info.QualifiersRange.first) +return llvm::createStringError("Qualifiers range is invalid."); - if (info->QualifiersRange.second < info->QualifiersRange.first) -return std::nullopt; - - return demangled_name.slice(info->QualifiersRange.first, - info->QualifiersRange.second); + return demangled_name.slice(info.QualifiersRange.first, + info.QualifiersRange.second); } -static std::optional +static llvm::Expected GetDemangledReturnTypeRHS(con
[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)
https://github.com/HemangGadhavi updated https://github.com/llvm/llvm-project/pull/144645 >From 5b842ed6c8721f314f677602a3b0ae81c4b39f27 Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Tue, 17 Jun 2025 02:50:45 -0500 Subject: [PATCH 1/2] [lldb][AIX] Added base file for AIX Register Context --- .../source/Plugins/Process/AIX/CMakeLists.txt | 1 + .../Process/AIX/NativeRegisterContextAIX.cpp | 66 + .../Process/AIX/NativeRegisterContextAIX.h| 74 +++ 3 files changed, 141 insertions(+) create mode 100644 lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp create mode 100644 lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h diff --git a/lldb/source/Plugins/Process/AIX/CMakeLists.txt b/lldb/source/Plugins/Process/AIX/CMakeLists.txt index 6b3151edbd1ef..3a6d9ec118e60 100644 --- a/lldb/source/Plugins/Process/AIX/CMakeLists.txt +++ b/lldb/source/Plugins/Process/AIX/CMakeLists.txt @@ -1,6 +1,7 @@ add_lldb_library(lldbPluginProcessAIX NativeProcessAIX.cpp NativeThreadAIX.cpp + NativeRegisterContextAIX.cpp LINK_COMPONENTS Support diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp new file mode 100644 index 0..0cb993110bf78 --- /dev/null +++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp @@ -0,0 +1,66 @@ +//===-- NativeRegisterContextAIX.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "NativeRegisterContextAIX.h" +#include "Plugins/Process/AIX/NativeProcessAIX.h" + +using namespace lldb_private; +using namespace lldb_private::process_aix; + +lldb::ByteOrder NativeRegisterContextAIX::GetByteOrder() const { + return m_thread.GetProcess().GetByteOrder(); +} + +Status NativeRegisterContextAIX::ReadRegisterRaw(uint32_t reg_index, + RegisterValue ®_value) { + return Status("unimplemented"); +} + +Status +NativeRegisterContextAIX::WriteRegisterRaw(uint32_t reg_index, + const RegisterValue ®_value) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::ReadGPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteGPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadFPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteFPR() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadVMX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteVMX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadVSX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::WriteVSX() { return Status("unimplemented"); } + +Status NativeRegisterContextAIX::ReadRegisterSet(void *buf, size_t buf_size, + unsigned int regset) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::WriteRegisterSet(void *buf, size_t buf_size, + unsigned int regset) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::DoReadRegisterValue(uint32_t offset, + const char *reg_name, + uint32_t size, + RegisterValue &value) { + return Status("unimplemented"); +} + +Status NativeRegisterContextAIX::DoWriteRegisterValue( +uint32_t offset, const char *reg_name, const RegisterValue &value) { + return Status("unimplemented"); +} diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h new file mode 100644 index 0..2a22c45ce008c --- /dev/null +++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h @@ -0,0 +1,74 @@ +//===-- NativeRegisterContextAIX.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef lldb_NativeRegisterContextAIX_h +#define lldb_NativeRegisterContextAIX_h + +#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h" + +namespace lldb_private { +namespace process_aix { + +class NativeThreadAIX; + +class NativeRegisterContextAIX +: public virtual NativeRegisterContextRegisterInfo { +protected:
[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)
@@ -0,0 +1,74 @@ +//===-- NativeRegisterContextAIX.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef lldb_NativeRegisterContextAIX_h +#define lldb_NativeRegisterContextAIX_h + +#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h" + +namespace lldb_private { +namespace process_aix { + +class NativeThreadAIX; HemangGadhavi wrote: Done https://github.com/llvm/llvm-project/pull/144645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)
@@ -0,0 +1,74 @@ +//===-- NativeRegisterContextAIX.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef lldb_NativeRegisterContextAIX_h +#define lldb_NativeRegisterContextAIX_h + +#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h" + +namespace lldb_private { +namespace process_aix { HemangGadhavi wrote: Done https://github.com/llvm/llvm-project/pull/144645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)
@@ -0,0 +1,66 @@ +//===-- NativeRegisterContextAIX.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "NativeRegisterContextAIX.h" +#include "Plugins/Process/AIX/NativeProcessAIX.h" + +using namespace lldb_private; +using namespace lldb_private::process_aix; + +lldb::ByteOrder NativeRegisterContextAIX::GetByteOrder() const { + return m_thread.GetProcess().GetByteOrder(); HemangGadhavi wrote: Done https://github.com/llvm/llvm-project/pull/144645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)
@@ -0,0 +1,74 @@ +//===-- NativeRegisterContextAIX.h *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef lldb_NativeRegisterContextAIX_h +#define lldb_NativeRegisterContextAIX_h HemangGadhavi wrote: Done https://github.com/llvm/llvm-project/pull/144645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits