[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits

https://github.com/hokein updated 
https://github.com/llvm/llvm-project/pull/73307

>From 5fb8fd532fe767feb2d361f9552ff31ea7770663 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 24 Nov 2023 10:46:03 +0100
Subject: [PATCH 1/2] [LLDB] Respect the DW_AT_alignment attribute.

Part of fixes for #72913.

clang emits the DW_AT_alignment attribute, however LLDB didn't respect it,
resulting an incorrect the RecordDecl built by lldb.

This only fixes non-inheritance cases. The inheritance case
will be handled in a follow-up patch.
---
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 12 ++--
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.h   |  1 +
 .../cpp/alignas_base_class/TestAlignAsBaseClass.py   |  4 
 lldb/test/API/lang/cpp/alignas_base_class/main.cpp   |  2 ++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index abe3c673e2cce69..a55ca0bf0f0fc1a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -355,6 +355,10 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const 
DWARFDIE &die) {
   byte_size = form_value.Unsigned();
   break;
 
+case DW_AT_alignment:
+  alignment = form_value.Unsigned();
+  break;
+
 case DW_AT_byte_stride:
   byte_stride = form_value.Unsigned();
   break;
@@ -1926,12 +1930,13 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   // TypeSystemClang is always in C++ mode, but some compilers such as
   // GCC and Clang give empty structs a size of 0 in C mode (in contrast to
   // the size of 1 for empty structs that would be computed in C++ mode).
-  if (attrs.byte_size) {
+  if (attrs.byte_size || attrs.alignment) {
 clang::RecordDecl *record_decl =
 TypeSystemClang::GetAsRecordDecl(clang_type);
 if (record_decl) {
   ClangASTImporter::LayoutInfo layout;
-  layout.bit_size = *attrs.byte_size * 8;
+  layout.bit_size = attrs.byte_size.value_or(0) * 8;
+  layout.alignment = attrs.alignment.value_or(0) * 8;
   GetClangASTImporter().SetRecordLayout(record_decl, layout);
 }
   }
@@ -2270,6 +2275,9 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
 if (layout_info.bit_size == 0)
   layout_info.bit_size =
   die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+if (layout_info.alignment == 0)
+  layout_info.alignment =
+  die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_alignment, 0) * 8;
 
 clang::CXXRecordDecl *record_decl =
 m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 0247783217008e8..81b705a036189eb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -456,6 +456,7 @@ struct ParsedDWARFTypeAttributes {
   lldb_private::plugin::dwarf::DWARFFormValue type;
   lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
   std::optional byte_size;
+  std::optional alignment;
   size_t calling_convention = llvm::dwarf::DW_CC_normal;
   uint32_t bit_stride = 0;
   uint32_t byte_stride = 0;
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index c7a88987733e176..7d97b0c42b7e166 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -12,3 +12,7 @@ def test(self):
 
 # The offset of f2 should be 8 because of `alignas(8)`.
 self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", 
result_value="8")
+
+# Verify specified class alignments.
+self.expect_expr("alignof(B2)", result_value="8")
+self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 8dfced6c784e102..cf727e808017bcc 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -10,4 +10,6 @@ struct D : B1, B2 {};
 
 D d3g;
 
+struct alignas(8) EmptyClassAlign8 {} t;
+
 int main() {}

>From fc488ecda9a0ab1a81d738b52b12ca88224346ea Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 28 Nov 2023 09:23:29 +0100
Subject: [PATCH 2/2] Update a stale comment.

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp| 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAS

[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits

https://github.com/hokein commented:

Thanks for the review.

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


[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits


@@ -1926,12 +1930,13 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   // TypeSystemClang is always in C++ mode, but some compilers such as
   // GCC and Clang give empty structs a size of 0 in C mode (in contrast to
   // the size of 1 for empty structs that would be computed in C++ mode).
-  if (attrs.byte_size) {
+  if (attrs.byte_size || attrs.alignment) {

hokein wrote:

Done.

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


[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits

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


[Lldb-commits] [flang] [libcxx] [compiler-rt] [clang] [llvm] [lldb] [clang-tools-extra] [libc] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-28 Thread Vlad Serebrennikov via lldb-commits

Endilll wrote:

> The human-readability of a big list of integers is not better than embedded 
> base64 -- and actually, seems more of a pain to decode.

I agree that the entirety of the data is not too comprehensible, but I can 
imagine users being interested in the first and last N bytes when they tweak 
offset and length of the embed. In this case list of integers is a clear winner.

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


[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits

https://github.com/hokein updated 
https://github.com/llvm/llvm-project/pull/73307

>From 5fb8fd532fe767feb2d361f9552ff31ea7770663 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 24 Nov 2023 10:46:03 +0100
Subject: [PATCH 1/3] [LLDB] Respect the DW_AT_alignment attribute.

Part of fixes for #72913.

clang emits the DW_AT_alignment attribute, however LLDB didn't respect it,
resulting an incorrect the RecordDecl built by lldb.

This only fixes non-inheritance cases. The inheritance case
will be handled in a follow-up patch.
---
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 12 ++--
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.h   |  1 +
 .../cpp/alignas_base_class/TestAlignAsBaseClass.py   |  4 
 lldb/test/API/lang/cpp/alignas_base_class/main.cpp   |  2 ++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index abe3c673e2cce69..a55ca0bf0f0fc1a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -355,6 +355,10 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const 
DWARFDIE &die) {
   byte_size = form_value.Unsigned();
   break;
 
+case DW_AT_alignment:
+  alignment = form_value.Unsigned();
+  break;
+
 case DW_AT_byte_stride:
   byte_stride = form_value.Unsigned();
   break;
@@ -1926,12 +1930,13 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   // TypeSystemClang is always in C++ mode, but some compilers such as
   // GCC and Clang give empty structs a size of 0 in C mode (in contrast to
   // the size of 1 for empty structs that would be computed in C++ mode).
-  if (attrs.byte_size) {
+  if (attrs.byte_size || attrs.alignment) {
 clang::RecordDecl *record_decl =
 TypeSystemClang::GetAsRecordDecl(clang_type);
 if (record_decl) {
   ClangASTImporter::LayoutInfo layout;
-  layout.bit_size = *attrs.byte_size * 8;
+  layout.bit_size = attrs.byte_size.value_or(0) * 8;
+  layout.alignment = attrs.alignment.value_or(0) * 8;
   GetClangASTImporter().SetRecordLayout(record_decl, layout);
 }
   }
@@ -2270,6 +2275,9 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
 if (layout_info.bit_size == 0)
   layout_info.bit_size =
   die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+if (layout_info.alignment == 0)
+  layout_info.alignment =
+  die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_alignment, 0) * 8;
 
 clang::CXXRecordDecl *record_decl =
 m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 0247783217008e8..81b705a036189eb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -456,6 +456,7 @@ struct ParsedDWARFTypeAttributes {
   lldb_private::plugin::dwarf::DWARFFormValue type;
   lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
   std::optional byte_size;
+  std::optional alignment;
   size_t calling_convention = llvm::dwarf::DW_CC_normal;
   uint32_t bit_stride = 0;
   uint32_t byte_stride = 0;
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index c7a88987733e176..7d97b0c42b7e166 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -12,3 +12,7 @@ def test(self):
 
 # The offset of f2 should be 8 because of `alignas(8)`.
 self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", 
result_value="8")
+
+# Verify specified class alignments.
+self.expect_expr("alignof(B2)", result_value="8")
+self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 8dfced6c784e102..cf727e808017bcc 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -10,4 +10,6 @@ struct D : B1, B2 {};
 
 D d3g;
 
+struct alignas(8) EmptyClassAlign8 {} t;
+
 int main() {}

>From fc488ecda9a0ab1a81d738b52b12ca88224346ea Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 28 Nov 2023 09:23:29 +0100
Subject: [PATCH 2/3] Update a stale comment.

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp| 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAS

[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Nikita Popov via lldb-commits

https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/73307

>From 5fb8fd532fe767feb2d361f9552ff31ea7770663 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 24 Nov 2023 10:46:03 +0100
Subject: [PATCH 1/3] [LLDB] Respect the DW_AT_alignment attribute.

Part of fixes for #72913.

clang emits the DW_AT_alignment attribute, however LLDB didn't respect it,
resulting an incorrect the RecordDecl built by lldb.

This only fixes non-inheritance cases. The inheritance case
will be handled in a follow-up patch.
---
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 12 ++--
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.h   |  1 +
 .../cpp/alignas_base_class/TestAlignAsBaseClass.py   |  4 
 lldb/test/API/lang/cpp/alignas_base_class/main.cpp   |  2 ++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index abe3c673e2cce69..a55ca0bf0f0fc1a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -355,6 +355,10 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const 
DWARFDIE &die) {
   byte_size = form_value.Unsigned();
   break;
 
+case DW_AT_alignment:
+  alignment = form_value.Unsigned();
+  break;
+
 case DW_AT_byte_stride:
   byte_stride = form_value.Unsigned();
   break;
@@ -1926,12 +1930,13 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   // TypeSystemClang is always in C++ mode, but some compilers such as
   // GCC and Clang give empty structs a size of 0 in C mode (in contrast to
   // the size of 1 for empty structs that would be computed in C++ mode).
-  if (attrs.byte_size) {
+  if (attrs.byte_size || attrs.alignment) {
 clang::RecordDecl *record_decl =
 TypeSystemClang::GetAsRecordDecl(clang_type);
 if (record_decl) {
   ClangASTImporter::LayoutInfo layout;
-  layout.bit_size = *attrs.byte_size * 8;
+  layout.bit_size = attrs.byte_size.value_or(0) * 8;
+  layout.alignment = attrs.alignment.value_or(0) * 8;
   GetClangASTImporter().SetRecordLayout(record_decl, layout);
 }
   }
@@ -2270,6 +2275,9 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
 if (layout_info.bit_size == 0)
   layout_info.bit_size =
   die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+if (layout_info.alignment == 0)
+  layout_info.alignment =
+  die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_alignment, 0) * 8;
 
 clang::CXXRecordDecl *record_decl =
 m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 0247783217008e8..81b705a036189eb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -456,6 +456,7 @@ struct ParsedDWARFTypeAttributes {
   lldb_private::plugin::dwarf::DWARFFormValue type;
   lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
   std::optional byte_size;
+  std::optional alignment;
   size_t calling_convention = llvm::dwarf::DW_CC_normal;
   uint32_t bit_stride = 0;
   uint32_t byte_stride = 0;
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index c7a88987733e176..7d97b0c42b7e166 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -12,3 +12,7 @@ def test(self):
 
 # The offset of f2 should be 8 because of `alignas(8)`.
 self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", 
result_value="8")
+
+# Verify specified class alignments.
+self.expect_expr("alignof(B2)", result_value="8")
+self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 8dfced6c784e102..cf727e808017bcc 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -10,4 +10,6 @@ struct D : B1, B2 {};
 
 D d3g;
 
+struct alignas(8) EmptyClassAlign8 {} t;
+
 int main() {}

>From fc488ecda9a0ab1a81d738b52b12ca88224346ea Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 28 Nov 2023 09:23:29 +0100
Subject: [PATCH 2/3] Update a stale comment.

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp| 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTP

[Lldb-commits] [lldb] 1459c62 - [lldb][PDB] Fix message order in test case

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

Author: David Spickett
Date: 2023-11-28T09:15:51Z
New Revision: 1459c627f0bc1a4938b5b6a7f4c2bdc1f3ec6a2c

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

LOG: [lldb][PDB] Fix message order in test case

Launch/stopped ordering was fixed by bd8f1068cad06b0f0342ac7ef351bf01c2e27322
but the Windows on Arm bot wasn't running at the time it landed.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
index a1f147b4bda6da8..9aa25adf6bcc7db 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
@@ -25,6 +25,7 @@ int main(int argc, char **argv) {
 // CHECK-NEXT: (lldb) break set -f local-variables.cpp -l 17
 // CHECK-NEXT: Breakpoint 1: where = local-variables.cpp.tmp.exe`main + {{.*}} 
at local-variables.cpp:{{.*}}, address = {{.*}}
 // CHECK-NEXT: (lldb) run a b c d e f g
+// CHECK-NEXT: Process {{.*}} launched: '{{.*}}local-variables.cpp.tmp.exe'
 // CHECK-NEXT: Process {{.*}} stopped
 // CHECK-NEXT: * thread #1, stop reason = breakpoint 1.1
 // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`main(argc=8, 
argv={{.*}}) at local-variables.cpp:{{.*}}
@@ -36,8 +37,7 @@ int main(int argc, char **argv) {
 // CHECK-NEXT:19   }
 // CHECK-NEXT:20
 
-// CHECK:  Process {{.*}} launched: '{{.*}}local-variables.cpp.tmp.exe'
-// CHECK-NEXT: (lldb) expression argc
+// CHECK:  (lldb) expression argc
 // CHECK-NEXT: (int) $0 = 8
 // CHECK-NEXT: (lldb) step
 // CHECK-NEXT: Process {{.*}} stopped



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


[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)

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

DavidSpickett wrote:

I've reverted this due to failures on Linaro's Linux bots.

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


[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits

hokein wrote:

@Michael137, I'm merging this patch now. I'm happy to address any post comments.

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


[Lldb-commits] [lldb] 439b16e - [LLDB] Respect the DW_AT_alignment attribute. (#73307)

2023-11-28 Thread via lldb-commits

Author: Haojian Wu
Date: 2023-11-28T12:27:55+01:00
New Revision: 439b16e2b369a0e3d482597b2c6597ce187e65f9

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

LOG: [LLDB] Respect the DW_AT_alignment attribute. (#73307)

Part of fixes for #72913.

clang emits `DW_AT_alignment` attribute, however LLDB didn't respect it,
resulting in incorrect RecordDecls built by lldb.

This only fixes non-inheritance cases. The inheritance case will be
handled in a follow-up patch.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
lldb/test/API/lang/cpp/alignas_base_class/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index abe3c673e2cce69..4d7d27b64e4c7f2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -355,6 +355,10 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const 
DWARFDIE &die) {
   byte_size = form_value.Unsigned();
   break;
 
+case DW_AT_alignment:
+  alignment = form_value.Unsigned();
+  break;
+
 case DW_AT_byte_stride:
   byte_stride = form_value.Unsigned();
   break;
@@ -1921,17 +1925,21 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 die.GetOffset(), attrs.name.GetCString());
   }
 
-  // If the byte size of the record is specified then overwrite the size
-  // that would be computed by Clang. This is only needed as LLDB's
-  // TypeSystemClang is always in C++ mode, but some compilers such as
-  // GCC and Clang give empty structs a size of 0 in C mode (in contrast to
-  // the size of 1 for empty structs that would be computed in C++ mode).
-  if (attrs.byte_size) {
+  // Setting authority byte size and alignment for empty structures.
+  //
+  // If the byte size or alignmenet of the record is specified then
+  // overwrite the ones that would be computed by Clang.
+  // This is only needed as LLDB's TypeSystemClang is always in C++ mode,
+  // but some compilers such as GCC and Clang give empty structs a size of 0
+  // in C mode (in contrast to the size of 1 for empty structs that would 
be
+  // computed in C++ mode).
+  if (attrs.byte_size || attrs.alignment) {
 clang::RecordDecl *record_decl =
 TypeSystemClang::GetAsRecordDecl(clang_type);
 if (record_decl) {
   ClangASTImporter::LayoutInfo layout;
-  layout.bit_size = *attrs.byte_size * 8;
+  layout.bit_size = attrs.byte_size.value_or(0) * 8;
+  layout.alignment = attrs.alignment.value_or(0) * 8;
   GetClangASTImporter().SetRecordLayout(record_decl, layout);
 }
   }
@@ -2270,6 +2278,9 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
 if (layout_info.bit_size == 0)
   layout_info.bit_size =
   die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
+if (layout_info.alignment == 0)
+  layout_info.alignment =
+  die.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_alignment, 0) * 8;
 
 clang::CXXRecordDecl *record_decl =
 m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 0247783217008e8..81b705a036189eb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -456,6 +456,7 @@ struct ParsedDWARFTypeAttributes {
   lldb_private::plugin::dwarf::DWARFFormValue type;
   lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;
   std::optional byte_size;
+  std::optional alignment;
   size_t calling_convention = llvm::dwarf::DW_CC_normal;
   uint32_t bit_stride = 0;
   uint32_t byte_stride = 0;

diff  --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index c7a88987733e176..7d97b0c42b7e166 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -12,3 +12,7 @@ def test(self):
 
 # The offset of f2 should be 8 because of `alignas(8)`.
 self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", 
result_value="8")
+
+# Verify specified class alignments.
+self.expect_expr("alignof(B2)", result_value="8")
+self.expect_expr("ali

[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Haojian Wu via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Respect the DW_AT_alignment attribute. (PR #73307)

2023-11-28 Thread Michael Buch via lldb-commits

Michael137 wrote:

LGTM, I don't expect this to change with any of the other outstanding bugs, so 
seems fine to merge now

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


[Lldb-commits] [libc] [lldb] [clang] [compiler-rt] [mlir] [polly] [libcxx] [openmp] [llvm] [C API] Add support for setting/getting new nneg flag on zext instructions (PR #73592)

2023-11-28 Thread Benji Smith via lldb-commits

https://github.com/Benjins updated 
https://github.com/llvm/llvm-project/pull/73592

>From de348ecdbf9d3c299eb4fe302ed2c224df7cde6b Mon Sep 17 00:00:00 2001
From: Benji Smith <6193112+benj...@users.noreply.github.com>
Date: Mon, 27 Nov 2023 18:15:22 -0500
Subject: [PATCH] [C API] Add support for setting/getting new nneg flag on zext
 instructions

This flag was added in #67982, but was not yet accessible via the C API. This
commit adds a getter/setter for this flag, and a test for it
---
 llvm/docs/ReleaseNotes.rst|  3 +++
 llvm/include/llvm-c/Core.h| 11 +++
 llvm/lib/IR/Core.cpp  | 10 ++
 llvm/test/Bindings/llvm-c/echo.ll |  2 ++
 llvm/tools/llvm-c-test/echo.cpp   |  8 
 5 files changed, 34 insertions(+)

diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 2c663932f8f8c2f..2c160f1707cbb95 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -199,6 +199,9 @@ Changes to the C API
   The option structure exposes an additional setting (i.e., the target ABI) and
   provides default values for unspecified settings.
 
+* Added ``LLVMGetNNeg`` and ``LLVMSetNNeg`` for setting/getting the new nneg 
flag
+  on zext instructions
+
 Changes to the CodeGen infrastructure
 -
 
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index b752fd42a7a12cf..b16f67ef02f3362 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -3974,6 +3974,17 @@ void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW);
 LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst);
 void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact);
 
+/**
+ * Gets if the instruction has the non-negative flag set
+ * Only valid for zext instructions
+ */
+LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst);
+/**
+ * Sets the non-negative flag for the instruction
+ * Only valid for zext instructions
+ */
+void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg);
+
 /* Memory */
 LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
 LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty,
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index b089dd48e55b4d4..e07664f8a17c6d9 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -3454,6 +3454,16 @@ void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool 
IsExact) {
   cast(P)->setIsExact(IsExact);
 }
 
+LLVMBool LLVMGetNNeg(LLVMValueRef NonNegInst) {
+  Value *P = unwrap(NonNegInst);
+  return cast(P)->hasNonNeg();
+}
+
+void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg) {
+  Value *P = unwrap(NonNegInst);
+  cast(P)->setNonNeg(IsNonNeg);
+}
+
 /*--.. Memory 
..--*/
 
 LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty,
diff --git a/llvm/test/Bindings/llvm-c/echo.ll 
b/llvm/test/Bindings/llvm-c/echo.ll
index 5daa238bfb8e533..72d5b455badcbec 100644
--- a/llvm/test/Bindings/llvm-c/echo.ll
+++ b/llvm/test/Bindings/llvm-c/echo.ll
@@ -90,6 +90,8 @@ define i32 @iops(i32 %a, i32 %b) {
   %21 = sdiv exact i32 %20, %2
   %22 = lshr exact i32 %21, %4
   %23 = ashr exact i32 %22, %14
+  %24 = zext i32 %23 to i64
+  %25 = zext nneg i32 %23 to i64
   ret i32 %23
 }
 
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index 06966ce528eae4d..3b07ccb29f3e061 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -899,6 +899,14 @@ struct FunCloner {
 Dst = LLVMBuildFence(Builder, Ordering, IsSingleThreaded, Name);
 break;
   }
+  case LLVMZExt: {
+LLVMValueRef Val = CloneValue(LLVMGetOperand(Src, 0));
+LLVMTypeRef DestTy = CloneType(LLVMTypeOf(Src));
+LLVMBool NNeg = LLVMGetNNeg(Src);
+Dst = LLVMBuildZExt(Builder, Val, DestTy, Name);
+LLVMSetNNeg(Dst, NNeg);
+break;
+  }
   default:
 break;
 }

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


[Lldb-commits] [clang-tools-extra] [libcxx] [libc] [llvm] [lldb] [compiler-rt] [clang] [flang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-28 Thread Aaron Ballman via lldb-commits

AaronBallman wrote:

> I guess I'd consider the "mental model" here to be that (notionally) `#embed` 
> is preprocessed by expanding to `#embed_base64`, which is handled by the 
> compiler proper, not the preprocessor. Yes, that's not entirely true in the 
> implementation, but it seems like a reasonable way to think about it. 
> (similar in feel to `#pragma` which is also not purely preprocessor, despite 
> starting with `#`.)

I don't see `#pragma` as being similar -- there is no sequence of preprocessed 
tokens to emit for a pragma, but there is for `#embed`. In fact, it is 
described specifically in terms of expansion (6.10.3p7):

> The expansion of a #embed directive is a token sequence formed from the list 
> of integer constant
expressions described below. The group of tokens for each integer constant 
expression in the list
is separated in the token sequence from the group of tokens for the previous 
integer constant
expression in the list by a comma. The sequence neither begins nor ends in a 
comma. If the list of
integer constant expressions is empty, the token sequence is empty. The 
directive is replaced by its
expansion and, with the presence of certain embed parameters, additional or 
replacement token
sequences.

So it's not so much that it's not actually true in the implementation details, 
it's that it's not actually true by specification either.

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


[Lldb-commits] [llvm] [lldb] Add support for parsing type unit entries in .debug_names. (PR #72952)

2023-11-28 Thread Alexander Yermolovich via lldb-commits

ayermolo wrote:

What happens when Linker tombstones the tu local entry to -1, or will that be 
in a separate patch after LLD changes land?

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


[Lldb-commits] [lldb] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (PR #73028)

2023-11-28 Thread Alex Langford via lldb-commits

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

Awesome!

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


[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)

2023-11-28 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/73605

>From 8c29a2034a57174ec68f8c1f1a2c5c66a7988762 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Mon, 27 Nov 2023 15:42:13 -0800
Subject: [PATCH 1/2] [lldb][progress] Always report progress upon Progress
 object destruction

This commit allows a final progress report upon the destruction of the
`Progress` object to happen at all times as opposed to when the progress
was not completed
---
 lldb/source/Core/Progress.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 08be73f1470f349..eee4d3955154ba9 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -32,8 +32,8 @@ Progress::~Progress() {
   std::lock_guard guard(m_mutex);
   if (!m_completed) {
 m_completed = m_total;
-ReportProgress();
   }
+  ReportProgress();
 }
 
 void Progress::Increment(uint64_t amount, std::string update) {

>From 67f5039850ebca4ae8730a1f63edac8437eea32c Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Tue, 28 Nov 2023 08:27:33 -0800
Subject: [PATCH 2/2] fixup! [lldb][progress] Always report progress upon
 Progress object destruction

---
 lldb/source/Core/Progress.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index eee4d3955154ba9..ea3f874916a999f 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -30,9 +30,8 @@ Progress::~Progress() {
   // Make sure to always report progress completed when this object is
   // destructed so it indicates the progress dialog/activity should go away.
   std::lock_guard guard(m_mutex);
-  if (!m_completed) {
+  if (!m_completed)
 m_completed = m_total;
-  }
   ReportProgress();
 }
 

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


[Lldb-commits] [lld] [lldb] [openmp] [libcxx] [mlir] [compiler-rt] [flang] [llvm] [clang-tools-extra] [libc] [clang] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-28 Thread Sang Ik Lee via lldb-commits

https://github.com/silee2 updated 
https://github.com/llvm/llvm-project/pull/71430

>From c76403cf8629b8f7d8a5b7a3ee5da2881713a7f8 Mon Sep 17 00:00:00 2001
From: "Lee, Sang Ik" 
Date: Mon, 6 Nov 2023 18:47:23 +
Subject: [PATCH 1/5] [MLIR] Enable GPU Dialect to SYCL runtime integration

GPU Dialect lowering to SYCL runtime is driven by spirv.target_env
attached to gpu.module. As a result of this, spirv.target_env remains
as an input to LLVMIR Translation.
A SPIRVToLLVMIRTranslation without any actual translation is added to
avoid an unregistered error in mlir-cpu-runner.
SelectObjectAttr.cpp is updated to
1) Pass binary size argument to getModuleLoadFn
2) Pass parameter count to getKernelLaunchFn
This change does not impact CUDA and ROCM usage since both
mlir_cuda_runtime and mlir_rocm_runtime are already updated to
accept and ignore the extra arguments.
---
 mlir/include/mlir/Target/LLVMIR/Dialect/All.h |  3 ++
 .../Dialect/SPIRV/SPIRVToLLVMIRTranslation.h  | 31 +++
 mlir/lib/Target/LLVMIR/CMakeLists.txt |  1 +
 mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt |  1 +
 .../LLVMIR/Dialect/GPU/SelectObjectAttr.cpp   | 50 +
 .../LLVMIR/Dialect/SPIRV/CMakeLists.txt   | 13 +
 .../SPIRV/SPIRVToLLVMIRTranslation.cpp| 31 +++
 mlir/test/CMakeLists.txt  |  4 ++
 .../Integration/GPU/SYCL/gpu-to-spirv.mlir| 54 +++
 mlir/test/Integration/GPU/SYCL/lit.local.cfg  |  2 +
 mlir/test/Target/LLVMIR/gpu.mlir  |  9 ++--
 mlir/test/lit.cfg.py  |  3 ++
 mlir/test/lit.site.cfg.py.in  |  1 +
 13 files changed, 188 insertions(+), 15 deletions(-)
 create mode 100644 
mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h
 create mode 100644 mlir/lib/Target/LLVMIR/Dialect/SPIRV/CMakeLists.txt
 create mode 100644 
mlir/lib/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.cpp
 create mode 100644 mlir/test/Integration/GPU/SYCL/gpu-to-spirv.mlir
 create mode 100644 mlir/test/Integration/GPU/SYCL/lit.local.cfg

diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h 
b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h
index 0563b9bf3d475a4..5dfc15afb75931a 100644
--- a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h
+++ b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h
@@ -26,6 +26,7 @@
 #include "mlir/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.h"
 #include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h"
 #include "mlir/Target/LLVMIR/Dialect/ROCDL/ROCDLToLLVMIRTranslation.h"
+#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h"
 #include "mlir/Target/LLVMIR/Dialect/X86Vector/X86VectorToLLVMIRTranslation.h"
 
 namespace mlir {
@@ -45,6 +46,7 @@ static inline void 
registerAllToLLVMIRTranslations(DialectRegistry ®istry) {
   registerOpenACCDialectTranslation(registry);
   registerOpenMPDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);
   registerX86VectorDialectTranslation(registry);
 
   // Extension required for translating GPU offloading Ops.
@@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) 
{
   registerLLVMDialectTranslation(registry);
   registerNVVMDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);
 
   // Extension required for translating GPU offloading Ops.
   gpu::registerOffloadingLLVMTranslationInterfaceExternalModels(registry);
diff --git 
a/mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h 
b/mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h
new file mode 100644
index 000..e9580a10b4ca780
--- /dev/null
+++ b/mlir/include/mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h
@@ -0,0 +1,31 @@
+//===- SPIRVToLLVMIRTranslation.h - SPIRV to LLVM IR *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This provides registration calls for SPIRV dialect to LLVM IR translation.
+//
+//===--===//
+
+#ifndef MLIR_TARGET_LLVMIR_DIALECT_SPIRV_SPIRVTOLLVMIRTRANSLATION_H
+#define MLIR_TARGET_LLVMIR_DIALECT_SPIRV_SPIRVTOLLVMIRTRANSLATION_H
+
+namespace mlir {
+
+class DialectRegistry;
+class MLIRContext;
+
+/// Register the SPIRV dialect and the translation from it to the LLVM IR in 
the
+/// given registry;
+void registerSPIRVDialectTranslation(DialectRegistry ®istry);
+
+/// Register the SPIRV dialect and the translation from it in the registry
+/// associated with the given context.
+void registerSPIRVDialectTranslation(MLIRContext &context);
+
+} // namespa

[Lldb-commits] [lld] [lldb] [openmp] [libcxx] [mlir] [compiler-rt] [flang] [llvm] [clang-tools-extra] [libc] [clang] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-28 Thread Sang Ik Lee via lldb-commits


@@ -0,0 +1,31 @@
+//===- SPIRVToLLVMIRTranslation.cpp - Translate SPIRV to LLVM IR 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements a translation between the MLIR SPIRV dialect and
+// LLVM IR.
+//
+//===--===//
+
+#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/Operation.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
+
+using namespace mlir;
+using namespace mlir::LLVM;
+
+void mlir::registerSPIRVDialectTranslation(DialectRegistry ®istry) {
+  registry.insert();

silee2 wrote:

@joker-eph 

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


[Lldb-commits] [libc] [compiler-rt] [clang] [libcxx] [llvm] [lldb] [flang] [clang-tools-extra] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)

2023-11-28 Thread via lldb-commits

cor3ntin wrote:

> So it's not so much that it's not actually true in the implementation 
> details, it's that it's not actually true by specification either.

+1. I really do not want `-E` to start not expanding, or transforming 
directives.
I do not see a difference between a large embed and a large include file. `-E` 
should expand both, regardless of size. Modify that very long standing behavior 
only cause pain and confusion imo.

If, we find the need for a fancier behavior (like the aforementioned 
`#embed_base64`), it's something we could consider later, under an additional 
switch (not `-E` without other flag)

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


[Lldb-commits] [lld] [lldb] [clang] [mlir] [compiler-rt] [clang-tools-extra] [llvm] [libcxx] [libc++][ranges] Implement ranges::contains_subrange (PR #66963)

2023-11-28 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/66963

>From 5a2c930770cf548c5e3f3451e76b48cb067e6762 Mon Sep 17 00:00:00 2001
From: Zijun Zhao 
Date: Wed, 13 Sep 2023 14:26:01 -0700
Subject: [PATCH 1/6] [libc++] Implement ranges::contains_subrange

---
 libcxx/include/CMakeLists.txt |   1 +
 .../__algorithm/ranges_contains_subrange.h| 145 +
 libcxx/include/algorithm  |  14 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../ranges.contains_subrange.pass.cpp | 293 ++
 .../niebloid.compile.pass.cpp |   3 +
 6 files changed, 460 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains_subrange.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains_subrange.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 2ec755236dbaee2..b096259f85f6ac8 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains_subrange.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains_subrange.h 
b/libcxx/include/__algorithm/ranges_contains_subrange.h
new file mode 100644
index 000..16de6c29cb2a1a4
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains_subrange.h
@@ -0,0 +1,145 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
+
+#include <__algorithm/ranges_starts_with.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains_subrange {
+struct __fn {
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred,
+class _Proj1,
+class _Proj2,
+class _Offset>
+  static _LIBCPP_HIDE_FROM_ABI constexpr bool __contains_subrange_fn_impl(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred& __pred,
+  _Proj1& __proj1,
+  _Proj2& __proj2,
+  _Offset __offset) {
+if (__offset < 0)
+  return false;
+else {
+  for (; __offset >= 0; __offset--, __first1++) {
+auto result = ranges::starts_with(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+std::ref(__pred),
+std::ref(__proj1),
+std::ref(__proj2));
+if (result)
+  return true;
+  }
+  return false;
+}
+  }
+
+  template  _Sent1,
+input_iterator _Iter2,
+sentinel_for<_Iter2> _Sent2,
+class _Pred  = ranges::equal_to,
+class _Proj1 = identity,
+class _Proj2 = identity>
+requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _Iter1 __first1,
+  _Sent1 __last1,
+  _Iter2 __first2,
+  _Sent2 __last2,
+  _Pred __pred   = {},
+  _Proj1 __proj1 = {},
+  _Proj2 __proj2 = {}) const {
+auto __n1 = ranges::distance(__first1, __last1);
+auto __n2 = ranges::distance(__first2, __last2);
+auto __offset = __n1 - __n2;
+
+return __contains_subrange_fn_impl(
+std::move(__first1),
+std::move(__last1),
+std::move(__first2),
+std::move(__last2),
+__pred,
+__proj1,
+__proj2,
+std::move(__offset));
+  }
+
+  template 
+requires indirectly_comparable, iterator_t<_Range2>, 
_Pred, _Proj1, _Proj2>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+  _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 
__proj1 = {}, _Proj2 __proj2 = {}) const {
+auto __n1 = 0;
+auto __n2 = 0;
+
+if cons

[Lldb-commits] [lld] [lldb] [clang] [mlir] [compiler-rt] [clang-tools-extra] [llvm] [libcxx] [libc++][ranges] Implement ranges::contains_subrange (PR #66963)

2023-11-28 Thread via lldb-commits

ZijunZhaoCCK wrote:

> Gentle ping. There's outstanding feedback to address on this review. 
> @ZijunZhaoCCK if you don't think you'll have time to pursue this PR anymore, 
> it's all good but please let us know so we can assign it to someone else!

Sorry for the late reply! I can’t make it a priority right now, but I’ll 
definitely do it when things calm down, maybe in January. If someone want to do 
it right now, I can stop pursuing this PR.

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits

mdko wrote:

@jimingham So it seems that when `-t ` is supplied, the user shouldn't be 
able to specify a thread index as well, e.g. the following is disallowed:
```
thread select -t 216051 1
```

Would it make sense then for `thread select` to take two possible mutually 
exclusive options (`-t `) and (`-i `), with the `-i` option being 
the default (i.e. doesn't need to be specified)? e.g.
```
thread select -t 216051
```

and
```
thread select -i 1
thread select 1
```
(where the `-i` doesn't need to be supplied by default)?


> It makes the completer much easier to hook up since the option value can 
> complete against the native thread ID's
Sounds good, I'll work on adding the complete for the native thread ID option 
with the above change.

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread via lldb-commits

jimingham wrote:

lldb doesn't have a notion of arguments actually being the value of a default 
option.  I'm not sure I like that idea, it seems like it could quickly become 
confusing.  

lldb does have the notion of "groups of options" that work together for a given 
command.  You can specify `break set -n foo` or `break set -a 0x1234` but `-a` 
and `-n` are in different option groups so the command parser won't allow you 
to specify them together.

Someone started to do the same thing with arguments, so you can say "if 
--something is provided, you can have an argument, but if --something-else is 
provided you can't".  But I don't think that is currently working (I noticed 
that hooking up the parsed scripted commands).  For now, you'll have to check 
the inputs by hand in the DoExecute, but then once we hook up the argument 
groups properly, you will be able to specify "one option with -t and no 
arguments" and "one argument" as the two command options, and the parser will 
handle the checking for you.  So that seems the more "lldb natural" way to do 
this.

It would have been better if we had made `thread select` take two options as 
you suggested.  We could have then fixed the `t` alias to specify the thread 
index so that we would have fast access to the most common command.  Sadly, I 
think `'thread select" has been around for long enough that changing the way 
the command line behaves would be disruptive, and I don't think that's a good 
idea.

JIm


> On Nov 28, 2023, at 9:58 AM, Michael Christensen ***@***.***> wrote:
> 
> 
> @jimingham  So it seems that when -t  is 
> supplied, the user shouldn't be able to specify a thread index as well, e.g. 
> the following is disallowed:
> 
> thread select -t 216051 1
> Would it make sense then for thread select to take two possible mutually 
> exclusive options (-t ) and (-i ), with the -i option being the 
> default (i.e. doesn't need to be specified)? e.g.
> 
> thread select -t 216051
> and
> 
> thread select -i 1
> thread select 1
> (where the -i doesn't need to be supplied by default)?
> 
> It makes the completer much easier to hook up since the option value can 
> complete against the native thread ID's
> Sounds good, I'll work on adding the complete for the native thread ID option 
> with the above change.
> 
> —
> Reply to this email directly, view it on GitHub 
> , or 
> unsubscribe 
> .
> You are receiving this because you were mentioned.
> 



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


[Lldb-commits] [lldb] c846f8b - [lldb][progress] Always report progress upon Progress object destruction (#73605)

2023-11-28 Thread via lldb-commits

Author: Chelsea Cassanova
Date: 2023-11-28T10:45:02-08:00
New Revision: c846f8ba104f18053ce666de7e2da0a82deb45cd

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

LOG: [lldb][progress] Always report progress upon Progress object destruction 
(#73605)

This commit allows a final progress report upon the destruction of the
`Progress` object to happen at all times as opposed to when the progress
was not completed.

Added: 


Modified: 
lldb/source/Core/Progress.cpp

Removed: 




diff  --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 08be73f1470f349..ea3f874916a999f 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -30,10 +30,9 @@ Progress::~Progress() {
   // Make sure to always report progress completed when this object is
   // destructed so it indicates the progress dialog/activity should go away.
   std::lock_guard guard(m_mutex);
-  if (!m_completed) {
+  if (!m_completed)
 m_completed = m_total;
-ReportProgress();
-  }
+  ReportProgress();
 }
 
 void Progress::Increment(uint64_t amount, std::string update) {



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


[Lldb-commits] [lldb] [lldb][progress] Always report progress upon Progress object destruction (PR #73605)

2023-11-28 Thread Chelsea Cassanova via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (PR #73028)

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

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


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


[Lldb-commits] [llvm] [mlir] [clang-tools-extra] [clang] [lldb] [compiler-rt] [flang] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-11-28 Thread Zequan Wu via lldb-commits

ZequanWu wrote:

Ping.

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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

https://github.com/clayborg requested changes to this pull request.

Rename long option and change it so the option requires a value, and make the 
code use the option value instead of command argument overloading.

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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


@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_thread_id : Option<"thread_id", "t">,

clayborg wrote:

Change the long option name to be "thread-id" (replace the '_' with a '-'). 
That is more consistent with the other commands (see above on line 1113).

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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


@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_thread_id : Option<"thread_id", "t">,

clayborg wrote:

Also wondering if there is only one long option that can be specified? It would 
be nice to allow "--thread-id " or "--tid " or "-t ". Not sure 
if the LLVM option parsing stuff allows multiple long options? @jimingham 
thoughts?

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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

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


[Lldb-commits] [llvm] [lldb] Add support for parsing type unit entries in .debug_names. (PR #72952)

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

clayborg wrote:

> What happens when Linker tombstones the tu local entry to -1, or will that be 
> in a separate patch after LLD changes land?

I can will do another PR for that once it lands.

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


[Lldb-commits] [lldb] 3661eb1 - Add support for parsing type unit entries in .debug_names. (#72952)

2023-11-28 Thread via lldb-commits

Author: Greg Clayton
Date: 2023-11-28T13:56:45-08:00
New Revision: 3661eb150e6d4e1e06adb8a62c4b45b056f3c8be

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

LOG: Add support for parsing type unit entries in .debug_names. (#72952)

This is a follow up patch after .debug_names can now emit local type
unit entries when we compile with type units + DWARF5 + .debug_names.
The pull request that added this functionality was:

https://github.com/llvm/llvm-project/pull/70515

This patch makes sure that the DebugNamesDWARFIndex in LLDB will not
manually need to parse type units if they have a valid index. It also
fixes the index to be able to correctly extract name entries that
reference type unit DIEs. Added a test to verify things work as
expected.

Added: 
lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-debug-names.cpp

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 4fc3866a3b608fd..7c253553d57b484 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -37,19 +37,29 @@ llvm::DenseSet
 DebugNamesDWARFIndex::GetUnits(const DebugNames &debug_names) {
   llvm::DenseSet result;
   for (const DebugNames::NameIndex &ni : debug_names) {
-for (uint32_t cu = 0; cu < ni.getCUCount(); ++cu)
+const uint32_t num_cus = ni.getCUCount();
+for (uint32_t cu = 0; cu < num_cus; ++cu)
   result.insert(ni.getCUOffset(cu));
+const uint32_t num_tus = ni.getLocalTUCount();
+for (uint32_t tu = 0; tu < num_tus; ++tu)
+  result.insert(ni.getLocalTUOffset(tu));
   }
   return result;
 }
 
 std::optional
 DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
-  std::optional cu_offset = entry.getCUOffset();
-  if (!cu_offset)
-return std::nullopt;
+  // Look for a DWARF unit offset (CU offset or local TU offset) as they are
+  // both offsets into the .debug_info section.
+  std::optional unit_offset = entry.getCUOffset();
+  if (!unit_offset) {
+unit_offset = entry.getLocalTUOffset();
+if (!unit_offset)
+  return std::nullopt;
+  }
 
-  DWARFUnit *cu = m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, 
*cu_offset);
+  DWARFUnit *cu =
+  m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, *unit_offset);
   if (!cu)
 return std::nullopt;
 

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-debug-names.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-debug-names.cpp
new file mode 100644
index 000..2b7a928c89a8f71
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-debug-names.cpp
@@ -0,0 +1,48 @@
+// Test that we can use .debug_names to lookup a type that is only referenced
+// from within a type unit. In the code below the type named "stype" is only
+// referenced within the type unit itself and when we enable .debug_names, we
+// expect the have an entry for this and to be able to find this type when
+// we do a lookup.
+
+// REQUIRES: lld
+
+// RUN: %clang %s -target x86_64-pc-linux -gdwarf-5 -fdebug-types-section \
+// RUN:   -gpubnames -fno-limit-debug-info -c -o %t.o
+// RUN: ld.lld %t.o -o %t
+// RUN: %lldb %t -o "type lookup stype" -b | FileCheck %s --check-prefix=BASE
+// RUN: %lldb %t -o "type lookup bar::stype" -b | FileCheck %s 
--check-prefix=PART
+// RUN: %lldb %t -o "type lookup foo::bar::stype" -b | FileCheck %s 
--check-prefix=FULL
+
+// BASE: (lldb) type lookup stype
+// BASE-NEXT: int
+
+// PART: (lldb) type lookup bar::stype
+// PART-NEXT: int
+
+// FULL: (lldb) type lookup foo::bar::stype
+// FULL-NEXT: int
+
+namespace foo {
+class bar {
+public:
+  typedef unsigned utype;
+  // This type is only referenced from within the type unit and we need to
+  // make sure we can find it with the new type unit support in .debug_names.
+  typedef int stype;
+
+private:
+  utype m_unsigned;
+
+public:
+  bar(utype u) : m_unsigned(u) {}
+
+  utype get() const { return m_unsigned; }
+  void set(utype u) { m_unsigned = u; }
+  stype gets() const { return (stype)m_unsigned; }
+};
+} // namespace foo
+
+int main() {
+  foo::bar b(12);
+  return 0;
+}

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index 1ba555a061904cc..b89536bc0c7230c 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -56,6 +56,14 @@ class DWARFAcceleratorTable {

[Lldb-commits] [llvm] [lldb] Add support for parsing type unit entries in .debug_names. (PR #72952)

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

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


[Lldb-commits] [llvm] [lldb] Add support for parsing type unit entries in .debug_names. (PR #72952)

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

clayborg wrote:

> What happens when Linker tombstones the tu local entry to -1, or will that be 
> in a separate patch after LLD changes land?

Actually this patch will work for tombstoned units already. I will make an 
inline comment and tag you with details.

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


[Lldb-commits] [llvm] [lldb] Add support for parsing type unit entries in .debug_names. (PR #72952)

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


@@ -37,19 +37,29 @@ llvm::DenseSet
 DebugNamesDWARFIndex::GetUnits(const DebugNames &debug_names) {
   llvm::DenseSet result;
   for (const DebugNames::NameIndex &ni : debug_names) {
-for (uint32_t cu = 0; cu < ni.getCUCount(); ++cu)
+const uint32_t num_cus = ni.getCUCount();
+for (uint32_t cu = 0; cu < num_cus; ++cu)
   result.insert(ni.getCUOffset(cu));
+const uint32_t num_tus = ni.getLocalTUCount();
+for (uint32_t tu = 0; tu < num_tus; ++tu)
+  result.insert(ni.getLocalTUOffset(tu));
   }
   return result;
 }
 
 std::optional
 DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
-  std::optional cu_offset = entry.getCUOffset();
-  if (!cu_offset)
-return std::nullopt;
+  // Look for a DWARF unit offset (CU offset or local TU offset) as they are
+  // both offsets into the .debug_info section.
+  std::optional unit_offset = entry.getCUOffset();
+  if (!unit_offset) {
+unit_offset = entry.getLocalTUOffset();
+if (!unit_offset)
+  return std::nullopt;
+  }
 
-  DWARFUnit *cu = m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, 
*cu_offset);
+  DWARFUnit *cu =
+  m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, *unit_offset);

clayborg wrote:

This will return a NULL `cu` if the `*unit_offset` is UINT32_MAX, so it will 
work with tombstoned units. Though we can make a patch to 
`DebugNames::Entry::getLocalTUOffset()' to return std::nullopt for tombstoned 
units as a better fix.

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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember: relax assertion on number of global variables (PR #73707)

2023-11-28 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/73707

In https://github.com/llvm/llvm-project/pull/73626 we started attaching 
`DW_AT_const_value`s on a static data-member's declaration again. In DWARFv5, 
those static members are represented with a `DW_TAG_variable`. When LLDB builds 
the `ManualDWARFIndex`, it simply iterates over all DIEs in a CU and puts *any* 
`DW_TAG_variable` with a constant or location into the index. So when using the 
manual index, we can end up having 2 entries for a static data member in the 
index.

This caused a test failure on Linux (where DWARFv5 is the default and the tests 
use the manual index).

This patch loosens the restriction that we find exactly 1 variable.

>From cec4d1bb8a26f44ba701eb62596014c71e607fc4 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Tue, 28 Nov 2023 22:42:10 +
Subject: [PATCH] [lldb][test] TestConstStaticIntegralMember: relax assertion
 on number of global variables

In https://github.com/llvm/llvm-project/pull/73626 we started attaching 
`DW_AT_const_value`s on a static data-member's declaration again. In DWARFv5, 
those static members are represented with a `DW_TAG_variable`. When LLDB builds 
the `ManualDWARFIndex`, it simply iterates over all DIEs in a CU and puts *any* 
`DW_TAG_variable` with a constant or location into the index. So when using the 
manual index, we can end up having 2 entries for a static data member in the 
index.

This caused a test failure on Linux (where DWARFv5 is the default and the tests 
use the manual index).

This patch loosens the restriction that we find exactly 1 variable.
---
 .../TestConstStaticIntegralMember.py| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 2e078ce9446b01a..e63a26f543cc429 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -118,7 +118,7 @@ def test_class_with_only_const_static(self):
 
 def check_global_var(self, name: str, expect_type, expect_val):
 var_list = self.target().FindGlobalVariables(name, lldb.UINT32_MAX)
-self.assertEqual(len(var_list), 1)
+self.assertGreaterEqual(len(var_list), 1)
 varobj = var_list[0]
 self.assertEqual(varobj.type.name, expect_type)
 self.assertEqual(varobj.value, expect_val)

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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember: relax assertion on number of global variables (PR #73707)

2023-11-28 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

In https://github.com/llvm/llvm-project/pull/73626 we started attaching 
`DW_AT_const_value`s on a static data-member's declaration again. In DWARFv5, 
those static members are represented with a `DW_TAG_variable`. When LLDB builds 
the `ManualDWARFIndex`, it simply iterates over all DIEs in a CU and puts *any* 
`DW_TAG_variable` with a constant or location into the index. So when using the 
manual index, we can end up having 2 entries for a static data member in the 
index.

This caused a test failure on Linux (where DWARFv5 is the default and the tests 
use the manual index).

This patch loosens the restriction that we find exactly 1 variable.

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


1 Files Affected:

- (modified) 
lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 (+1-1) 


``diff
diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 2e078ce9446b01a..e63a26f543cc429 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -118,7 +118,7 @@ def test_class_with_only_const_static(self):
 
 def check_global_var(self, name: str, expect_type, expect_val):
 var_list = self.target().FindGlobalVariables(name, lldb.UINT32_MAX)
-self.assertEqual(len(var_list), 1)
+self.assertGreaterEqual(len(var_list), 1)
 varobj = var_list[0]
 self.assertEqual(varobj.type.name, expect_type)
 self.assertEqual(varobj.value, expect_val)

``




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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember: relax assertion on number of global variables (PR #73707)

2023-11-28 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread via lldb-commits


@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_thread_id : Option<"thread_id", "t">,

jimingham wrote:

I don't know about the underlying code, but our command definition interface 
doesn't allow multiple long options mapping to the same short option.  You 
could add a long option `--tid` that has no short option if you wanted to 
provide that.  You don't really get any benefit to having the short option 
pointing to both long options anyway.  But I don't think we do this anywhere 
else, and that does seem a little odd to me.

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


[Lldb-commits] [clang-tools-extra] [flang] [libunwind] [libcxx] [lldb] [llvm] [mlir] [compiler-rt] [clang] [libcxxabi] [lld] [libc] Implement libcxx ranges contains (PR #70258)

2023-11-28 Thread Nikolas Klauser via lldb-commits

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


[Lldb-commits] [lld] [clang] [llvm] [clang-tools-extra] [flang] [libunwind] [libc] [libcxxabi] [libcxx] [lldb] [compiler-rt] [mlir] [libc++] Implement ranges::contains (PR #65148)

2023-11-28 Thread Nikolas Klauser via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [clang-tools-extra] [libcxx] [libcxxabi] [libc] [mlir] [flang] [libunwind] [compiler-rt] [clang] [lld] [libc++] Implement ranges::contains (PR #65148)

2023-11-28 Thread Nikolas Klauser via lldb-commits

https://github.com/philnik777 updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/17] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec142..024aa8959fb7200 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 000..647b7ea34be3421
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef85..003bf132b38b4d8 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_cop

[Lldb-commits] [libcxx] [clang-tools-extra] [libc] [flang] [lld] [compiler-rt] [llvm] [libunwind] [mlir] [clang] [libcxxabi] [lldb] Implement libcxx ranges contains (PR #70258)

2023-11-28 Thread Nikolas Klauser via lldb-commits

philnik777 wrote:

I've reopened the old one for you. Let's keep the discussion in one place.

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


[Lldb-commits] [libcxx] [clang-tools-extra] [libc] [flang] [lld] [compiler-rt] [llvm] [libunwind] [mlir] [clang] [libcxxabi] [lldb] [libc++] Implement ranges::contains (PR #65148)

2023-11-28 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/17] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec142..024aa8959fb7200 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 000..647b7ea34be3421
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef85..003bf132b38b4d8 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_c

[Lldb-commits] [lldb] 4eb4211 - [lldb][test] TestConstStaticIntegralMember: relax assertion on number of global variables (#73707)

2023-11-28 Thread via lldb-commits

Author: Michael Buch
Date: 2023-11-28T17:04:19-08:00
New Revision: 4eb421192479dbecae2621b868e55aaf6d945b02

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

LOG: [lldb][test] TestConstStaticIntegralMember: relax assertion on number of 
global variables (#73707)

In https://github.com/llvm/llvm-project/pull/73626 we started attaching
`DW_AT_const_value`s on a static data-member's declaration again. In
DWARFv5, those static members are represented with a `DW_TAG_variable`.
When LLDB builds the `ManualDWARFIndex`, it simply iterates over all
DIEs in a CU and puts *any* `DW_TAG_variable` with a constant or
location into the index. So when using the manual index, we can end up
having 2 entries for a static data member in the index, one for the
declaration and one for the definition.

This caused a test failure on Linux (where DWARFv5 is the default and
the tests use the manual index).

This patch loosens the restriction that we find exactly 1 variable.

Added: 


Modified: 

lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 2e078ce9446b01a..e63a26f543cc429 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -118,7 +118,7 @@ def test_class_with_only_const_static(self):
 
 def check_global_var(self, name: str, expect_type, expect_val):
 var_list = self.target().FindGlobalVariables(name, lldb.UINT32_MAX)
-self.assertEqual(len(var_list), 1)
+self.assertGreaterEqual(len(var_list), 1)
 varobj = var_list[0]
 self.assertEqual(varobj.type.name, expect_type)
 self.assertEqual(varobj.value, expect_val)



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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember: relax assertion on number of global variables (PR #73707)

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

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits

https://github.com/mdko updated https://github.com/llvm/llvm-project/pull/73596

>From 97a6e23c85457a14c91c5800fa03bb872e6f1fa6 Mon Sep 17 00:00:00 2001
From: Michael Christensen 
Date: Mon, 27 Nov 2023 12:49:24 -0800
Subject: [PATCH 1/2] Add option to pass thread ID to thread select command

---
 lldb/source/Commands/CommandObjectThread.cpp  | 59 +--
 lldb/source/Commands/Options.td   |  5 ++
 .../thread/select/TestThreadSelect.py | 23 +++-
 3 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index a9f5a4f8a4fbd71..9384df319cc221d 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -1129,8 +1129,44 @@ class CommandObjectThreadUntil : public 
CommandObjectParsed {
 
 // CommandObjectThreadSelect
 
+#define LLDB_OPTIONS_thread_select
+#include "CommandOptions.inc"
+
 class CommandObjectThreadSelect : public CommandObjectParsed {
 public:
+  class CommandOptions : public Options {
+  public:
+CommandOptions() { OptionParsingStarting(nullptr); }
+
+~CommandOptions() override = default;
+
+void OptionParsingStarting(ExecutionContext *execution_context) override {
+  m_thread_id = false;
+}
+
+Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+  ExecutionContext *execution_context) override {
+  const int short_option = m_getopt_table[option_idx].val;
+  switch (short_option) {
+  case 't': {
+m_thread_id = true;
+break;
+  }
+
+  default:
+llvm_unreachable("Unimplemented option");
+  }
+
+  return {};
+}
+
+llvm::ArrayRef GetDefinitions() override {
+  return llvm::ArrayRef(g_thread_select_options);
+}
+
+bool m_thread_id;
+  };
+
   CommandObjectThreadSelect(CommandInterpreter &interpreter)
   : CommandObjectParsed(interpreter, "thread select",
 "Change the currently selected thread.", nullptr,
@@ -1165,6 +1201,8 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
 nullptr);
   }
 
+  Options *GetOptions() override { return &m_options; }
+
 protected:
   void DoExecute(Args &command, CommandReturnObject &result) override {
 Process *process = m_exe_ctx.GetProcessPtr();
@@ -1173,22 +1211,29 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
   return;
 } else if (command.GetArgumentCount() != 1) {
   result.AppendErrorWithFormat(
-  "'%s' takes exactly one thread index argument:\nUsage: %s\n",
-  m_cmd_name.c_str(), m_cmd_syntax.c_str());
+  "'%s' takes exactly one thread %s argument:\nUsage: %s\n",
+  m_cmd_name.c_str(), m_options.m_thread_id ? "ID" : "index",
+  m_cmd_syntax.c_str());
   return;
 }
 
 uint32_t index_id;
 if (!llvm::to_integer(command.GetArgumentAtIndex(0), index_id)) {
-  result.AppendErrorWithFormat("Invalid thread index '%s'",
+  result.AppendErrorWithFormat("Invalid thread %s '%s'",
+   m_options.m_thread_id ? "ID" : "index",
command.GetArgumentAtIndex(0));
   return;
 }
 
-Thread *new_thread =
-process->GetThreadList().FindThreadByIndexID(index_id).get();
+Thread *new_thread = nullptr;
+if (m_options.m_thread_id) {
+new_thread = process->GetThreadList().FindThreadByID(index_id).get();
+} else {
+new_thread = 
process->GetThreadList().FindThreadByIndexID(index_id).get();
+}
 if (new_thread == nullptr) {
-  result.AppendErrorWithFormat("invalid thread #%s.\n",
+  result.AppendErrorWithFormat("invalid thread %s%s.\n",
+   m_options.m_thread_id ? "ID " : "#",
command.GetArgumentAtIndex(0));
   return;
 }
@@ -1196,6 +1241,8 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
 process->GetThreadList().SetSelectedThreadByID(new_thread->GetID(), true);
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
   }
+
+  CommandOptions m_options;
 };
 
 // CommandObjectThreadList
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 542c78be5a12dad..23886046df8f673 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_thread_id : Option<"thread_id", "t">,
+Desc<"Provide a thread ID instead of a thread index.">;
+}
+
 let Command = "thread trace dump function calls" in {
   def thread_trace_dump_function_calls_file : Option<"file", "F">, Group<1>,
 Arg<"Filename">,
diff --git a/lldb/test/API/commands/thread/select/TestThreadSelect.py 
b/lldb/test/AP

[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits

https://github.com/mdko updated https://github.com/llvm/llvm-project/pull/73596

>From 97a6e23c85457a14c91c5800fa03bb872e6f1fa6 Mon Sep 17 00:00:00 2001
From: Michael Christensen 
Date: Mon, 27 Nov 2023 12:49:24 -0800
Subject: [PATCH 1/3] Add option to pass thread ID to thread select command

---
 lldb/source/Commands/CommandObjectThread.cpp  | 59 +--
 lldb/source/Commands/Options.td   |  5 ++
 .../thread/select/TestThreadSelect.py | 23 +++-
 3 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index a9f5a4f8a4fbd71..9384df319cc221d 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -1129,8 +1129,44 @@ class CommandObjectThreadUntil : public 
CommandObjectParsed {
 
 // CommandObjectThreadSelect
 
+#define LLDB_OPTIONS_thread_select
+#include "CommandOptions.inc"
+
 class CommandObjectThreadSelect : public CommandObjectParsed {
 public:
+  class CommandOptions : public Options {
+  public:
+CommandOptions() { OptionParsingStarting(nullptr); }
+
+~CommandOptions() override = default;
+
+void OptionParsingStarting(ExecutionContext *execution_context) override {
+  m_thread_id = false;
+}
+
+Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+  ExecutionContext *execution_context) override {
+  const int short_option = m_getopt_table[option_idx].val;
+  switch (short_option) {
+  case 't': {
+m_thread_id = true;
+break;
+  }
+
+  default:
+llvm_unreachable("Unimplemented option");
+  }
+
+  return {};
+}
+
+llvm::ArrayRef GetDefinitions() override {
+  return llvm::ArrayRef(g_thread_select_options);
+}
+
+bool m_thread_id;
+  };
+
   CommandObjectThreadSelect(CommandInterpreter &interpreter)
   : CommandObjectParsed(interpreter, "thread select",
 "Change the currently selected thread.", nullptr,
@@ -1165,6 +1201,8 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
 nullptr);
   }
 
+  Options *GetOptions() override { return &m_options; }
+
 protected:
   void DoExecute(Args &command, CommandReturnObject &result) override {
 Process *process = m_exe_ctx.GetProcessPtr();
@@ -1173,22 +1211,29 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
   return;
 } else if (command.GetArgumentCount() != 1) {
   result.AppendErrorWithFormat(
-  "'%s' takes exactly one thread index argument:\nUsage: %s\n",
-  m_cmd_name.c_str(), m_cmd_syntax.c_str());
+  "'%s' takes exactly one thread %s argument:\nUsage: %s\n",
+  m_cmd_name.c_str(), m_options.m_thread_id ? "ID" : "index",
+  m_cmd_syntax.c_str());
   return;
 }
 
 uint32_t index_id;
 if (!llvm::to_integer(command.GetArgumentAtIndex(0), index_id)) {
-  result.AppendErrorWithFormat("Invalid thread index '%s'",
+  result.AppendErrorWithFormat("Invalid thread %s '%s'",
+   m_options.m_thread_id ? "ID" : "index",
command.GetArgumentAtIndex(0));
   return;
 }
 
-Thread *new_thread =
-process->GetThreadList().FindThreadByIndexID(index_id).get();
+Thread *new_thread = nullptr;
+if (m_options.m_thread_id) {
+new_thread = process->GetThreadList().FindThreadByID(index_id).get();
+} else {
+new_thread = 
process->GetThreadList().FindThreadByIndexID(index_id).get();
+}
 if (new_thread == nullptr) {
-  result.AppendErrorWithFormat("invalid thread #%s.\n",
+  result.AppendErrorWithFormat("invalid thread %s%s.\n",
+   m_options.m_thread_id ? "ID " : "#",
command.GetArgumentAtIndex(0));
   return;
 }
@@ -1196,6 +1241,8 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
 process->GetThreadList().SetSelectedThreadByID(new_thread->GetID(), true);
 result.SetStatus(eReturnStatusSuccessFinishNoResult);
   }
+
+  CommandOptions m_options;
 };
 
 // CommandObjectThreadList
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 542c78be5a12dad..23886046df8f673 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_thread_id : Option<"thread_id", "t">,
+Desc<"Provide a thread ID instead of a thread index.">;
+}
+
 let Command = "thread trace dump function calls" in {
   def thread_trace_dump_function_calls_file : Option<"file", "F">, Group<1>,
 Arg<"Filename">,
diff --git a/lldb/test/API/commands/thread/select/TestThreadSelect.py 
b/lldb/test/AP

[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits

mdko wrote:

[Latest 
changes](https://github.com/llvm/llvm-project/pull/73596/commits/34045b9b2e04e01fed142ad2d7f4503e69646c9f)
 implement reviewer suggestions:
* `thread_id` option is now `thread-id`
*  This option takes a value rather than causing original argument to be 
interpreted differently
* This option is now in a separate grouping, so we can show the two separate 
ways of calling this command: `thread select ` and ` thread 
select [-t ]`. This is similar to what shows up with `memory write 
...`

Example usage:
```
michristensen@devbig356 llvm/Debug » ./bin/lldb ~/scratch/cpp/virtual/a.out
error: module importing failed: This script interpreter does not support 
importing modules.
NAME PASS STOP NOTIFY
===  ===  ===  ===
SIGPIPE  true falsefalse
(lldb) target create "/home/michristensen/scratch/cpp/virtual/a.out"
Current executable set to '/home/michristensen/scratch/cpp/virtual/a.out' 
(x86_64).
(lldb) b 18
Breakpoint 1: where = a.out`main + 13 at t2.cpp:20:14, address = 
0x0c2d
(lldb) ^D
michristensen@devbig356 llvm/Debug »
michristensen@devbig356 llvm/Debug » ./bin/lldb ~/scratch/cpp/threading/a.out
error: module importing failed: This script interpreter does not support 
importing modules.
NAME PASS STOP NOTIFY
===  ===  ===  ===
SIGPIPE  true falsefalse
(lldb) target create "/home/michristensen/scratch/cpp/threading/a.out"
Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' 
(x86_64).
(lldb) b 18
Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 
0x0850
(lldb) run
Process 3517265 launched: '/home/michristensen/scratch/cpp/threading/a.out' 
(x86_64)
This is a thread, i=1
This is a thread, i=2
This is a thread, i=3
This is a thread, i=4
This is a thread, i=5
Process 3517265 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x55400850 a.out`main at main.cpp:18:12
   15 for (int i = 0; i < 5; i++) {
   16   pthread_create(&thread_ids[i], NULL, foo, NULL);
   17 }
-> 18 for (int i = 0; i < 5; i++) {
   19   pthread_join(thread_ids[i], NULL);
   20 }
   21 return 0;
(lldb) thread select 2
* thread #2, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #2: tid = 3517533, 0x768f9918 libc.so.6`__nanosleep + 72, name = 
'a.out'

(lldb) thread list
Process 3517265 stopped
  thread #1: tid = 3517265, 0x55400850 a.out`main at main.cpp:18:12, 
name = 'a.out', stop reason = breakpoint 1.1
* thread #2: tid = 3517533, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #3: tid = 3517534, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #4: tid = 3517535, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #5: tid = 3517536, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #6: tid = 3517537, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
(lldb) thread select 3517265
error: Invalid thread #3517265.
(lldb) thread select -t 3517265
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x55400850 a.out`main at main.cpp:18:12
   15 for (int i = 0; i < 5; i++) {
   16   pthread_create(&thread_ids[i], NULL, foo, NULL);
   17 }
-> 18 for (int i = 0; i < 5; i++) {
   19   pthread_join(thread_ids[i], NULL);
   20 }
   21 return 0;
(lldb) thread select -t 3517534
* thread #3, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select 6
* thread #6, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #6: tid = 3517537, 0x768f9918 libc.so.6`__nanosleep + 72, name = 
'a.out'

(lldb) thread select -t 3517536
* thread #5, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #5: tid = 3517536, 0x768f9918 libc.s

[Lldb-commits] [lldb] Allow lldb to load .dwp files with large .debug_info or .debug_types. (PR #73736)

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

https://github.com/clayborg created 
https://github.com/llvm/llvm-project/pull/73736

A previous patch to llvm allowed the DWARFUnitIndex class to handle 
.debug_info.dwo and .debug_types.dwo sections to go over 4GB by checking for 
this case and fixing up the DWARFUnitIndex. LLDB's DWARF parser tries to use 
the llvm's DWARF parser when it can, and LLDB's DWARF parser uses the 
llvm::DWARFUnitIndex which should allow us to load large .dwp files, but there 
were a few things missing on the LLDB front:
- support for parsing DWARFUnit objects when the offset exceeds 4GB due to a 32 
bit truncation issue
- not populating the required DWARF sections when we call 
DWARFContext::GetAsLLVM() which didn't allow the fixups to happen as the data 
was missing.

This patch fixes these issues and now allows LLDB to parse large .dwp files 
without issues. The issue was discovered when running the "target modules dump 
separate-debug-info" command on one of these binaries that used a large .dwp 
file.

This is unfortunately hard to test without creating a huge .dwp file, so there 
are currently no tests for this that I can think of adding that wouldn't cause 
disk space constraints or making testing times longer by producing a huge .dwp 
file.

>From 80f6d62d718c8cad6ce35a77d2e3e75b2fe92f17 Mon Sep 17 00:00:00 2001
From: Greg Clayton 
Date: Tue, 28 Nov 2023 18:03:47 -0800
Subject: [PATCH] Allow lldb to load .dwp files with large .debug_info or
 .debug_types.

A previous patch to llvm allowed the DWARFUnitIndex class to handle 
.debug_info.dwo and .debug_types.dwo sections to go over 4GB by checking for 
this case and fixing up the DWARFUnitIndex. LLDB's DWARF parser tries to use 
the llvm's DWARF parser when it can, and LLDB's DWARF parser uses the 
llvm::DWARFUnitIndex which should allow us to load large .dwp files, but there 
were a few things missing on the LLDB front:
- support for parsing DWARFUnit objects when the offset exceeds 4GB due to a 32 
bit truncation issue
- not populating the required DWARF sections when we call 
DWARFContext::GetAsLLVM() which didn't allow the fixups to happen as the data 
was missing.

This patch fixes these issues and now allows LLDB to parse large .dwp files 
without issues. The issue was discovered when running the "target modules dump 
separate-debug-info" command on one of these binaries that used a large .dwp 
file.

This is unfortunately hard to test without creating a huge .dwp file, so there 
are currently no tests for this that I can think of adding that wouldn't cause 
disk space constraints or making testing times longer by producing a huge .dwp 
file.
---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp | 5 -
 lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h  | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
index ee347036dbbc034..e3872dc626be038 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -142,7 +142,10 @@ llvm::DWARFContext &DWARFContext::GetAsLLVM() {
 AddSection("debug_line_str", getOrLoadLineStrData());
 AddSection("debug_cu_index", getOrLoadCuIndexData());
 AddSection("debug_tu_index", getOrLoadTuIndexData());
-
+if (isDwo()) {
+  AddSection("debug_info.dwo", getOrLoadDebugInfoData());
+  AddSection("debug_types.dwo", getOrLoadDebugTypesData());
+}
 m_llvm_context = llvm::DWARFContext::create(section_map, addr_size);
   }
   return *m_llvm_context;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 3aef03712d00dc8..3f528e913d8cfab 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -76,7 +76,7 @@ class DWARFUnitHeader {
 return m_unit_type == llvm::dwarf::DW_UT_type ||
m_unit_type == llvm::dwarf::DW_UT_split_type;
   }
-  uint32_t GetNextUnitOffset() const { return m_offset + m_length + 4; }
+  dw_offset_t GetNextUnitOffset() const { return m_offset + m_length + 4; }
 
   llvm::Error ApplyIndexEntry(const llvm::DWARFUnitIndex::Entry *index_entry);
 
@@ -157,7 +157,7 @@ class DWARFUnit : public UserID {
   // Size of the CU data (without initial length and without header).
   size_t GetDebugInfoSize() const;
   // Size of the CU data incl. header but without initial length.
-  uint32_t GetLength() const { return m_header.GetLength(); }
+  dw_offset_t GetLength() const { return m_header.GetLength(); }
   uint16_t GetVersion() const { return m_header.GetVersion(); }
   const llvm::DWARFAbbreviationDeclarationSet *GetAbbreviations() const;
   dw_offset_t GetAbbrevOffset() const;

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


[Lldb-commits] [lldb] Allow lldb to load .dwp files with large .debug_info or .debug_types. (PR #73736)

2023-11-28 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Greg Clayton (clayborg)


Changes

A previous patch to llvm allowed the DWARFUnitIndex class to handle 
.debug_info.dwo and .debug_types.dwo sections to go over 4GB by checking for 
this case and fixing up the DWARFUnitIndex. LLDB's DWARF parser tries to use 
the llvm's DWARF parser when it can, and LLDB's DWARF parser uses the 
llvm::DWARFUnitIndex which should allow us to load large .dwp files, but there 
were a few things missing on the LLDB front:
- support for parsing DWARFUnit objects when the offset exceeds 4GB due to a 32 
bit truncation issue
- not populating the required DWARF sections when we call 
DWARFContext::GetAsLLVM() which didn't allow the fixups to happen as the data 
was missing.

This patch fixes these issues and now allows LLDB to parse large .dwp files 
without issues. The issue was discovered when running the "target modules dump 
separate-debug-info" command on one of these binaries that used a large .dwp 
file.

This is unfortunately hard to test without creating a huge .dwp file, so there 
are currently no tests for this that I can think of adding that wouldn't cause 
disk space constraints or making testing times longer by producing a huge .dwp 
file.

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


2 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp (+4-1) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (+2-2) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
index ee347036dbbc034..e3872dc626be038 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -142,7 +142,10 @@ llvm::DWARFContext &DWARFContext::GetAsLLVM() {
 AddSection("debug_line_str", getOrLoadLineStrData());
 AddSection("debug_cu_index", getOrLoadCuIndexData());
 AddSection("debug_tu_index", getOrLoadTuIndexData());
-
+if (isDwo()) {
+  AddSection("debug_info.dwo", getOrLoadDebugInfoData());
+  AddSection("debug_types.dwo", getOrLoadDebugTypesData());
+}
 m_llvm_context = llvm::DWARFContext::create(section_map, addr_size);
   }
   return *m_llvm_context;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 3aef03712d00dc8..3f528e913d8cfab 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -76,7 +76,7 @@ class DWARFUnitHeader {
 return m_unit_type == llvm::dwarf::DW_UT_type ||
m_unit_type == llvm::dwarf::DW_UT_split_type;
   }
-  uint32_t GetNextUnitOffset() const { return m_offset + m_length + 4; }
+  dw_offset_t GetNextUnitOffset() const { return m_offset + m_length + 4; }
 
   llvm::Error ApplyIndexEntry(const llvm::DWARFUnitIndex::Entry *index_entry);
 
@@ -157,7 +157,7 @@ class DWARFUnit : public UserID {
   // Size of the CU data (without initial length and without header).
   size_t GetDebugInfoSize() const;
   // Size of the CU data incl. header but without initial length.
-  uint32_t GetLength() const { return m_header.GetLength(); }
+  dw_offset_t GetLength() const { return m_header.GetLength(); }
   uint16_t GetVersion() const { return m_header.GetVersion(); }
   const llvm::DWARFAbbreviationDeclarationSet *GetAbbreviations() const;
   dw_offset_t GetAbbrevOffset() const;

``




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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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

https://github.com/clayborg requested changes to this pull request.

Great changes, just a few inline comments.

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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


@@ -1239,11 +1242,12 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
   new_thread = 
process->GetThreadList().FindThreadByIndexID(index_id).get();
   if (new_thread == nullptr) {
 result.AppendErrorWithFormat("Invalid thread #%s.\n",

clayborg wrote:

Do we want to add some extra text saying "Invalid thread index #%s" to make it 
clear the thread index is invalid? Since we mention the "Invalid thread ID %lu" 
below?

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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


@@ -1165,37 +1208,59 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
 nullptr);
   }
 
+  Options *GetOptions() override { return &m_option_group; }
+
 protected:
   void DoExecute(Args &command, CommandReturnObject &result) override {
 Process *process = m_exe_ctx.GetProcessPtr();
 if (process == nullptr) {
   result.AppendError("no process");
   return;
-} else if (command.GetArgumentCount() != 1) {
+} else if (m_options.m_thread_id == LLDB_INVALID_THREAD_ID &&
+   command.GetArgumentCount() != 1) {
   result.AppendErrorWithFormat(
-  "'%s' takes exactly one thread index argument:\nUsage: %s\n",
+  "'%s' takes exactly one thread index argument, or a thread ID "
+  "option:\nUsage: %s\n",
   m_cmd_name.c_str(), m_cmd_syntax.c_str());
   return;
-}
-
-uint32_t index_id;
-if (!llvm::to_integer(command.GetArgumentAtIndex(0), index_id)) {
-  result.AppendErrorWithFormat("Invalid thread index '%s'",
-   command.GetArgumentAtIndex(0));
+} else if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID &&
+   command.GetArgumentCount() != 0) {
+  result.AppendErrorWithFormat("'%s' cannot take both a thread ID option "
+   "and a thread index argument:\nUsage: %s\n",
+   m_cmd_name.c_str(), m_cmd_syntax.c_str());
   return;
 }
 
-Thread *new_thread =
-process->GetThreadList().FindThreadByIndexID(index_id).get();
-if (new_thread == nullptr) {
-  result.AppendErrorWithFormat("invalid thread #%s.\n",
-   command.GetArgumentAtIndex(0));
-  return;
+Thread *new_thread = nullptr;
+if (command.GetArgumentCount() == 1) {
+  uint32_t index_id;
+  if (!llvm::to_integer(command.GetArgumentAtIndex(0), index_id)) {
+result.AppendErrorWithFormat("Invalid thread index '%s'",
+ command.GetArgumentAtIndex(0));
+return;
+  }
+  new_thread = 
process->GetThreadList().FindThreadByIndexID(index_id).get();
+  if (new_thread == nullptr) {
+result.AppendErrorWithFormat("Invalid thread #%s.\n",
+ command.GetArgumentAtIndex(0));
+return;
+  }
+} else {
+  new_thread =
+  process->GetThreadList().FindThreadByID(m_options.m_thread_id).get();
+  if (new_thread == nullptr) {
+result.AppendErrorWithFormat("Invalid thread ID %lu.\n",

clayborg wrote:

use `PRIu64` instead of `u` above:
```
result.AppendErrorWithFormat("Invalid thread ID %l" PRIu64 ".\n",
```
Also, do we default to showing thread IDs as unsigned decimal numbers or as hex 
in other `thread` commands?

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

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


@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_select_thread_id : Option<"thread-id", "t">, Group<2>,
+Arg<"ThreadID">, Desc<"Provide a thread ID instead of a thread index.">;

clayborg wrote:

We want to make sure this type is a `lldb::tid_t` (which is a `uint64_t`). Does 
`Arg<"ThreadID">` take care of this for us? I want to make sure we aren't 
defaulting to a 32 bit integer where someone might not be able to specify the 
full thread ID without it getting trucated. Can we verify this is using a 
`uint64_t`?

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


[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

2023-11-28 Thread via lldb-commits


@@ -436,8 +482,8 @@ class CompilerType {
  ExecutionContextScope *exe_scope);
 
   /// Dump to stdout.
-  void DumpTypeDescription(lldb::DescriptionLevel level =
-   lldb::eDescriptionLevelFull) const;

cmtice wrote:

Personally I agree with you. GIthub pull request creation did not give me any 
choice: It would not allow me to create a PR that did not pass clang-format. If 
you know of some way to bypass that requirement, PLEASE tell me!! 

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


[Lldb-commits] [lldb] 3d7e6db - [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (#73028)

2023-11-28 Thread via lldb-commits

Author: Jordan Rupprecht
Date: 2023-11-28T23:36:05-06:00
New Revision: 3d7e6db12072c26c7ad42c2c473d1dc321725db4

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

LOG: [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage 
(#73028)

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/test/API/commands/expression/test/TestExprs.py
lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
lldb/test/API/functionalities/thread/state/TestThreadStates.py
lldb/test/API/lang/c/shared_lib/TestSharedLib.py

lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py

lldb/test/API/lang/cpp/reference-to-outer-type/TestCppReferenceToOuterClass.py
lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index bb06a5ee20f2532..a4cee1f5761625a 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -113,10 +113,6 @@ def _compiler_supports(
 return True
 
 
-def expectedFailure(func):
-return unittest2.expectedFailure(func)
-
-
 def expectedFailureIfFn(expected_fn, bugnumber=None):
 def expectedFailure_impl(func):
 if isinstance(func, type) and issubclass(func, unittest2.TestCase):

diff  --git a/lldb/test/API/commands/expression/test/TestExprs.py 
b/lldb/test/API/commands/expression/test/TestExprs.py
index 76a5e9efebb1866..e95c76b7104c2a9 100644
--- a/lldb/test/API/commands/expression/test/TestExprs.py
+++ b/lldb/test/API/commands/expression/test/TestExprs.py
@@ -12,6 +12,7 @@
 """
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -43,9 +44,9 @@ def build_and_run(self):
 
 self.runCmd("run", RUN_SUCCEEDED)
 
-@expectedFailure(
-"llvm.org/pr17135  APFloat::toString does not 
identify the correct (i.e. least) precision."
-)
+# llvm.org/pr17135 
+# APFloat::toString does not identify the correct (i.e. least) precision.
+@unittest2.expectedFailure
 def test_floating_point_expr_commands(self):
 self.build_and_run()
 

diff  --git a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py 
b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
index e93f566ea7ea63c..a07421524478744 100644
--- a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
+++ b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
@@ -1,6 +1,7 @@
 """Test for the JITLoaderGDB interface"""
 
 
+import unittest2
 import os
 import lldb
 from lldbsuite.test import lldbutil
@@ -13,7 +14,7 @@ class JITLoaderGDBTestCase(TestBase):
 lambda: "Skipped because the test crashes the test runner",
 bugnumber="llvm.org/pr24702",
 )
-@expectedFailure("llvm.org/pr24702")
+@unittest2.expectedFailure  # llvm.org/pr24702
 def test_bogus_values(self):
 """Test that we handle inferior misusing the GDB JIT interface"""
 self.build()

diff  --git a/lldb/test/API/functionalities/thread/state/TestThreadStates.py 
b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
index ad1edff6ae3f354..e128ca84977b411 100644
--- a/lldb/test/API/functionalities/thread/state/TestThreadStates.py
+++ b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
@@ -3,6 +3,7 @@
 """
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -40,14 +41,14 @@ def test_state_after_continue(self):
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660")
 @expectedFailureNetBSD
 # thread states not properly maintained
-@expectedFailure("llvm.org/pr16712")
+@unittest2.expectedFailure  # llvm.org/pr16712
 def test_state_after_expression(self):
 """Test thread state after expression."""
 self.build()
 self.thread_state_after_expression_test()
 
 # thread states not properly maintained
-@expectedFailure("llvm.org/pr15824 and ")
+@unittest2.expectedFailure  # llvm.org/pr15824 and 

 @expectedFailureAll(
 oslist=["windows"],
 bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly",

diff  --git a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py 
b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
index b375aa6a86e14fb..235b9b4ce3442df 100644
--- a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
+++ b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
@@ -1,6 +1,7 @@
 """Test that types defined in shared libraries work correctly."""
 
 
+import un

[Lldb-commits] [lldb] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (PR #73028)

2023-11-28 Thread Jordan Rupprecht via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

2023-11-28 Thread Will Hawkins via lldb-commits


@@ -436,8 +482,8 @@ class CompilerType {
  ExecutionContextScope *exe_scope);
 
   /// Dump to stdout.
-  void DumpTypeDescription(lldb::DescriptionLevel level =
-   lldb::eDescriptionLevelFull) const;

hawkinsw wrote:

It's ugly, but there *is* this:

```C++
// clang-format off
...
// clang-format on
```

I am sure that you knew that and were asking for a nicer workaround. I, too, 
would be interested in learning such a trick, if it existed.

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


[Lldb-commits] [llvm] [clang-tools-extra] [clang] [lldb] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2023-11-28 Thread Jordan Rupprecht via lldb-commits

https://github.com/rupprecht updated 
https://github.com/llvm/llvm-project/pull/73067

>From 22bfc5878f1f96b3138a03eea4dc856948185c89 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Tue, 21 Nov 2023 17:28:30 -0800
Subject: [PATCH 1/2] [lldb][test] Apply @expectedFailureAll/@skipIf early for
 debug_info tests

The @expectedFailureAll and @skipIf decorators will mark the test case as 
xfail/skip if _all_ conditions passed in match, including debug_info.
* If debug_info is not one of the matching conditions, we can immediately 
evaluate the check and decide if it should be decorated.
* If debug_info *is* present as a match condition, we need to defer whether or 
not to decorate until when the `LLDBTestCaseFactory` metaclass expands the test 
case into its potential variants. This is still early enough that the standard 
`unittest` framework will recognize the test as xfail/skip by the time the test 
actually runs.

TestDecorators exhibits the edge cases more thoroughly. With the exception of 
`@expectedFailureIf` (added by this commit), all those test cases pass prior to 
this commit.

This is a followup to 212a60ec37322f853e91e171b305479b1abff2f2.
---
 .../Python/lldbsuite/test/decorators.py   |  53 -
 .../Python/lldbsuite/test/lldbtest.py |  20 
 lldb/test/API/test_utils/TestDecorators.py| 110 +-
 3 files changed, 177 insertions(+), 6 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index bb06a5ee20f2532..2398892b9e14814 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -117,6 +117,21 @@ def expectedFailure(func):
 return unittest2.expectedFailure(func)
 
 
+def expectedFailureIf(condition, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+if condition:
+return expectedFailure(func)
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
 def expectedFailureIfFn(expected_fn, bugnumber=None):
 def expectedFailure_impl(func):
 if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -178,6 +193,34 @@ def wrapper(*args, **kwargs):
 return skipTestIfFn_impl
 
 
+def _xfailForDebugInfo(expected_fn, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__xfail_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
+def _skipForDebugInfo(expected_fn, bugnumber=None):
+def skipImpl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__skip_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return skipImpl(bugnumber)
+else:
+return skipImpl
+
+
 def _decorateTest(
 mode,
 bugnumber=None,
@@ -195,7 +238,7 @@ def _decorateTest(
 dwarf_version=None,
 setting=None,
 ):
-def fn(self):
+def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
 lldbplatform.translate(oslist), lldbplatformutil.getPlatform()
 )
@@ -208,7 +251,7 @@ def fn(self):
 skip_for_arch = _match_decorator_property(
 archs, lldbplatformutil.getArchitecture()
 )
-skip_for_debug_info = _match_decorator_property(debug_info, 
self.getDebugInfo())
+skip_for_debug_info = _match_decorator_property(debug_info, 
actual_debug_info)
 skip_for_triple = _match_decorator_property(
 triple, lldb.selected_platform.GetTriple()
 )
@@ -283,9 +326,13 @@ def fn(self):
 return reason_str
 
 if mode == DecorateMode.Skip:
+if debug_info:
+return _skipForDebugInfo(fn, bugnumber)
 return skipTestIfFn(fn, bugnumber)
 elif mode == DecorateMode.Xfail:
-return expectedFailureIfFn(fn, bugnumber)
+if debug_info:
+return _xfailForDebugInfo(fn, bugnumber)
+return expectedFailureIf(fn(), bugnumber)
 else:
 return None
 
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index dc4e322c675dc9d..872866655093d21 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1667,6 +1667,11 @@ def __new__(cls, name, bases, attrs

[Lldb-commits] [libc] [flang] [libcxxabi] [libcxx] [clang] [lld] [llvm] [clang-tools-extra] [lldb] [flang] Pass Argv0 to getIntriniscDir and getOpenMPHeadersDir (PR #73254)

2023-11-28 Thread Brad Smith via lldb-commits

brad0 wrote:

It would be nice to get this in so Flang is buildable.

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits


@@ -1117,6 +1117,11 @@ let Command = "thread plan list" in {
 Desc<"Display thread plans for unreported threads">;
 }
 
+let Command = "thread select" in {
+  def thread_select_thread_id : Option<"thread-id", "t">, Group<2>,
+Arg<"ThreadID">, Desc<"Provide a thread ID instead of a thread index.">;

mdko wrote:

Yes it's a uint64_t:

https://github.com/llvm/llvm-project/blob/35db35b7cfb80139ab6f23c7f10c47df5d1d7462/lldb/include/lldb/lldb-types.h#L82

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-11-28 Thread Michael Christensen via lldb-commits


@@ -1165,37 +1208,59 @@ class CommandObjectThreadSelect : public 
CommandObjectParsed {
 nullptr);
   }
 
+  Options *GetOptions() override { return &m_option_group; }
+
 protected:
   void DoExecute(Args &command, CommandReturnObject &result) override {
 Process *process = m_exe_ctx.GetProcessPtr();
 if (process == nullptr) {
   result.AppendError("no process");
   return;
-} else if (command.GetArgumentCount() != 1) {
+} else if (m_options.m_thread_id == LLDB_INVALID_THREAD_ID &&
+   command.GetArgumentCount() != 1) {
   result.AppendErrorWithFormat(
-  "'%s' takes exactly one thread index argument:\nUsage: %s\n",
+  "'%s' takes exactly one thread index argument, or a thread ID "
+  "option:\nUsage: %s\n",
   m_cmd_name.c_str(), m_cmd_syntax.c_str());
   return;
-}
-
-uint32_t index_id;
-if (!llvm::to_integer(command.GetArgumentAtIndex(0), index_id)) {
-  result.AppendErrorWithFormat("Invalid thread index '%s'",
-   command.GetArgumentAtIndex(0));
+} else if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID &&
+   command.GetArgumentCount() != 0) {
+  result.AppendErrorWithFormat("'%s' cannot take both a thread ID option "
+   "and a thread index argument:\nUsage: %s\n",
+   m_cmd_name.c_str(), m_cmd_syntax.c_str());
   return;
 }
 
-Thread *new_thread =
-process->GetThreadList().FindThreadByIndexID(index_id).get();
-if (new_thread == nullptr) {
-  result.AppendErrorWithFormat("invalid thread #%s.\n",
-   command.GetArgumentAtIndex(0));
-  return;
+Thread *new_thread = nullptr;
+if (command.GetArgumentCount() == 1) {
+  uint32_t index_id;
+  if (!llvm::to_integer(command.GetArgumentAtIndex(0), index_id)) {
+result.AppendErrorWithFormat("Invalid thread index '%s'",
+ command.GetArgumentAtIndex(0));
+return;
+  }
+  new_thread = 
process->GetThreadList().FindThreadByIndexID(index_id).get();
+  if (new_thread == nullptr) {
+result.AppendErrorWithFormat("Invalid thread #%s.\n",
+ command.GetArgumentAtIndex(0));
+return;
+  }
+} else {
+  new_thread =
+  process->GetThreadList().FindThreadByID(m_options.m_thread_id).get();
+  if (new_thread == nullptr) {
+result.AppendErrorWithFormat("Invalid thread ID %lu.\n",

mdko wrote:

Thread IDs are shown as unsigned decimal, e.g.:
```
(lldb) thread list
Process 2291372 stopped
  thread #1: tid = 2291372, 0x55400850 a.out`main at main.cpp:18:12, 
name = 'a.out', stop reason = breakpoint 1.1
* thread #2: tid = 2291686, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #3: tid = 2291688, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #4: tid = 2291690, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #5: tid = 2291691, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #6: tid = 2291692, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
```

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


[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup (PR #69422)

2023-11-28 Thread via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


taalhaataahir0102 wrote:

Hi @reviewers. Did you got the chance to look at the code and is there any 
feedback 🙂

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