[Lldb-commits] [lldb] [lldb] Fix SWIG bug detection in CMake (PR #169212)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

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


https://github.com/llvm/llvm-project/pull/169212
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use AST nodes as Subscript and BitField arguments in DIL (PR #169363)

2025-11-28 Thread Ilia Kuklin via lldb-commits

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

Use AST nodes as Subscript and BitField arguments instead of bare integers. 
This enables using any supported expression as an array or bit index.

>From 04720a744587cccd827b9c2bb23bcc0c3c4a1836 Mon Sep 17 00:00:00 2001
From: Ilia Kuklin 
Date: Mon, 24 Nov 2025 19:43:04 +0500
Subject: [PATCH] [LLDB] Use AST nodes as Subscript and BitField arguments in
 DIL

---
 lldb/docs/dil-expr-lang.ebnf  |  5 +-
 lldb/include/lldb/ValueObject/DILAST.h| 24 +++
 lldb/include/lldb/ValueObject/DILEval.h   |  2 +
 lldb/include/lldb/ValueObject/DILParser.h |  1 -
 lldb/source/ValueObject/DILEval.cpp   | 70 ++-
 lldb/source/ValueObject/DILParser.cpp | 49 ++---
 .../TestFrameVarDILArraySubscript.py  | 48 ++---
 .../var-dil/basics/ArraySubscript/main.cpp|  5 +-
 .../TestFrameVarDILBitFieldExtraction.py  | 28 
 .../basics/BitFieldExtraction/main.cpp| 10 ++-
 10 files changed, 123 insertions(+), 119 deletions(-)

diff --git a/lldb/docs/dil-expr-lang.ebnf b/lldb/docs/dil-expr-lang.ebnf
index ccd2b00223910..554b107c117e0 100644
--- a/lldb/docs/dil-expr-lang.ebnf
+++ b/lldb/docs/dil-expr-lang.ebnf
@@ -11,7 +11,8 @@ unary_expression = postfix_expression
 unary_operator = "*" | "&" | "+" | "-";
 
 postfix_expression = primary_expression
-   | postfix_expression "[" integer_literal "]"
+   | postfix_expression "[" expression "]"
+   | postfix_expression "[" expression "-" expression "]"
| postfix_expression "." id_expression
| postfix_expression "->" id_expression ;
 
@@ -31,8 +32,6 @@ qualified_id = ["::"] [nested_name_specifier] unqualified_id
 
 identifier = ? C99 Identifier ? ;
 
-integer_literal = ? Integer constant: hexademical, decimal, octal, binary ? ;
-
 numeric_literal = ? Integer constant: hexademical, decimal, octal, binary ?
 | ? Floating constant ? ;
 
diff --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 91f8d93c09622..31de575f25fb0 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -141,14 +141,14 @@ class UnaryOpNode : public ASTNode {
 
 class ArraySubscriptNode : public ASTNode {
 public:
-  ArraySubscriptNode(uint32_t location, ASTNodeUP base, int64_t index)
+  ArraySubscriptNode(uint32_t location, ASTNodeUP base, ASTNodeUP index)
   : ASTNode(location, NodeKind::eArraySubscriptNode),
-m_base(std::move(base)), m_index(index) {}
+m_base(std::move(base)), m_index(std::move(index)) {}
 
   llvm::Expected Accept(Visitor *v) const override;
 
   ASTNode *GetBase() const { return m_base.get(); }
-  int64_t GetIndex() const { return m_index; }
+  ASTNode *GetIndex() const { return m_index.get(); }
 
   static bool classof(const ASTNode *node) {
 return node->GetKind() == NodeKind::eArraySubscriptNode;
@@ -156,22 +156,22 @@ class ArraySubscriptNode : public ASTNode {
 
 private:
   ASTNodeUP m_base;
-  int64_t m_index;
+  ASTNodeUP m_index;
 };
 
 class BitFieldExtractionNode : public ASTNode {
 public:
-  BitFieldExtractionNode(uint32_t location, ASTNodeUP base, int64_t 
first_index,
- int64_t last_index)
+  BitFieldExtractionNode(uint32_t location, ASTNodeUP base,
+ ASTNodeUP first_index, ASTNodeUP last_index)
   : ASTNode(location, NodeKind::eBitExtractionNode),
-m_base(std::move(base)), m_first_index(first_index),
-m_last_index(last_index) {}
+m_base(std::move(base)), m_first_index(std::move(first_index)),
+m_last_index(std::move(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; }
+  ASTNode *GetFirstIndex() const { return m_first_index.get(); }
+  ASTNode *GetLastIndex() const { return m_last_index.get(); }
 
   static bool classof(const ASTNode *node) {
 return node->GetKind() == NodeKind::eBitExtractionNode;
@@ -179,8 +179,8 @@ class BitFieldExtractionNode : public ASTNode {
 
 private:
   ASTNodeUP m_base;
-  int64_t m_first_index;
-  int64_t m_last_index;
+  ASTNodeUP m_first_index;
+  ASTNodeUP m_last_index;
 };
 
 enum class IntegerTypeSuffix { None, Long, LongLong };
diff --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index a65edc58cc4e7..b88177a269ab5 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -46,6 +46,8 @@ class Interpreter : Visitor {
   llvm::Expected Evaluate(const ASTNode *node);
 
 private:
+  llvm::Expected
+  EvaluateAndDereference(const ASTNode *node);
   llvm::Expected
   Visit(const IdentifierNode *node) ove

[Lldb-commits] [lldb] 51fef12 - [lldb] Add const& to InstructionList parameter (#169342)

2025-11-28 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2025-11-24T16:41:09Z
New Revision: 51fef127f29fe2225358396728d95e2d9e6af75e

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

LOG: [lldb] Add const& to InstructionList parameter (#169342)

Added: 


Modified: 

lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index 987586b97dfdc..b6b073a96bcad 100644
--- 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -63,7 +63,7 @@ static void DumpUnwindRowsToLog(Log *log, AddressRange range,
 }
 
 static void DumpInstToLog(Log *log, Instruction &inst,
-  InstructionList inst_list) {
+  const InstructionList &inst_list) {
   if (!log || !log->GetVerbose())
 return;
   const bool show_address = true;



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add const& to InstructionList parameter (PR #169342)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan closed 
https://github.com/llvm/llvm-project/pull/169342
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use AST nodes as Subscript and BitField arguments in DIL (PR #169363)

2025-11-28 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ilia Kuklin (kuilpd)


Changes

Use AST nodes as Subscript and BitField arguments instead of bare integers. 
This enables using any supported expression as an array or bit index.

---

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


10 Files Affected:

- (modified) lldb/docs/dil-expr-lang.ebnf (+2-3) 
- (modified) lldb/include/lldb/ValueObject/DILAST.h (+12-12) 
- (modified) lldb/include/lldb/ValueObject/DILEval.h (+2) 
- (modified) lldb/include/lldb/ValueObject/DILParser.h (-1) 
- (modified) lldb/source/ValueObject/DILEval.cpp (+52-18) 
- (modified) lldb/source/ValueObject/DILParser.cpp (+6-43) 
- (modified) 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/TestFrameVarDILArraySubscript.py
 (+20-28) 
- (modified) 
lldb/test/API/commands/frame/var-dil/basics/ArraySubscript/main.cpp (+4-1) 
- (modified) 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/TestFrameVarDILBitFieldExtraction.py
 (+16-12) 
- (modified) 
lldb/test/API/commands/frame/var-dil/basics/BitFieldExtraction/main.cpp (+9-1) 


``diff
diff --git a/lldb/docs/dil-expr-lang.ebnf b/lldb/docs/dil-expr-lang.ebnf
index ccd2b00223910..554b107c117e0 100644
--- a/lldb/docs/dil-expr-lang.ebnf
+++ b/lldb/docs/dil-expr-lang.ebnf
@@ -11,7 +11,8 @@ unary_expression = postfix_expression
 unary_operator = "*" | "&" | "+" | "-";
 
 postfix_expression = primary_expression
-   | postfix_expression "[" integer_literal "]"
+   | postfix_expression "[" expression "]"
+   | postfix_expression "[" expression "-" expression "]"
| postfix_expression "." id_expression
| postfix_expression "->" id_expression ;
 
@@ -31,8 +32,6 @@ qualified_id = ["::"] [nested_name_specifier] unqualified_id
 
 identifier = ? C99 Identifier ? ;
 
-integer_literal = ? Integer constant: hexademical, decimal, octal, binary ? ;
-
 numeric_literal = ? Integer constant: hexademical, decimal, octal, binary ?
 | ? Floating constant ? ;
 
diff --git a/lldb/include/lldb/ValueObject/DILAST.h 
b/lldb/include/lldb/ValueObject/DILAST.h
index 91f8d93c09622..31de575f25fb0 100644
--- a/lldb/include/lldb/ValueObject/DILAST.h
+++ b/lldb/include/lldb/ValueObject/DILAST.h
@@ -141,14 +141,14 @@ class UnaryOpNode : public ASTNode {
 
 class ArraySubscriptNode : public ASTNode {
 public:
-  ArraySubscriptNode(uint32_t location, ASTNodeUP base, int64_t index)
+  ArraySubscriptNode(uint32_t location, ASTNodeUP base, ASTNodeUP index)
   : ASTNode(location, NodeKind::eArraySubscriptNode),
-m_base(std::move(base)), m_index(index) {}
+m_base(std::move(base)), m_index(std::move(index)) {}
 
   llvm::Expected Accept(Visitor *v) const override;
 
   ASTNode *GetBase() const { return m_base.get(); }
-  int64_t GetIndex() const { return m_index; }
+  ASTNode *GetIndex() const { return m_index.get(); }
 
   static bool classof(const ASTNode *node) {
 return node->GetKind() == NodeKind::eArraySubscriptNode;
@@ -156,22 +156,22 @@ class ArraySubscriptNode : public ASTNode {
 
 private:
   ASTNodeUP m_base;
-  int64_t m_index;
+  ASTNodeUP m_index;
 };
 
 class BitFieldExtractionNode : public ASTNode {
 public:
-  BitFieldExtractionNode(uint32_t location, ASTNodeUP base, int64_t 
first_index,
- int64_t last_index)
+  BitFieldExtractionNode(uint32_t location, ASTNodeUP base,
+ ASTNodeUP first_index, ASTNodeUP last_index)
   : ASTNode(location, NodeKind::eBitExtractionNode),
-m_base(std::move(base)), m_first_index(first_index),
-m_last_index(last_index) {}
+m_base(std::move(base)), m_first_index(std::move(first_index)),
+m_last_index(std::move(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; }
+  ASTNode *GetFirstIndex() const { return m_first_index.get(); }
+  ASTNode *GetLastIndex() const { return m_last_index.get(); }
 
   static bool classof(const ASTNode *node) {
 return node->GetKind() == NodeKind::eBitExtractionNode;
@@ -179,8 +179,8 @@ class BitFieldExtractionNode : public ASTNode {
 
 private:
   ASTNodeUP m_base;
-  int64_t m_first_index;
-  int64_t m_last_index;
+  ASTNodeUP m_first_index;
+  ASTNodeUP m_last_index;
 };
 
 enum class IntegerTypeSuffix { None, Long, LongLong };
diff --git a/lldb/include/lldb/ValueObject/DILEval.h 
b/lldb/include/lldb/ValueObject/DILEval.h
index a65edc58cc4e7..b88177a269ab5 100644
--- a/lldb/include/lldb/ValueObject/DILEval.h
+++ b/lldb/include/lldb/ValueObject/DILEval.h
@@ -46,6 +46,8 @@ class Interpreter : Visitor {
   llvm::Expected Evaluate(const ASTNode *node);
 
 private:
+  llvm::Expected
+  EvaluateAndDereference(const ASTN

[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [clang] Refactor to remove clangDriver dependency from clangFrontend and flangFrontend (PR #165277)

2025-11-28 Thread Shilei Tian via lldb-commits

shiltian wrote:

This PR introduced a dependency cycle:

```
ninja: error: dependency cycle: lib/libclangDriver.so.22.0git -> 
lib/libclangFrontend.so.22.0git -> lib/libclangDriver.so.22.0git
```

https://github.com/llvm/llvm-project/pull/165277
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Remove code dupl in favour of a named variable in UnwindAssemblyInstEmulation (PR #169369)

2025-11-28 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)


Changes



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


1 Files Affected:

- (modified) 
lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 (+4-5) 


``diff
diff --git 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index b6b073a96bcad..4da09adba787b 100644
--- 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -212,11 +212,10 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
 if (m_curr_row_modified) {
   // Save the modified row if we don't already have a CFI row in the
   // current address
-  if (saved_unwind_states.count(current_offset +
-inst->GetOpcode().GetByteSize()) == 0) {
-m_state.row.SetOffset(current_offset + 
inst->GetOpcode().GetByteSize());
-saved_unwind_states.emplace(
-current_offset + inst->GetOpcode().GetByteSize(), m_state);
+  auto next_inst_offset = current_offset + inst->GetOpcode().GetByteSize();
+  if (saved_unwind_states.count(next_inst_offset) == 0) {
+m_state.row.SetOffset(next_inst_offset);
+saved_unwind_states.emplace(next_inst_offset, m_state);
   }
 }
   }

``




https://github.com/llvm/llvm-project/pull/169369
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Remove code dupl in favour of a named variable in UnwindAssemblyInstEmulation (PR #169369)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan created 
https://github.com/llvm/llvm-project/pull/169369

None

>From 1e4b119c203aa5c703cc355addd5167b4037964b Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Mon, 24 Nov 2025 17:08:31 +
Subject: [PATCH] [lldb][NFC] Remove code dupl in favour of a named variable in
 UnwindAssemblyInstEmulation

---
 .../InstEmulation/UnwindAssemblyInstEmulation.cpp| 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index b6b073a96bcad..4da09adba787b 100644
--- 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -212,11 +212,10 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
 if (m_curr_row_modified) {
   // Save the modified row if we don't already have a CFI row in the
   // current address
-  if (saved_unwind_states.count(current_offset +
-inst->GetOpcode().GetByteSize()) == 0) {
-m_state.row.SetOffset(current_offset + 
inst->GetOpcode().GetByteSize());
-saved_unwind_states.emplace(
-current_offset + inst->GetOpcode().GetByteSize(), m_state);
+  auto next_inst_offset = current_offset + inst->GetOpcode().GetByteSize();
+  if (saved_unwind_states.count(next_inst_offset) == 0) {
+m_state.row.SetOffset(next_inst_offset);
+saved_unwind_states.emplace(next_inst_offset, m_state);
   }
 }
   }

___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [clang] Refactor to remove clangDriver dependency from clangFrontend and flangFrontend (PR #165277)

2025-11-28 Thread Naveen Seth Hanig via lldb-commits

naveen-seth wrote:

Does this go away when doing a clean build?
While working on this PR, I had the issue that cmake or ninja cache wasn't 
aware of when a dependency relation was removed, but only when one was added.

(I suspect this might be it, because the LLVM buildbot didn't fail with 
`-DBUILD_SHARED_LIBS=ON`).

If the error is introduced by this PR, could you revert this?
I'd only be available to do it a bit later. Thank you!

https://github.com/llvm/llvm-project/pull/165277
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] make PseudoTerminal::GetPTY return a shared pointer (PR #168730)

2025-11-28 Thread Charles Zablit via lldb-commits

charles-zablit wrote:

Closing this patch as, as @adrian-prantl said, this could be a much smaller 
change by either having a new API which returns a shared pointer or using 
`shared_from_this`.

https://github.com/llvm/llvm-project/pull/168730
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Remove code dupl in favour of a named variable in UnwindAssemblyInstEmulation (PR #169369)

2025-11-28 Thread Ebuka Ezike via lldb-commits


@@ -212,11 +212,10 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
 if (m_curr_row_modified) {
   // Save the modified row if we don't already have a CFI row in the
   // current address
-  if (saved_unwind_states.count(current_offset +
-inst->GetOpcode().GetByteSize()) == 0) {
-m_state.row.SetOffset(current_offset + 
inst->GetOpcode().GetByteSize());
-saved_unwind_states.emplace(
-current_offset + inst->GetOpcode().GetByteSize(), m_state);
+  auto next_inst_offset = current_offset + inst->GetOpcode().GetByteSize();

da-viper wrote:

use `const type` instead of auto. 

https://github.com/llvm/llvm-project/pull/169369
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] make PseudoTerminal::GetPTY return a shared pointer (PR #168730)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit closed 
https://github.com/llvm/llvm-project/pull/168730
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] c1f24a5 - [windows] improve python3.dll load check (#168864)

2025-11-28 Thread via lldb-commits

Author: Charles Zablit
Date: 2025-11-24T18:40:45+01:00
New Revision: c1f24a5205364686213a23182dc45df9c2383360

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

LOG: [windows] improve python3.dll load check (#168864)

Added: 


Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 0b77e0a4929a7..48107717abd31 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -477,18 +477,17 @@ bool AddPythonDLLToSearchPath() {
 #endif
 
 #ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
-/// Returns whether `python3x.dll` is in the DLL search path.
+/// Returns true if `python3x.dll` can be loaded.
 bool IsPythonDLLInPath() {
 #define WIDEN2(x) L##x
 #define WIDEN(x) WIDEN2(x)
-  WCHAR foundPath[MAX_PATH];
-  DWORD result =
-  SearchPathW(nullptr, WIDEN(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME), 
nullptr,
-  MAX_PATH, foundPath, nullptr);
+  HMODULE h = LoadLibraryW(WIDEN(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME));
+  if (!h)
+return false;
+  FreeLibrary(h);
+  return true;
 #undef WIDEN2
 #undef WIDEN
-
-  return result > 0;
 }
 #endif
 



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [windows] improve python3.dll load check (PR #168864)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit closed 
https://github.com/llvm/llvm-project/pull/168864
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb-dap] Add multi-session support with shared debugger instances (PR #163653)

2025-11-28 Thread Janet Yang via lldb-commits

https://github.com/qxy11 closed https://github.com/llvm/llvm-project/pull/163653
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread David Peixotto via lldb-commits


@@ -481,18 +481,22 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-if (IsTrivialBasename(m_basename)) {
+// if the context has a white space it may have a return type.
+// e.g. `int foo::bar::func()` or `Type foo::bar::func(int)`
+const bool no_whitespace =

dmpots wrote:

Is the whitespace check sufficient here? It looks like we could still fail by 
incorrectly parsing something with a return type that does not have a space 
before the start of the context like this:

```
std::vectorfoo::bar()
```

Maybe we need a check for `IsValidContext` that makes sure it only consists of 
identifiers and `:` characters?

https://github.com/llvm/llvm-project/pull/169652
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread David Peixotto via lldb-commits


@@ -481,18 +481,22 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-if (IsTrivialBasename(m_basename)) {
+// if the context has a white space it may have a return type.

dmpots wrote:

Could you add more details to the summary about what cases are fixed with this 
change and what happens without the fix (e.g. crash, incorrect output).

It looks like previously we were incorrectly handling cases that had both a 
context and a return type, but seems like it did handle the case where we had a 
return type without a context based on this test case

```
{"int main()", "int", "", "main", "()", "", "main"},
```


https://github.com/llvm/llvm-project/pull/169652
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a059afa - [lldb] Fix reading 32-bit signed integers (#169150)

2025-11-28 Thread via lldb-commits

Author: Igor Kudrin
Date: 2025-11-26T10:49:49-08:00
New Revision: a059afafde068773693c1fab4d89c208b1437f76

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

LOG: [lldb] Fix reading 32-bit signed integers (#169150)

Both `Target::ReadSignedIntegerFromMemory()` and
`Process::ReadSignedIntegerFromMemory()` internally created an unsigned
scalar, so extending the value later did not duplicate the sign bit.

Added: 


Modified: 
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/unittests/Target/MemoryTest.cpp

Removed: 




diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 69edea503002e..5879b8f4795ab 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2452,8 +2452,10 @@ size_t Process::ReadScalarIntegerFromMemory(addr_t addr, 
uint32_t byte_size,
 scalar = data.GetMaxU32(&offset, byte_size);
   else
 scalar = data.GetMaxU64(&offset, byte_size);
-  if (is_signed)
+  if (is_signed) {
+scalar.MakeSigned();
 scalar.SignExtend(byte_size * 8);
+  }
   return bytes_read;
 }
   } else {

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 12c653c0eb8cf..3a936b85f6339 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2283,8 +2283,10 @@ size_t Target::ReadScalarIntegerFromMemory(const Address 
&addr, uint32_t byte_si
   else
 scalar = data.GetMaxU64(&offset, byte_size);
 
-  if (is_signed)
+  if (is_signed) {
+scalar.MakeSigned();
 scalar.SignExtend(byte_size * 8);
+  }
   return bytes_read;
 }
   } else {
@@ -2299,7 +2301,7 @@ int64_t Target::ReadSignedIntegerFromMemory(const Address 
&addr,
 int64_t fail_value, Status &error,
 bool force_live_memory) {
   Scalar scalar;
-  if (ReadScalarIntegerFromMemory(addr, integer_byte_size, false, scalar, 
error,
+  if (ReadScalarIntegerFromMemory(addr, integer_byte_size, true, scalar, error,
   force_live_memory))
 return scalar.SLongLong(fail_value);
   return fail_value;

diff  --git a/lldb/unittests/Target/MemoryTest.cpp 
b/lldb/unittests/Target/MemoryTest.cpp
index e444f68dc4871..131a3cabdd896 100644
--- a/lldb/unittests/Target/MemoryTest.cpp
+++ b/lldb/unittests/Target/MemoryTest.cpp
@@ -48,6 +48,8 @@ class DummyProcess : public Process {
   }
   Status DoDestroy() override { return {}; }
   void RefreshStateAfterStop() override {}
+  // Required by Target::ReadMemory() to call Process::ReadMemory()
+  bool IsAlive() override { return true; }
   size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
   Status &error) override {
 if (m_bytes_left == 0)
@@ -61,7 +63,7 @@ class DummyProcess : public Process {
   m_bytes_left -= size;
 }
 
-memset(buf, 'B', num_bytes_to_write);
+memset(buf, m_filler, num_bytes_to_write);
 return num_bytes_to_write;
   }
   bool DoUpdateThreadList(ThreadList &old_thread_list,
@@ -72,8 +74,10 @@ class DummyProcess : public Process {
 
   // Test-specific additions
   size_t m_bytes_left;
+  int m_filler = 'B';
   MemoryCache &GetMemoryCache() { return m_memory_cache; }
   void SetMaxReadSize(size_t size) { m_bytes_left = size; }
+  void SetFiller(int filler) { m_filler = filler; }
 };
 } // namespace
 
@@ -85,6 +89,18 @@ TargetSP CreateTarget(DebuggerSP &debugger_sp, ArchSpec 
&arch) {
   return target_sp;
 }
 
+static ProcessSP CreateProcess(lldb::TargetSP target_sp) {
+  ListenerSP listener_sp(Listener::MakeListener("dummy"));
+  ProcessSP process_sp = std::make_shared(target_sp, 
listener_sp);
+
+  struct TargetHack : public Target {
+void SetProcess(ProcessSP process) { m_process_sp = process; }
+  };
+  static_cast(target_sp.get())->SetProcess(process_sp);
+
+  return process_sp;
+}
+
 TEST_F(MemoryTest, TesetMemoryCacheRead) {
   ArchSpec arch("x86_64-apple-macosx-");
 
@@ -96,8 +112,7 @@ TEST_F(MemoryTest, TesetMemoryCacheRead) {
   TargetSP target_sp = CreateTarget(debugger_sp, arch);
   ASSERT_TRUE(target_sp);
 
-  ListenerSP listener_sp(Listener::MakeListener("dummy"));
-  ProcessSP process_sp = std::make_shared(target_sp, 
listener_sp);
+  ProcessSP process_sp = CreateProcess(target_sp);
   ASSERT_TRUE(process_sp);
 
   DummyProcess *process = static_cast(process_sp.get());
@@ -227,6 +242,58 @@ TEST_F(MemoryTest, TesetMemoryCacheRead) {
// old cache
 }
 
+TEST_F(MemoryTest, TestReadInteger) {
+  ArchSpec arch("x86_64-apple-macosx-");
+
+  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
+  

[Lldb-commits] [lldb] [llvm] [lldb-dap] Add multi-session support with shared debugger instances (PR #163653)

2025-11-28 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`cross-project-tests-sie-ubuntu` running on `doug-worker-1a` while building 
`lldb,llvm` at step 6 "test-build-unified-tree-check-cross-project".

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


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

```
Step 6 (test-build-unified-tree-check-cross-project) failure: test (failure)
 TEST 'cross-project-tests :: 
debuginfo-tests/dexter-tests/dbg-arg.c' FAILED 
Exit Code: 2

Command Output (stdout):
--
dbg-arg.c: nan/nan (nan) [Command '['/usr/bin/python3.8', 
'/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dex/../dexter.py',
 'run-debugger-internal-', 
'/tmp/lit-tmp-ahbg28kn/dexter/tmp7oerzpxf/tmpmt4j8rgn', 
'--working-directory=/tmp/lit-tmp-ahbg28kn/dexter/tmp7oerzpxf', 
'--unittest=off', '--indent-timer-level=3']' returned non-zero exit status 1.]
Command '['/usr/bin/python3.8', 
'/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dex/../dexter.py',
 'run-debugger-internal-', 
'/tmp/lit-tmp-ahbg28kn/dexter/tmp7oerzpxf/tmpmt4j8rgn', 
'--working-directory=/tmp/lit-tmp-ahbg28kn/dexter/tmp7oerzpxf', 
'--unittest=off', '--indent-timer-level=3']' returned non-zero exit status 1.
--
Command Output (stderr):
--
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/clang 
-std=gnu11 -m64 -mllvm -fast-isel=false -g 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
 -o 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
 # RUN: at line 5
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/clang 
-std=gnu11 -m64 -mllvm -fast-isel=false -g 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
 -o 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
"/usr/bin/python3.8" 
"/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py"
 test -v --fail-lt 1.0 -w  --binary 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
 --lldb-executable 
"/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/lldb-dap"
 --debugger lldb-dap --dap-message-log=-e -- 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
 # RUN: at line 6
+ /usr/bin/python3.8 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py
 test -v --fail-lt 1.0 -w --binary 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
 --lldb-executable 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/lldb-dap 
--debugger lldb-dap --dap-message-log=-e -- 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
note: Opening DAP server: 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/lldb-dap
-> {
  "type": "request",
  "command": "initialize",
  "arguments": {
"clientID": "dexter",
"adapterID": "lldb-dap",
"pathFormat": "path",
"linesStartAt1": true,
"columnsStartAt1": true,
"supportsVariableType": true,
"supportsVariablePaging": true,
"supportsRunInTerminalRequest": false
  },
  "seq": 1
}
<- {
  "body": {
"$__lldb_version": "lldb version 22.0.0git 
(https://github.com/llvm/llvm-project.git revision 
5ab3375b2cf461ab02704d129a1f4d5ba1a1e275)\n  clang revision 
5ab3375b2cf461ab02704d129a1f4d5ba1a1e275\n  llvm revision 
5ab3375b2cf461ab02704d129a1f4d5ba1a1e275",
"completionTriggerCharacters": [
  ".",
  " ",
  "\t"
],
"exceptionBreakpointFilters": [
  {
"description": "C++ Catch",
"filter": "cpp_catch",
"label": "C++ Catch",
"supportsCondition": true
  },
  {
"description": "C++ Throw",
"filter": "cpp_throw",
"label": "C++ Throw",
"supportsCondition": true
...

```



https://github.com/llvm/llvm-project/pull/163653
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix reading 32-bit signed integers (PR #169150)

2025-11-28 Thread Igor Kudrin via lldb-commits

https://github.com/igorkudrin closed 
https://github.com/llvm/llvm-project/pull/169150
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb-dap] Add multi-session support with shared debugger instances (PR #163653)

2025-11-28 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`cross-project-tests-sie-ubuntu-dwarf5` running on `doug-worker-1b` while 
building `lldb,llvm` at step 6 "test-build-unified-tree-check-cross-project".

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


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

```
Step 6 (test-build-unified-tree-check-cross-project) failure: test (failure)
 TEST 'cross-project-tests :: 
debuginfo-tests/dexter-tests/dbg-arg.c' FAILED 
Exit Code: 2

Command Output (stdout):
--
dbg-arg.c: nan/nan (nan) [Command '['/usr/bin/python3.10', 
'/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dex/../dexter.py',
 'run-debugger-internal-', 
'/tmp/lit-tmp-j2zr83xm/dexter/tmph6sxnouz/tmpsqn9ypvq', 
'--working-directory=/tmp/lit-tmp-j2zr83xm/dexter/tmph6sxnouz', 
'--unittest=off', '--indent-timer-level=3']' returned non-zero exit status 1.]
Command '['/usr/bin/python3.10', 
'/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dex/../dexter.py',
 'run-debugger-internal-', 
'/tmp/lit-tmp-j2zr83xm/dexter/tmph6sxnouz/tmpsqn9ypvq', 
'--working-directory=/tmp/lit-tmp-j2zr83xm/dexter/tmph6sxnouz', 
'--unittest=off', '--indent-timer-level=3']' returned non-zero exit status 1.
--
Command Output (stderr):
--
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang
 -std=gnu11 -m64 -mllvm -fast-isel=false -g 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
 -o 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
 # RUN: at line 5
+ 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang
 -std=gnu11 -m64 -mllvm -fast-isel=false -g 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
 -o 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
"/usr/bin/python3.10" 
"/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py"
 test -v --fail-lt 1.0 -w  --binary 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
 --lldb-executable 
"/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/lldb-dap"
 --debugger lldb-dap --dap-message-log=-e -- 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
 # RUN: at line 6
+ /usr/bin/python3.10 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py
 test -v --fail-lt 1.0 -w --binary 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/dexter-tests/Output/dbg-arg.c.tmp
 --lldb-executable 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/lldb-dap
 --debugger lldb-dap --dap-message-log=-e -- 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/dbg-arg.c
note: Opening DAP server: 
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/lldb-dap
-> {
  "type": "request",
  "command": "initialize",
  "arguments": {
"clientID": "dexter",
"adapterID": "lldb-dap",
"pathFormat": "path",
"linesStartAt1": true,
"columnsStartAt1": true,
"supportsVariableType": true,
"supportsVariablePaging": true,
"supportsRunInTerminalRequest": false
  },
  "seq": 1
}
<- {
  "body": {
"$__lldb_version": "lldb version 22.0.0git 
(https://github.com/llvm/llvm-project.git revision 
5ab3375b2cf461ab02704d129a1f4d5ba1a1e275)\n  clang revision 
5ab3375b2cf461ab02704d129a1f4d5ba1a1e275\n  llvm revision 
5ab3375b2cf461ab02704d129a1f4d5ba1a1e275",
"completionTriggerCharacters": [
  ".",
  " ",
  "\t"
],
"exceptionBreakpointFilters": [
  {
"description": "C++ Catch",
"filter": "cpp_catch",
"label": "C++ Catch",
"supportsCondition": true
  },
  {
"description": "C++ Throw",
"filter": "cpp_throw",
"label": "C++ Throw",
"supportsCondition": true
...

```



https://github.com/llvm/llvm-project/pull/163653
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lld

[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread Ebuka Ezike via lldb-commits


@@ -481,18 +481,22 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-if (IsTrivialBasename(m_basename)) {
+// if the context has a white space it may have a return type.

da-viper wrote:

Yes I did handle `int main()` correctly, I can remove that test case. 

https://github.com/llvm/llvm-project/pull/169652
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper edited 
https://github.com/llvm/llvm-project/pull/169652
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Saleem Abdulrasool via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});

compnerd wrote:

Wow, I don't think that I ever noticed the sorting requirement. Thanks! This 
might deserve a comment.

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a4d4277 - [lldb] [scripting bridge] 167388 chore: add api to return arch name for target (#168273)

2025-11-28 Thread via lldb-commits

Author: n2h9
Date: 2025-11-26T11:36:19-08:00
New Revision: a4d42775b9af0d961f71934e38342a9384534022

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

LOG: [lldb] [scripting bridge] 167388 chore: add api to return arch name for 
target (#168273)

This pr fixes #167388 .

## Description

This pr adds new method `GetArchName` to `SBTarget` so that no need to
parse triple to get arch name in client code.

## Testing

### All from `TestTargetAPI.py`

run test with

```
./build/bin/lldb-dotest -v -p TestTargetAPI.py
```

existing tests (without newly added)
https://github.com/user-attachments/assets/617e4c69-5c6b-44c4-9aeb-b751a47e253c";
/>



existing tests (with newly added)
https://github.com/user-attachments/assets/746990a1-df88-4348-a090-224963d3c640";
/>



### Only `test_get_arch_name`

run test with 
```
./build/bin/lldb-dotest -v -p TestTargetAPI.py -f test_get_arch_name_dwarf -f 
test_get_arch_name_dwo -f test_get_arch_name_dsym 
lldb/test/API/python_api/target

```

only newly added
https://github.com/user-attachments/assets/fcaafa5d-2622-4171-acee-e104ecee0652";
/>


-

Signed-off-by: Nikita B 
Co-authored-by: Jonas Devlieghere 

Added: 


Modified: 
lldb/bindings/interface/SBTargetExtensions.i
lldb/examples/python/templates/scripted_process.py
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp
lldb/test/API/python_api/target/TestTargetAPI.py

Removed: 




diff  --git a/lldb/bindings/interface/SBTargetExtensions.i 
b/lldb/bindings/interface/SBTargetExtensions.i
index 43125d8970615..ef1093b03ced9 100644
--- a/lldb/bindings/interface/SBTargetExtensions.i
+++ b/lldb/bindings/interface/SBTargetExtensions.i
@@ -190,6 +190,7 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTarget, 
lldb::eDescriptionLevelBrief)
 byte_order = property(GetByteOrder, None, doc='''A read only property 
that returns an lldb enumeration value (lldb.eByteOrderLittle, 
lldb.eByteOrderBig, lldb.eByteOrderInvalid) that represents the byte order for 
this target.''')
 addr_size = property(GetAddressByteSize, None, doc='''A read only 
property that returns the size in bytes of an address for this target.''')
 triple = property(GetTriple, None, doc='''A read only property that 
returns the target triple (arch-vendor-os) for this target as a string.''')
+arch_name = property(GetArchName, None, doc='''A read only property 
that returns the architecture name for this target as a string.''')
 data_byte_size = property(GetDataByteSize, None, doc='''A read only 
property that returns the size in host bytes of a byte in the data address 
space for this target.''')
 code_byte_size = property(GetCodeByteSize, None, doc='''A read only 
property that returns the size in host bytes of a byte in the code address 
space for this target.''')
 platform = property(GetPlatform, None, doc='''A read only property 
that returns the platform associated with with this target.''')

diff  --git a/lldb/examples/python/templates/scripted_process.py 
b/lldb/examples/python/templates/scripted_process.py
index 49059d533f38a..b4232f632a30a 100644
--- a/lldb/examples/python/templates/scripted_process.py
+++ b/lldb/examples/python/templates/scripted_process.py
@@ -35,9 +35,7 @@ def __init__(self, exe_ctx, args):
 target = exe_ctx.target
 if isinstance(target, lldb.SBTarget) and target.IsValid():
 self.target = target
-triple = self.target.triple
-if triple:
-self.arch = triple.split("-")[0]
+self.arch = target.arch_name
 self.dbg = target.GetDebugger()
 if isinstance(args, lldb.SBStructuredData) and args.IsValid():
 self.args = args

diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index d0b91ff4741fa..ce81ae46a0905 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -358,6 +358,8 @@ class LLDB_API SBTarget {
 
   const char *GetTriple();
 
+  const char *GetArchName();
+
   const char *GetABIName();
 
   const char *GetLabel() const;

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 1879f3957ca32..578a7bdf7433d 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1620,6 +1620,19 @@ const char *SBTarget::GetTriple() {
   return nullptr;
 }
 
+const char *SBTarget::GetArchName() {
+  LLDB_INSTRUMENT_VA(this);
+
+  if (TargetSP target_sp = GetSP()) {
+llvm::StringRef arch_name =
+target_sp->GetArchitecture().GetTriple().getArchName();
+ConstString const_arch_name(arch_name);
+
+return const_arch_name.GetCString();
+  }
+  return nullptr;
+}
+
 const char *SBTarget::GetABIName() {
   LLDB_INSTRUMENT_VA(th

[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -286,6 +286,10 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
   return false;
 }
 
+static constexpr const char *UndefLocation = "undef";
+static const std::string UndefLocationFormatted =
+llvm::formatv("<{0}>", UndefLocation).str();

JDevlieghere wrote:

```suggestion
static constexpr const llvm::StringLiteral kUndefLocation = "undef";
static contexpr const llvm::StringLiteral kUndefLocationFormatted = "";
```

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -300,16 +304,41 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
 // disassembled instruction stream, similar to how debug information
 // enhances source-level debugging.
 std::vector VariableAnnotator::Annotate(Instruction &inst) {
+  auto structured_annotations = AnnotateStructured(inst);
+
   std::vector events;
+  events.reserve(structured_annotations.size());
+
+  for (const auto &annotation : structured_annotations) {

JDevlieghere wrote:

Same here, I can't tell what type `auto` is here by reading the code. Applies 
to other parts of this PR as well.

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb-dap] Add multi-session support with shared debugger instances (PR #163653)

2025-11-28 Thread Greg Clayton via lldb-commits

clayborg wrote:

@Michael137 any ideas on how to track down what is going wrong here? How do we 
run these tests?

https://github.com/llvm/llvm-project/pull/163653
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [scripting bridge] 167388 chore: add api to return arch name for target (PR #168273)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

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


https://github.com/llvm/llvm-project/pull/168273
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [scripting bridge] 167388 chore: add api to return arch name for target (PR #168273)

2025-11-28 Thread via lldb-commits

github-actions[bot] wrote:



@n2h9 Congratulations on having your first Pull Request (PR) merged into the 
LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a 
problem with a build, you may receive a report in an email or a comment on this 
PR.

Please check whether problems have been caused by your change specifically, as 
the builds can include changes from many authors. It is not uncommon for your 
change to be included in a build that fails due to someone else's changes, or 
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself. This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/168273
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [lldb-dap] Add multi-session support with shared debugger instances (PR #163653)

2025-11-28 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-m68k-linux-cross` 
running on `suse-gary-m68k-cross` while building `lldb,llvm` at step 5 "ninja 
check 1".

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


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

```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[186/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/FormulaTest.cpp.o
[187/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ArenaTest.cpp.o
[188/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp.o
[189/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/DXCModeTest.cpp.o
[190/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Parse/ParseHLSLRootSignatureTest.cpp.o
[191/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/ToolChainTest.cpp.o
[192/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/MacroExpansionContextTest.cpp.o
[193/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CloneDetectionTest.cpp.o
[194/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ValueTest.cpp.o
[195/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o
FAILED: 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o
 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG 
-D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/unittests
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Tooling
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/include
 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden 
-Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings 
-Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long 
-Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess 
-Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move 
-Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
-Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 
-DNDEBUG -std=c++17  -Wno-variadic-macros -fno-exceptions -funwind-tables 
-fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o
 -MF 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o.d
 -o 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o
 -c 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[196/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MatchSwitchTest.cpp.o
[197/1214] Building CXX object 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp.o
FAILED: 
tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp.o
 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG 
-D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/unittests
 
-I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/

[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Saleem Abdulrasool via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});
+
+  std::vector buffer;
+  buffer.clear();
+  for (const auto &env_entry : env_entries) {
+buffer.insert(buffer.end(), env_entry.begin(), env_entry.end());
+buffer.push_back(L'\0');
+  }
+  buffer.push_back(L'\0');
+
+  return buffer;
 }
 
-static bool GetFlattenedWindowsCommandString(Args args, std::wstring &command) 
{
+llvm::ErrorOr
+ProcessLauncherWindows::GetFlattenedWindowsCommandStringW(Args args) {

compnerd wrote:

I think that making them free functions and giving them static storage is best. 
We should be able to put them into an anonymous namespace and use them within 
the file without having them be in the member. That is much better in terms of 
encapsulation and enables the compiler to be more aggressive with the functions.

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere commented:

This generally looks good, just a few nits.

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -300,16 +304,41 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
 // disassembled instruction stream, similar to how debug information
 // enhances source-level debugging.
 std::vector VariableAnnotator::Annotate(Instruction &inst) {
+  auto structured_annotations = AnnotateStructured(inst);

JDevlieghere wrote:

Don't use `auto` when the type isn't obvious from the right-hand side. 

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 684f64c - [lldb] [test-suite] fix typo in variable in darwin builder (#169254)

2025-11-28 Thread via lldb-commits

Author: n2h9
Date: 2025-11-26T11:35:32-08:00
New Revision: 684f64c0baca15c84e222c0f7c7455e8c505e575

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

LOG: [lldb] [test-suite] fix typo in variable in darwin builder (#169254)

While taking a look at the code of lldb test-suite packages, I have
noticed that in `get_triple_str` in `darwin.py` env is added inside a
`components` list, which is probably supposed to be `component` (defined
on the line 61).

Signed-off-by: Nikita B 

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/builders/darwin.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/builders/darwin.py 
b/lldb/packages/Python/lldbsuite/test/builders/darwin.py
index a023bda3ad801..eebe0ef47fd85 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/darwin.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/darwin.py
@@ -60,7 +60,7 @@ def get_triple_str(arch, vendor, os, version, env):
 
 component = [arch, vendor, os + version]
 if env:
-components.append(env)
+component.append(env)
 return "-".join(component)
 
 



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][AIX] Added Kill() implementation (PR #169454)

2025-11-28 Thread Dhruv Srivastava via lldb-commits

https://github.com/DhruvSrivastavaX edited 
https://github.com/llvm/llvm-project/pull/169454
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][AIX] Added Kill() implementation (PR #169454)

2025-11-28 Thread Dhruv Srivastava via lldb-commits


@@ -187,7 +193,41 @@ Status NativeProcessAIX::Signal(int signo) { return 
Status("unsupported"); }
 
 Status NativeProcessAIX::Interrupt() { return Status("unsupported"); }
 
-Status NativeProcessAIX::Kill() { return Status("unsupported"); }
+Status NativeProcessAIX::Kill() {
+
+  Log *log = GetLog(POSIXLog::Process);
+  LLDB_LOG(log, "pid {0}", GetID());
+
+  Status error;
+
+  switch (m_state) {
+  case StateType::eStateInvalid:
+  case StateType::eStateExited:
+  case StateType::eStateCrashed:
+  case StateType::eStateDetached:
+  case StateType::eStateUnloaded:
+// Nothing to do - the process is already dead.
+LLDB_LOG(log, "ignored for PID {0} due to current state: {1}", GetID(),
+ m_state);
+return error;
+
+  case StateType::eStateConnected:
+  case StateType::eStateAttaching:
+  case StateType::eStateLaunching:
+  case StateType::eStateStopped:
+  case StateType::eStateRunning:
+  case StateType::eStateStepping:
+  case StateType::eStateSuspended:
+// We can try to kill a process in these states.
+break;
+  }
+
+  llvm::Error result =
+  (PtraceWrapper(PT_KILL, GetID(), nullptr, nullptr, 0)).takeError();

DhruvSrivastavaX wrote:

SIGKILL on a traced debuggee does not trigger SIGCHLD, thats why we use PT_KILL 
here.

https://github.com/llvm/llvm-project/pull/169454
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [lldb] [mlir] [NFC] Fix typo of `integer` (PR #169325)

2025-11-28 Thread Longsheng Mou via lldb-commits

https://github.com/CoTinker closed 
https://github.com/llvm/llvm-project/pull/169325
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f817a1b - [NFC] Fix typo of `integer` (#169325)

2025-11-28 Thread via lldb-commits

Author: Longsheng Mou
Date: 2025-11-25T16:06:13+08:00
New Revision: f817a1b0394b7f722b4bb13e9aeead5e177ff6d7

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

LOG: [NFC] Fix typo of `integer` (#169325)

Added: 


Modified: 
flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
lldb/include/lldb/API/SBStructuredData.h
mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h
mlir/lib/Target/LLVMIR/ModuleImport.cpp

Removed: 




diff  --git a/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp 
b/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
index 157d4358329ce..343d84861d1d8 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
@@ -1841,7 +1841,7 @@ mlir::Value fir::runtime::genReduce(fir::FirOpBuilder 
&builder,
 
   assert((fir::isa_real(eleTy) || fir::isa_integer(eleTy) ||
   mlir::isa(eleTy)) &&
- "expect real, interger or logical");
+ "expect real, integer or logical");
 
   auto [cat, kind] = fir::mlirTypeToCategoryKind(loc, eleTy);
   mlir::func::FuncOp func;

diff  --git a/lldb/include/lldb/API/SBStructuredData.h 
b/lldb/include/lldb/API/SBStructuredData.h
index dfd8ec0e180ce..05b9ef4cd06f4 100644
--- a/lldb/include/lldb/API/SBStructuredData.h
+++ b/lldb/include/lldb/API/SBStructuredData.h
@@ -114,11 +114,11 @@ class SBStructuredData {
   /// the previous data.
   void SetValueForKey(const char *key, SBStructuredData &value);
 
-  /// Change the type to unsigned interger and overwrite the previous data with
+  /// Change the type to unsigned integer and overwrite the previous data with
   /// the new value.
   void SetUnsignedIntegerValue(uint64_t value);
 
-  /// Change the type to signed interger and overwrite the previous data with
+  /// Change the type to signed integer and overwrite the previous data with
   /// the new value.
   void SetSignedIntegerValue(int64_t value);
 

diff  --git a/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h 
b/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h
index 72ec6061cbb62..4975cedb282e4 100644
--- a/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h
+++ b/mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h
@@ -48,7 +48,7 @@ class IntegerRangeAnalysis
 public:
   using SparseForwardDataFlowAnalysis::SparseForwardDataFlowAnalysis;
 
-  /// At an entry point, we cannot reason about interger value ranges.
+  /// At an entry point, we cannot reason about integer value ranges.
   void setToEntryState(IntegerValueRangeLattice *lattice) override {
 propagateIfChanged(lattice, lattice->join(IntegerValueRange::getMaxRange(
 lattice->getAnchor(;

diff  --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp 
b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
index 18e132dfeabc2..d7d215bf1bd09 100644
--- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
@@ -1221,7 +1221,7 @@ static TypedAttr getScalarConstantAsAttr(OpBuilder 
&builder,
  llvm::Constant *constScalar) {
   MLIRContext *context = builder.getContext();
 
-  // Convert scalar intergers.
+  // Convert scalar integers.
   if (auto *constInt = dyn_cast(constScalar)) {
 return builder.getIntegerAttr(
 IntegerType::get(context, constInt->getBitWidth()),



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread David Spickett via lldb-commits


@@ -150,29 +152,38 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
   EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-if (!inst)
-  continue;
-DumpInstToLog(log, *inst, inst_list);
+  std::deque to_visit = {0};
+  llvm::SmallSet enqueued = {0};
+
+  // Instructions reachable through jumps are inserted on the front.
+  // The next instruction in inserted on the back.
+  // Pop from the back to ensure non-branching instructions are visited
+  // sequentially.
+  while (!to_visit.empty()) {
+std::size_t current_index = to_visit.back();

DavidSpickett wrote:

No I just forgot that C++ be weird sometimes.

I'd put the pop_back() immediately after the back() to make it clear there 
isn't a state in this code where you rely on having a copy of the index but 
that index still being the back of the queue.

But it's only one line away so do whatever you prefer.

Surprising to me there isn't a pop_back that returns a value but if there were, 
you'd be "paying" for the copy and hoping the compiler was smart enough to 
discard it. And you know how C++ is with paying for things you don't use.

https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

It is the thanksgiving holiday in the US, so I will ping Jason next week

https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/169630

>From 9295ef8614e7f2d14cb7d95c8d963e4128d5992c Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Wed, 26 Nov 2025 10:55:12 +
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.7
---
 .../UnwindAssemblyInstEmulation.cpp   | 52 ++-
 1 file changed, 38 insertions(+), 14 deletions(-)

diff --git 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index b9d665902dc45..074746c0fab3d 100644
--- 
a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ 
b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -25,6 +25,8 @@
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
+#include "llvm/ADT/SmallSet.h"
+#include 
 
 using namespace lldb;
 using namespace lldb_private;
@@ -150,29 +152,38 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
   EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-if (!inst)
-  continue;
-DumpInstToLog(log, *inst, inst_list);
+  std::deque to_visit = {0};
+  llvm::SmallSet enqueued = {0};
+
+  // Instructions reachable through jumps are inserted on the front.
+  // The next instruction in inserted on the back.
+  // Pop from the back to ensure non-branching instructions are visited
+  // sequentially.
+  while (!to_visit.empty()) {
+std::size_t current_index = to_visit.back();
+Instruction &inst = *inst_list.GetInstructionAtIndex(current_index);
+to_visit.pop_back();
+DumpInstToLog(log, inst, inst_list);
 
 m_curr_row_modified = false;
 m_forward_branch_offset = 0;
 
 lldb::addr_t current_offset =
-inst->GetAddress().GetFileAddress() - base_addr;
+inst.GetAddress().GetFileAddress() - base_addr;
 auto it = saved_unwind_states.upper_bound(current_offset);
 assert(it != saved_unwind_states.begin() &&
"Unwind row for the function entry missing");
 --it; // Move it to the row corresponding to the current offset
 
-// If the offset of m_state.row doesn't match with the offset we see in
-// saved_unwind_states then we have to update current unwind state to
-// the saved values. It is happening after we processed an epilogue and a
-// return to caller instruction.
+// When state is forwarded through a branch, the offset of m_state.row is
+// different from the offset available in saved_unwind_states. Use the
+// forwarded state in this case, as the previous instruction may have been
+// an unconditional jump.
+// FIXME: this assignment can always be done unconditionally.
 if (it->second.row.GetOffset() != m_state.row.GetOffset())
   m_state = it->second;
 
-m_inst_emulator_up->SetInstruction(inst->GetOpcode(), inst->GetAddress(),
+m_inst_emulator_up->SetInstruction(inst.GetOpcode(), inst.GetAddress(),
nullptr);
 const EmulateInstruction::InstructionCondition new_condition =
 m_inst_emulator_up->GetInstructionCondition();
@@ -199,13 +210,21 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
 
 // If the current instruction is a branch forward then save the current
 // CFI information for the offset where we are branching.
+Address branch_address = inst.GetAddress();
+branch_address.Slide(m_forward_branch_offset);
 if (m_forward_branch_offset != 0 &&
-range.ContainsFileAddress(inst->GetAddress().GetFileAddress() +
-  m_forward_branch_offset)) {
+range.ContainsFileAddress(branch_address.GetFileAddress())) {
   if (auto [it, inserted] = saved_unwind_states.emplace(
   current_offset + m_forward_branch_offset, m_state);
-  inserted)
+  inserted) {
 it->second.row.SetOffset(current_offset + m_forward_branch_offset);
+if (std::size_t dest_instr_index =
+inst_list.GetIndexOfInstructionAtAddress(branch_address);
+dest_instr_index < inst_list.GetSize()) {
+  to_visit.push_front(dest_instr_index);
+  enqueued.insert(dest_instr_index);
+}
+  }
 }
 
 // Were there any changes to the CFI while evaluating this instruction?
@@ -213,12 +232,17 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   // Save the modified row if we don't already have a CFI row in the
   // current address
   const lldb::addr_t next_inst_offse

[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -150,29 +152,38 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
   EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-if (!inst)
-  continue;
-DumpInstToLog(log, *inst, inst_list);
+  std::deque to_visit = {0};
+  llvm::SmallSet enqueued = {0};
+
+  // Instructions reachable through jumps are inserted on the front.
+  // The next instruction in inserted on the back.
+  // Pop from the back to ensure non-branching instructions are visited
+  // sequentially.
+  while (!to_visit.empty()) {
+std::size_t current_index = to_visit.back();

felipepiovezan wrote:

`pop_back` does not return the value popped. You might be thinking of 
`pop_back_val`, which is an LLVM ADT function available in things like 
SmallVector

https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/168733

>From 71c4fd1953dfa65a215ce347bee3c5d51db41e11 Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Wed, 19 Nov 2025 16:17:31 +
Subject: [PATCH 1/3] [lldb][windows] refactor CreateProcessW setup

---
 .../Host/windows/ProcessLauncherWindows.h | 31 ++-
 .../Host/windows/ProcessLauncherWindows.cpp   | 82 ++-
 2 files changed, 73 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h 
b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
index 81aea5b2022a5..153086eb9b17c 100644
--- a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
+++ b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
@@ -11,6 +11,9 @@
 
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/Environment.h"
+#include "llvm/Support/ErrorOr.h"
 
 namespace lldb_private {
 
@@ -23,7 +26,33 @@ class ProcessLauncherWindows : public ProcessLauncher {
 
 protected:
   HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+
+  /// Create a UTF-16 environment block to use with CreateProcessW.
+  ///
+  /// The buffer is a sequence of null-terminated UTF-16 strings, followed by 
an
+  /// extra L'\0' (two bytes of 0). An empty environment must have one
+  /// empty string, followed by an extra L'\0'.
+  ///
+  /// The keys are sorted to comply with the CreateProcess' calling convention.
+  ///
+  /// Ensure that the resulting buffer is used in conjunction with
+  /// CreateProcessW and be sure that dwCreationFlags includes
+  /// CREATE_UNICODE_ENVIRONMENT.
+  ///
+  /// \param env The Environment object to convert.
+  /// \returns The sorted sequence of environment variables and their values,
+  /// separated by null terminators.
+  static std::vector CreateEnvironmentBufferW(const Environment &env);
+
+  /// Flattens an Args object into a Windows command-line wide string.
+  ///
+  /// Returns an empty string if args is empty.
+  ///
+  /// \param args The Args object to flatten.
+  /// \returns A wide string containing the flattened command line.
+  static llvm::ErrorOr
+  GetFlattenedWindowsCommandStringW(Args args);
 };
 }
 
-#endif
+#endif
\ No newline at end of file
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp 
b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index f5adadaf061bf..42de009b173e5 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});
+
+  std::vector buffer;
+  buffer.clear();
+  for (const auto &env_entry : env_entries) {
+buffer.insert(buffer.end(), env_entry.begin(), env_entry.end());
+buffer.push_back(L'\0');
+  }
+  buffer.push_back(L'\0');
+
+  return buffer;
 }
 
-static bool GetFlattenedWindowsCommandString(Args args, std::wstring &command) 
{
+llvm::ErrorOr
+ProcessLauncherWindows::GetFlattenedWindowsCommandStringW(Args args) {
   if (args.empty())
-return false;
+return L"";
 
   std::vector args_ref;
   for (auto &entry : args.entries())
 args_ref.push_back(entry.ref());
 
-  llvm::ErrorOr result =
-  llvm::sys::flattenWindowsCommandLine(args_ref);
-  if (result.getError())
-return false;
-
-  command = *result;
-  return true;
+  return llvm::sys::flattenWindowsCommandLine(args_ref);
 }
 
 HostProcess
@@ -66,8 +65,8 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo 
&launch_info,
 
   std::string executable;
   std::vector environment;
-  STARTUPINFOEX startupinfoex = {};
-  STARTUPIN

[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});
+
+  std::vector buffer;
+  buffer.clear();
+  for (const auto &env_entry : env_entries) {
+buffer.insert(buffer.end(), env_entry.begin(), env_entry.end());
+buffer.push_back(L'\0');
+  }
+  buffer.push_back(L'\0');
+
+  return buffer;
 }
 
-static bool GetFlattenedWindowsCommandString(Args args, std::wstring &command) 
{
+llvm::ErrorOr
+ProcessLauncherWindows::GetFlattenedWindowsCommandStringW(Args args) {

charles-zablit wrote:

Reverted that change in the latest patch 👍 

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {

charles-zablit wrote:

Fixed in a3029fc8046b2af9ad65ec7052dcf7a8fdead9eb

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -23,7 +26,33 @@ class ProcessLauncherWindows : public ProcessLauncher {
 
 protected:
   HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+
+  /// Create a UTF-16 environment block to use with CreateProcessW.
+  ///
+  /// The buffer is a sequence of null-terminated UTF-16 strings, followed by 
an
+  /// extra L'\0' (two bytes of 0). An empty environment must have one
+  /// empty string, followed by an extra L'\0'.
+  ///
+  /// The keys are sorted to comply with the CreateProcess' calling convention.
+  ///
+  /// Ensure that the resulting buffer is used in conjunction with
+  /// CreateProcessW and be sure that dwCreationFlags includes
+  /// CREATE_UNICODE_ENVIRONMENT.
+  ///
+  /// \param env The Environment object to convert.
+  /// \returns The sorted sequence of environment variables and their values,
+  /// separated by null terminators.
+  static std::vector CreateEnvironmentBufferW(const Environment &env);

charles-zablit wrote:

Fixed in a3029fc8046b2af9ad65ec7052dcf7a8fdead9eb

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -23,7 +26,33 @@ class ProcessLauncherWindows : public ProcessLauncher {
 
 protected:
   HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+
+  /// Create a UTF-16 environment block to use with CreateProcessW.
+  ///
+  /// The buffer is a sequence of null-terminated UTF-16 strings, followed by 
an
+  /// extra L'\0' (two bytes of 0). An empty environment must have one
+  /// empty string, followed by an extra L'\0'.
+  ///
+  /// The keys are sorted to comply with the CreateProcess' calling convention.
+  ///
+  /// Ensure that the resulting buffer is used in conjunction with
+  /// CreateProcessW and be sure that dwCreationFlags includes
+  /// CREATE_UNICODE_ENVIRONMENT.
+  ///
+  /// \param env The Environment object to convert.
+  /// \returns The sorted sequence of environment variables and their values,
+  /// separated by null terminators.
+  static std::vector CreateEnvironmentBufferW(const Environment &env);
+
+  /// Flattens an Args object into a Windows command-line wide string.
+  ///
+  /// Returns an empty string if args is empty.
+  ///
+  /// \param args The Args object to flatten.
+  /// \returns A wide string containing the flattened command line.
+  static llvm::ErrorOr

charles-zablit wrote:

Fixed in a3029fc8046b2af9ad65ec7052dcf7a8fdead9eb

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use AST nodes as Subscript and BitField arguments in DIL (PR #169363)

2025-11-28 Thread Ilia Kuklin via lldb-commits

kuilpd wrote:

@Michael137 @jimingham 
Could you please take a look at this patch? It should be fairly straightforward.

https://github.com/llvm/llvm-project/pull/169363
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix ThreadPlanStepOut::DoPlanExplainsStop inspection of BreakpointSite (PR #169799)

2025-11-28 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)


Changes

Suppose two threads are performing the exact same step out plan. They will both 
have an internal breakpoint set at their parent frame. Now supposed both of 
those breakpoints are in the same address (i.e. the same BreakpointSite).

At the end of `ThreadPlanStepOut::DoPlanExplainsStop`, we see this:

```
// If there was only one owner, then we're done.  But if we also hit
// some user breakpoint on our way out, we should mark ourselves as
// done, but also not claim to explain the stop, since it is more
// important to report the user breakpoint than the step out
// completion.

if (site_sp->GetNumberOfConstituents() == 1)
  return true;
```

In other words, the plan looks at the name number of constituents of the site 
to decide whether it explains the stop, the logic being that a _user_ might 
have put a breakpoint there. However, the implementation is not correct; in 
particular, it will fail in the situation described above. We should only care 
about non-internal breakpoints that would stop for the current thread.

It is tricky to test this, as it depends on the timing of threads, but I was 
able to consistently reproduce the issue with a swift program using concurrency.

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


1 Files Affected:

- (modified) lldb/source/Target/ThreadPlanStepOut.cpp (+20-7) 


``diff
diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp 
b/lldb/source/Target/ThreadPlanStepOut.cpp
index d49a01bdbcef7..7970e731aa972 100644
--- a/lldb/source/Target/ThreadPlanStepOut.cpp
+++ b/lldb/source/Target/ThreadPlanStepOut.cpp
@@ -8,6 +8,7 @@
 
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Symbol/Block.h"
 #include "lldb/Symbol/Function.h"
@@ -306,6 +307,21 @@ bool ThreadPlanStepOut::ValidatePlan(Stream *error) {
   return true;
 }
 
+/// Returns true if :
+/// 1. All breakpoints in this site are internal, and
+/// 2. All breakpoint locations in this site are NOT valid for `thread`.
+static bool NoUserBreakpointsHere(BreakpointSite &site, Thread &thread) {
+  for (unsigned bp_idx = 0; bp_idx < site.GetNumberOfConstituents(); bp_idx++) 
{
+BreakpointLocation &bp_loc = *site.GetConstituentAtIndex(bp_idx);
+const Breakpoint &bp = bp_loc.GetBreakpoint();
+if (bp.IsInternal())
+  continue;
+if (bp_loc.ValidForThisThread(thread))
+  return false;
+  }
+  return true;
+}
+
 bool ThreadPlanStepOut::DoPlanExplainsStop(Event *event_ptr) {
   // If the step out plan is done, then we just need to step through the
   // inlined frame.
@@ -356,13 +372,10 @@ bool ThreadPlanStepOut::DoPlanExplainsStop(Event 
*event_ptr) {
   }
 }
 
-// If there was only one owner, then we're done.  But if we also hit
-// some user breakpoint on our way out, we should mark ourselves as
-// done, but also not claim to explain the stop, since it is more
-// important to report the user breakpoint than the step out
-// completion.
-
-if (site_sp->GetNumberOfConstituents() == 1)
+// If the thread also hit a user breakpoint on its way out, the plan is
+// done but should not claim to explain the stop. It is more important
+// to report the user breakpoint than the step out completion.
+if (NoUserBreakpointsHere(*site_sp, GetThread()))
   return true;
   }
   return false;

``




https://github.com/llvm/llvm-project/pull/169799
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix ThreadPlanStepOut::DoPlanExplainsStop inspection of BreakpointSite (PR #169799)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan created 
https://github.com/llvm/llvm-project/pull/169799

Suppose two threads are performing the exact same step out plan. They will both 
have an internal breakpoint set at their parent frame. Now supposed both of 
those breakpoints are in the same address (i.e. the same BreakpointSite).

At the end of `ThreadPlanStepOut::DoPlanExplainsStop`, we see this:

```
// If there was only one owner, then we're done.  But if we also hit
// some user breakpoint on our way out, we should mark ourselves as
// done, but also not claim to explain the stop, since it is more
// important to report the user breakpoint than the step out
// completion.

if (site_sp->GetNumberOfConstituents() == 1)
  return true;
```

In other words, the plan looks at the name number of constituents of the site 
to decide whether it explains the stop, the logic being that a _user_ might 
have put a breakpoint there. However, the implementation is not correct; in 
particular, it will fail in the situation described above. We should only care 
about non-internal breakpoints that would stop for the current thread.

It is tricky to test this, as it depends on the timing of threads, but I was 
able to consistently reproduce the issue with a swift program using concurrency.

>From 17b475b7cc48ff1fd9eceffdaa13e09043cbeec5 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Thu, 27 Nov 2025 12:41:18 +
Subject: [PATCH] [lldb] Fix ThreadPlanStepOut::DoPlanExplainsStop inspection
 of BreakpointSite

Suppose two threads are performing the exact same step out plan.
They will both have an internal breakpoint set at their parent frame.
Now supposed both of those breakpoints are in the same address (i.e. the
same BreakpointSite).

At the end of `ThreadPlanStepOut::DoPlanExplainsStop`, we see this:

```
// If there was only one owner, then we're done.  But if we also hit
// some user breakpoint on our way out, we should mark ourselves as
// done, but also not claim to explain the stop, since it is more
// important to report the user breakpoint than the step out
// completion.

if (site_sp->GetNumberOfConstituents() == 1)
  return true;
```

In other words, the plan looks at the name number of constituents of the
site to decide whether it explains the stop, the logic being that a
_user_ might have put a breakpoint there. However, the implementation is
not correct; in particular, it will fail in the situation described
above. We should only care about non-internal breakpoints that would
stop for the current thread.

It is tricky to test this, as it depends on the timing of threads, but I
was able to consistently reproduce the issue with a swift program using
concurrency.
---
 lldb/source/Target/ThreadPlanStepOut.cpp | 27 ++--
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp 
b/lldb/source/Target/ThreadPlanStepOut.cpp
index d49a01bdbcef7..7970e731aa972 100644
--- a/lldb/source/Target/ThreadPlanStepOut.cpp
+++ b/lldb/source/Target/ThreadPlanStepOut.cpp
@@ -8,6 +8,7 @@
 
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Symbol/Block.h"
 #include "lldb/Symbol/Function.h"
@@ -306,6 +307,21 @@ bool ThreadPlanStepOut::ValidatePlan(Stream *error) {
   return true;
 }
 
+/// Returns true if :
+/// 1. All breakpoints in this site are internal, and
+/// 2. All breakpoint locations in this site are NOT valid for `thread`.
+static bool NoUserBreakpointsHere(BreakpointSite &site, Thread &thread) {
+  for (unsigned bp_idx = 0; bp_idx < site.GetNumberOfConstituents(); bp_idx++) 
{
+BreakpointLocation &bp_loc = *site.GetConstituentAtIndex(bp_idx);
+const Breakpoint &bp = bp_loc.GetBreakpoint();
+if (bp.IsInternal())
+  continue;
+if (bp_loc.ValidForThisThread(thread))
+  return false;
+  }
+  return true;
+}
+
 bool ThreadPlanStepOut::DoPlanExplainsStop(Event *event_ptr) {
   // If the step out plan is done, then we just need to step through the
   // inlined frame.
@@ -356,13 +372,10 @@ bool ThreadPlanStepOut::DoPlanExplainsStop(Event 
*event_ptr) {
   }
 }
 
-// If there was only one owner, then we're done.  But if we also hit
-// some user breakpoint on our way out, we should mark ourselves as
-// done, but also not claim to explain the stop, since it is more
-// important to report the user breakpoint than the step out
-// completion.
-
-if (site_sp->GetNumberOfConstituents() == 1)
+// If the thread also hit a user breakpoint on its way out, the plan is
+// done but should not claim to explain the stop. It is more important
+// to report the user breakpoint than the step out completion.
+if (NoUserBreakpointsHere(*site_sp, GetThread()))
   return true;
   }
   return false;

_

[Lldb-commits] [lldb] [lldb] Fix ThreadPlanStepOut::DoPlanExplainsStop inspection of BreakpointSite (PR #169799)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/169799
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Add Windows release binary builds (PR #150793)

2025-11-28 Thread Tom Stellard via lldb-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/150793

>From 2bc5c1ae0c21ebc0bfa28777d19751fe2a811487 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:27:08 -0700
Subject: [PATCH 01/65] Add Windows release binary builds

---
 .github/workflows/release-binaries-windows.yml | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 .github/workflows/release-binaries-windows.yml

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
new file mode 100644
index 0..fa116bc9a379a
--- /dev/null
+++ b/.github/workflows/release-binaries-windows.yml
@@ -0,0 +1,17 @@
+name: Release Binaries Windows
+
+on:
+  pull:
+
+
+permissions:
+  contents: read # Default everything to read-only
+
+jobs:
+  build-windows-release:
+runs-on: depot-windows-2022-16
+if: github.repository_owner == 'llvm'
+steps:
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - run: |
+llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 860dff2f330bd9c976cdabc77076c83f8da9b8d5 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:29:47 -0700
Subject: [PATCH 02/65] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index fa116bc9a379a..630a2facba8b4 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 6533e4438019c747abd4f9b1d6e6c32ce7948c90 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:31:42 -0700
Subject: [PATCH 03/65] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 630a2facba8b4..a7a4dc969ea43 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -1,7 +1,7 @@
 name: Release Binaries Windows
 
 on:
-  pull:
+  pull_request:
 
 
 permissions:

>From 04381bbafc5b02ada4eb0cd5e0d43b4e637e3b93 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:45:05 -0700
Subject: [PATCH 04/65] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index a7a4dc969ea43..58a1ad17ee44c 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python

>From 1a9ab34c48a532b397db2294aa8e2d868a21 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 21:18:40 -0700
Subject: [PATCH 05/65] Fix

---
 .github/workflows/release-binaries-windows.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 58a1ad17ee44c..86951337aa2ee 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -12,6 +12,8 @@ jobs:
 runs-on: depot-windows-2022-16
 if: github.repository_owner == 'llvm'
 steps:
-  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1A
+with:
+  ref: llvmorg-20.1.8
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--skip-checkout --local-python

>From d2dcb30b6707007267153683615528f274e40dd4 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Mon, 11 Aug 2025 20:28:56 +
Subject: [PATCH 06/65] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 86951337aa2ee..6793656c5dcef 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -9,7 +9,7 @@ permis

[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread Ebuka Ezike via lldb-commits

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

>From a0f2bcd3b3361572d68e11b6ee3b4284bc97679b Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 26 Nov 2025 13:52:51 +
Subject: [PATCH 1/3] [lldb] fix CxxMethodName Parser.

The simplified parser incorrectly assumes if there is a context,
there is no return type.
---
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 24 +++
 .../CPlusPlus/CPlusPlusLanguageTest.cpp   |  5 
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 4b66ff814935a..d347b57996c65 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -481,18 +481,22 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-if (IsTrivialBasename(m_basename)) {
+// if the context has a white space it may have a return type.
+// e.g. `int foo::bar::func()` or `Type foo::bar::func(int)`
+const bool no_whitespace =
+m_context.find_first_of(" \t\n\v\f\r") == llvm::StringRef::npos;
+
+if (no_whitespace && IsTrivialBasename(m_basename)) {
   return true;
-} else {
-  // The C++ basename doesn't match our regular expressions so this can't
-  // be a valid C++ method, clear everything out and indicate an error
-  m_context = llvm::StringRef();
-  m_basename = llvm::StringRef();
-  m_arguments = llvm::StringRef();
-  m_qualifiers = llvm::StringRef();
-  m_return_type = llvm::StringRef();
-  return false;
 }
+// The C++ basename doesn't match our regular expressions so this can't
+// be a valid C++ method, clear everything out and indicate an error
+m_context = llvm::StringRef();
+m_basename = llvm::StringRef();
+m_arguments = llvm::StringRef();
+m_qualifiers = llvm::StringRef();
+m_return_type = llvm::StringRef();
+return false;
   }
   return false;
 }
diff --git a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp 
b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
index 23f2f4218601a..f0c4b0a83c890 100644
--- a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -30,6 +30,9 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
   {"foo::~bar(baz)", "", "foo", "~bar", "(baz)", "", "foo::~bar"},
   {"a::b::c::d(e,f)", "", "a::b::c", "d", "(e,f)", "", "a::b::c::d"},
   {"void f(int)", "void", "", "f", "(int)", "", "f"},
+  {"int main()", "int", "", "main", "()", "", "main"},
+  {"int foo::bar::func01(int a, double b)", "int", "foo::bar", "func01",
+   "(int a, double b)", "", "foo::bar::func01"},
 
   // Operators
   {"std::basic_ostream >& "
@@ -101,6 +104,8 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
"std::forward"},
 
   // Templates
+  {"vector foo::bar::func(int)", "vector", "foo::bar", "func",
+   "(int)", "", "foo::bar::func"},
   {"void llvm::PM>::"
"addPass(llvm::VP)",
"void", "llvm::PM>",

>From 8634de5c8647c79f196fbf3b5c7745957bf5d7ae Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 26 Nov 2025 19:56:13 +
Subject: [PATCH 2/3] [lldb] add review changes

---
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 20 +--
 .../CPlusPlus/CPlusPlusLanguageTest.cpp   |  3 ++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index d347b57996c65..ab9affe438c86 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -208,6 +208,19 @@ static bool IsTrivialBasename(const llvm::StringRef 
&basename) {
   return idx == basename.size();
 }
 
+/// A context is trivial if an only if it matches this pattern.
+/// "^\s*([A-Za-z_:]*)\s*$".
+static bool IsTrivialContext(llvm::StringRef context) {
+  // remove trailing or leading whitespace.
+  context = context.trim();
+
+  const auto iter = context.find_if_not([](char current) {
+return std::isalnum(static_cast(current)) ||
+   current == '_' || current == ':';
+  });
+  return iter == llvm::StringRef::npos;
+}
+
 /// Writes out the function name in 'full_name' to 'out_stream'
 /// but replaces each argument type with the variable name
 /// and the corresponding pretty-printed value
@@ -481,12 +494,7 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-// if the context has a white space it may have a return type.
-// e.g. `int foo::bar::func()

[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper closed 
https://github.com/llvm/llvm-project/pull/169652
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 90e8889 - [lldb] Fix CxxMethodName Parser on return type (#169652)

2025-11-28 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-11-27T15:09:05Z
New Revision: 90e8889a6394e29843ba903eff45ca03f877a6dd

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

LOG: [lldb] Fix CxxMethodName Parser on return type (#169652)

The simplified parser incorrectly assumes if there is a context, there
is no return type.

Fixed the case where functions have both a context and a return type.
For example,

`int foo::bar::func()`
`Type foo::bar::func()` 

Also fixed the case where there is no space between the context and
return.
`std::vectorfoo::bar()`

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 4b66ff814935a..a3624accf9b5a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -208,6 +208,20 @@ static bool IsTrivialBasename(const llvm::StringRef 
&basename) {
   return idx == basename.size();
 }
 
+/// A context is trivial if an only if it matches this pattern.
+/// "^\s*([A-Za-z_:]*)\s*$". for example function `foo::bar::func()`
+/// has a trivial context but. but `foo::bar::func()` doesn't.
+static bool IsTrivialContext(llvm::StringRef context) {
+  // remove trailing or leading whitespace.
+  context = context.trim();
+
+  const auto iter = context.find_if_not([](char current) {
+return std::isalnum(static_cast(current)) ||
+   current == '_' || current == ':';
+  });
+  return iter == llvm::StringRef::npos;
+}
+
 /// Writes out the function name in 'full_name' to 'out_stream'
 /// but replaces each argument type with the variable name
 /// and the corresponding pretty-printed value
@@ -481,18 +495,17 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-if (IsTrivialBasename(m_basename)) {
+if (IsTrivialBasename(m_basename) && IsTrivialContext(m_context)) {
   return true;
-} else {
-  // The C++ basename doesn't match our regular expressions so this can't
-  // be a valid C++ method, clear everything out and indicate an error
-  m_context = llvm::StringRef();
-  m_basename = llvm::StringRef();
-  m_arguments = llvm::StringRef();
-  m_qualifiers = llvm::StringRef();
-  m_return_type = llvm::StringRef();
-  return false;
 }
+// The C++ basename doesn't match our regular expressions so this can't
+// be a valid C++ method, clear everything out and indicate an error
+m_context = llvm::StringRef();
+m_basename = llvm::StringRef();
+m_arguments = llvm::StringRef();
+m_qualifiers = llvm::StringRef();
+m_return_type = llvm::StringRef();
+return false;
   }
   return false;
 }

diff  --git a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp 
b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
index 23f2f4218601a..c05418168e62e 100644
--- a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -30,6 +30,10 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
   {"foo::~bar(baz)", "", "foo", "~bar", "(baz)", "", "foo::~bar"},
   {"a::b::c::d(e,f)", "", "a::b::c", "d", "(e,f)", "", "a::b::c::d"},
   {"void f(int)", "void", "", "f", "(int)", "", "f"},
+  {"std::vectorfoo::bar()", "std::vector", "foo", "bar", "()", 
"",
+   "foo::bar"},
+  {"int foo::bar::func01(int a, double b)", "int", "foo::bar", "func01",
+   "(int a, double b)", "", "foo::bar::func01"},
 
   // Operators
   {"std::basic_ostream >& "
@@ -101,6 +105,8 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
"std::forward"},
 
   // Templates
+  {"vector foo::bar::func(int)", "vector", "foo::bar", "func",
+   "(int)", "", "foo::bar::func"},
   {"void llvm::PM>::"
"addPass(llvm::VP)",
"void", "llvm::PM>",



___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});
+
+  std::vector buffer;
+  buffer.clear();

charles-zablit wrote:

I removed the call to clear.

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -23,7 +26,33 @@ class ProcessLauncherWindows : public ProcessLauncher {
 
 protected:
   HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+
+  /// Create a UTF-16 environment block to use with CreateProcessW.
+  ///
+  /// The buffer is a sequence of null-terminated UTF-16 strings, followed by 
an
+  /// extra L'\0' (two bytes of 0). An empty environment must have one
+  /// empty string, followed by an extra L'\0'.
+  ///
+  /// The keys are sorted to comply with the CreateProcess' calling convention.
+  ///
+  /// Ensure that the resulting buffer is used in conjunction with
+  /// CreateProcessW and be sure that dwCreationFlags includes
+  /// CREATE_UNICODE_ENVIRONMENT.
+  ///
+  /// \param env The Environment object to convert.
+  /// \returns The sorted sequence of environment variables and their values,
+  /// separated by null terminators.
+  static std::vector CreateEnvironmentBufferW(const Environment &env);
+
+  /// Flattens an Args object into a Windows command-line wide string.
+  ///
+  /// Returns an empty string if args is empty.
+  ///
+  /// \param args The Args object to flatten.
+  /// \returns A wide string containing the flattened command line.
+  static llvm::ErrorOr
+  GetFlattenedWindowsCommandStringW(Args args);
 };
 }
 
-#endif
+#endif

charles-zablit wrote:

Fixed, thanks

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/168733

>From 71c4fd1953dfa65a215ce347bee3c5d51db41e11 Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Wed, 19 Nov 2025 16:17:31 +
Subject: [PATCH 1/2] [lldb][windows] refactor CreateProcessW setup

---
 .../Host/windows/ProcessLauncherWindows.h | 31 ++-
 .../Host/windows/ProcessLauncherWindows.cpp   | 82 ++-
 2 files changed, 73 insertions(+), 40 deletions(-)

diff --git a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h 
b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
index 81aea5b2022a5..153086eb9b17c 100644
--- a/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
+++ b/lldb/include/lldb/Host/windows/ProcessLauncherWindows.h
@@ -11,6 +11,9 @@
 
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/Environment.h"
+#include "llvm/Support/ErrorOr.h"
 
 namespace lldb_private {
 
@@ -23,7 +26,33 @@ class ProcessLauncherWindows : public ProcessLauncher {
 
 protected:
   HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+
+  /// Create a UTF-16 environment block to use with CreateProcessW.
+  ///
+  /// The buffer is a sequence of null-terminated UTF-16 strings, followed by 
an
+  /// extra L'\0' (two bytes of 0). An empty environment must have one
+  /// empty string, followed by an extra L'\0'.
+  ///
+  /// The keys are sorted to comply with the CreateProcess' calling convention.
+  ///
+  /// Ensure that the resulting buffer is used in conjunction with
+  /// CreateProcessW and be sure that dwCreationFlags includes
+  /// CREATE_UNICODE_ENVIRONMENT.
+  ///
+  /// \param env The Environment object to convert.
+  /// \returns The sorted sequence of environment variables and their values,
+  /// separated by null terminators.
+  static std::vector CreateEnvironmentBufferW(const Environment &env);
+
+  /// Flattens an Args object into a Windows command-line wide string.
+  ///
+  /// Returns an empty string if args is empty.
+  ///
+  /// \param args The Args object to flatten.
+  /// \returns A wide string containing the flattened command line.
+  static llvm::ErrorOr
+  GetFlattenedWindowsCommandStringW(Args args);
 };
 }
 
-#endif
+#endif
\ No newline at end of file
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp 
b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index f5adadaf061bf..42de009b173e5 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});
+
+  std::vector buffer;
+  buffer.clear();
+  for (const auto &env_entry : env_entries) {
+buffer.insert(buffer.end(), env_entry.begin(), env_entry.end());
+buffer.push_back(L'\0');
+  }
+  buffer.push_back(L'\0');
+
+  return buffer;
 }
 
-static bool GetFlattenedWindowsCommandString(Args args, std::wstring &command) 
{
+llvm::ErrorOr
+ProcessLauncherWindows::GetFlattenedWindowsCommandStringW(Args args) {
   if (args.empty())
-return false;
+return L"";
 
   std::vector args_ref;
   for (auto &entry : args.entries())
 args_ref.push_back(entry.ref());
 
-  llvm::ErrorOr result =
-  llvm::sys::flattenWindowsCommandLine(args_ref);
-  if (result.getError())
-return false;
-
-  command = *result;
-  return true;
+  return llvm::sys::flattenWindowsCommandLine(args_ref);
 }
 
 HostProcess
@@ -66,8 +65,8 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo 
&launch_info,
 
   std::string executable;
   std::vector environment;
-  STARTUPINFOEX startupinfoex = {};
-  STARTUPIN

[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});

charles-zablit wrote:

As I understand it from [the `CreateProcess` 
documentation](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw),
 we have to sort the env variables before calling `CreateProcessW`:
> An application must manually pass the current directory information to the 
> new process. To do so, the application must explicitly create these 
> environment variable strings, sort them alphabetically (because the system 
> uses a sorted environment), and put them into the environment block. 
> Typically, they will go at the front of the environment block, due to the 
> environment block sort order.

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {

charles-zablit wrote:

Fixed, thanks!

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] refactor CreateProcessW setup (PR #168733)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -21,42 +21,41 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static void CreateEnvironmentBuffer(const Environment &env,
-std::vector &buffer) {
-  // The buffer is a list of null-terminated UTF-16 strings, followed by an
-  // extra L'\0' (two bytes of 0).  An empty environment must have one
-  // empty string, followed by an extra L'\0'.
+std::vector
+ProcessLauncherWindows::CreateEnvironmentBufferW(const Environment &env) {
+  std::vector env_entries;
   for (const auto &KV : env) {
-std::wstring warg;
-if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-  buffer.insert(
-  buffer.end(), reinterpret_cast(warg.c_str()),
-  reinterpret_cast(warg.c_str() + warg.size() + 1));
+std::wstring wentry;
+if (llvm::ConvertUTF8toWide(Environment::compose(KV), wentry)) {
+  env_entries.push_back(std::move(wentry));
 }
   }
-  // One null wchar_t (to end the block) is two null bytes
-  buffer.push_back(0);
-  buffer.push_back(0);
-  // Insert extra two bytes, just in case the environment was empty.
-  buffer.push_back(0);
-  buffer.push_back(0);
+  std::sort(env_entries.begin(), env_entries.end(),
+[](const std::wstring &a, const std::wstring &b) {
+  return _wcsicmp(a.c_str(), b.c_str()) < 0;
+});
+
+  std::vector buffer;
+  buffer.clear();
+  for (const auto &env_entry : env_entries) {
+buffer.insert(buffer.end(), env_entry.begin(), env_entry.end());
+buffer.push_back(L'\0');
+  }
+  buffer.push_back(L'\0');
+
+  return buffer;
 }
 
-static bool GetFlattenedWindowsCommandString(Args args, std::wstring &command) 
{
+llvm::ErrorOr
+ProcessLauncherWindows::GetFlattenedWindowsCommandStringW(Args args) {

charles-zablit wrote:

Answering to all related comments:

`GetFlattenedWindowsCommandStringW` and `CreateEnvironmentBufferW` are only 
called from `ProcessLauncherWindows`. Because of that, I figured that it made 
sense for them to be members of that class as well.

https://github.com/llvm/llvm-project/pull/168733
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] add a marker before skipped frames (PR #167550)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/167550

>From 8615f3d2a10a106f45815f28340ae3e8770f6186 Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Tue, 11 Nov 2025 18:09:05 +0100
Subject: [PATCH 1/6] [lldb] add a marker before skipped frames

---
 lldb/include/lldb/Target/StackFrame.h | 21 +++---
 lldb/include/lldb/Target/StackFrameList.h |  8 +++
 lldb/source/Target/StackFrame.cpp | 22 +--
 lldb/source/Target/StackFrameList.cpp | 26 +--
 4 files changed, 66 insertions(+), 11 deletions(-)

diff --git a/lldb/include/lldb/Target/StackFrame.h 
b/lldb/include/lldb/Target/StackFrame.h
index cdbe8ae3c6779..c3e3c945e114c 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -335,11 +335,16 @@ class StackFrame : public ExecutionContextScope,
   /// \param[in] frame_marker
   ///   Optional string that will be prepended to the frame output description.
   ///
+  /// \param[in] skipped_frame_marker
+  ///   Optional string that will be prepended to the first or last non skipped
+  ///   frame output description.
+  ///
   /// \return
   ///   \b true if and only if dumping with the given \p format worked.
   bool DumpUsingFormat(Stream &strm,
const lldb_private::FormatEntity::Entry *format,
-   llvm::StringRef frame_marker = {});
+   llvm::StringRef frame_marker = {},
+   llvm::StringRef skipped_frame_marker = {});
 
   /// Print a description for this frame using the frame-format formatter
   /// settings. If the current frame-format settings are invalid, then the
@@ -353,8 +358,13 @@ class StackFrame : public ExecutionContextScope,
   ///
   /// \param [in] frame_marker
   ///   Optional string that will be prepended to the frame output description.
+  ///
+  /// \param[in] skipped_frame_marker
+  ///   Optional string that will be prepended to the first or last non skipped
+  ///   frame output description.
   void DumpUsingSettingsFormat(Stream *strm, bool show_unique = false,
-   const char *frame_marker = nullptr);
+   const char *frame_marker = nullptr,
+   const std::wstring skipped_frame_marker = L"");
 
   /// Print a description for this frame using a default format.
   ///
@@ -387,10 +397,15 @@ class StackFrame : public ExecutionContextScope,
   /// \param[in] frame_marker
   ///   Passed to DumpUsingSettingsFormat() for the frame info printing.
   ///
+  ///
+  /// \param[in] skipped_frame_marker
+  ///   Optional string that will be prepended to the first or last non skipped
+  ///   frame output description.
   /// \return
   ///   Returns true if successful.
   bool GetStatus(Stream &strm, bool show_frame_info, bool show_source,
- bool show_unique = false, const char *frame_marker = nullptr);
+ bool show_unique = false, const char *frame_marker = nullptr,
+ const std::wstring skipped_frame_marker = L"");
 
   /// Query whether this frame is a concrete frame on the call stack, or if it
   /// is an inlined frame derived from the debug information and presented by
diff --git a/lldb/include/lldb/Target/StackFrameList.h 
b/lldb/include/lldb/Target/StackFrameList.h
index 5b0df0ddb3e29..8d6b8fc284336 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -49,6 +49,14 @@ class StackFrameList {
   /// Resets the selected frame index of this object.
   void ClearSelectedFrameIndex();
 
+  /// Return \code true if the next frame is hidden. False otherwise or if it's
+  /// the last frame.
+  bool IsNextFrameHidden(lldb_private::StackFrame &frame);
+
+  /// Return \code true if the previous frame is hidden. False otherwise or if
+  /// it's the first frame.
+  bool IsPreviousFrameHidden(lldb_private::StackFrame &frame);
+
   /// Get the currently selected frame index.
   /// We should only call SelectMostRelevantFrame if (a) the user hasn't 
already
   /// selected a frame, and (b) if this really is a user facing
diff --git a/lldb/source/Target/StackFrame.cpp 
b/lldb/source/Target/StackFrame.cpp
index 78f67d21d6600..362980f17d689 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -37,6 +37,7 @@
 #include "lldb/ValueObject/ValueObjectConstResult.h"
 #include "lldb/ValueObject/ValueObjectMemory.h"
 #include "lldb/ValueObject/ValueObjectVariable.h"
+#include "llvm/Support/ConvertUTF.h"
 
 #include "lldb/lldb-enumerations.h"
 
@@ -1920,11 +1921,13 @@ void 
StackFrame::CalculateExecutionContext(ExecutionContext &exe_ctx) {
 
 bool StackFrame::DumpUsingFormat(Stream &strm,
  const FormatEntity::Entry *format,
- llvm::StringRef frame_marker) {
+ llvm::StringRef frame_

[Lldb-commits] [lldb] [lldb] improve the heuristics for checking if a terminal supports Unicode (PR #168603)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/168603

>From 65126c7ebb94bcee69ac513ec97e0227f4f2e1aa Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Tue, 18 Nov 2025 22:41:43 +0100
Subject: [PATCH 1/4] [lldb] improve the heuristics for checking if a terminal
 supports Unicode

---
 lldb/include/lldb/Host/Terminal.h| 11 +++
 lldb/source/Host/common/DiagnosticsRendering.cpp |  8 +++-
 lldb/source/Host/common/Terminal.cpp | 15 +++
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/lldb/include/lldb/Host/Terminal.h 
b/lldb/include/lldb/Host/Terminal.h
index da0d05e8bd265..6da5d45644b28 100644
--- a/lldb/include/lldb/Host/Terminal.h
+++ b/lldb/include/lldb/Host/Terminal.h
@@ -169,6 +169,17 @@ class TerminalState {
   lldb::pid_t m_process_group = -1;   ///< Cached process group 
information.
 };
 
+/// Returns whether or not the current terminal supports Unicode rendering.
+///
+/// The value is cached after the first computation.
+///
+/// On POSIX systems, we check if the LANG environment variable contains the
+/// substring "UTF-8";
+///
+/// On Windows, we check that we are running from the Windows Terminal
+/// application.
+bool TerminalSupportsUnicode();
+
 } // namespace lldb_private
 
 #endif // LLDB_HOST_TERMINAL_H
diff --git a/lldb/source/Host/common/DiagnosticsRendering.cpp 
b/lldb/source/Host/common/DiagnosticsRendering.cpp
index f2cd3968967fb..c7e083573c631 100644
--- a/lldb/source/Host/common/DiagnosticsRendering.cpp
+++ b/lldb/source/Host/common/DiagnosticsRendering.cpp
@@ -7,6 +7,8 @@
 
//===--===//
 
 #include "lldb/Host/common/DiagnosticsRendering.h"
+#include "lldb/Host/Terminal.h"
+
 #include 
 
 using namespace lldb_private;
@@ -97,12 +99,8 @@ void RenderDiagnosticDetails(Stream &stream,
 return;
   }
 
-  // Since there is no other way to find this out, use the color
-  // attribute as a proxy for whether the terminal supports Unicode
-  // characters.  In the future it might make sense to move this into
-  // Host so it can be customized for a specific platform.
   llvm::StringRef cursor, underline, vbar, joint, hbar, spacer;
-  if (stream.AsRawOstream().colors_enabled()) {
+  if (TerminalSupportsUnicode()) {
 cursor = "˄";
 underline = "˜";
 vbar = "│";
diff --git a/lldb/source/Host/common/Terminal.cpp 
b/lldb/source/Host/common/Terminal.cpp
index 436dfd8130d9b..825e9e0aee78e 100644
--- a/lldb/source/Host/common/Terminal.cpp
+++ b/lldb/source/Host/common/Terminal.cpp
@@ -472,3 +472,18 @@ bool TerminalState::TTYStateIsValid() const { return 
bool(m_data); }
 bool TerminalState::ProcessGroupIsValid() const {
   return static_cast(m_process_group) != -1;
 }
+
+bool lldb_private::TerminalSupportsUnicode() {
+  static std::optional result;
+  if (result)
+return result.value();
+#ifdef _WIN32
+  return true;
+#else
+  const char *lang_var = std::getenv("LANG");
+  if (!lang_var)
+return false;
+  result = llvm::StringRef(lang_var).lower().find("utf-8") != 
std::string::npos;
+#endif
+  return result.value();
+}

>From 6fc6b567ba158d9867561b45ac68a3601c28c67e Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Wed, 19 Nov 2025 15:01:23 +0100
Subject: [PATCH 2/4] fixup! [lldb] improve the heuristics for checking if a
 terminal supports Unicode

---
 lldb/include/lldb/Host/Terminal.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lldb/include/lldb/Host/Terminal.h 
b/lldb/include/lldb/Host/Terminal.h
index 6da5d45644b28..bfcd66b13ded8 100644
--- a/lldb/include/lldb/Host/Terminal.h
+++ b/lldb/include/lldb/Host/Terminal.h
@@ -174,10 +174,11 @@ class TerminalState {
 /// The value is cached after the first computation.
 ///
 /// On POSIX systems, we check if the LANG environment variable contains the
-/// substring "UTF-8";
+/// substring "UTF-8", case insensitive.
 ///
-/// On Windows, we check that we are running from the Windows Terminal
-/// application.
+/// On Windows, we always return true since we use the `WriteConsoleW` API
+/// internally. Note that the default Windows codepage (437) does not support
+/// all Unicode characters. This function does not check the codepage.
 bool TerminalSupportsUnicode();
 
 } // namespace lldb_private

>From 19cad716e620256a06be2ac03351b0a5116380ee Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Mon, 24 Nov 2025 18:02:45 +
Subject: [PATCH 3/4] fixup! fixup! [lldb] improve the heuristics for checking
 if a terminal supports Unicode

---
 lldb/include/lldb/Host/Terminal.h| 24 +++---
 lldb/source/Host/common/Terminal.cpp | 30 ++--
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/lldb/include/lldb/Host/Terminal.h 
b/lldb/include/lldb/Host/Terminal.h
index bfcd66b13ded8..3d66515c18812 100644
--- a/lldb/include/lldb/Host/Terminal.h
+++ b/lldb/include/lldb/Host/T

[Lldb-commits] [lldb] [lldb-dap] Add data breakpoints for bytes (PR #167237)

2025-11-28 Thread Ebuka Ezike via lldb-commits


@@ -678,7 +678,7 @@ llvm::json::Value CreateThreadStopped(DAP &dap, 
lldb::SBThread &thread,
   } break;
   case lldb::eStopReasonWatchpoint:
   case lldb::eStopReasonInstrumentation:
-body.try_emplace("reason", "breakpoint");
+body.try_emplace("reason", "data breakpoint");

da-viper wrote:

the data breakpoint reason should only apply to `eStopReasonWatchpoint` 

we should also append the `description` and `hitBreakpointIds` see the case 
`eStopReasonBreakpoint` above. 

https://github.com/llvm/llvm-project/pull/167237
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 5ab3375 - [lldb-dap] Add multi-session support with shared debugger instances (#163653)

2025-11-28 Thread via lldb-commits

Author: Janet Yang
Date: 2025-11-26T10:32:25-08:00
New Revision: 5ab3375b2cf461ab02704d129a1f4d5ba1a1e275

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

LOG: [lldb-dap] Add multi-session support with shared debugger instances 
(#163653)

## Summary:
This change introduces a `DAPSessionManager` to enable multiple DAP
sessions to share debugger instances when needed, for things like child
process debugging and some scripting hooks that create dynamically new
targets.

Changes include:
- Add `DAPSessionManager` singleton to track and coordinate all active DAP
sessions
- Support attaching to an existing target via its globally unique target
ID (targetId parameter)
- Share debugger instances across sessions when new targets are created
dynamically
- Refactor event thread management to allow sharing event threads
between sessions and move event thread and event thread handlers to 
`EventHelpers`
- Add `eBroadcastBitNewTargetCreated` event to notify when new targets are
created
- Extract session names from target creation events
- Defer debugger initialization from 'initialize' request to
'launch'/'attach' requests. The only time the debugger is used currently
in between its creation in `InitializeRequestHandler` and the `Launch`
or `Attach` requests is during the `TelemetryDispatcher` destruction
call at the end of the `DAP::HandleObject` call, so this is safe.

This enables scenarios when new targets are created dynamically so that
the debug adapter can automatically start a new debug session for the
spawned target while sharing the debugger instance.

## Tests:
The refactoring maintains backward compatibility. All existing DAP test
cases pass.

Also added a few basic unit tests for DAPSessionManager
```
>> ninja DAPTests
>> ./tools/lldb/unittests/DAP/DAPTests
>>./bin/llvm-lit -v ../llvm-project/lldb/test/API/tools/lldb-dap/
```

Added: 
lldb/tools/lldb-dap/DAPSessionManager.cpp
lldb/tools/lldb-dap/DAPSessionManager.h
lldb/unittests/DAP/DAPSessionManagerTest.cpp

Modified: 
lldb/include/lldb/API/SBTarget.h
lldb/include/lldb/Target/Target.h
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
lldb/source/API/SBTarget.cpp
lldb/source/Target/Target.cpp
lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py
lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
lldb/tools/lldb-dap/CMakeLists.txt
lldb/tools/lldb-dap/DAP.cpp
lldb/tools/lldb-dap/DAP.h
lldb/tools/lldb-dap/DAPForward.h
lldb/tools/lldb-dap/EventHelper.cpp
lldb/tools/lldb-dap/EventHelper.h
lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
lldb/tools/lldb-dap/Handler/InitializeRequestHandler.cpp
lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp
lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
lldb/tools/lldb-dap/package.json
lldb/tools/lldb-dap/tool/lldb-dap.cpp
lldb/unittests/DAP/CMakeLists.txt
llvm/utils/gn/secondary/lldb/tools/lldb-dap/BUILD.gn

Removed: 




diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index 379a0bb7e9513..d0b91ff4741fa 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -44,6 +44,7 @@ class LLDB_API SBTarget {
 eBroadcastBitWatchpointChanged = (1 << 3),
 eBroadcastBitSymbolsLoaded = (1 << 4),
 eBroadcastBitSymbolsChanged = (1 << 5),
+eBroadcastBitNewTargetCreated = (1 << 6),
   };
 
   // Constructors
@@ -64,6 +65,10 @@ class LLDB_API SBTarget {
 
   static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);
 
+  /// For eBroadcastBitNewTargetCreated events, returns the newly created
+  /// target. For other event types, returns an invalid SBTarget.
+  static lldb::SBTarget GetCreatedTargetFromEvent(const lldb::SBEvent &event);
+
   static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);
 
   static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
@@ -365,6 +370,16 @@ class LLDB_API SBTarget {
   /// LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID if the target is invalid.
   lldb::user_id_t GetGloballyUniqueID() const;
 
+  /// Get the target session name for this target.
+  ///
+  /// The target session name provides a meaningful name for IDEs or tools to
+  /// display to help the user identify the origin and purpose of the target.
+  ///
+  /// \return
+  /// The target session name for this target, or nullptr if the target is
+  /// invalid or has no target session name.
+  const char *GetTargetSessionName() const;
+
   SBError SetLabel(const char *label);
 
   /// Architecture opcode byte size width accessor

diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 908

[Lldb-commits] [lldb] [llvm] [DRAFT][lldb][windows] add Windows Virtual Console support (PR #168729)

2025-11-28 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit updated 
https://github.com/llvm/llvm-project/pull/168729

>From 3ac4774c5d45ef4830b6605d7de9e133a19a1c60 Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Wed, 26 Nov 2025 18:25:23 +
Subject: [PATCH] [lldb][windows] add Windows Virtual Console support

---
 lldb/include/lldb/Host/ProcessLaunchInfo.h|   4 +-
 lldb/include/lldb/Host/PseudoTerminal.h   |  40 -
 .../Host/windows/ProcessLauncherWindows.h |  29 
 .../lldb/Host/windows/PseudoTerminalWindows.h |  37 
 lldb/include/lldb/Host/windows/windows.h  |   4 +-
 lldb/include/lldb/Target/Process.h|  28 +++
 lldb/source/Host/CMakeLists.txt   |   1 +
 lldb/source/Host/common/ProcessLaunchInfo.cpp |  19 +-
 lldb/source/Host/common/PseudoTerminal.cpp|  12 +-
 .../Host/windows/ProcessLauncherWindows.cpp   | 164 ++
 .../Host/windows/PseudoTerminalWindows.cpp|  68 
 lldb/source/Interpreter/ScriptInterpreter.cpp |   2 +-
 .../Platform/Windows/PlatformWindows.cpp  |  11 +-
 .../Process/Windows/Common/ProcessWindows.cpp |  32 ++--
 .../Process/Windows/Common/ProcessWindows.h   |   8 +-
 lldb/source/Target/Process.cpp|  17 +-
 .../tools/lldb-dap/launch/TestDAP_launch.py   |   1 -
 .../GDBRemoteCommunicationClientTest.cpp  |  34 ++--
 .../gn/secondary/lldb/source/Host/BUILD.gn|   1 +
 19 files changed, 369 insertions(+), 143 deletions(-)
 create mode 100644 lldb/include/lldb/Host/windows/PseudoTerminalWindows.h
 create mode 100644 lldb/source/Host/windows/PseudoTerminalWindows.cpp

diff --git a/lldb/include/lldb/Host/ProcessLaunchInfo.h 
b/lldb/include/lldb/Host/ProcessLaunchInfo.h
index 25762bc65295d..e0528c5b80539 100644
--- a/lldb/include/lldb/Host/ProcessLaunchInfo.h
+++ b/lldb/include/lldb/Host/ProcessLaunchInfo.h
@@ -118,7 +118,9 @@ class ProcessLaunchInfo : public ProcessInfo {
 
   bool MonitorProcess() const;
 
-  PseudoTerminal &GetPTY() { return *m_pty; }
+  PseudoTerminal &GetPTY() const { return *m_pty; }
+
+  std::shared_ptr GetPTYSP() const { return m_pty; }
 
   void SetLaunchEventData(const char *data) { m_event_data.assign(data); }
 
diff --git a/lldb/include/lldb/Host/PseudoTerminal.h 
b/lldb/include/lldb/Host/PseudoTerminal.h
index bd1e2f56241b2..b61c213e138cb 100644
--- a/lldb/include/lldb/Host/PseudoTerminal.h
+++ b/lldb/include/lldb/Host/PseudoTerminal.h
@@ -35,11 +35,14 @@ class PseudoTerminal {
 
   /// Destructor
   ///
-  /// The destructor will close the primary and secondary file descriptors if
-  /// they are valid and ownership has not been released using one of: @li
-  /// PseudoTerminal::ReleasePrimaryFileDescriptor() @li
-  /// PseudoTerminal::ReleaseSaveFileDescriptor()
-  ~PseudoTerminal();
+  /// The destructor will close the primary and secondary file
+  /// descriptor/HANDLEs if they are valid and ownership has not been released
+  /// using PseudoTerminal::Close().
+  virtual ~PseudoTerminal();
+
+  /// Close all the file descriptors or Handles of the PseudoTerminal if they
+  /// are valid.
+  virtual void Close();
 
   /// Close the primary file descriptor if it is valid.
   void ClosePrimaryFileDescriptor();
@@ -59,8 +62,7 @@ class PseudoTerminal {
   ///
   /// This class will close the file descriptors for the primary/secondary when
   /// the destructor is called. The file handles can be released using either:
-  /// @li PseudoTerminal::ReleasePrimaryFileDescriptor() @li
-  /// PseudoTerminal::ReleaseSaveFileDescriptor()
+  /// @li PseudoTerminal::ReleasePrimaryFileDescriptor()
   ///
   /// \return
   /// \b Parent process: a child process ID that is greater
@@ -82,6 +84,16 @@ class PseudoTerminal {
   /// \see PseudoTerminal::ReleasePrimaryFileDescriptor()
   int GetPrimaryFileDescriptor() const;
 
+  /// The primary HANDLE accessor.
+  ///
+  /// This object retains ownership of the primary HANDLE when this
+  /// accessor is used.
+  ///
+  /// \return
+  /// The primary HANDLE, or INVALID_HANDLE_VALUE if the primary HANDLE is
+  /// not currently valid.
+  virtual void *GetPrimaryHandle() const { return ((void *)(long long)-1); };
+
   /// The secondary file descriptor accessor.
   ///
   /// This object retains ownership of the secondary file descriptor when this
@@ -105,7 +117,17 @@ class PseudoTerminal {
   /// The name of the secondary pseudo terminal.
   ///
   /// \see PseudoTerminal::OpenFirstAvailablePrimary()
-  std::string GetSecondaryName() const;
+  virtual std::string GetSecondaryName() const;
+
+  /// The underlying Windows Pseudo Terminal HANDLE's accessor.
+  ///
+  /// This object retains ownership of the ConPTY's HANDLE when this
+  /// accessor is used.
+  ///
+  /// \return
+  /// The primary HANDLE, or INVALID_HANDLE_VALUE if the primary HANDLE is
+  /// not currently valid.
+  virtual void *GetPseudoTerminalHandle() { return ((void *)(long long)-1); };
 
   /// Open the first available pseudo terminal.
   ///
@@ -126,7 +14

[Lldb-commits] [lldb] [llvm] [DRAFT][lldb][windows] add Windows Virtual Console support (PR #168729)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -0,0 +1,61 @@
+//===-- ConnectionPseudoTerminalWindows.h *- C++
+//-*-===//

charles-zablit wrote:

Fixed, thanks!

https://github.com/llvm/llvm-project/pull/168729
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [DRAFT][lldb][windows] add Windows Virtual Console support (PR #168729)

2025-11-28 Thread Charles Zablit via lldb-commits


@@ -542,6 +542,9 @@ static llvm::Error serveConnection(
 }
 
 int main(int argc, char *argv[]) {
+  int zzz = 0;
+  while (zzz) {
+  }

charles-zablit wrote:

Removed  :)

https://github.com/llvm/llvm-project/pull/168729
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][NativePDB] Look for PDBs in `target.debug-file-search-paths` (PR #169719)

2025-11-28 Thread via lldb-commits

https://github.com/Nerixyz created 
https://github.com/llvm/llvm-project/pull/169719

Similar to DWARF's DWO, we should look for PDBs in 
`target.debug-file-search-paths` if the PDB isn't at the original location or 
next to the executable.

With this PR, the search order is as follows:

1. PDB path specified in the PE/COFF file
2. Next to the executable
3. In `target.debug-file-search-paths`

This roughly matches [the order Visual Studio 
uses](https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2022#where-the-debugger-looks-for-symbols),
 except that we don't have a project folder and don't support symbol servers.

Closes #125355 (though I think this is already fixed in the native plugin).

>From 4cde00bf2947b8b10f0579f76d519c3af17bcb58 Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Wed, 26 Nov 2025 20:43:32 +0100
Subject: [PATCH] [LLDB][NativePDB] Look for PDB in
 `target.debug-file-search-paths`

---
 .../NativePDB/SymbolFileNativePDB.cpp | 52 +---
 .../NativePDB/find-pdb-next-to-exe.test   | 81 +++
 2 files changed, 124 insertions(+), 9 deletions(-)
 create mode 100644 
lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index aaec1600dacff..4ee1b0759a10e 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -86,6 +86,40 @@ static lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
   }
 }
 
+static std::optional
+findMatchingPDBFilePath(llvm::StringRef original_pdb_path,
+llvm::StringRef exe_path) {
+  const FileSystem &fs = FileSystem::Instance();
+
+  if (fs.Exists(original_pdb_path))
+return std::string(original_pdb_path);
+
+  const auto exe_dir = FileSpec(exe_path).CopyByRemovingLastPathComponent();
+  // While the exe_path uses the native style, the exe might be compiled on a
+  // different OS, so try to guess the style used.
+  const FileSpec original_pdb_spec(original_pdb_path,
+   FileSpec::GuessPathStyle(original_pdb_path)
+   .value_or(FileSpec::Style::native));
+  const llvm::StringRef pdb_filename = original_pdb_spec.GetFilename();
+
+  // If the file doesn't exist, perhaps the path specified at build time
+  // doesn't match the PDB's current location, so check the location of the
+  // executable.
+  const FileSpec local_pdb = 
exe_dir.CopyByAppendingPathComponent(pdb_filename);
+  if (fs.Exists(local_pdb))
+return local_pdb.GetPath();
+
+  // Otherwise, search for one in target.debug-file-search-paths
+  FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
+  for (const FileSpec &search_dir : search_paths) {
+FileSpec pdb_path = search_dir.CopyByAppendingPathComponent(pdb_filename);
+if (fs.Exists(pdb_path))
+  return pdb_path.GetPath();
+  }
+
+  return std::nullopt;
+}
+
 static std::unique_ptr
 loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator) {
   // Try to find a matching PDB for an EXE.
@@ -113,17 +147,14 @@ loadMatchingPDBFile(std::string exe_path, 
llvm::BumpPtrAllocator &allocator) {
 return nullptr;
   }
 
-  // If the file doesn't exist, perhaps the path specified at build time
-  // doesn't match the PDB's current location, so check the location of the
-  // executable.
-  if (!FileSystem::Instance().Exists(pdb_file)) {
-const auto exe_dir = FileSpec(exe_path).CopyByRemovingLastPathComponent();
-const auto pdb_name = FileSpec(pdb_file).GetFilename().GetCString();
-pdb_file = 
exe_dir.CopyByAppendingPathComponent(pdb_name).GetPathAsConstString().GetStringRef();
-  }
+  std::optional resolved_pdb_path =
+  findMatchingPDBFilePath(pdb_file, exe_path);
+  if (!resolved_pdb_path)
+return nullptr;
 
   // If the file is not a PDB or if it doesn't have a matching GUID, fail.
-  auto pdb = ObjectFilePDB::loadPDBFile(std::string(pdb_file), allocator);
+  auto pdb =
+  ObjectFilePDB::loadPDBFile(*std::move(resolved_pdb_path), allocator);
   if (!pdb)
 return nullptr;
 
@@ -137,6 +168,9 @@ loadMatchingPDBFile(std::string exe_path, 
llvm::BumpPtrAllocator &allocator) {
 
   if (expected_info->getGuid() != guid)
 return nullptr;
+
+  LLDB_LOG(GetLog(LLDBLog::Symbols), "Loading {0} for {1}", pdb->getFilePath(),
+   exe_path);
   return pdb;
 }
 
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test 
b/lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test
new file mode 100644
index 0..9ca850b1fd5b6
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test
@@ -0,0 +1,81 @@
+# REQUIRES: lld, target-windows
+
+# Test where LLDB looks for PDBs.
+# RUN: split-

[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }
+
+  if (size > 8) {
+return llvm::createStringError(
+"Invalid address size for DW_OP_deref_size: %d\n", size);
+  }
+  Value::ValueType value_type = stack.back().GetValueType();
   switch (value_type) {
   case Value::ValueType::HostAddress: {
 void *src = (void *)stack.back().GetScalar().ULongLong();
 intptr_t ptr;
 ::memcpy(&ptr, src, sizeof(void *));
+// I can't decide whether the size operand should apply to the bytes in
+// their
+// lldb-host endianness or the target endianness.. I doubt this'll ever
+// come up but I'll opt for assuming big endian regardless.
+switch (size) {
+case 1:
+  ptr = ptr & 0xff;
+  break;
+case 2:
+  ptr = ptr & 0x;
+  break;
+case 3:
+  ptr = ptr & 0xff;
+  break;
+case 4:
+  ptr = ptr & 0x;
+  break;
+// the casts are added to work around the case where intptr_t is a 32
+// bit quantity;
+// presumably we won't hit the 5..7 cases if (void*) is 32-bits in this
+// program.
+case 5:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+case 6:
+  ptr = (intptr_t)ptr & 0xULL;
+  break;
+case 7:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+default:
+  break;
+}
 stack.back().GetScalar() = ptr;
 stack.back().ClearContext();
   } break;
   case Value::ValueType::FileAddress: {
 auto file_addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
 Address so_addr;
-auto maybe_load_addr = ResolveLoadAddress(exe_ctx, module_sp, 
"DW_OP_deref",
-  file_addr, so_addr);
+auto maybe_load_addr = ResolveLoadAddress(
+exe_ctx, module_sp, "DW_OP_deref_size", file_addr, so_addr,
+/*check_sectionoffset=*/true);
+
 if (!maybe_load_addr)
   return maybe_load_addr.takeError();
-stack.back().GetScalar() = *maybe_load_addr;
+
+addr_t load_addr = *maybe_load_addr;
+
+if (load_addr == LLDB_INVALID_ADDRESS && so_addr.IsSectionOffset()) {
+  uint8_t addr_bytes[8];
+  Status error;
+
+  if (target && target->ReadMemory(so_addr, &addr_bytes, size, error,
+   /*force_live_memory=*/false) == size) {
+ObjectFile *objfile = module_sp->GetObjectFile();
+
+stack.back().GetScalar() = DerefSizeExtractDataHelper(
+addr_bytes, size, objfile->GetByteOrder(), size);
+stack.back().ClearContext();
+break;
+  } else {
+return llvm::createStringError(
+"Failed to dereference pointer for DW_OP_deref_size: "
+"%s\n",
+error.AsCString());
+  }
+}
+stack.back().GetScalar() = load_addr;
 // Fall through to load address promotion code below.
   }
+
 [[fallthrough]];
   case Value::ValueType::Scalar:
 // Promote Scalar to LoadAddress and fall through.
 stack.back().SetValueType(Value::ValueType::LoadAddress);
 [[fallthrough]];
-  case Value::ValueT

[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }
+
+  if (size > 8) {
+return llvm::createStringError(
+"Invalid address size for DW_OP_deref_size: %d\n", size);
+  }
+  Value::ValueType value_type = stack.back().GetValueType();
   switch (value_type) {
   case Value::ValueType::HostAddress: {
 void *src = (void *)stack.back().GetScalar().ULongLong();
 intptr_t ptr;
 ::memcpy(&ptr, src, sizeof(void *));
+// I can't decide whether the size operand should apply to the bytes in
+// their
+// lldb-host endianness or the target endianness.. I doubt this'll ever
+// come up but I'll opt for assuming big endian regardless.
+switch (size) {
+case 1:
+  ptr = ptr & 0xff;
+  break;
+case 2:
+  ptr = ptr & 0x;
+  break;
+case 3:
+  ptr = ptr & 0xff;
+  break;
+case 4:
+  ptr = ptr & 0x;
+  break;
+// the casts are added to work around the case where intptr_t is a 32
+// bit quantity;
+// presumably we won't hit the 5..7 cases if (void*) is 32-bits in this
+// program.
+case 5:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+case 6:
+  ptr = (intptr_t)ptr & 0xULL;
+  break;
+case 7:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+default:
+  break;
+}
 stack.back().GetScalar() = ptr;
 stack.back().ClearContext();
   } break;
   case Value::ValueType::FileAddress: {
 auto file_addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
 Address so_addr;
-auto maybe_load_addr = ResolveLoadAddress(exe_ctx, module_sp, 
"DW_OP_deref",
-  file_addr, so_addr);
+auto maybe_load_addr = ResolveLoadAddress(
+exe_ctx, module_sp, "DW_OP_deref_size", file_addr, so_addr,
+/*check_sectionoffset=*/true);
+
 if (!maybe_load_addr)
   return maybe_load_addr.takeError();
-stack.back().GetScalar() = *maybe_load_addr;
+
+addr_t load_addr = *maybe_load_addr;
+
+if (load_addr == LLDB_INVALID_ADDRESS && so_addr.IsSectionOffset()) {
+  uint8_t addr_bytes[8];
+  Status error;
+
+  if (target && target->ReadMemory(so_addr, &addr_bytes, size, error,
+   /*force_live_memory=*/false) == size) {
+ObjectFile *objfile = module_sp->GetObjectFile();
+
+stack.back().GetScalar() = DerefSizeExtractDataHelper(
+addr_bytes, size, objfile->GetByteOrder(), size);
+stack.back().ClearContext();
+break;
+  } else {
+return llvm::createStringError(
+"Failed to dereference pointer for DW_OP_deref_size: "
+"%s\n",
+error.AsCString());
+  }
+}
+stack.back().GetScalar() = load_addr;
 // Fall through to load address promotion code below.
   }
+
 [[fallthrough]];
   case Value::ValueType::Scalar:
 // Promote Scalar to LoadAddress and fall through.
 stack.back().SetValueType(Value::ValueType::LoadAddress);
 [[fallthrough]];
-  case Value::ValueT

[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }
+
+  if (size > 8) {
+return llvm::createStringError(
+"Invalid address size for DW_OP_deref_size: %d\n", size);
+  }
+  Value::ValueType value_type = stack.back().GetValueType();
   switch (value_type) {
   case Value::ValueType::HostAddress: {
 void *src = (void *)stack.back().GetScalar().ULongLong();
 intptr_t ptr;
 ::memcpy(&ptr, src, sizeof(void *));
+// I can't decide whether the size operand should apply to the bytes in
+// their
+// lldb-host endianness or the target endianness.. I doubt this'll ever
+// come up but I'll opt for assuming big endian regardless.

JDevlieghere wrote:

I know you're just moving this, but please reflow this comment and the one 
below.

https://github.com/llvm/llvm-project/pull/169587
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar

JDevlieghere wrote:

Can you format these properly to be Doxygen comments? Also please add 
capitalization and periods.

https://github.com/llvm/llvm-project/pull/169587
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }
+
+  if (size > 8) {
+return llvm::createStringError(
+"Invalid address size for DW_OP_deref_size: %d\n", size);
+  }
+  Value::ValueType value_type = stack.back().GetValueType();
   switch (value_type) {
   case Value::ValueType::HostAddress: {
 void *src = (void *)stack.back().GetScalar().ULongLong();
 intptr_t ptr;
 ::memcpy(&ptr, src, sizeof(void *));
+// I can't decide whether the size operand should apply to the bytes in
+// their
+// lldb-host endianness or the target endianness.. I doubt this'll ever
+// come up but I'll opt for assuming big endian regardless.
+switch (size) {
+case 1:
+  ptr = ptr & 0xff;
+  break;
+case 2:
+  ptr = ptr & 0x;
+  break;
+case 3:
+  ptr = ptr & 0xff;
+  break;
+case 4:
+  ptr = ptr & 0x;
+  break;
+// the casts are added to work around the case where intptr_t is a 32
+// bit quantity;
+// presumably we won't hit the 5..7 cases if (void*) is 32-bits in this
+// program.
+case 5:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+case 6:
+  ptr = (intptr_t)ptr & 0xULL;
+  break;
+case 7:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+default:
+  break;
+}
 stack.back().GetScalar() = ptr;
 stack.back().ClearContext();
   } break;
   case Value::ValueType::FileAddress: {
 auto file_addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
 Address so_addr;
-auto maybe_load_addr = ResolveLoadAddress(exe_ctx, module_sp, 
"DW_OP_deref",
-  file_addr, so_addr);
+auto maybe_load_addr = ResolveLoadAddress(
+exe_ctx, module_sp, "DW_OP_deref_size", file_addr, so_addr,
+/*check_sectionoffset=*/true);
+
 if (!maybe_load_addr)
   return maybe_load_addr.takeError();
-stack.back().GetScalar() = *maybe_load_addr;
+
+addr_t load_addr = *maybe_load_addr;
+
+if (load_addr == LLDB_INVALID_ADDRESS && so_addr.IsSectionOffset()) {
+  uint8_t addr_bytes[8];
+  Status error;
+
+  if (target && target->ReadMemory(so_addr, &addr_bytes, size, error,
+   /*force_live_memory=*/false) == size) {
+ObjectFile *objfile = module_sp->GetObjectFile();
+
+stack.back().GetScalar() = DerefSizeExtractDataHelper(
+addr_bytes, size, objfile->GetByteOrder(), size);
+stack.back().ClearContext();
+break;
+  } else {
+return llvm::createStringError(
+"Failed to dereference pointer for DW_OP_deref_size: "
+"%s\n",
+error.AsCString());

JDevlieghere wrote:

Let's invert the condition and do an early return to save the indentation. 
While you're at it, errors shouldn't start with a capital letter. 

https://github.com/llvm/llvm-project/pull/169587
___
lldb-commits mailing list
[email protected]
https://li

[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread Ebuka Ezike via lldb-commits

https://github.com/da-viper edited 
https://github.com/llvm/llvm-project/pull/169652
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Use InlHostByteOrder in RegisterValue::SetValueFromData (PR #169624)

2025-11-28 Thread Jonas Devlieghere via lldb-commits
Matej =?utf-8?q?Ko=C5=A1=C3=ADk?= 
Message-ID:
In-Reply-To: 


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


https://github.com/llvm/llvm-project/pull/169624
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }
+
+  if (size > 8) {
+return llvm::createStringError(
+"Invalid address size for DW_OP_deref_size: %d\n", size);
+  }

JDevlieghere wrote:

No braces.

https://github.com/llvm/llvm-project/pull/169587
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }
+
+  if (size > 8) {
+return llvm::createStringError(
+"Invalid address size for DW_OP_deref_size: %d\n", size);
+  }
+  Value::ValueType value_type = stack.back().GetValueType();
   switch (value_type) {
   case Value::ValueType::HostAddress: {
 void *src = (void *)stack.back().GetScalar().ULongLong();
 intptr_t ptr;
 ::memcpy(&ptr, src, sizeof(void *));
+// I can't decide whether the size operand should apply to the bytes in
+// their
+// lldb-host endianness or the target endianness.. I doubt this'll ever
+// come up but I'll opt for assuming big endian regardless.
+switch (size) {
+case 1:
+  ptr = ptr & 0xff;
+  break;
+case 2:
+  ptr = ptr & 0x;
+  break;
+case 3:
+  ptr = ptr & 0xff;
+  break;
+case 4:
+  ptr = ptr & 0x;
+  break;
+// the casts are added to work around the case where intptr_t is a 32
+// bit quantity;
+// presumably we won't hit the 5..7 cases if (void*) is 32-bits in this
+// program.
+case 5:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+case 6:
+  ptr = (intptr_t)ptr & 0xULL;
+  break;
+case 7:
+  ptr = (intptr_t)ptr & 0xffULL;
+  break;
+default:
+  break;
+}
 stack.back().GetScalar() = ptr;
 stack.back().ClearContext();
   } break;
   case Value::ValueType::FileAddress: {
 auto file_addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
 Address so_addr;
-auto maybe_load_addr = ResolveLoadAddress(exe_ctx, module_sp, 
"DW_OP_deref",
-  file_addr, so_addr);
+auto maybe_load_addr = ResolveLoadAddress(
+exe_ctx, module_sp, "DW_OP_deref_size", file_addr, so_addr,
+/*check_sectionoffset=*/true);
+
 if (!maybe_load_addr)
   return maybe_load_addr.takeError();
-stack.back().GetScalar() = *maybe_load_addr;
+
+addr_t load_addr = *maybe_load_addr;
+
+if (load_addr == LLDB_INVALID_ADDRESS && so_addr.IsSectionOffset()) {
+  uint8_t addr_bytes[8];
+  Status error;
+
+  if (target && target->ReadMemory(so_addr, &addr_bytes, size, error,
+   /*force_live_memory=*/false) == size) {
+ObjectFile *objfile = module_sp->GetObjectFile();
+
+stack.back().GetScalar() = DerefSizeExtractDataHelper(
+addr_bytes, size, objfile->GetByteOrder(), size);
+stack.back().ClearContext();
+break;
+  } else {
+return llvm::createStringError(
+"Failed to dereference pointer for DW_OP_deref_size: "
+"%s\n",
+error.AsCString());
+  }
+}
+stack.back().GetScalar() = load_addr;
 // Fall through to load address promotion code below.
   }
+
 [[fallthrough]];
   case Value::ValueType::Scalar:
 // Promote Scalar to LoadAddress and fall through.
 stack.back().SetValueType(Value::ValueType::LoadAddress);
 [[fallthrough]];
-  case Value::ValueT

[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);

JDevlieghere wrote:

No else after return.

https://github.com/llvm/llvm-project/pull/169587
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -150,29 +152,38 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
   EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-if (!inst)
-  continue;
-DumpInstToLog(log, *inst, inst_list);
+  std::deque to_visit = {0};
+  llvm::SmallSet enqueued = {0};

felipepiovezan wrote:

I am adding zero to the list! Otherwise the loop below would never be entered 😅

https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Unify DW_OP_deref and DW_OP_deref_size implementations (PR #169587)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -861,84 +861,159 @@ ResolveLoadAddress(ExecutionContext *exe_ctx, 
lldb::ModuleSP &module_sp,
   return load_addr;
 }
 
-static llvm::Error Evaluate_DW_OP_deref(DWARFExpression::Stack &stack,
-ExecutionContext *exe_ctx,
-lldb::ModuleSP module_sp,
-Process *process) {
-  if (stack.empty())
-return llvm::createStringError("expression stack empty for DW_OP_deref");
-
-  const Value::ValueType value_type = stack.back().GetValueType();
+/// Helper function to move common code used to load sized data from a uint8_t
+/// buffer.
+///
+/// \param addr_bytes uint8_t buffer containg raw data
+/// \param size_addr_bytes how large is the underlying raw data
+/// \param byte_order what is the byter order of the underlyig data
+/// \param size How much of the underlying data we want to use
+/// \return The underlying data converted into a Scalar
+static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
+ size_t size_addr_bytes,
+ ByteOrder byte_order, size_t size) {
+  DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
+
+  lldb::offset_t addr_data_offset = 0;
+  if (size <= 8)
+return addr_data.GetMaxU64(&addr_data_offset, size);
+  else
+return addr_data.GetAddress(&addr_data_offset);
+}
+
+static llvm::Error Evaluate_DW_OP_deref_size(DWARFExpression::Stack &stack,
+ ExecutionContext *exe_ctx,
+ lldb::ModuleSP module_sp,
+ Process *process, Target *target,
+ uint8_t size) {
+  if (stack.empty()) {
+return llvm::createStringError(
+"expression stack empty for DW_OP_deref_size");
+  }

JDevlieghere wrote:

No braces.

https://github.com/llvm/llvm-project/pull/169587
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix CxxMethodName Parser on return type (PR #169652)

2025-11-28 Thread Ebuka Ezike via lldb-commits

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

>From a0f2bcd3b3361572d68e11b6ee3b4284bc97679b Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 26 Nov 2025 13:52:51 +
Subject: [PATCH 1/2] [lldb] fix CxxMethodName Parser.

The simplified parser incorrectly assumes if there is a context,
there is no return type.
---
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 24 +++
 .../CPlusPlus/CPlusPlusLanguageTest.cpp   |  5 
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 4b66ff814935a..d347b57996c65 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -481,18 +481,22 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-if (IsTrivialBasename(m_basename)) {
+// if the context has a white space it may have a return type.
+// e.g. `int foo::bar::func()` or `Type foo::bar::func(int)`
+const bool no_whitespace =
+m_context.find_first_of(" \t\n\v\f\r") == llvm::StringRef::npos;
+
+if (no_whitespace && IsTrivialBasename(m_basename)) {
   return true;
-} else {
-  // The C++ basename doesn't match our regular expressions so this can't
-  // be a valid C++ method, clear everything out and indicate an error
-  m_context = llvm::StringRef();
-  m_basename = llvm::StringRef();
-  m_arguments = llvm::StringRef();
-  m_qualifiers = llvm::StringRef();
-  m_return_type = llvm::StringRef();
-  return false;
 }
+// The C++ basename doesn't match our regular expressions so this can't
+// be a valid C++ method, clear everything out and indicate an error
+m_context = llvm::StringRef();
+m_basename = llvm::StringRef();
+m_arguments = llvm::StringRef();
+m_qualifiers = llvm::StringRef();
+m_return_type = llvm::StringRef();
+return false;
   }
   return false;
 }
diff --git a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp 
b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
index 23f2f4218601a..f0c4b0a83c890 100644
--- a/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ b/lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -30,6 +30,9 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
   {"foo::~bar(baz)", "", "foo", "~bar", "(baz)", "", "foo::~bar"},
   {"a::b::c::d(e,f)", "", "a::b::c", "d", "(e,f)", "", "a::b::c::d"},
   {"void f(int)", "void", "", "f", "(int)", "", "f"},
+  {"int main()", "int", "", "main", "()", "", "main"},
+  {"int foo::bar::func01(int a, double b)", "int", "foo::bar", "func01",
+   "(int a, double b)", "", "foo::bar::func01"},
 
   // Operators
   {"std::basic_ostream >& "
@@ -101,6 +104,8 @@ TEST(CPlusPlusLanguage, MethodNameParsing) {
"std::forward"},
 
   // Templates
+  {"vector foo::bar::func(int)", "vector", "foo::bar", "func",
+   "(int)", "", "foo::bar::func"},
   {"void llvm::PM>::"
"addPass(llvm::VP)",
"void", "llvm::PM>",

>From 8634de5c8647c79f196fbf3b5c7745957bf5d7ae Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 26 Nov 2025 19:56:13 +
Subject: [PATCH 2/2] [lldb] add review changes

---
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  | 20 +--
 .../CPlusPlus/CPlusPlusLanguageTest.cpp   |  3 ++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index d347b57996c65..ab9affe438c86 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -208,6 +208,19 @@ static bool IsTrivialBasename(const llvm::StringRef 
&basename) {
   return idx == basename.size();
 }
 
+/// A context is trivial if an only if it matches this pattern.
+/// "^\s*([A-Za-z_:]*)\s*$".
+static bool IsTrivialContext(llvm::StringRef context) {
+  // remove trailing or leading whitespace.
+  context = context.trim();
+
+  const auto iter = context.find_if_not([](char current) {
+return std::isalnum(static_cast(current)) ||
+   current == '_' || current == ':';
+  });
+  return iter == llvm::StringRef::npos;
+}
+
 /// Writes out the function name in 'full_name' to 'out_stream'
 /// but replaces each argument type with the variable name
 /// and the corresponding pretty-printed value
@@ -481,12 +494,7 @@ bool 
CPlusPlusLanguage::CxxMethodName::TrySimplifiedParse() {
   m_basename = full.substr(basename_begin, basename_end - basename_begin);
 }
 
-// if the context has a white space it may have a return type.
-// e.g. `int foo::bar::func()

[Lldb-commits] [lldb] [LLDB][NativePDB] Look for PDBs in `target.debug-file-search-paths` (PR #169719)

2025-11-28 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: nerix (Nerixyz)


Changes

Similar to DWARF's DWO, we should look for PDBs in 
`target.debug-file-search-paths` if the PDB isn't at the original location or 
next to the executable.

With this PR, the search order is as follows:

1. PDB path specified in the PE/COFF file
2. Next to the executable
3. In `target.debug-file-search-paths`

This roughly matches [the order Visual Studio 
uses](https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2022#where-the-debugger-looks-for-symbols),
 except that we don't have a project folder and don't support symbol servers.

Closes #125355 (though I think this is already fixed in the native 
plugin).

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


2 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(+43-9) 
- (added) lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test (+81) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index aaec1600dacff..4ee1b0759a10e 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -86,6 +86,40 @@ static lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
   }
 }
 
+static std::optional
+findMatchingPDBFilePath(llvm::StringRef original_pdb_path,
+llvm::StringRef exe_path) {
+  const FileSystem &fs = FileSystem::Instance();
+
+  if (fs.Exists(original_pdb_path))
+return std::string(original_pdb_path);
+
+  const auto exe_dir = FileSpec(exe_path).CopyByRemovingLastPathComponent();
+  // While the exe_path uses the native style, the exe might be compiled on a
+  // different OS, so try to guess the style used.
+  const FileSpec original_pdb_spec(original_pdb_path,
+   FileSpec::GuessPathStyle(original_pdb_path)
+   .value_or(FileSpec::Style::native));
+  const llvm::StringRef pdb_filename = original_pdb_spec.GetFilename();
+
+  // If the file doesn't exist, perhaps the path specified at build time
+  // doesn't match the PDB's current location, so check the location of the
+  // executable.
+  const FileSpec local_pdb = 
exe_dir.CopyByAppendingPathComponent(pdb_filename);
+  if (fs.Exists(local_pdb))
+return local_pdb.GetPath();
+
+  // Otherwise, search for one in target.debug-file-search-paths
+  FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
+  for (const FileSpec &search_dir : search_paths) {
+FileSpec pdb_path = search_dir.CopyByAppendingPathComponent(pdb_filename);
+if (fs.Exists(pdb_path))
+  return pdb_path.GetPath();
+  }
+
+  return std::nullopt;
+}
+
 static std::unique_ptr
 loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator) {
   // Try to find a matching PDB for an EXE.
@@ -113,17 +147,14 @@ loadMatchingPDBFile(std::string exe_path, 
llvm::BumpPtrAllocator &allocator) {
 return nullptr;
   }
 
-  // If the file doesn't exist, perhaps the path specified at build time
-  // doesn't match the PDB's current location, so check the location of the
-  // executable.
-  if (!FileSystem::Instance().Exists(pdb_file)) {
-const auto exe_dir = FileSpec(exe_path).CopyByRemovingLastPathComponent();
-const auto pdb_name = FileSpec(pdb_file).GetFilename().GetCString();
-pdb_file = 
exe_dir.CopyByAppendingPathComponent(pdb_name).GetPathAsConstString().GetStringRef();
-  }
+  std::optional resolved_pdb_path =
+  findMatchingPDBFilePath(pdb_file, exe_path);
+  if (!resolved_pdb_path)
+return nullptr;
 
   // If the file is not a PDB or if it doesn't have a matching GUID, fail.
-  auto pdb = ObjectFilePDB::loadPDBFile(std::string(pdb_file), allocator);
+  auto pdb =
+  ObjectFilePDB::loadPDBFile(*std::move(resolved_pdb_path), allocator);
   if (!pdb)
 return nullptr;
 
@@ -137,6 +168,9 @@ loadMatchingPDBFile(std::string exe_path, 
llvm::BumpPtrAllocator &allocator) {
 
   if (expected_info->getGuid() != guid)
 return nullptr;
+
+  LLDB_LOG(GetLog(LLDBLog::Symbols), "Loading {0} for {1}", pdb->getFilePath(),
+   exe_path);
   return pdb;
 }
 
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test 
b/lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test
new file mode 100644
index 0..9ca850b1fd5b6
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/find-pdb-next-to-exe.test
@@ -0,0 +1,81 @@
+# REQUIRES: lld, target-windows
+
+# Test where LLDB looks for PDBs.
+# RUN: split-file %s %t
+
+# RUN: mkdir -p %t/build
+# RUN: mkdir -p %t/dir1
+# RUN: mkdir -p %t/dir2
+# RUN: mkdir -p %t/dir3
+
+# RUN: echo "settings append target.debug-file-search-paths %t/dir2" >> 
%t/init.input
+# RUN: echo "

[Lldb-commits] [lldb] [lldb] Use InlHostByteOrder in RegisterValue::SetValueFromData (PR #169624)

2025-11-28 Thread Jonas Devlieghere via lldb-commits
Matej =?utf-8?q?Ko=C5=A1=C3=ADk?= 
Message-ID:
In-Reply-To: 


JDevlieghere wrote:

LGTM. Please let us know if you need one of us to merge this on your behalf.

https://github.com/llvm/llvm-project/pull/169624
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -150,29 +152,38 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
   EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-if (!inst)
-  continue;
-DumpInstToLog(log, *inst, inst_list);
+  std::deque to_visit = {0};
+  llvm::SmallSet enqueued = {0};
+
+  // Instructions reachable through jumps are inserted on the front.
+  // The next instruction in inserted on the back.
+  // Pop from the back to ensure non-branching instructions are visited
+  // sequentially.
+  while (!to_visit.empty()) {
+std::size_t current_index = to_visit.back();

JDevlieghere wrote:

The current index remains unmodified, right?
```suggestion
const std::size_t current_index = to_visit.back();
```

https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Rewrite UnwindAssemblyInstEmulation in terms of a CFG visit (PR #169630)

2025-11-28 Thread Jonas Devlieghere via lldb-commits


@@ -150,29 +152,38 @@ bool 
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
   EmulateInstruction::InstructionCondition last_condition =
   EmulateInstruction::UnconditionalCondition;
 
-  for (const InstructionSP &inst : inst_list.Instructions()) {
-if (!inst)
-  continue;
-DumpInstToLog(log, *inst, inst_list);
+  std::deque to_visit = {0};
+  llvm::SmallSet enqueued = {0};

JDevlieghere wrote:

What's the point of initializing them like this? Why not 

```
std::deque to_visit;
llvm::SmallSet enqueued;
```

This seems needlessly confusing. Now I'm forced to double check that this is 
initializing both to zero elements and not adding a zero to the list (i.e. `= 
{{0}}`). 

https://github.com/llvm/llvm-project/pull/169630
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [test-suite] fix typo in variable in darwin builder (PR #169254)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

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


https://github.com/llvm/llvm-project/pull/169254
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [scripting bridge] 167388 chore: add api to return arch name for target (PR #168273)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere closed 
https://github.com/llvm/llvm-project/pull/168273
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere edited 
https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [test-suite] fix typo in variable in darwin builder (PR #169254)

2025-11-28 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere closed 
https://github.com/llvm/llvm-project/pull/169254
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread via lldb-commits

https://github.com/n2h9 edited https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Add Windows release binary builds (PR #150793)

2025-11-28 Thread Tom Stellard via lldb-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/150793

>From 2bc5c1ae0c21ebc0bfa28777d19751fe2a811487 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:27:08 -0700
Subject: [PATCH 01/61] Add Windows release binary builds

---
 .github/workflows/release-binaries-windows.yml | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 .github/workflows/release-binaries-windows.yml

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
new file mode 100644
index 0..fa116bc9a379a
--- /dev/null
+++ b/.github/workflows/release-binaries-windows.yml
@@ -0,0 +1,17 @@
+name: Release Binaries Windows
+
+on:
+  pull:
+
+
+permissions:
+  contents: read # Default everything to read-only
+
+jobs:
+  build-windows-release:
+runs-on: depot-windows-2022-16
+if: github.repository_owner == 'llvm'
+steps:
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - run: |
+llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 860dff2f330bd9c976cdabc77076c83f8da9b8d5 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:29:47 -0700
Subject: [PATCH 02/61] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index fa116bc9a379a..630a2facba8b4 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 6533e4438019c747abd4f9b1d6e6c32ce7948c90 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:31:42 -0700
Subject: [PATCH 03/61] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 630a2facba8b4..a7a4dc969ea43 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -1,7 +1,7 @@
 name: Release Binaries Windows
 
 on:
-  pull:
+  pull_request:
 
 
 permissions:

>From 04381bbafc5b02ada4eb0cd5e0d43b4e637e3b93 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:45:05 -0700
Subject: [PATCH 04/61] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index a7a4dc969ea43..58a1ad17ee44c 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python

>From 1a9ab34c48a532b397db2294aa8e2d868a21 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 21:18:40 -0700
Subject: [PATCH 05/61] Fix

---
 .github/workflows/release-binaries-windows.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 58a1ad17ee44c..86951337aa2ee 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -12,6 +12,8 @@ jobs:
 runs-on: depot-windows-2022-16
 if: github.repository_owner == 'llvm'
 steps:
-  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1A
+with:
+  ref: llvmorg-20.1.8
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--skip-checkout --local-python

>From d2dcb30b6707007267153683615528f274e40dd4 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Mon, 11 Aug 2025 20:28:56 +
Subject: [PATCH 06/61] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 86951337aa2ee..6793656c5dcef 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -9,7 +9,7 @@ permis

[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread via lldb-commits


@@ -300,16 +304,41 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
 // disassembled instruction stream, similar to how debug information
 // enhances source-level debugging.
 std::vector VariableAnnotator::Annotate(Instruction &inst) {
+  auto structured_annotations = AnnotateStructured(inst);

n2h9 wrote:

Updated :white_check_mark: 

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Add Windows release binary builds (PR #150793)

2025-11-28 Thread Tom Stellard via lldb-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/150793

>From 2bc5c1ae0c21ebc0bfa28777d19751fe2a811487 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:27:08 -0700
Subject: [PATCH 01/62] Add Windows release binary builds

---
 .github/workflows/release-binaries-windows.yml | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 .github/workflows/release-binaries-windows.yml

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
new file mode 100644
index 0..fa116bc9a379a
--- /dev/null
+++ b/.github/workflows/release-binaries-windows.yml
@@ -0,0 +1,17 @@
+name: Release Binaries Windows
+
+on:
+  pull:
+
+
+permissions:
+  contents: read # Default everything to read-only
+
+jobs:
+  build-windows-release:
+runs-on: depot-windows-2022-16
+if: github.repository_owner == 'llvm'
+steps:
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - run: |
+llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 860dff2f330bd9c976cdabc77076c83f8da9b8d5 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:29:47 -0700
Subject: [PATCH 02/62] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index fa116bc9a379a..630a2facba8b4 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 6533e4438019c747abd4f9b1d6e6c32ce7948c90 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:31:42 -0700
Subject: [PATCH 03/62] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 630a2facba8b4..a7a4dc969ea43 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -1,7 +1,7 @@
 name: Release Binaries Windows
 
 on:
-  pull:
+  pull_request:
 
 
 permissions:

>From 04381bbafc5b02ada4eb0cd5e0d43b4e637e3b93 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:45:05 -0700
Subject: [PATCH 04/62] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index a7a4dc969ea43..58a1ad17ee44c 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python

>From 1a9ab34c48a532b397db2294aa8e2d868a21 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 21:18:40 -0700
Subject: [PATCH 05/62] Fix

---
 .github/workflows/release-binaries-windows.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 58a1ad17ee44c..86951337aa2ee 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -12,6 +12,8 @@ jobs:
 runs-on: depot-windows-2022-16
 if: github.repository_owner == 'llvm'
 steps:
-  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1A
+with:
+  ref: llvmorg-20.1.8
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--skip-checkout --local-python

>From d2dcb30b6707007267153683615528f274e40dd4 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Mon, 11 Aug 2025 20:28:56 +
Subject: [PATCH 06/62] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 86951337aa2ee..6793656c5dcef 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -9,7 +9,7 @@ permis

[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread via lldb-commits


@@ -300,16 +304,41 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
 // disassembled instruction stream, similar to how debug information
 // enhances source-level debugging.
 std::vector VariableAnnotator::Annotate(Instruction &inst) {
+  auto structured_annotations = AnnotateStructured(inst);
+
   std::vector events;
+  events.reserve(structured_annotations.size());
+
+  for (const auto &annotation : structured_annotations) {

n2h9 wrote:

Updated :white_check_mark: 

Here and in most other places within this pr.

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Add Windows release binary builds (PR #150793)

2025-11-28 Thread Tom Stellard via lldb-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/150793

>From 2bc5c1ae0c21ebc0bfa28777d19751fe2a811487 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:27:08 -0700
Subject: [PATCH 01/63] Add Windows release binary builds

---
 .github/workflows/release-binaries-windows.yml | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 .github/workflows/release-binaries-windows.yml

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
new file mode 100644
index 0..fa116bc9a379a
--- /dev/null
+++ b/.github/workflows/release-binaries-windows.yml
@@ -0,0 +1,17 @@
+name: Release Binaries Windows
+
+on:
+  pull:
+
+
+permissions:
+  contents: read # Default everything to read-only
+
+jobs:
+  build-windows-release:
+runs-on: depot-windows-2022-16
+if: github.repository_owner == 'llvm'
+steps:
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - run: |
+llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 860dff2f330bd9c976cdabc77076c83f8da9b8d5 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:29:47 -0700
Subject: [PATCH 02/63] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index fa116bc9a379a..630a2facba8b4 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8

>From 6533e4438019c747abd4f9b1d6e6c32ce7948c90 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:31:42 -0700
Subject: [PATCH 03/63] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 630a2facba8b4..a7a4dc969ea43 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -1,7 +1,7 @@
 name: Release Binaries Windows
 
 on:
-  pull:
+  pull_request:
 
 
 permissions:

>From 04381bbafc5b02ada4eb0cd5e0d43b4e637e3b93 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 12:45:05 -0700
Subject: [PATCH 04/63] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index a7a4dc969ea43..58a1ad17ee44c 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -14,4 +14,4 @@ jobs:
 steps:
   - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python

>From 1a9ab34c48a532b397db2294aa8e2d868a21 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Sat, 26 Jul 2025 21:18:40 -0700
Subject: [PATCH 05/63] Fix

---
 .github/workflows/release-binaries-windows.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 58a1ad17ee44c..86951337aa2ee 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -12,6 +12,8 @@ jobs:
 runs-on: depot-windows-2022-16
 if: github.repository_owner == 'llvm'
 steps:
-  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1A
+with:
+  ref: llvmorg-20.1.8
   - run: |
-  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--local-python
+  llvm\utils\release\build_llvm_release.bat --x64 --version 20.1.8 
--skip-checkout --local-python

>From d2dcb30b6707007267153683615528f274e40dd4 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Mon, 11 Aug 2025 20:28:56 +
Subject: [PATCH 06/63] Fix

---
 .github/workflows/release-binaries-windows.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-binaries-windows.yml 
b/.github/workflows/release-binaries-windows.yml
index 86951337aa2ee..6793656c5dcef 100644
--- a/.github/workflows/release-binaries-windows.yml
+++ b/.github/workflows/release-binaries-windows.yml
@@ -9,7 +9,7 @@ permis

[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)

2025-11-28 Thread via lldb-commits

n2h9 wrote:

Also were updated since last review (while doing `auto` replacement):
- add  `const` statement for local variables where they are supposed to be read 
only;
- add `move` statement where `push_back` `annotation_entity` to `annotations` 
vector. 

https://github.com/llvm/llvm-project/pull/169408
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][PDB] Access object file through module (PR #169728)

2025-11-28 Thread via lldb-commits

https://github.com/Nerixyz created 
https://github.com/llvm/llvm-project/pull/169728

When a PDB is loaded through `target symbols add `, its 
`m_objectfile_sp` is an `ObjectFilePDB` instead of `ObjectFilePECOFF` (the 
debugged module). In both the native and DIA plugin, some paths assumed that 
`m_objectfile_sp` is the debugged module. With this PR, they go through 
`m_objfile_sp->GetModule()->GetObjectFile()`.

For the DIA plugin, this lead to an assertion failure 
(https://github.com/llvm/llvm-project/issues/169628#issuecomment-3582555277) 
and for both plugins, it meant that the symbol table wasn't loaded.

>From 2ce6a13861b96842b2f5ae9f7c63913da524088a Mon Sep 17 00:00:00 2001
From: Nerixyz 
Date: Wed, 26 Nov 2025 21:44:22 +0100
Subject: [PATCH] [LLDB][PDB] Access object file through module

---
 .../NativePDB/SymbolFileNativePDB.cpp |  3 +-
 .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp  |  9 +++--
 .../test/Shell/SymbolFile/PDB/add-symbols.cpp | 39 +++
 3 files changed, 47 insertions(+), 4 deletions(-)
 create mode 100644 lldb/test/Shell/SymbolFile/PDB/add-symbols.cpp

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index aaec1600dacff..40e783f9bad38 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1126,7 +1126,8 @@ lldb::LanguageType 
SymbolFileNativePDB::ParseLanguage(CompileUnit &comp_unit) {
 }
 
 void SymbolFileNativePDB::AddSymbols(Symtab &symtab) {
-  auto *section_list = m_objfile_sp->GetSectionList();
+  auto *section_list =
+  m_objfile_sp->GetModule()->GetObjectFile()->GetSectionList();
   if (!section_list)
 return;
 
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 0ccb1804bb13a..97c995fc9b22a 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -287,8 +287,10 @@ uint32_t SymbolFilePDB::CalculateAbilities() {
 }
 
 void SymbolFilePDB::InitializeObject() {
-  lldb::addr_t obj_load_address =
-  m_objfile_sp->GetBaseAddress().GetFileAddress();
+  lldb::addr_t obj_load_address = m_objfile_sp->GetModule()
+  ->GetObjectFile()
+  ->GetBaseAddress()
+  .GetFileAddress();
   lldbassert(obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS);
   m_session_up->setLoadAddress(obj_load_address);
   if (!m_global_scope_up)
@@ -1479,7 +1481,8 @@ void SymbolFilePDB::AddSymbols(lldb_private::Symtab 
&symtab) {
   if (!results)
 return;
 
-  auto section_list = m_objfile_sp->GetSectionList();
+  auto section_list =
+  m_objfile_sp->GetModule()->GetObjectFile()->GetSectionList();
   if (!section_list)
 return;
 
diff --git a/lldb/test/Shell/SymbolFile/PDB/add-symbols.cpp 
b/lldb/test/Shell/SymbolFile/PDB/add-symbols.cpp
new file mode 100644
index 0..ef7690b1720a6
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/add-symbols.cpp
@@ -0,0 +1,39 @@
+// REQUIRES: lld, target-windows
+
+// Test that `target symbols add ` works.
+// RUN: %build --compiler=clang-cl --nodefaultlib --output=%t.exe %s
+// RUN: mv %t.pdb %t-renamed.pdb
+
+// RUN: env LLDB_USE_NATIVE_PDB_READER=0 %lldb \
+// RUN:   -o "b main" \
+// RUN:   -o "target symbols add %t-renamed.pdb" \
+// RUN:   -o r \
+// RUN:   -o "target variable a" \
+// RUN:   -o "target modules dump symtab" \
+// RUN:   -b %t.exe | FileCheck %s
+
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb \
+// RUN:   -o "b main" \
+// RUN:   -o "target symbols add %t-renamed.pdb" \
+// RUN:   -o r \
+// RUN:   -o "target variable a" \
+// RUN:   -o "target modules dump symtab" \
+// RUN:   -b %t.exe | FileCheck %s
+
+// CHECK: target create
+// CHECK: (lldb) b main
+// CHECK-NEXT: Breakpoint 1: no locations (pending).
+// CHECK: (lldb) target symbols add
+// CHECK: 1 location added to breakpoint 1
+// CHECK: (lldb) r
+// CHECK: * thread #1, stop reason = breakpoint 1.1
+// CHECK: (lldb) target variable a
+// CHECK-NEXT: (A) a = (x = 47)
+// CHECK: (lldb) target modules dump symtab
+// CHECK: [{{.*}} main
+
+struct A {
+  int x = 47;
+};
+A a;
+int main() {}

___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


  1   2   3   4   >