[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen created 
https://github.com/llvm/llvm-project/pull/141426

Refactor code revolving source objects such that most logics will be reused.

The main change is to  expose a single  `CreateSource(addr, target)` that can 
return either a normal or an assembly source object, and call 
`ShouldDisplayAssemblySource()` only from this function instead of multiple 
places across the code. 

Other functions can use  `source.IsAssemblySource()` in order to check which 
type the source is.

>From ec1bd91c824c356d554ef248b35f3ce28c432daa Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Wed, 21 May 2025 23:39:56 +0200
Subject: [PATCH 1/2] Reuse creation of Source objects for assembly and normal
 sources

---
 lldb/tools/lldb-dap/Breakpoint.cpp|  14 +-
 .../Handler/DisassembleRequestHandler.cpp |  21 +--
 .../Handler/LocationsRequestHandler.cpp   |  10 +-
 .../Handler/StackTraceRequestHandler.cpp  |   6 +-
 lldb/tools/lldb-dap/JSONUtils.cpp | 123 +-
 lldb/tools/lldb-dap/JSONUtils.h   |  49 ++-
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |   2 +
 7 files changed, 100 insertions(+), 125 deletions(-)

diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp 
b/lldb/tools/lldb-dap/Breakpoint.cpp
index 2d0fd9c9c3954..440d589b912fc 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -9,12 +9,10 @@
 #include "Breakpoint.h"
 #include "DAP.h"
 #include "JSONUtils.h"
-#include "LLDBUtils.h"
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBBreakpointLocation.h"
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBMutex.h"
-#include "lldb/lldb-enumerations.h"
 #include "llvm/ADT/StringExtras.h"
 #include 
 #include 
@@ -66,17 +64,15 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget()));
 breakpoint.instructionReference = formatted_addr;
 
-lldb::StopDisassemblyType stop_disassembly_display =
-GetStopDisassemblyDisplay(m_dap.debugger);
-auto line_entry = bp_addr.GetLineEntry();
-if (!ShouldDisplayAssemblySource(line_entry, stop_disassembly_display)) {
+auto source = CreateSource(bp_addr, m_dap.debugger);
+if (!source.IsAssemblySource()) {
+  auto line_entry = bp_addr.GetLineEntry();
   const auto line = line_entry.GetLine();
   if (line != LLDB_INVALID_LINE_NUMBER)
 breakpoint.line = line;
   const auto column = line_entry.GetColumn();
   if (column != LLDB_INVALID_COLUMN_NUMBER)
 breakpoint.column = column;
-  breakpoint.source = CreateSource(line_entry);
 } else {
   // Assembly breakpoint.
   auto symbol = bp_addr.GetSymbol();
@@ -86,10 +82,10 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
 .ReadInstructions(symbol.GetStartAddress(), bp_addr, nullptr)
 .GetSize() +
 1;
-
-breakpoint.source = CreateAssemblySource(m_dap.target, bp_addr);
   }
 }
+
+breakpoint.source = std::move(source);
   }
 
   return breakpoint;
diff --git a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
index c9061ef19f17a..5145178502bc9 100644
--- a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
@@ -13,6 +13,7 @@
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBInstruction.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/lldb-types.h"
@@ -80,12 +81,15 @@ static lldb::SBAddress 
GetDisassembleStartAddress(lldb::SBTarget target,
   .GetAddress();
 }
 
-static DisassembledInstruction ConvertSBInstructionToDisassembledInstruction(
-lldb::SBTarget &target, lldb::SBInstruction &inst, bool resolve_symbols) {
+static DisassembledInstruction
+ConvertSBInstructionToDisassembledInstruction(lldb::SBDebugger &debugger,
+  lldb::SBInstruction &inst,
+  bool resolve_symbols) {
   if (!inst.IsValid())
 return GetInvalidInstruction();
 
-  auto addr = inst.GetAddress();
+  lldb::SBTarget target = debugger.GetSelectedTarget();
+  lldb::SBAddress addr = inst.GetAddress();
   const auto inst_addr = addr.GetLoadAddress(target);
 
   // FIXME: This is a workaround - this address might come from
@@ -138,15 +142,14 @@ static DisassembledInstruction 
ConvertSBInstructionToDisassembledInstruction(
 
   disassembled_inst.instruction = std::move(instruction);
 
+  auto source = CreateSource(addr, debugger);
   auto line_entry = addr.GetLineEntry();
-  // If the line number is 0 then the entry represents a compiler generated
-  // location.
 
-  if (line_entry.GetStartAddress() == addr && line_entry.IsValid() &&
+  if (!source.IsAssemblySource() && line_entry.IsValid()

[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ely Ronnen (eronnen)


Changes

Refactor code revolving source objects such that most logics will be reused.

The main change is to  expose a single  `CreateSource(addr, target)` that can 
return either a normal or an assembly source object, and call 
`ShouldDisplayAssemblySource()` only from this function instead of multiple 
places across the code. 

Other functions can use  `source.IsAssemblySource()` in order to check which 
type the source is.

---

Patch is 22.05 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/141426.diff


12 Files Affected:

- (modified) lldb/include/lldb/API/SBAddress.h (+7) 
- (modified) lldb/source/API/SBAddress.cpp (+19-3) 
- (modified) lldb/source/Core/Module.cpp (+3) 
- (modified) lldb/tools/lldb-dap/Breakpoint.cpp (+5-9) 
- (modified) lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp (+9-6) 
- (modified) lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp (+6-3) 
- (modified) lldb/tools/lldb-dap/Handler/StackTraceRequestHandler.cpp (+1-6) 
- (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+65-62) 
- (modified) lldb/tools/lldb-dap/JSONUtils.h (+10-38) 
- (modified) lldb/tools/lldb-dap/LLDBUtils.cpp (+7) 
- (modified) lldb/tools/lldb-dap/LLDBUtils.h (+14) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.h (+2) 


``diff
diff --git a/lldb/include/lldb/API/SBAddress.h 
b/lldb/include/lldb/API/SBAddress.h
index 430dad4862dbf..c61f02702f1ca 100644
--- a/lldb/include/lldb/API/SBAddress.h
+++ b/lldb/include/lldb/API/SBAddress.h
@@ -11,6 +11,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBModule.h"
+#include "lldb/API/SBTarget.h"
 
 namespace lldb {
 
@@ -58,6 +59,9 @@ class LLDB_API SBAddress {
   // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
   lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
 
+  lldb::SBSymbolContext GetSymbolContext(const SBTarget &target,
+ uint32_t resolve_scope);
+
   // The following functions grab individual objects for a given address and
   // are less efficient if you want more than one symbol related objects. Use
   // one of the following when you want multiple debug symbol related objects
@@ -122,6 +126,9 @@ class LLDB_API SBAddress {
 
   void SetAddress(const lldb_private::Address &address);
 
+  void CalculateSymbolContext(lldb_private::SymbolContext &sc,
+  uint32_t resolve_scope);
+
 private:
   std::unique_ptr m_opaque_up;
 };
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index e519f0bcc83c6..b6b9e238d3cbf 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -213,9 +213,18 @@ SBSymbolContext SBAddress::GetSymbolContext(uint32_t 
resolve_scope) {
   LLDB_INSTRUMENT_VA(this, resolve_scope);
 
   SBSymbolContext sb_sc;
-  SymbolContextItem scope = static_cast(resolve_scope);
-  if (m_opaque_up->IsValid())
-m_opaque_up->CalculateSymbolContext(&sb_sc.ref(), scope);
+  CalculateSymbolContext(sb_sc.ref(), resolve_scope);
+  return sb_sc;
+}
+
+SBSymbolContext SBAddress::GetSymbolContext(const SBTarget &target,
+uint32_t resolve_scope) {
+  LLDB_INSTRUMENT_VA(this, target, resolve_scope);
+
+  SBSymbolContext sb_sc;
+  lldb_private::SymbolContext &sc = sb_sc.ref();
+  sc.target_sp = target.GetSP();
+  CalculateSymbolContext(sc, resolve_scope);
   return sb_sc;
 }
 
@@ -266,3 +275,10 @@ SBLineEntry SBAddress::GetLineEntry() {
   }
   return sb_line_entry;
 }
+
+void SBAddress::CalculateSymbolContext(lldb_private::SymbolContext &sc,
+   uint32_t resolve_scope) {
+  SymbolContextItem scope = static_cast(resolve_scope);
+  if (m_opaque_up->IsValid())
+m_opaque_up->CalculateSymbolContext(&sc, scope);
+}
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 625c14e4a2153..90997dada3666 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -483,6 +483,9 @@ uint32_t Module::ResolveSymbolContextForAddress(
   symfile->SetLoadDebugInfoEnabled();
   resolved_flags |=
   symfile->ResolveSymbolContext(so_addr, resolve_scope, sc);
+
+  if ((resolve_scope & eSymbolContextLineEntry) && sc.line_entry.IsValid())
+sc.line_entry.ApplyFileMappings(sc.target_sp);
 }
 
 // Resolve the symbol if requested, but don't re-look it up if we've
diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp 
b/lldb/tools/lldb-dap/Breakpoint.cpp
index 2d0fd9c9c3954..dea4dbadc0bda 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -9,12 +9,10 @@
 #include "Breakpoint.h"
 #include "DAP.h"
 #include "JSONUtils.h"
-#include "LLDBUtils.h"
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBBreakpointLocation.h"
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBMutex.h"
-#include "lldb/lldb-enumeration

[Lldb-commits] [lldb] [lldb] add missing cmake build type argument (PR #141427)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen created 
https://github.com/llvm/llvm-project/pull/141427

None

>From 12b61db385a595f1a9028c194322cb3d3c746f3c Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 25 May 2025 22:22:34 +0200
Subject: [PATCH] [lldb] add missing cmake build type argument

---
 lldb/utils/lldb-dotest/lldb-dotest.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/utils/lldb-dotest/lldb-dotest.in 
b/lldb/utils/lldb-dotest/lldb-dotest.in
index 9688b94d91842..c959c389f8a85 100755
--- a/lldb/utils/lldb-dotest/lldb-dotest.in
+++ b/lldb/utils/lldb-dotest/lldb-dotest.in
@@ -21,6 +21,7 @@ has_libcxx = @LLDB_HAS_LIBCXX@
 libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
 libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
 libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
+cmake_build_type = "@CMAKE_BUILD_TYPE@"
 
 if __name__ == '__main__':
 wrapper_args = sys.argv[1:]
@@ -52,6 +53,7 @@ if __name__ == '__main__':
 if lldb_build_intel_pt == "1":
 cmd.extend(['--enable-plugin', 'intel-pt'])
 cmd.extend(['--lldb-obj-root', lldb_obj_root])
+cmd.extend(['--cmake-build-type', cmake_build_type])
 cmd.extend(wrapper_args)
 # Invoke dotest.py and return exit code.
 print(' '.join(cmd))

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add missing cmake build type argument (PR #141427)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ely Ronnen (eronnen)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/141427.diff


1 Files Affected:

- (modified) lldb/utils/lldb-dotest/lldb-dotest.in (+2) 


``diff
diff --git a/lldb/utils/lldb-dotest/lldb-dotest.in 
b/lldb/utils/lldb-dotest/lldb-dotest.in
index 9688b94d91842..c959c389f8a85 100755
--- a/lldb/utils/lldb-dotest/lldb-dotest.in
+++ b/lldb/utils/lldb-dotest/lldb-dotest.in
@@ -21,6 +21,7 @@ has_libcxx = @LLDB_HAS_LIBCXX@
 libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
 libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
 libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
+cmake_build_type = "@CMAKE_BUILD_TYPE@"
 
 if __name__ == '__main__':
 wrapper_args = sys.argv[1:]
@@ -52,6 +53,7 @@ if __name__ == '__main__':
 if lldb_build_intel_pt == "1":
 cmd.extend(['--enable-plugin', 'intel-pt'])
 cmd.extend(['--lldb-obj-root', lldb_obj_root])
+cmd.extend(['--cmake-build-type', cmake_build_type])
 cmd.extend(wrapper_args)
 # Invoke dotest.py and return exit code.
 print(' '.join(cmd))

``




https://github.com/llvm/llvm-project/pull/141427
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add array subscription and integer parsing to DIL (PR #141102)

2025-05-25 Thread Ilia Kuklin via lldb-commits

https://github.com/kuilpd edited 
https://github.com/llvm/llvm-project/pull/141102
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use std::tie to implement operator< (NFC) (PR #141416)

2025-05-25 Thread Matt Arsenault via lldb-commits

https://github.com/arsenm approved this pull request.


https://github.com/llvm/llvm-project/pull/141416
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f314588 - [lldb] Use std::tie to implement operator< (NFC) (#141416)

2025-05-25 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-25T10:55:21-07:00
New Revision: f314588f41d4ee6ad57eb3e429ab12c56b9f07f9

URL: 
https://github.com/llvm/llvm-project/commit/f314588f41d4ee6ad57eb3e429ab12c56b9f07f9
DIFF: 
https://github.com/llvm/llvm-project/commit/f314588f41d4ee6ad57eb3e429ab12c56b9f07f9.diff

LOG: [lldb] Use std::tie to implement operator< (NFC) (#141416)

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerDeclContext.h
lldb/include/lldb/Target/CoreFileMemoryRanges.h
lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h 
b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index 89b4a9787688b..fe2ef215a8d19 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -48,9 +48,8 @@ class CompilerDeclContext {
   explicit operator bool() const { return IsValid(); }
 
   bool operator<(const CompilerDeclContext &rhs) const {
-if (m_type_system == rhs.m_type_system)
-  return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
-return m_type_system < rhs.m_type_system;
+return std::tie(m_type_system, m_opaque_decl_ctx) <
+   std::tie(rhs.m_type_system, rhs.m_opaque_decl_ctx);
   }
 
   bool IsValid() const {

diff  --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h 
b/lldb/include/lldb/Target/CoreFileMemoryRanges.h
index 0cc5433525ddc..78d01acca324e 100644
--- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h
+++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h
@@ -30,11 +30,8 @@ struct CoreFileMemoryRange {
   }
 
   bool operator<(const CoreFileMemoryRange &rhs) const {
-if (range < rhs.range)
-  return true;
-if (range == rhs.range)
-  return lldb_permissions < rhs.lldb_permissions;
-return false;
+return std::tie(range, lldb_permissions) <
+   std::tie(rhs.range, rhs.lldb_permissions);
   }
 
   std::string Dump() const {

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h 
b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index ffe9725fa6826..45de098c15f51 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -386,16 +386,8 @@ class ObjCLanguageRuntime : public LanguageRuntime {
 }
 
 bool operator<(const ClassAndSel &rhs) const {
-  if (class_addr < rhs.class_addr)
-return true;
-  else if (class_addr > rhs.class_addr)
-return false;
-  else {
-if (sel_addr < rhs.sel_addr)
-  return true;
-else
-  return false;
-  }
+  return std::tie(class_addr, sel_addr) <
+ std::tie(rhs.class_addr, rhs.sel_addr);
 }
 
 lldb::addr_t class_addr = LLDB_INVALID_ADDRESS;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use std::tie to implement operator< (NFC) (PR #141416)

2025-05-25 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/141416
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add array subscription and integer parsing to DIL (PR #141102)

2025-05-25 Thread Ilia Kuklin via lldb-commits

https://github.com/kuilpd closed 
https://github.com/llvm/llvm-project/pull/141102
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] fe51d8a - [LLDB] Add array subscription and integer parsing to DIL (#141102)

2025-05-25 Thread via lldb-commits

Author: Ilia Kuklin
Date: 2025-05-25T21:09:33+05:00
New Revision: fe51d8ae5772626ef8237c33e0911695cf4f07db

URL: 
https://github.com/llvm/llvm-project/commit/fe51d8ae5772626ef8237c33e0911695cf4f07db
DIFF: 
https://github.com/llvm/llvm-project/commit/fe51d8ae5772626ef8237c33e0911695cf4f07db.diff

LOG: [LLDB] Add array subscription and integer parsing to DIL (#141102)

Reapply #138551 with an xfailed test on Windows

Added: 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/Makefile

lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp

Modified: 
lldb/docs/dil-expr-lang.ebnf
lldb/include/lldb/ValueObject/DILAST.h
lldb/include/lldb/ValueObject/DILEval.h
lldb/include/lldb/ValueObject/DILLexer.h
lldb/include/lldb/ValueObject/DILParser.h
lldb/source/ValueObject/DILAST.cpp
lldb/source/ValueObject/DILEval.cpp
lldb/source/ValueObject/DILLexer.cpp
lldb/source/ValueObject/DILParser.cpp
lldb/unittests/ValueObject/DILLexerTests.cpp

Removed: 




diff  --git a/lldb/docs/dil-expr-lang.ebnf b/lldb/docs/dil-expr-lang.ebnf
index 580626862c005..783432dabd6db 100644
--- a/lldb/docs/dil-expr-lang.ebnf
+++ b/lldb/docs/dil-expr-lang.ebnf
@@ -10,16 +10,17 @@ unary_expression = postfix_expression
 
 unary_operator = "*" | "&" ;
 
-postfix_expresson = primary_expression
-  | postfix_expression "." id_expression
-  | postfix_expression "->" id_expression ;
+postfix_expression = primary_expression
+   | postfix_expression "[" integer_literal "]"
+   | postfix_expression "." id_expression
+   | postfix_expression "->" id_expression ;
 
 primary_expression = id_expression
-   | "(" expression ")"  ;
+   | "(" expression ")" ;
 
 id_expression = unqualified_id
   | qualified_id
- | register ;
+  | register ;
 
 unqualified_id = identifier ;
 
@@ -28,6 +29,8 @@ qualified_id = ["::"] [nested_name_specifier] unqualified_id
 
 identifier = ? C99 Identifier ? ;
 
+integer_literal = ? Integer constant: hexademical, decimal, octal, binary ? ;
+
 register = "$" ? Register name ? ;
 
 nested_name_specifier = type_name "::"

diff  --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 8687316657ca9..6c7838e05c93c 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -18,6 +18,7 @@ namespace lldb_private::dil {
 
 /// The various types DIL AST nodes (used by the DIL parser).
 enum class NodeKind {
+  eArraySubscriptNode,
   eErrorNode,
   eIdentifierNode,
   eMemberOfNode,
@@ -120,8 +121,8 @@ class UnaryOpNode : public ASTNode {
 
   llvm::Expected Accept(Visitor *v) const override;
 
-  UnaryOpKind kind() const { return m_kind; }
-  ASTNode *operand() const { return m_operand.get(); }
+  UnaryOpKind GetKind() const { return m_kind; }
+  ASTNode *GetOperand() const { return m_operand.get(); }
 
   static bool classof(const ASTNode *node) {
 return node->GetKind() == NodeKind::eUnaryOpNode;
@@ -132,6 +133,26 @@ class UnaryOpNode : public ASTNode {
   ASTNodeUP m_operand;
 };
 
+class ArraySubscriptNode : public ASTNode {
+public:
+  ArraySubscriptNode(uint32_t location, ASTNodeUP base, int64_t index)
+  : ASTNode(location, NodeKind::eArraySubscriptNode),
+m_base(std::move(base)), m_index(index) {}
+
+  llvm::Expected Accept(Visitor *v) const override;
+
+  ASTNode *GetBase() const { return m_base.get(); }
+  int64_t GetIndex() const { return m_index; }
+
+  static bool classof(const ASTNode *node) {
+return node->GetKind() == NodeKind::eArraySubscriptNode;
+  }
+
+private:
+  ASTNodeUP m_base;
+  int64_t m_index;
+};
+
 /// This class contains one Visit method for each specialized type of
 /// DIL AST node. The Visit methods are used to dispatch a DIL AST node to
 /// the correct function in the DIL expression evaluator for evaluating that
@@ -145,6 +166,8 @@ class Visitor {
   Visit(const MemberOfNode *node) = 0;
   virtual llvm::Expected
   Visit(const UnaryOpNode *node) = 0;
+  virtual llvm::Expected
+  Visit(const ArraySubscriptNode *node) = 0;
 };
 
 } // namespace lldb_private::dil

diff  --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index 266b6fb1a63eb..9d0fa53c6622a 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -52,6 +52,8 @@ class Interpreter : Visitor {
   Visit(const IdentifierNode *node) override;
   llvm::Expected Visit(const MemberOfNode *node) override;
   llvm::Expected Visit(const UnaryOpNode *node) override;
+  llvm::Expected
+  Visit(const ArraySubscriptNode *node) override;
 
   // Used by the interpreter to create objects, perfor

[Lldb-commits] [lldb] [lldb][lldb-dap] Use the default disassembly flavour if none is provided. (PR #141424)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)


Changes

This is the currently the default for `SBTarget::ReadInstructions(SBAddress, 
uint32_t)`. But not for others, to make it consistent used the user assigned 
instruction flavour.

---
Full diff: https://github.com/llvm/llvm-project/pull/141424.diff


3 Files Affected:

- (modified) lldb/source/API/SBTarget.cpp (+20-1) 
- (modified) lldb/source/Commands/CommandObjectDisassemble.cpp (-1) 
- (modified) lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp (+1-16) 


``diff
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index cd8a770a0ec04..8d97c454c300c 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -2039,7 +2039,17 @@ lldb::SBInstructionList 
SBTarget::ReadInstructions(lldb::SBAddress base_addr,
   const size_t bytes_read =
   target_sp->ReadMemory(*addr_ptr, data.GetBytes(), data.GetByteSize(),
 error, force_live_memory, &load_addr);
+
   const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
+  if (!flavor_string || flavor_string[0] == '\0') {
+// FIXME - we don't have the mechanism in place to do per-architecture
+// settings.  But since we know that for now we only support flavors on
+// x86 & x86_64,
+const llvm::Triple::ArchType arch =
+target_sp->GetArchitecture().GetTriple().getArch();
+if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+  flavor_string = target_sp->GetDisassemblyFlavor();
+  }
   sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
   target_sp->GetArchitecture(), nullptr, flavor_string,
   target_sp->GetDisassemblyCPU(), target_sp->GetDisassemblyFeatures(),
@@ -2098,7 +2108,16 @@ SBTarget::GetInstructionsWithFlavor(lldb::SBAddress 
base_addr,
 if (base_addr.get())
   addr = *base_addr.get();
 
-const bool data_from_file = true;
+constexpr bool data_from_file = true;
+if (!flavor_string || flavor_string[0] == '\0') {
+  // FIXME - we don't have the mechanism in place to do per-architecture
+  // settings.  But since we know that for now we only support flavors on
+  // x86 & x86_64,
+  const llvm::Triple::ArchType arch =
+  target_sp->GetArchitecture().GetTriple().getArch();
+  if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+flavor_string = target_sp->GetDisassemblyFlavor();
+}
 
 sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
 target_sp->GetArchitecture(), nullptr, flavor_string,
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 5774effb9e9ba..70e687e19ac6d 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -190,7 +190,6 @@ void 
CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
 // architecture.  For now GetDisassemblyFlavor is really only valid for x86
 // (and for the llvm assembler plugin, but I'm papering over that since 
that
 // is the only disassembler plugin we have...
-// This logic is duplicated in `Handler/DisassembleRequestHandler`.
 if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86 ||
 target->GetArchitecture().GetTriple().getArch() ==
 llvm::Triple::x86_64) {
diff --git a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
index c9061ef19f17a..a7d70d4c3aceb 100644
--- a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
@@ -192,21 +192,6 @@ DisassembleRequestHandler::Run(const DisassembleArguments 
&args) const {
 return llvm::make_error(
 "Memory reference not found in the current binary.");
 
-  std::string flavor_string;
-  const auto target_triple = llvm::StringRef(dap.target.GetTriple());
-  // This handles both 32 and 64bit x86 architecture. The logic is duplicated 
in
-  // `CommandObjectDisassemble::CommandOptions::OptionParsingStarting`
-  if (target_triple.starts_with("x86")) {
-const lldb::SBStructuredData flavor =
-dap.debugger.GetSetting("target.x86-disassembly-flavor");
-
-const size_t str_length = flavor.GetStringValue(nullptr, 0);
-if (str_length != 0) {
-  flavor_string.resize(str_length + 1);
-  flavor.GetStringValue(flavor_string.data(), flavor_string.length());
-}
-  }
-
   // Offset (in instructions) to be applied after the byte offset (if any)
   // before disassembling. Can be negative.
   int64_t instruction_offset = args.instructionOffset.value_or(0);
@@ -219,7 +204,7 @@ DisassembleRequestHandler::Run(const DisassembleArguments 
&args) const {
 "Unexpected error while disassembling instructions.");
 
   lldb::SBInstru

[Lldb-commits] [lldb] [lldb][lldb-dap] Use the default disassembly flavour if none is provided. (PR #141424)

2025-05-25 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper created 
https://github.com/llvm/llvm-project/pull/141424

This is the currently the default for `SBTarget::ReadInstructions(SBAddress, 
uint32_t)`. But not for others, to make it consistent used the user assigned 
instruction flavour.

>From 6d3872f06ea10985c05a19f42c0c96f0ae148d4a Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Sun, 25 May 2025 02:08:41 +0100
Subject: [PATCH 1/2] [lldb] use the default instruction flavour if none is
 provided

this is already done in the other overloaded function 
`SBTarget::ReadInstructions::(SBAddress, SBAddress, const char *)`

It completes it to be more in line wither other 
`ReadInstruction/GetInstructions` api
---
 lldb/source/API/SBTarget.cpp | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index cd8a770a0ec04..8d97c454c300c 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -2039,7 +2039,17 @@ lldb::SBInstructionList 
SBTarget::ReadInstructions(lldb::SBAddress base_addr,
   const size_t bytes_read =
   target_sp->ReadMemory(*addr_ptr, data.GetBytes(), data.GetByteSize(),
 error, force_live_memory, &load_addr);
+
   const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
+  if (!flavor_string || flavor_string[0] == '\0') {
+// FIXME - we don't have the mechanism in place to do per-architecture
+// settings.  But since we know that for now we only support flavors on
+// x86 & x86_64,
+const llvm::Triple::ArchType arch =
+target_sp->GetArchitecture().GetTriple().getArch();
+if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+  flavor_string = target_sp->GetDisassemblyFlavor();
+  }
   sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
   target_sp->GetArchitecture(), nullptr, flavor_string,
   target_sp->GetDisassemblyCPU(), target_sp->GetDisassemblyFeatures(),
@@ -2098,7 +2108,16 @@ SBTarget::GetInstructionsWithFlavor(lldb::SBAddress 
base_addr,
 if (base_addr.get())
   addr = *base_addr.get();
 
-const bool data_from_file = true;
+constexpr bool data_from_file = true;
+if (!flavor_string || flavor_string[0] == '\0') {
+  // FIXME - we don't have the mechanism in place to do per-architecture
+  // settings.  But since we know that for now we only support flavors on
+  // x86 & x86_64,
+  const llvm::Triple::ArchType arch =
+  target_sp->GetArchitecture().GetTriple().getArch();
+  if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+flavor_string = target_sp->GetDisassemblyFlavor();
+}
 
 sb_instructions.SetDisassembler(Disassembler::DisassembleBytes(
 target_sp->GetArchitecture(), nullptr, flavor_string,

>From 0bdc52fc0cdeb6f5ad09b1f4931474933c43cabb Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Sun, 25 May 2025 02:14:42 +0100
Subject: [PATCH 2/2] [lldb][lldb-dap] remove redundant code

---
 .../Commands/CommandObjectDisassemble.cpp   |  1 -
 .../Handler/DisassembleRequestHandler.cpp   | 17 +
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 5774effb9e9ba..70e687e19ac6d 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -190,7 +190,6 @@ void 
CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
 // architecture.  For now GetDisassemblyFlavor is really only valid for x86
 // (and for the llvm assembler plugin, but I'm papering over that since 
that
 // is the only disassembler plugin we have...
-// This logic is duplicated in `Handler/DisassembleRequestHandler`.
 if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86 ||
 target->GetArchitecture().GetTriple().getArch() ==
 llvm::Triple::x86_64) {
diff --git a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
index c9061ef19f17a..a7d70d4c3aceb 100644
--- a/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DisassembleRequestHandler.cpp
@@ -192,21 +192,6 @@ DisassembleRequestHandler::Run(const DisassembleArguments 
&args) const {
 return llvm::make_error(
 "Memory reference not found in the current binary.");
 
-  std::string flavor_string;
-  const auto target_triple = llvm::StringRef(dap.target.GetTriple());
-  // This handles both 32 and 64bit x86 architecture. The logic is duplicated 
in
-  // `CommandObjectDisassemble::CommandOptions::OptionParsingStarting`
-  if (target_triple.starts_with("x86")) {
-const lldb::SBStructuredData flavor =
-dap.debugger.GetSetting("target.x86-disassembly-flavo

[Lldb-commits] [lldb] [lldb] Use llvm::any_of (NFC) (PR #141443)

2025-05-25 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/141443

None

>From 5748dfe7f68a0778a7b7caeacbf79c2fb3536bd1 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Sun, 25 May 2025 10:41:49 -0700
Subject: [PATCH] [lldb] Use llvm::any_of (NFC)

---
 lldb/source/Breakpoint/WatchpointResource.cpp  | 6 ++
 lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp 
b/lldb/source/Breakpoint/WatchpointResource.cpp
index fa0442997b528..49d9d12aadfc3 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -73,10 +73,8 @@ bool WatchpointResource::ConstituentsContains(const 
WatchpointSP &wp_sp) {
 
 bool WatchpointResource::ConstituentsContains(const Watchpoint *wp) {
   std::lock_guard guard(m_constituents_mutex);
-  WatchpointCollection::const_iterator match =
-  std::find_if(m_constituents.begin(), m_constituents.end(),
-   [&wp](const WatchpointSP &x) { return x.get() == wp; });
-  return match != m_constituents.end();
+  return llvm::any_of(m_constituents,
+  [&wp](const WatchpointSP &x) { return x.get() == wp; });
 }
 
 WatchpointSP WatchpointResource::GetConstituentAtIndex(size_t idx) {
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp 
b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
index 3bafb21f7c33a..b9e7c698cdec0 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
@@ -177,8 +177,8 @@ void ABIAArch64::AugmentRegisterInfo(
   lldb::eFormatHex);
 
   auto bool_predicate = [](const auto ®_num) { return bool(reg_num); };
-  bool saw_v_regs = std::any_of(v_regs.begin(), v_regs.end(), bool_predicate);
-  bool saw_z_regs = std::any_of(z_regs.begin(), z_regs.end(), bool_predicate);
+  bool saw_v_regs = llvm::any_of(v_regs, bool_predicate);
+  bool saw_z_regs = llvm::any_of(z_regs, bool_predicate);
 
   // Sn/Dn for Vn.
   if (saw_v_regs) {

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use llvm::any_of (NFC) (PR #141443)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/141443.diff


2 Files Affected:

- (modified) lldb/source/Breakpoint/WatchpointResource.cpp (+2-4) 
- (modified) lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp (+2-2) 


``diff
diff --git a/lldb/source/Breakpoint/WatchpointResource.cpp 
b/lldb/source/Breakpoint/WatchpointResource.cpp
index fa0442997b528..49d9d12aadfc3 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -73,10 +73,8 @@ bool WatchpointResource::ConstituentsContains(const 
WatchpointSP &wp_sp) {
 
 bool WatchpointResource::ConstituentsContains(const Watchpoint *wp) {
   std::lock_guard guard(m_constituents_mutex);
-  WatchpointCollection::const_iterator match =
-  std::find_if(m_constituents.begin(), m_constituents.end(),
-   [&wp](const WatchpointSP &x) { return x.get() == wp; });
-  return match != m_constituents.end();
+  return llvm::any_of(m_constituents,
+  [&wp](const WatchpointSP &x) { return x.get() == wp; });
 }
 
 WatchpointSP WatchpointResource::GetConstituentAtIndex(size_t idx) {
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp 
b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
index 3bafb21f7c33a..b9e7c698cdec0 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
@@ -177,8 +177,8 @@ void ABIAArch64::AugmentRegisterInfo(
   lldb::eFormatHex);
 
   auto bool_predicate = [](const auto ®_num) { return bool(reg_num); };
-  bool saw_v_regs = std::any_of(v_regs.begin(), v_regs.end(), bool_predicate);
-  bool saw_z_regs = std::any_of(z_regs.begin(), z_regs.end(), bool_predicate);
+  bool saw_v_regs = llvm::any_of(v_regs, bool_predicate);
+  bool saw_z_regs = llvm::any_of(z_regs, bool_predicate);
 
   // Sn/Dn for Vn.
   if (saw_v_regs) {

``




https://github.com/llvm/llvm-project/pull/141443
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][lldb-dap] Use the default disassembly flavour if none is provided. (PR #141424)

2025-05-25 Thread Ely Ronnen via lldb-commits


@@ -2039,7 +2039,17 @@ lldb::SBInstructionList 
SBTarget::ReadInstructions(lldb::SBAddress base_addr,
   const size_t bytes_read =
   target_sp->ReadMemory(*addr_ptr, data.GetBytes(), data.GetByteSize(),
 error, force_live_memory, &load_addr);
+
   const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
+  if (!flavor_string || flavor_string[0] == '\0') {

eronnen wrote:

This check already exists in `Disassembler::FindPluginForTarget`, maybe more 
straightforward would be to call a function in the `Disassembler` class that 
uses it instead of `Disassembler::DisassembleBytes`?

https://github.com/llvm/llvm-project/pull/141424
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][lldb-dap] Use the default disassembly flavour if none is provided. (PR #141424)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen edited 
https://github.com/llvm/llvm-project/pull/141424
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add missing cmake build type argument (PR #141427)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen edited 
https://github.com/llvm/llvm-project/pull/141427
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add array subscription and integer parsing to DIL (PR #141102)

2025-05-25 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` 
running on `as-builder-9` while building `lldb` at step 16 
"test-check-lldb-api".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/195/builds/9534


Here is the relevant piece of the build log for the reference

```
Step 16 (test-check-lldb-api) failure: Test just built components: 
check-lldb-api completed (failure)
 TEST 'lldb-api :: 
functionalities/thread/exit_during_step/TestExitDuringStep.py' FAILED 

Script:
--
/usr/bin/python3.12 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib
 --env 
LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include
 --env 
LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin
 --libcxx-include-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1
 --libcxx-include-target-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1
 --libcxx-library-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu
 --arch aarch64 --build-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex
 --lldb-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb 
--compiler 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang 
--dsymutil 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil
 --make /usr/bin/gmake --llvm-tools-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin 
--lldb-obj-root 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb 
--lldb-libs-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib 
--cmake-build-type Release --platform-url 
connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir 
/home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env 
ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux 
--skip-category=lldb-server 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/thread/exit_during_step
 -p TestExitDuringStep.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
fe51d8ae5772626ef8237c33e0911695cf4f07db)
  clang revision fe51d8ae5772626ef8237c33e0911695cf4f07db
  llvm revision fe51d8ae5772626ef8237c33e0911695cf4f07db
Setting up remote platform 'remote-linux'
Connecting to remote platform 'remote-linux' at 
'connect://jetson-agx-2198.lab.llvm.org:1234'...
Connected.
Setting remote platform working directory to '/home/ubuntu/lldb-tests'...
Skipping the following test categories: ['lldb-server', 'dsym', 'gmodules', 
'debugserver', 'objc', 'lldb-dap']

--
Command Output (stderr):
--
WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx 
arguments
UNSUPPORTED: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_dsym (TestExitDuringStep.ExitDuringStepTestCase.test_dsym) (test case 
does not fall in any category of interest for this run) 
PASS: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_dwarf (TestExitDuringStep.ExitDuringStepTestCase.test_dwarf)
PASS: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_dwo (TestExitDuringStep.ExitDuringStepTestCase.test_dwo)
UNSUPPORTED: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_step_in_dsym 
(TestExitDuringStep.ExitDuringStepTestCase.test_step_in_dsym) (test case does 
not fall in any category of interest for this run) 
FAIL: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_step_in_dwarf 
(TestExitDuringStep.ExitDuringStepTestCase.test_step_in_dwarf)
PASS: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_step_in_dwo 
(TestExitDuringStep.ExitDuringStepTestCase.test_step_in_dwo)
UNSUPPORTED: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test_step_over_dsym 
(TestExitDuringStep.ExitDuringStepTestCase.test_step_over_dsym) (test case does 
not fall in any category of interest for this run) 
PASS: LLDB 
(/home/buildbo

[Lldb-commits] [lldb] [lldb] Use std::tie to implement operator< (NFC) (PR #141416)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/141416.diff


3 Files Affected:

- (modified) lldb/include/lldb/Symbol/CompilerDeclContext.h (+2-3) 
- (modified) lldb/include/lldb/Target/CoreFileMemoryRanges.h (+2-5) 
- (modified) lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h 
(+2-10) 


``diff
diff --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h 
b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index 89b4a9787688b..fe2ef215a8d19 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -48,9 +48,8 @@ class CompilerDeclContext {
   explicit operator bool() const { return IsValid(); }
 
   bool operator<(const CompilerDeclContext &rhs) const {
-if (m_type_system == rhs.m_type_system)
-  return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
-return m_type_system < rhs.m_type_system;
+return std::tie(m_type_system, m_opaque_decl_ctx) <
+   std::tie(rhs.m_type_system, rhs.m_opaque_decl_ctx);
   }
 
   bool IsValid() const {
diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h 
b/lldb/include/lldb/Target/CoreFileMemoryRanges.h
index 0cc5433525ddc..78d01acca324e 100644
--- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h
+++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h
@@ -30,11 +30,8 @@ struct CoreFileMemoryRange {
   }
 
   bool operator<(const CoreFileMemoryRange &rhs) const {
-if (range < rhs.range)
-  return true;
-if (range == rhs.range)
-  return lldb_permissions < rhs.lldb_permissions;
-return false;
+return std::tie(range, lldb_permissions) <
+   std::tie(rhs.range, rhs.lldb_permissions);
   }
 
   std::string Dump() const {
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h 
b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index ffe9725fa6826..45de098c15f51 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -386,16 +386,8 @@ class ObjCLanguageRuntime : public LanguageRuntime {
 }
 
 bool operator<(const ClassAndSel &rhs) const {
-  if (class_addr < rhs.class_addr)
-return true;
-  else if (class_addr > rhs.class_addr)
-return false;
-  else {
-if (sel_addr < rhs.sel_addr)
-  return true;
-else
-  return false;
-  }
+  return std::tie(class_addr, sel_addr) <
+ std::tie(rhs.class_addr, rhs.sel_addr);
 }
 
 lldb::addr_t class_addr = LLDB_INVALID_ADDRESS;

``




https://github.com/llvm/llvm-project/pull/141416
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use std::tie to implement operator< (NFC) (PR #141416)

2025-05-25 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/141416

None

>From e2a76ae23d253dc1802d2eb4fb3fc2789b5ee64f Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Sat, 24 May 2025 20:51:21 -0700
Subject: [PATCH] [lldb] Use std::tie to implement operator< (NFC)

---
 lldb/include/lldb/Symbol/CompilerDeclContext.h   |  5 ++---
 lldb/include/lldb/Target/CoreFileMemoryRanges.h  |  7 ++-
 .../LanguageRuntime/ObjC/ObjCLanguageRuntime.h   | 12 ++--
 3 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h 
b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index 89b4a9787688b..fe2ef215a8d19 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -48,9 +48,8 @@ class CompilerDeclContext {
   explicit operator bool() const { return IsValid(); }
 
   bool operator<(const CompilerDeclContext &rhs) const {
-if (m_type_system == rhs.m_type_system)
-  return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
-return m_type_system < rhs.m_type_system;
+return std::tie(m_type_system, m_opaque_decl_ctx) <
+   std::tie(rhs.m_type_system, rhs.m_opaque_decl_ctx);
   }
 
   bool IsValid() const {
diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h 
b/lldb/include/lldb/Target/CoreFileMemoryRanges.h
index 0cc5433525ddc..78d01acca324e 100644
--- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h
+++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h
@@ -30,11 +30,8 @@ struct CoreFileMemoryRange {
   }
 
   bool operator<(const CoreFileMemoryRange &rhs) const {
-if (range < rhs.range)
-  return true;
-if (range == rhs.range)
-  return lldb_permissions < rhs.lldb_permissions;
-return false;
+return std::tie(range, lldb_permissions) <
+   std::tie(rhs.range, rhs.lldb_permissions);
   }
 
   std::string Dump() const {
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h 
b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index ffe9725fa6826..45de098c15f51 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -386,16 +386,8 @@ class ObjCLanguageRuntime : public LanguageRuntime {
 }
 
 bool operator<(const ClassAndSel &rhs) const {
-  if (class_addr < rhs.class_addr)
-return true;
-  else if (class_addr > rhs.class_addr)
-return false;
-  else {
-if (sel_addr < rhs.sel_addr)
-  return true;
-else
-  return false;
-  }
+  return std::tie(class_addr, sel_addr) <
+ std::tie(rhs.class_addr, rhs.sel_addr);
 }
 
 lldb::addr_t class_addr = LLDB_INVALID_ADDRESS;

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] optionally match the `__debug` namespace for libstdc++ containers. (PR #140727)

2025-05-25 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/140727

>From cb2db78130e372b67d760cd89d2418252fa37459 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Sun, 18 May 2025 09:55:25 +0100
Subject: [PATCH 1/3] [lldb] optionally match the `__debug` namespace for
 libstdc++ containers.

If libstdc++ is compiled with `_GLIBCXX_DEBUG` flag it puts the containers in 
the namespace `std::__debug`. this causes the summary and synthetic formatters 
not to match the types. The formatters is updated to optionally match the 
`__debug::`.

The formatters now clashed with the libc++ containers namespace regex which 
uses `std::__1` namespace

The libc++ formatter is loaded first, then the libstdc++ since the priority of 
the formatters in lldb is the last one added.

Fixes #60841
---
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 67 +++
 .../TestDataFormatterCategories.py|  4 +-
 2 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 542f13bef23e7..e98eef49f501a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -592,7 +592,7 @@ class NodeAllocator {
 public:
   void reset() { Alloc.Reset(); }
 
-  template  T *makeNode(Args &&... args) {
+  template  T *makeNode(Args &&...args) {
 return new (Alloc.Allocate(sizeof(T), alignof(T)))
 T(std::forward(args)...);
   }
@@ -614,7 +614,7 @@ class ManglingSubstitutor
   ManglingSubstitutor() : Base(nullptr, nullptr) {}
 
   template 
-  ConstString substitute(llvm::StringRef Mangled, Ts &&... Vals) {
+  ConstString substitute(llvm::StringRef Mangled, Ts &&...Vals) {
 this->getDerived().reset(Mangled, std::forward(Vals)...);
 return substituteImpl(Mangled);
   }
@@ -1449,47 +1449,50 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   stl_deref_flags.SetFrontEndWantsDereference();
 
   cpp_category_sp->AddTypeSynthetic(
-  "^std::vector<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::(__debug::)?vector<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::map<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::(__debug::)?map<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::deque<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::(__debug)?deque<.+>(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::set<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::(__debug::)?set<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::multimap<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::(__debug::)?multimap<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::multiset<.+> >(( )?&)?$", eFormatterMatchRegex,
+  "^std::(__debug::)?multiset<.+> >(( )?&)?$", eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::unordered_(multi)?(map|set)<.+> >$", eFormatterMatchRegex,
+  "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$",
+  eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__cxx11::)?list<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::((__debug::)?|(__cxx11::)?)list<.+>(( )?&)?$",
+  eFormatterMatchRegex,
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_deref_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   cpp_category_sp->AddTypeSynthetic(
-  "^std::(__cxx11::)?forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
+  "^std::((__debug::)?|(__cxx11::)?)forward_list<.+>(( )?&)?$",
+  eFormatterMatchRegex,
   Synt

[Lldb-commits] [lldb] [LLDB] Add array subscription and integer parsing to DIL (PR #141102)

2025-05-25 Thread Ilia Kuklin via lldb-commits

https://github.com/kuilpd updated 
https://github.com/llvm/llvm-project/pull/141102

>From 5210b8b00dfd05d092b3519cbb0a5480b3abe534 Mon Sep 17 00:00:00 2001
From: Ilia Kuklin 
Date: Thu, 22 May 2025 16:15:11 +0500
Subject: [PATCH 1/2] [LLDB] Add array subscription and integer parsing to DIL
 (#138551)

---
 lldb/docs/dil-expr-lang.ebnf  |  13 ++-
 lldb/include/lldb/ValueObject/DILAST.h|  27 -
 lldb/include/lldb/ValueObject/DILEval.h   |   2 +
 lldb/include/lldb/ValueObject/DILLexer.h  |   3 +
 lldb/include/lldb/ValueObject/DILParser.h |   1 +
 lldb/source/ValueObject/DILAST.cpp|   5 +
 lldb/source/ValueObject/DILEval.cpp   |  51 +++-
 lldb/source/ValueObject/DILLexer.cpp  |  31 -
 lldb/source/ValueObject/DILParser.cpp |  57 +++--
 .../var-dil/basics/ArraySubscript/Makefile|   3 +
 .../TestFrameVarDILArraySubscript.py  | 110 ++
 .../var-dil/basics/ArraySubscript/main.cpp|  32 +
 lldb/unittests/ValueObject/DILLexerTests.cpp  |  33 +-
 13 files changed, 344 insertions(+), 24 deletions(-)
 create mode 100644 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/Makefile
 create mode 100644 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py
 create mode 100644 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp

diff --git a/lldb/docs/dil-expr-lang.ebnf b/lldb/docs/dil-expr-lang.ebnf
index 580626862c005..783432dabd6db 100644
--- a/lldb/docs/dil-expr-lang.ebnf
+++ b/lldb/docs/dil-expr-lang.ebnf
@@ -10,16 +10,17 @@ unary_expression = postfix_expression
 
 unary_operator = "*" | "&" ;
 
-postfix_expresson = primary_expression
-  | postfix_expression "." id_expression
-  | postfix_expression "->" id_expression ;
+postfix_expression = primary_expression
+   | postfix_expression "[" integer_literal "]"
+   | postfix_expression "." id_expression
+   | postfix_expression "->" id_expression ;
 
 primary_expression = id_expression
-   | "(" expression ")"  ;
+   | "(" expression ")" ;
 
 id_expression = unqualified_id
   | qualified_id
- | register ;
+  | register ;
 
 unqualified_id = identifier ;
 
@@ -28,6 +29,8 @@ qualified_id = ["::"] [nested_name_specifier] unqualified_id
 
 identifier = ? C99 Identifier ? ;
 
+integer_literal = ? Integer constant: hexademical, decimal, octal, binary ? ;
+
 register = "$" ? Register name ? ;
 
 nested_name_specifier = type_name "::"
diff --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 8687316657ca9..6c7838e05c93c 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -18,6 +18,7 @@ namespace lldb_private::dil {
 
 /// The various types DIL AST nodes (used by the DIL parser).
 enum class NodeKind {
+  eArraySubscriptNode,
   eErrorNode,
   eIdentifierNode,
   eMemberOfNode,
@@ -120,8 +121,8 @@ class UnaryOpNode : public ASTNode {
 
   llvm::Expected Accept(Visitor *v) const override;
 
-  UnaryOpKind kind() const { return m_kind; }
-  ASTNode *operand() const { return m_operand.get(); }
+  UnaryOpKind GetKind() const { return m_kind; }
+  ASTNode *GetOperand() const { return m_operand.get(); }
 
   static bool classof(const ASTNode *node) {
 return node->GetKind() == NodeKind::eUnaryOpNode;
@@ -132,6 +133,26 @@ class UnaryOpNode : public ASTNode {
   ASTNodeUP m_operand;
 };
 
+class ArraySubscriptNode : public ASTNode {
+public:
+  ArraySubscriptNode(uint32_t location, ASTNodeUP base, int64_t index)
+  : ASTNode(location, NodeKind::eArraySubscriptNode),
+m_base(std::move(base)), m_index(index) {}
+
+  llvm::Expected Accept(Visitor *v) const override;
+
+  ASTNode *GetBase() const { return m_base.get(); }
+  int64_t GetIndex() const { return m_index; }
+
+  static bool classof(const ASTNode *node) {
+return node->GetKind() == NodeKind::eArraySubscriptNode;
+  }
+
+private:
+  ASTNodeUP m_base;
+  int64_t m_index;
+};
+
 /// This class contains one Visit method for each specialized type of
 /// DIL AST node. The Visit methods are used to dispatch a DIL AST node to
 /// the correct function in the DIL expression evaluator for evaluating that
@@ -145,6 +166,8 @@ class Visitor {
   Visit(const MemberOfNode *node) = 0;
   virtual llvm::Expected
   Visit(const UnaryOpNode *node) = 0;
+  virtual llvm::Expected
+  Visit(const ArraySubscriptNode *node) = 0;
 };
 
 } // namespace lldb_private::dil
diff --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index 266b6fb1a63eb..9d0fa53c6622a 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -52,6 +52,8 @@ class Interpreter : Visitor {
   Visit(const IdentifierNode *node) override;
   llvm::Expected Visit(const M

[Lldb-commits] [lldb] 6235479 - [lldb] Fix a typo in documentation (#141384)

2025-05-25 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-25T08:20:04-07:00
New Revision: 6235479db3b34e52e7f58a8f587372f4f818d68a

URL: 
https://github.com/llvm/llvm-project/commit/6235479db3b34e52e7f58a8f587372f4f818d68a
DIFF: 
https://github.com/llvm/llvm-project/commit/6235479db3b34e52e7f58a8f587372f4f818d68a.diff

LOG: [lldb] Fix a typo in documentation (#141384)

Added: 


Modified: 
lldb/docs/use/python-reference.rst

Removed: 




diff  --git a/lldb/docs/use/python-reference.rst 
b/lldb/docs/use/python-reference.rst
index 4bf0cb075064b..325d0685d9d38 100644
--- a/lldb/docs/use/python-reference.rst
+++ b/lldb/docs/use/python-reference.rst
@@ -609,7 +609,7 @@ special needs.
 The easiest way to do this is to derive your new command from the 
lldb.ParsedCommand
 class.  That responds in the same way to the help & repeat command interfaces, 
and
 provides some convenience methods, and most importantly an 
LLDBOptionValueParser,
-accessed throught lldb.ParsedCommand.get_parser().  The parser is used to set
+accessed through lldb.ParsedCommand.get_parser().  The parser is used to set
 your command definitions, and to retrieve option values in the __call__ method.
 
 To set up the command definition, implement the ParsedCommand abstract method:



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix a typo in documentation (PR #141384)

2025-05-25 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/141384
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ef29a79 - [lldb] Use llvm::find_if (NFC) (#141385)

2025-05-25 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-25T08:21:30-07:00
New Revision: ef29a79adf8f3a5b80e0ef10b84de54f7eacefa4

URL: 
https://github.com/llvm/llvm-project/commit/ef29a79adf8f3a5b80e0ef10b84de54f7eacefa4
DIFF: 
https://github.com/llvm/llvm-project/commit/ef29a79adf8f3a5b80e0ef10b84de54f7eacefa4.diff

LOG: [lldb] Use llvm::find_if (NFC) (#141385)

Added: 


Modified: 
lldb/include/lldb/Breakpoint/StopPointSiteList.h
lldb/source/Breakpoint/BreakpointList.cpp
lldb/source/Breakpoint/BreakpointLocationCollection.cpp
lldb/source/Breakpoint/WatchpointList.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/DataFormatters/TypeCategoryMap.cpp
lldb/source/Target/TargetList.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/StopPointSiteList.h 
b/lldb/include/lldb/Breakpoint/StopPointSiteList.h
index b929c37a12f09..7ed53e952dc8d 100644
--- a/lldb/include/lldb/Breakpoint/StopPointSiteList.h
+++ b/lldb/include/lldb/Breakpoint/StopPointSiteList.h
@@ -278,9 +278,8 @@ template  class StopPointSiteList {
 [site_id](const std::pair s) {
   return site_id == s.second->GetID();
 };
-return std::find_if(m_site_list.begin(),
-m_site_list.end(), // Search full range
-id_matches);
+return llvm::find_if(m_site_list, // Search full range
+ id_matches);
   }
 
   typename collection::const_iterator
@@ -290,9 +289,8 @@ template  class StopPointSiteList {
 [site_id](const std::pair s) {
   return site_id == s.second->GetID();
 };
-return std::find_if(m_site_list.begin(),
-m_site_list.end(), // Search full range
-id_matches);
+return llvm::find_if(m_site_list, // Search full range
+ id_matches);
   }
 
   mutable std::recursive_mutex m_mutex;

diff  --git a/lldb/source/Breakpoint/BreakpointList.cpp 
b/lldb/source/Breakpoint/BreakpointList.cpp
index 2c47b3b1263c6..779490ae0316a 100644
--- a/lldb/source/Breakpoint/BreakpointList.cpp
+++ b/lldb/source/Breakpoint/BreakpointList.cpp
@@ -47,9 +47,9 @@ break_id_t BreakpointList::Add(BreakpointSP &bp_sp, bool 
notify) {
 bool BreakpointList::Remove(break_id_t break_id, bool notify) {
   std::lock_guard guard(m_mutex);
 
-  auto it = std::find_if(
-  m_breakpoints.begin(), m_breakpoints.end(),
-  [&](const BreakpointSP &bp) { return bp->GetID() == break_id; });
+  auto it = llvm::find_if(m_breakpoints, [&](const BreakpointSP &bp) {
+return bp->GetID() == break_id;
+  });
 
   if (it == m_breakpoints.end())
 return false;
@@ -109,16 +109,16 @@ void BreakpointList::RemoveAllowed(bool notify) {
 
 BreakpointList::bp_collection::iterator
 BreakpointList::GetBreakpointIDIterator(break_id_t break_id) {
-  return std::find_if(
-  m_breakpoints.begin(), m_breakpoints.end(),
-  [&](const BreakpointSP &bp) { return bp->GetID() == break_id; });
+  return llvm::find_if(m_breakpoints, [&](const BreakpointSP &bp) {
+return bp->GetID() == break_id;
+  });
 }
 
 BreakpointList::bp_collection::const_iterator
 BreakpointList::GetBreakpointIDConstIterator(break_id_t break_id) const {
-  return std::find_if(
-  m_breakpoints.begin(), m_breakpoints.end(),
-  [&](const BreakpointSP &bp) { return bp->GetID() == break_id; });
+  return llvm::find_if(m_breakpoints, [&](const BreakpointSP &bp) {
+return bp->GetID() == break_id;
+  });
 }
 
 BreakpointSP BreakpointList::FindBreakpointByID(break_id_t break_id) const {

diff  --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp 
b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
index d649e889c3f76..28a3639e95bb6 100644
--- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
@@ -60,18 +60,16 @@ class BreakpointIDPairMatches {
 BreakpointLocationCollection::collection::iterator
 BreakpointLocationCollection::GetIDPairIterator(lldb::break_id_t break_id,
 lldb::break_id_t break_loc_id) 
{
-  return std::find_if(
-  m_break_loc_collection.begin(),
-  m_break_loc_collection.end(), // Search full range
+  return llvm::find_if(
+  m_break_loc_collection,   // Search full range
   BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
 }
 
 BreakpointLocationCollection::collection::const_iterator
 BreakpointLocationCollection::GetIDPairConstIterator(
 lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const {
-  return std::find_if(
-  m_break_loc_collection.begin(),
-  m_break_loc_collection.end(), // Search full range
+  return llvm::find_if(
+  m_break_loc_collection,   // Search full range
   BreakpointIDPairMatc

[Lldb-commits] [lldb] [lldb] Use llvm::find_if (NFC) (PR #141385)

2025-05-25 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/141385
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Add bit extraction to DIL (PR #141422)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ilia Kuklin (kuilpd)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/141422.diff


11 Files Affected:

- (modified) lldb/include/lldb/ValueObject/DILAST.h (+27) 
- (modified) lldb/include/lldb/ValueObject/DILEval.h (+2) 
- (modified) lldb/include/lldb/ValueObject/DILLexer.h (+1) 
- (modified) lldb/source/ValueObject/DILAST.cpp (+5) 
- (modified) lldb/source/ValueObject/DILEval.cpp (+32) 
- (modified) lldb/source/ValueObject/DILLexer.cpp (+5-2) 
- (modified) lldb/source/ValueObject/DILParser.cpp (+18-4) 
- (modified) 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py
 (+1-1) 
- (added) 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/Makefile (+3) 
- (added) 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/TestFrameVarDILBitFieldExtraction.py
 (+56) 
- (added) 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/main.cpp (+9) 


``diff
diff --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 6c7838e05c93c..709f0639135f1 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -19,6 +19,7 @@ namespace lldb_private::dil {
 /// The various types DIL AST nodes (used by the DIL parser).
 enum class NodeKind {
   eArraySubscriptNode,
+  eBitExtractionNode,
   eErrorNode,
   eIdentifierNode,
   eMemberOfNode,
@@ -153,6 +154,30 @@ class ArraySubscriptNode : public ASTNode {
   int64_t m_index;
 };
 
+class BitFieldExtractionNode : public ASTNode {
+public:
+  BitFieldExtractionNode(uint32_t location, ASTNodeUP base, int64_t 
first_index,
+ int64_t last_index)
+  : ASTNode(location, NodeKind::eBitExtractionNode),
+m_base(std::move(base)), m_first_index(first_index),
+m_last_index(last_index) {}
+
+  llvm::Expected Accept(Visitor *v) const override;
+
+  ASTNode *GetBase() const { return m_base.get(); }
+  int64_t GetFirstIndex() const { return m_first_index; }
+  int64_t GetLastIndex() const { return m_last_index; }
+
+  static bool classof(const ASTNode *node) {
+return node->GetKind() == NodeKind::eBitExtractionNode;
+  }
+
+private:
+  ASTNodeUP m_base;
+  int64_t m_first_index;
+  int64_t m_last_index;
+};
+
 /// This class contains one Visit method for each specialized type of
 /// DIL AST node. The Visit methods are used to dispatch a DIL AST node to
 /// the correct function in the DIL expression evaluator for evaluating that
@@ -168,6 +193,8 @@ class Visitor {
   Visit(const UnaryOpNode *node) = 0;
   virtual llvm::Expected
   Visit(const ArraySubscriptNode *node) = 0;
+  virtual llvm::Expected
+  Visit(const BitFieldExtractionNode *node) = 0;
 };
 
 } // namespace lldb_private::dil
diff --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index 9d0fa53c6622a..2a0cb548a810f 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -54,6 +54,8 @@ class Interpreter : Visitor {
   llvm::Expected Visit(const UnaryOpNode *node) override;
   llvm::Expected
   Visit(const ArraySubscriptNode *node) override;
+  llvm::Expected
+  Visit(const BitFieldExtractionNode *node) override;
 
   // Used by the interpreter to create objects, perform casts, etc.
   lldb::TargetSP m_target;
diff --git a/lldb/include/lldb/ValueObject/DILLexer.h 
b/lldb/include/lldb/ValueObject/DILLexer.h
index 7d70f88f9a718..9c1ba97680253 100644
--- a/lldb/include/lldb/ValueObject/DILLexer.h
+++ b/lldb/include/lldb/ValueObject/DILLexer.h
@@ -31,6 +31,7 @@ class Token {
 identifier,
 l_paren,
 l_square,
+minus,
 numeric_constant,
 period,
 r_paren,
diff --git a/lldb/source/ValueObject/DILAST.cpp 
b/lldb/source/ValueObject/DILAST.cpp
index 8b5e64ad462cc..b1cd824c2299e 100644
--- a/lldb/source/ValueObject/DILAST.cpp
+++ b/lldb/source/ValueObject/DILAST.cpp
@@ -32,4 +32,9 @@ ArraySubscriptNode::Accept(Visitor *v) const {
   return v->Visit(this);
 }
 
+llvm::Expected
+BitFieldExtractionNode::Accept(Visitor *v) const {
+  return v->Visit(this);
+}
+
 } // namespace lldb_private::dil
diff --git a/lldb/source/ValueObject/DILEval.cpp 
b/lldb/source/ValueObject/DILEval.cpp
index c8cb54aa18a93..b2bb4e20ddc24 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -430,4 +430,36 @@ Interpreter::Visit(const ArraySubscriptNode *node) {
   return base->GetSyntheticArrayMember(signed_child_idx, true);
 }
 
+llvm::Expected
+Interpreter::Visit(const BitFieldExtractionNode *node) {
+  auto lhs_or_err = Evaluate(node->GetBase());
+  if (!lhs_or_err)
+return lhs_or_err;
+  lldb::ValueObjectSP base = *lhs_or_err;
+  int64_t first_index = node->GetFirstIndex();
+  int64_t last_index = node->GetLastIndex();
+
+  // if the format given is [high-low], swap range
+  if (first_index > last_index)
+std::swap(first_index, last

[Lldb-commits] [lldb] [LLDB] Add bit extraction to DIL (PR #141422)

2025-05-25 Thread Ilia Kuklin via lldb-commits

https://github.com/kuilpd created 
https://github.com/llvm/llvm-project/pull/141422

None

>From b093c5fb20c56251c61235c748b673ce59840173 Mon Sep 17 00:00:00 2001
From: Ilia Kuklin 
Date: Tue, 20 May 2025 17:58:01 +0500
Subject: [PATCH] [LLDB] Add BitExtraction node to DIL

---
 lldb/include/lldb/ValueObject/DILAST.h| 27 +
 lldb/include/lldb/ValueObject/DILEval.h   |  2 +
 lldb/include/lldb/ValueObject/DILLexer.h  |  1 +
 lldb/source/ValueObject/DILAST.cpp|  5 ++
 lldb/source/ValueObject/DILEval.cpp   | 32 +++
 lldb/source/ValueObject/DILLexer.cpp  |  7 ++-
 lldb/source/ValueObject/DILParser.cpp | 22 ++--
 .../TestFrameVarDILArraySubscript.py  |  2 +-
 .../basics/BitFieldExtraction/Makefile|  3 +
 .../TestFrameVarDILBitFieldExtraction.py  | 56 +++
 .../basics/BitFieldExtraction/main.cpp|  9 +++
 11 files changed, 159 insertions(+), 7 deletions(-)
 create mode 100644 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/Makefile
 create mode 100644 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/TestFrameVarDILBitFieldExtraction.py
 create mode 100644 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/main.cpp

diff --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 6c7838e05c93c..709f0639135f1 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -19,6 +19,7 @@ namespace lldb_private::dil {
 /// The various types DIL AST nodes (used by the DIL parser).
 enum class NodeKind {
   eArraySubscriptNode,
+  eBitExtractionNode,
   eErrorNode,
   eIdentifierNode,
   eMemberOfNode,
@@ -153,6 +154,30 @@ class ArraySubscriptNode : public ASTNode {
   int64_t m_index;
 };
 
+class BitFieldExtractionNode : public ASTNode {
+public:
+  BitFieldExtractionNode(uint32_t location, ASTNodeUP base, int64_t 
first_index,
+ int64_t last_index)
+  : ASTNode(location, NodeKind::eBitExtractionNode),
+m_base(std::move(base)), m_first_index(first_index),
+m_last_index(last_index) {}
+
+  llvm::Expected Accept(Visitor *v) const override;
+
+  ASTNode *GetBase() const { return m_base.get(); }
+  int64_t GetFirstIndex() const { return m_first_index; }
+  int64_t GetLastIndex() const { return m_last_index; }
+
+  static bool classof(const ASTNode *node) {
+return node->GetKind() == NodeKind::eBitExtractionNode;
+  }
+
+private:
+  ASTNodeUP m_base;
+  int64_t m_first_index;
+  int64_t m_last_index;
+};
+
 /// This class contains one Visit method for each specialized type of
 /// DIL AST node. The Visit methods are used to dispatch a DIL AST node to
 /// the correct function in the DIL expression evaluator for evaluating that
@@ -168,6 +193,8 @@ class Visitor {
   Visit(const UnaryOpNode *node) = 0;
   virtual llvm::Expected
   Visit(const ArraySubscriptNode *node) = 0;
+  virtual llvm::Expected
+  Visit(const BitFieldExtractionNode *node) = 0;
 };
 
 } // namespace lldb_private::dil
diff --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index 9d0fa53c6622a..2a0cb548a810f 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -54,6 +54,8 @@ class Interpreter : Visitor {
   llvm::Expected Visit(const UnaryOpNode *node) override;
   llvm::Expected
   Visit(const ArraySubscriptNode *node) override;
+  llvm::Expected
+  Visit(const BitFieldExtractionNode *node) override;
 
   // Used by the interpreter to create objects, perform casts, etc.
   lldb::TargetSP m_target;
diff --git a/lldb/include/lldb/ValueObject/DILLexer.h 
b/lldb/include/lldb/ValueObject/DILLexer.h
index 7d70f88f9a718..9c1ba97680253 100644
--- a/lldb/include/lldb/ValueObject/DILLexer.h
+++ b/lldb/include/lldb/ValueObject/DILLexer.h
@@ -31,6 +31,7 @@ class Token {
 identifier,
 l_paren,
 l_square,
+minus,
 numeric_constant,
 period,
 r_paren,
diff --git a/lldb/source/ValueObject/DILAST.cpp 
b/lldb/source/ValueObject/DILAST.cpp
index 8b5e64ad462cc..b1cd824c2299e 100644
--- a/lldb/source/ValueObject/DILAST.cpp
+++ b/lldb/source/ValueObject/DILAST.cpp
@@ -32,4 +32,9 @@ ArraySubscriptNode::Accept(Visitor *v) const {
   return v->Visit(this);
 }
 
+llvm::Expected
+BitFieldExtractionNode::Accept(Visitor *v) const {
+  return v->Visit(this);
+}
+
 } // namespace lldb_private::dil
diff --git a/lldb/source/ValueObject/DILEval.cpp 
b/lldb/source/ValueObject/DILEval.cpp
index c8cb54aa18a93..b2bb4e20ddc24 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -430,4 +430,36 @@ Interpreter::Visit(const ArraySubscriptNode *node) {
   return base->GetSyntheticArrayMember(signed_child_idx, true);
 }
 
+llvm::Expected
+Interpreter::Visit(const BitFieldExtractionNode *node) {
+  auto lhs_or_err = Evaluate(node->GetBase());
+  if (!lhs_or_err)
+return

[Lldb-commits] [lldb] [lldb] Use llvm::find_if (NFC) (PR #141385)

2025-05-25 Thread Tim Gymnich via lldb-commits

https://github.com/tgymnich approved this pull request.


https://github.com/llvm/llvm-project/pull/141385
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support breakpoint info bytes (PR #141122)

2025-05-25 Thread Ebuka Ezike via lldb-commits


@@ -16,12 +15,61 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {

da-viper wrote:

I thought that no {} in if statment only applies when it is one line. 

https://github.com/llvm/llvm-project/pull/141122
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support breakpoint info bytes (PR #141122)

2025-05-25 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper deleted 
https://github.com/llvm/llvm-project/pull/141122
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix a typo in documentation (PR #141384)

2025-05-25 Thread Matt Arsenault via lldb-commits

https://github.com/arsenm approved this pull request.


https://github.com/llvm/llvm-project/pull/141384
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support breakpoint info bytes (PR #141122)

2025-05-25 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/141122

>From 3b166d8f484cda8702c798a1fa2cf01fd5222f80 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 21 May 2025 23:26:14 +0100
Subject: [PATCH 1/6] [lldb][lldb-dap] support DataBreakpointBytes capability

---
 .../DataBreakpointInfoRequestHandler.cpp  | 48 ++-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  3 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  2 +-
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
index 8cb25d0603449..9b969560d7973 100644
--- a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBMemoryRegionInfo.h"
@@ -16,12 +15,59 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+  } else {
+response.description = llvm::formatv("{} bytes at {:x}", load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,
+protocol::eDataBreakpointAccessTypeWrite,
+protocol::eDataBreakpointAccessTypeReadWrite};
+  }
+
+  return response;
+}
+
 /// Obtains information on a possible data breakpoint that could be set on an
 /// expression or variable. Clients should only call this request if the
 /// corresponding capability supportsDataBreakpoints is true.
 llvm::Expected
 DataBreakpointInfoRequestHandler::Run(
 const protocol::DataBreakpointInfoArguments &args) const {
+
+  if (args.asAddress.value_or(false))
+return HandleDataBreakpointBytes(dap, args);
+
   protocol::DataBreakpointInfoResponseBody response;
   lldb::SBFrame frame = dap.GetLLDBFrame(args.frameId.value_or(UINT64_MAX));
   lldb::SBValue variable = dap.variables.FindVariable(
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 3a965bcc87a5e..dec68683fee65 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -420,6 +420,9 @@ class DataBreakpointInfoRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "dataBreakpointInfo"; }
+  FeatureSet GetSupportedFeatures() const override {
+return {protocol::eAdapterFeatureDataBreakpointBytes};
+  }
   llvm::Expected
   Run(const protocol::DataBreakpointInfoArguments &args) const override;
 };
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 7c774e50d6e56..cde441351fc88 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -668,7 +668,7 @@ struct DataBreakpointInfoArguments {
   /// pause on data access anywhere within that range.
   /// Clients may set this property only if the `supportsDataBreakpointBytes`
   /// capability is true.
-  std::optional bytes;
+  std::optional bytes;
 
   /// If `true`, the `name` is a memory address and the debugger should
   /// interpret it as a decimal value, or hex value if it is prefixed with 
`0x`.

>From 88738d7a581de49657b3bf3018e95a3b5c90bb29 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 22 May 2025 15:18:57 +0100
Subject: [PATCH 2/6] [lldb]

[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

2025-05-25 Thread Ebuka Ezike via lldb-commits


@@ -1649,11 +1649,14 @@ class CommandObjectThreadJump : public 
CommandObjectParsed {
   return Status::FromErrorStringWithFormat("invalid line number: 
'%s'.",
option_arg.str().c_str());
 break;
-  case 'b':
+  case 'b': {
+option_arg.consume_front("+");

da-viper wrote:

added documentation clarifying it can be negative or positive.

https://github.com/llvm/llvm-project/pull/135778
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] skip unnamed symbol test on arm 32 architecture (PR #141407)

2025-05-25 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ely Ronnen (eronnen)


Changes

The test fails because LLDB does not recognize any function which is not in the 
symbol table on armv7 

---
Full diff: https://github.com/llvm/llvm-project/pull/141407.diff


2 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+14) 
- (modified) 
lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py (+2) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 868e9f7e5eca0..e87e8d662e4ae 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -799,6 +799,20 @@ def arch_doesnt_match():
 return skipTestIfFn(arch_doesnt_match)
 
 
+def skipIfArch(arch):
+"""Decorate the item to skip tests if running on the specified 
architecture."""
+
+def arch_matches():
+target_arch = lldbplatformutil.getArchitecture()
+if arch == target_arch:
+return (
+"Test does not run on " + arch + ", but target arch is " + 
target_arch
+)
+return None
+
+return skipTestIfFn(arch_matches)
+
+
 def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
 """Decorator to skip tests when the target is Android.
 
diff --git 
a/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py 
b/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
index c0438f77fb1d1..f798ec342e41b 100644
--- a/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
+++ b/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
@@ -10,6 +10,8 @@
 
 # --keep-symbol causes error on Windows: llvm-strip.exe: error: option is not 
supported for COFF
 @skipIfWindows
+# Unnamed symbols don't get into the .eh_frame section on ARM, so LLDB can't 
find them.
+@skipIfArch("arm")
 class TestUnnamedSymbolLookup(TestBase):
 def test_unnamed_symbol_lookup(self):
 """Test looking up unnamed symbol synthetic name"""

``




https://github.com/llvm/llvm-project/pull/141407
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] skip unnamed symbol test on arm 32 architecture (PR #141407)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen created 
https://github.com/llvm/llvm-project/pull/141407

The test fails because LLDB does not recognize any function which is not in the 
symbol table on armv7 

>From 27159c6f52e18bf3b11553ce380449b38689154d Mon Sep 17 00:00:00 2001
From: Ely Ronnen 
Date: Sun, 25 May 2025 14:35:57 +0200
Subject: [PATCH] [lldb] skip unnamed symbol test on arm 32 architecture

---
 lldb/packages/Python/lldbsuite/test/decorators.py  | 14 ++
 .../TestUnnamedSymbolLookup.py |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 868e9f7e5eca0..e87e8d662e4ae 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -799,6 +799,20 @@ def arch_doesnt_match():
 return skipTestIfFn(arch_doesnt_match)
 
 
+def skipIfArch(arch):
+"""Decorate the item to skip tests if running on the specified 
architecture."""
+
+def arch_matches():
+target_arch = lldbplatformutil.getArchitecture()
+if arch == target_arch:
+return (
+"Test does not run on " + arch + ", but target arch is " + 
target_arch
+)
+return None
+
+return skipTestIfFn(arch_matches)
+
+
 def skipIfTargetAndroid(bugnumber=None, api_levels=None, archs=None):
 """Decorator to skip tests when the target is Android.
 
diff --git 
a/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py 
b/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
index c0438f77fb1d1..f798ec342e41b 100644
--- a/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
+++ b/lldb/test/API/python_api/unnamed_symbol_lookup/TestUnnamedSymbolLookup.py
@@ -10,6 +10,8 @@
 
 # --keep-symbol causes error on Windows: llvm-strip.exe: error: option is not 
supported for COFF
 @skipIfWindows
+# Unnamed symbols don't get into the .eh_frame section on ARM, so LLDB can't 
find them.
+@skipIfArch("arm")
 class TestUnnamedSymbolLookup(TestBase):
 def test_unnamed_symbol_lookup(self):
 """Test looking up unnamed symbol synthetic name"""

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] skip unnamed symbol test on arm 32 architecture (PR #141407)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen edited 
https://github.com/llvm/llvm-project/pull/141407
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support breakpoint info bytes (PR #141122)

2025-05-25 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/141122

>From 3b166d8f484cda8702c798a1fa2cf01fd5222f80 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 21 May 2025 23:26:14 +0100
Subject: [PATCH 1/7] [lldb][lldb-dap] support DataBreakpointBytes capability

---
 .../DataBreakpointInfoRequestHandler.cpp  | 48 ++-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  3 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  2 +-
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
index 8cb25d0603449..9b969560d7973 100644
--- a/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
 #include "Protocol/ProtocolTypes.h"
 #include "RequestHandler.h"
 #include "lldb/API/SBMemoryRegionInfo.h"
@@ -16,12 +15,59 @@
 
 namespace lldb_dap {
 
+static llvm::Expected
+HandleDataBreakpointBytes(DAP &dap,
+  const protocol::DataBreakpointInfoArguments &args) {
+  llvm::StringRef address = args.name;
+
+  unsigned long long load_addr = LLDB_INVALID_ADDRESS;
+  if (llvm::getAsUnsignedInteger(address, 0, load_addr)) {
+return llvm::make_error(llvm::formatv("invalid address"),
+  llvm::inconvertibleErrorCode(), false);
+  }
+
+  lldb::SBAddress sb_addr(load_addr, dap.target);
+  if (!sb_addr.IsValid()) {
+return llvm::make_error(
+llvm::formatv("address {:x} does not exist in the debuggee", 
load_addr),
+llvm::inconvertibleErrorCode(), false);
+  }
+
+  const uint32_t byte_size =
+  args.bytes.value_or(dap.target.GetAddressByteSize());
+
+  protocol::DataBreakpointInfoResponseBody response;
+  response.dataId = llvm::formatv("{:x}/{}", load_addr, byte_size);
+
+  lldb::SBMemoryRegionInfo region;
+  lldb::SBError err =
+  dap.target.GetProcess().GetMemoryRegionInfo(load_addr, region);
+  // Only lldb-server supports "qMemoryRegionInfo". So, don't fail this
+  // request if SBProcess::GetMemoryRegionInfo returns error.
+  if (err.Success() && !(region.IsReadable() || region.IsWritable())) {
+response.description = llvm::formatv(
+"memory region for address {} has no read or write permissions",
+load_addr);
+  } else {
+response.description = llvm::formatv("{} bytes at {:x}", load_addr);
+response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,
+protocol::eDataBreakpointAccessTypeWrite,
+protocol::eDataBreakpointAccessTypeReadWrite};
+  }
+
+  return response;
+}
+
 /// Obtains information on a possible data breakpoint that could be set on an
 /// expression or variable. Clients should only call this request if the
 /// corresponding capability supportsDataBreakpoints is true.
 llvm::Expected
 DataBreakpointInfoRequestHandler::Run(
 const protocol::DataBreakpointInfoArguments &args) const {
+
+  if (args.asAddress.value_or(false))
+return HandleDataBreakpointBytes(dap, args);
+
   protocol::DataBreakpointInfoResponseBody response;
   lldb::SBFrame frame = dap.GetLLDBFrame(args.frameId.value_or(UINT64_MAX));
   lldb::SBValue variable = dap.variables.FindVariable(
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 3a965bcc87a5e..dec68683fee65 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -420,6 +420,9 @@ class DataBreakpointInfoRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "dataBreakpointInfo"; }
+  FeatureSet GetSupportedFeatures() const override {
+return {protocol::eAdapterFeatureDataBreakpointBytes};
+  }
   llvm::Expected
   Run(const protocol::DataBreakpointInfoArguments &args) const override;
 };
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index 7c774e50d6e56..cde441351fc88 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -668,7 +668,7 @@ struct DataBreakpointInfoArguments {
   /// pause on data access anywhere within that range.
   /// Clients may set this property only if the `supportsDataBreakpointBytes`
   /// capability is true.
-  std::optional bytes;
+  std::optional bytes;
 
   /// If `true`, the `name` is a memory address and the debugger should
   /// interpret it as a decimal value, or hex value if it is prefixed with 
`0x`.

>From 88738d7a581de49657b3bf3018e95a3b5c90bb29 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Thu, 22 May 2025 15:18:57 +0100
Subject: [PATCH 2/7] [lldb]

[Lldb-commits] [lldb] Support breakpoint info bytes (PR #141122)

2025-05-25 Thread Ely Ronnen via lldb-commits

https://github.com/eronnen approved this pull request.


https://github.com/llvm/llvm-project/pull/141122
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits