[Lldb-commits] [lldb] [LLDB][SBSaveCore] Fix bug where default values are not propagated. (PR #101770)

2024-08-05 Thread Haojian Wu via lldb-commits

hokein wrote:

The newly-added test causes a msan failure:

```
==1960==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55e25271b29e in RetryAfterSignal 
llvm-project/llvm/include/llvm/Support/Errno.h:37:11
#1 0x55e25271b29e in lldb_private::NativeFile::Write(void const*, unsigned 
long&) llvm-project/lldb/source/Host/common/File.cpp:618:9
#2 0x55e25223793f in MinidumpFileBuilder::FlushBufferToDisk() 
llvm-project/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:1165:26
#3 0x55e252237548 in MinidumpFileBuilder::FixThreadStacks() 
llvm-project/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:568:3
#4 0x55e25223ba52 in MinidumpFileBuilder::AddMemoryList() 
llvm-project/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:890:10
#5 0x55e2522438ad in 
ObjectFileMinidump::SaveCore(std::__msan::shared_ptr 
const&, lldb_private::SaveCoreOptions&, lldb_private::Status&) 
llvm-project/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp:124:19
#6 0x55e251e1f482 in 
lldb_private::PluginManager::SaveCore(std::__msan::shared_ptr
 const&, lldb_private::SaveCoreOptions&) 
llvm-project/lldb/source/Core/PluginManager.cpp:736:33
```

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


[Lldb-commits] [lldb] 86f7374 - Revert "[LLDB][SBSaveCore] Fix bug where default values are not propagated. (#101770)"

2024-08-05 Thread Haojian Wu via lldb-commits

Author: Haojian Wu
Date: 2024-08-05T09:37:36+02:00
New Revision: 86f7374078288e2b3d3d0fd66428f7752e2319e6

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

LOG: Revert "[LLDB][SBSaveCore] Fix bug where default values are not 
propagated. (#101770)"

This reverts commit 34766d0d488ba2fbefa80dcd0cc8720a0e753448 which
caused a msan failure, see comment 
https://github.com/llvm/llvm-project/pull/101770#issuecomment-2268373325 for 
details.

Added: 


Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index e4e0c3eea67f8..a23f834f471fb 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -194,7 +194,7 @@ class PluginManager {
   GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name);
 
   static Status SaveCore(const lldb::ProcessSP &process_sp,
- lldb_private::SaveCoreOptions &core_options);
+ const lldb_private::SaveCoreOptions &core_options);
 
   // ObjectContainer
   static bool RegisterPlugin(

diff  --git a/lldb/include/lldb/lldb-private-interfaces.h 
b/lldb/include/lldb/lldb-private-interfaces.h
index b3c8cda899b95..87c5ff8d22fb6 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -57,7 +57,7 @@ typedef ObjectFile *(*ObjectFileCreateMemoryInstance)(
 const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
 const lldb::ProcessSP &process_sp, lldb::addr_t offset);
 typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp,
-   lldb_private::SaveCoreOptions &options,
+   const lldb_private::SaveCoreOptions 
&options,
Status &error);
 typedef EmulateInstruction *(*EmulateInstructionCreateInstance)(
 const ArchSpec &arch, InstructionType inst_type);

diff  --git a/lldb/source/Core/PluginManager.cpp 
b/lldb/source/Core/PluginManager.cpp
index f243807df509e..fbd78a7780578 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -702,7 +702,7 @@ 
PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
 }
 
 Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp,
-   lldb_private::SaveCoreOptions &options) {
+   const lldb_private::SaveCoreOptions &options) {
   Status error;
   if (!options.GetOutputFile()) {
 error.SetErrorString("No output file specified");

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 22ece4f4dacf7..4322bd7e2674f 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6351,7 +6351,7 @@ static offset_t
 CreateAllImageInfosPayload(const lldb::ProcessSP &process_sp,
offset_t initial_file_offset,
StreamString &all_image_infos_payload,
-   lldb_private::SaveCoreOptions &options) {
+   const lldb_private::SaveCoreOptions &options) {
   Target &target = process_sp->GetTarget();
   ModuleList modules = target.GetImages();
 
@@ -6522,17 +6522,16 @@ struct page_object {
 };
 
 bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
-   lldb_private::SaveCoreOptions &options,
+   const lldb_private::SaveCoreOptions &options,
Status &error) {
+  auto core_style = options.GetStyle();
+  if (core_style == SaveCoreStyle::eSaveCoreUnspecified)
+core_style = SaveCoreStyle::eSaveCoreDirtyOnly;
   // The FileSpec and Process are already checked in PluginManager::SaveCore.
   assert(options.GetOutputFile().has_value());
   assert(process_sp);
   const FileSpec outfile = options.G

[Lldb-commits] [lldb] [LLDB][SBSaveCore] Fix bug where default values are not propagated. (PR #101770)

2024-08-05 Thread Haojian Wu via lldb-commits

hokein wrote:

@Jlalond, I revert it in 86f7374078288e2b3d3d0fd66428f7752e2319e6 to keep the 
trunk green. Feel free to reland the patch with the fix.

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


[Lldb-commits] [lldb] [LLDB][SBSaveCore] Fix bug where default values are not propagated. (PR #101770)

2024-08-06 Thread Haojian Wu via lldb-commits

hokein wrote:

 I saw the msan failure when integrating LLVM into our internal codebase, it is 
a msan-build lldb.

The second error `AssertionError: launching (4) != stopped (5)` occurred in a 
non-msan-build lldb from the upstream repository. And I ran `llvm-lit -sv 
lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py`

https://github.com/llvm/llvm-project/pull/101770
___
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-24 Thread Haojian Wu via lldb-commits

https://github.com/hokein created 
https://github.com/llvm/llvm-project/pull/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.

>From 5fb8fd532fe767feb2d361f9552ff31ea7770663 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 24 Nov 2023 10:46:03 +0100
Subject: [PATCH] [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() {}

___
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-24 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) {
 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;

hokein wrote:

> Is it because in your tests alignof(EmptyStruct) wouldn't trigger 
> CompleteRecordType?

Yes, exactly, this is the major reason. The codepath in `CompleteRecordType` 
has a conditional statement  `if (!layout_info.field_offsets.empty() || 
!layout_info.base_offsets.empty() || !layout_info.vbase_offsets.empty())` where 
an empty structure will never hit.

We could tweak the if condition there, but I'm less certain about it, my 
reading of code is that the location here seem to be responsible for empty 
structures (happy to change if this is not reasonable).

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 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] [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 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] [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] eaf4f60 - [lldb] Remove unused lldb.cpp

2021-12-09 Thread Haojian Wu via lldb-commits

Author: Haojian Wu
Date: 2021-12-09T17:54:27+01:00
New Revision: eaf4f60507fd7e5d20c5dcee711ca12f13f1acc1

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

LOG: [lldb] Remove unused lldb.cpp

lldb.cpp is unused after 
https://github.com/llvm/llvm-project/commit/ccf1469a4cdb03cb2bc7868f76164e85d90ebee1

Differential Revision: https://reviews.llvm.org/D115438

Added: 


Modified: 


Removed: 
lldb/source/lldb.cpp



diff  --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp
deleted file mode 100644
index 371902f6c1b5d..0
--- a/lldb/source/lldb.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//===-- lldb.cpp 
--===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "VCSVersion.inc"
-#include "lldb/lldb-private.h"
-#include "clang/Basic/Version.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-// LLDB_VERSION_STRING is set through a define so unlike the other defines
-// expanded with CMake, it lacks the double quotes.
-#define QUOTE(str) #str
-#define EXPAND_AND_QUOTE(str) QUOTE(str)
-
-static const char *GetLLDBVersion() {
-#ifdef LLDB_VERSION_STRING
-  return EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
-#else
-  return "lldb version " CLANG_VERSION_STRING;
-#endif
-}
-
-static const char *GetLLDBRevision() {
-#ifdef LLDB_REVISION
-  return LLDB_REVISION;
-#else
-  return NULL;
-#endif
-}
-
-static const char *GetLLDBRepository() {
-#ifdef LLDB_REPOSITORY
-  return LLDB_REPOSITORY;
-#else
-  return NULL;
-#endif
-}
-
-const char *lldb_private::GetVersion() {
-  static std::string g_version_str;
-  if (g_version_str.empty()) {
-const char *lldb_version = GetLLDBVersion();
-const char *lldb_repo = GetLLDBRepository();
-const char *lldb_rev = GetLLDBRevision();
-g_version_str += lldb_version;
-if (lldb_repo || lldb_rev) {
-  g_version_str += " (";
-  if (lldb_repo)
-g_version_str += lldb_repo;
-  if (lldb_repo && lldb_rev)
-g_version_str += " ";
-  if (lldb_rev) {
-g_version_str += "revision ";
-g_version_str += lldb_rev;
-  }
-  g_version_str += ")";
-}
-
-std::string clang_rev(clang::getClangRevision());
-if (clang_rev.length() > 0) {
-  g_version_str += "\n  clang revision ";
-  g_version_str += clang_rev;
-}
-std::string llvm_rev(clang::getLLVMRevision());
-if (llvm_rev.length() > 0) {
-  g_version_str += "\n  llvm revision ";
-  g_version_str += llvm_rev;
-}
-  }
-  return g_version_str.c_str();
-}



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


[Lldb-commits] [lldb] 2a579db - [lldb] Replace llvm::writeFileAtomically with llvm::writeToOutput API.

2023-07-03 Thread Haojian Wu via lldb-commits

Author: Haojian Wu
Date: 2023-07-04T08:52:45+02:00
New Revision: 2a579db32a7a0a5f10ddd989eb4cb14974c17c26

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

LOG: [lldb] Replace llvm::writeFileAtomically with llvm::writeToOutput API.

Differential Revision: https://reviews.llvm.org/D154329

Added: 


Modified: 
lldb/tools/lldb-server/lldb-platform.cpp

Removed: 




diff  --git a/lldb/tools/lldb-server/lldb-platform.cpp 
b/lldb/tools/lldb-server/lldb-platform.cpp
index 21b433511c5657..3e126584eb25b4 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -22,7 +22,6 @@
 #include 
 
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -103,38 +102,15 @@ static Status save_socket_id_to_file(const std::string 
&socket_id,
 return Status("Failed to create directory %s: %s",
   temp_file_spec.GetPath().c_str(), error.AsCString());
 
-  llvm::SmallString<64> temp_file_path;
-  temp_file_spec.AppendPathComponent("port-file.%%");
-  temp_file_path = temp_file_spec.GetPath();
-
   Status status;
-  if (auto Err =
-  handleErrors(llvm::writeFileAtomically(
-   temp_file_path, file_spec.GetPath(), socket_id),
-   [&status, &file_spec](const AtomicFileWriteError &E) {
- std::string ErrorMsgBuffer;
- llvm::raw_string_ostream S(ErrorMsgBuffer);
- E.log(S);
-
- switch (E.Error) {
- case atomic_write_error::failed_to_create_uniq_file:
-   status = Status("Failed to create temp file: %s",
-   ErrorMsgBuffer.c_str());
-   break;
- case atomic_write_error::output_stream_error:
-   status = Status("Failed to write to port file.");
-   break;
- case atomic_write_error::failed_to_rename_temp_file:
-   status = Status("Failed to rename file %s to %s: 
%s",
-   ErrorMsgBuffer.c_str(),
-   file_spec.GetPath().c_str(),
-   ErrorMsgBuffer.c_str());
-   break;
- }
-   })) {
-return Status("Failed to atomically write file %s",
-  file_spec.GetPath().c_str());
-  }
+  if (auto Err = llvm::writeToOutput(file_spec.GetPath(),
+ [&socket_id](llvm::raw_ostream &OS) {
+   OS << socket_id;
+   return llvm::Error::success();
+ }))
+return Status("Failed to atomically write file %s: %s",
+  file_spec.GetPath().c_str(),
+  llvm::toString(std::move(Err)).c_str());
   return status;
 }
 



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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

2023-10-31 Thread Haojian Wu via lldb-commits

https://github.com/hokein created 
https://github.com/llvm/llvm-project/pull/70779

Fixes #69309 

* always populate all fields for the generated coroutine frame type;
* make the artificial variables `__promise`, `__coro_frame` visible, so that 
they are present in the `frame var` command;

>From 4cc40aafef4db5133f4360b2fb367e1776dc2901 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 31 Oct 2023 11:15:45 +0100
Subject: [PATCH] [LLDB] Don't ignore artificial variables and members for
 coroutines

* always populate all fields for the generated coroutine frame type;
* make the artificial variables `__promise`, `__coro_frame` visible, so
  that they are present in the `frame var` command;
---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp | 5 -
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 3 ++-
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 3 +++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..c7d9eb37f9b5199 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 182cc6764651747..d2708d183801035 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3061,7 +3061,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // artificial member with (unnamed bitfield) padding.
   // FIXME: This check should verify that this is indeed an artificial member
   // we are supposed to ignore.
-  if (attrs.is_artificial) {
+  if (attrs.is_artificial &&
+  !TypeSystemClang::IsCoroutineFrameType(class_clang_type)) {
 last_field_info.SetIsArtificial(true);
 return;
   }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f037708efc38007..138f5531db2a9fb 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -771,6 +771,10 @@ TypeSystemClang 
*TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
   return clang_ast;
 }
 
+bool TypeSystemClang::IsCoroutineFrameType(const CompilerType &Type) {
+  return Type.GetTypeName().GetStringRef().ends_with(".coro_frame_ty");
+}
+
 clang::MangleContext *TypeSystemClang::getMangleContext() {
   if (m_mangle_ctx_up == nullptr)
 m_mangle_ctx_up.reset(getASTContext().createMangleContext());
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0ec2d026e996105..6168a065eb522e9 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -154,6 +154,9 @@ class TypeSystemClang : public TypeSystem {
 
   static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
 
+  // Returns true if the given type is a coroutine frame debug type.
+  static bool IsCoroutineFrameType(const CompilerType &Type);
+
   /// Returns the display name of this TypeSystemClang that indicates what
   /// purpose it serves in LLDB. Used for example in logs.
   llvm::StringRef getDisplayName() const { return m_display_name; }

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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

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

>From 4cc40aafef4db5133f4360b2fb367e1776dc2901 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 31 Oct 2023 11:15:45 +0100
Subject: [PATCH 1/2] [LLDB] Don't ignore artificial variables and members for
 coroutines

* always populate all fields for the generated coroutine frame type;
* make the artificial variables `__promise`, `__coro_frame` visible, so
  that they are present in the `frame var` command;
---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp | 5 -
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 3 ++-
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 3 +++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..c7d9eb37f9b5199 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 182cc6764651747..d2708d183801035 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3061,7 +3061,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // artificial member with (unnamed bitfield) padding.
   // FIXME: This check should verify that this is indeed an artificial member
   // we are supposed to ignore.
-  if (attrs.is_artificial) {
+  if (attrs.is_artificial &&
+  !TypeSystemClang::IsCoroutineFrameType(class_clang_type)) {
 last_field_info.SetIsArtificial(true);
 return;
   }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f037708efc38007..138f5531db2a9fb 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -771,6 +771,10 @@ TypeSystemClang 
*TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
   return clang_ast;
 }
 
+bool TypeSystemClang::IsCoroutineFrameType(const CompilerType &Type) {
+  return Type.GetTypeName().GetStringRef().ends_with(".coro_frame_ty");
+}
+
 clang::MangleContext *TypeSystemClang::getMangleContext() {
   if (m_mangle_ctx_up == nullptr)
 m_mangle_ctx_up.reset(getASTContext().createMangleContext());
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0ec2d026e996105..6168a065eb522e9 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -154,6 +154,9 @@ class TypeSystemClang : public TypeSystem {
 
   static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
 
+  // Returns true if the given type is a coroutine frame debug type.
+  static bool IsCoroutineFrameType(const CompilerType &Type);
+
   /// Returns the display name of this TypeSystemClang that indicates what
   /// purpose it serves in LLDB. Used for example in logs.
   llvm::StringRef getDisplayName() const { return m_display_name; }

>From c145045251683c42008dff49e2f02cf0a8020894 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 3 Nov 2023 12:07:23 +0100
Subject: [PATCH 2/2] Add and use `ShouldIgnoreArtificialField` API to ignore
 the indeed artificial members we should ignore.

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 ++--
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index d2708d183801035..0c0566eec56133f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3059,10 +3059,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // This needs to be done after updating FieldInfo which keeps track of where
   // field start/end so we don't later try to fill the space of this
   // artificial member with (unnamed bitfield) padding.

[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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


@@ -3061,7 +3061,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // artificial member with (unnamed bitfield) padding.
   // FIXME: This check should verify that this is indeed an artificial member
   // we are supposed to ignore.
-  if (attrs.is_artificial) {
+  if (attrs.is_artificial &&
+  !TypeSystemClang::IsCoroutineFrameType(class_clang_type)) {

hokein wrote:

I changed to `ShouldIgnoreArtificialField` per suggest (unite tests are 
passed). It looks like the vtable pointer is the only case for C/C++.

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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

https://github.com/hokein commented:

Thanks for the review.

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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


@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");

hokein wrote:

> I am not sure if I would expose the __coro_frame variable.
For completeness, I'm leaning towards exposing `__coro_frame` as well, even 
though it is not that useful.

> Any chance we can get the Type from the Variable in 
> CommandObjectFrameVariable and can re-use the IsCoroutineFrameType check?

Yes, we can get the Type in `CommandObjectFrameVariable` by calling 
`valobj_sp->GetCompilerType();`. 
However it only works for the coroutine-frame variables,  other variables like 
`__promise` (whose type is a user-defined promise_type) are still not 
available. One idea is to make the `IsCoroutineFrameType` more generic to check 
coroutine-relevant types (promise_type, coroutine_frame_type).

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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

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

>From 2ff56f181659a0079c66ce646d50780844ffb080 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 31 Oct 2023 11:15:45 +0100
Subject: [PATCH 1/3] [LLDB] Don't ignore artificial variables and members for
 coroutines

* always populate all fields for the generated coroutine frame type;
* make the artificial variables `__promise`, `__coro_frame` visible, so
  that they are present in the `frame var` command;
---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp | 5 -
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 3 ++-
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 3 +++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..c7d9eb37f9b5199 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 3174c18c97d888c..48e85cac7b4256f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3061,7 +3061,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // artificial member with (unnamed bitfield) padding.
   // FIXME: This check should verify that this is indeed an artificial member
   // we are supposed to ignore.
-  if (attrs.is_artificial) {
+  if (attrs.is_artificial &&
+  !TypeSystemClang::IsCoroutineFrameType(class_clang_type)) {
 last_field_info.SetIsArtificial(true);
 return;
   }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 6f65587c4acedd1..590ba1f6a986ea5 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -771,6 +771,10 @@ TypeSystemClang 
*TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
   return clang_ast;
 }
 
+bool TypeSystemClang::IsCoroutineFrameType(const CompilerType &Type) {
+  return Type.GetTypeName().GetStringRef().ends_with(".coro_frame_ty");
+}
+
 clang::MangleContext *TypeSystemClang::getMangleContext() {
   if (m_mangle_ctx_up == nullptr)
 m_mangle_ctx_up.reset(getASTContext().createMangleContext());
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0ec2d026e996105..6168a065eb522e9 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -154,6 +154,9 @@ class TypeSystemClang : public TypeSystem {
 
   static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
 
+  // Returns true if the given type is a coroutine frame debug type.
+  static bool IsCoroutineFrameType(const CompilerType &Type);
+
   /// Returns the display name of this TypeSystemClang that indicates what
   /// purpose it serves in LLDB. Used for example in logs.
   llvm::StringRef getDisplayName() const { return m_display_name; }

>From ac813b4acd5dbe79fb6d3559e00a454169985067 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 3 Nov 2023 12:07:23 +0100
Subject: [PATCH 2/3] Add and use `ShouldIgnoreArtificialField` API to ignore
 the indeed artificial members we should ignore.

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 ++--
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 48e85cac7b4256f..63260f28a7da85d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3059,10 +3059,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // This needs to be done after updating FieldInfo which keeps track of where
   // field start/end so we don't later try to fill the space of this
   // artificial member with (unnamed bitfield) padding.

[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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


@@ -3059,9 +3059,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // This needs to be done after updating FieldInfo which keeps track of where
   // field start/end so we don't later try to fill the space of this
   // artificial member with (unnamed bitfield) padding.
-  // FIXME: This check should verify that this is indeed an artificial member
-  // we are supposed to ignore.
-  if (attrs.is_artificial) {
+  if (attrs.is_artificial &&
+  TypeSystemClang::ShouldIgnoreArtificialField(attrs.name)) {

hokein wrote:

This function is only used to parse `DW_TAG_MEMBER`. I took a look on all 
related usages of `createMemberType` with `llvm::DINode::FlagArtificial` in the 
llvm source repo:
- vptr pointer: 
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGDebugInfo.cpp#L2426
- coroutines:
   - 
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Coroutines/CoroFrame.cpp#L1058
  
   - 
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Coroutines/CoroFrame.cpp#L1234

so two cases are virtual pointer, and coroutines frames. And to my best 
knowledge, not ignoring coroutine artificial fields should be fine, the 
coroutine frame is just a regular plain struct . 

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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


@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");

hokein wrote:

I removed this change from this pull request now (will sent as a followup). 
Let's focus on addressing the ignore-artificial-fields issue in 
`DWARFASTParserClang.cpp`.

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


[Lldb-commits] [lldb] [LLDB] Don't ignore artificial variables and members for coroutines (PR #70779)

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


@@ -771,6 +771,10 @@ TypeSystemClang 
*TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
   return clang_ast;
 }
 
+bool TypeSystemClang::ShouldIgnoreArtificialField(llvm::StringRef Name) {
+  return Name.starts_with("_vptr$");

hokein wrote:

Thanks, good catch. Handled the gdb case and added a test case (I thought the 
Clang name in the filename and path name indicates that these part of code only 
cares about clang-generated code, but it looks like we use Clang type system to 
parse the DWARF debug info).

Do we care about the msvc-built program as well? I think? probably not, as we 
use a different debug info format `PDB` on Windows. And this class is only used 
in parsing DWARF.

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

hokein wrote:

Thanks for the comment, I updated the patch, this is ready for another round of 
review.

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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


@@ -771,6 +771,10 @@ TypeSystemClang 
*TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
   return clang_ast;
 }
 
+bool TypeSystemClang::ShouldIgnoreArtificialField(llvm::StringRef Name) {
+  return Name.starts_with("_vptr$");

hokein wrote:

> TypeSystemClang should be agnostic to the debug-info format. The various 
> debug-info->AST parsers (e.g., 
> DWARFASTParserClang/PDBASTParser/npdb::PdbAstBuilder, the latter two being 
> the MSVC debug-info parsers) use TypeSystemClang after they've parsed 
> debug-info to construct clang AST nodes.

Thanks for the clarification. 

That makes sense. I don't have any plan to use this API. It is better to move 
DWARFASTParserClang.cpp (better layering).

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

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

>From 2ff56f181659a0079c66ce646d50780844ffb080 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Tue, 31 Oct 2023 11:15:45 +0100
Subject: [PATCH 1/4] [LLDB] Don't ignore artificial variables and members for
 coroutines

* always populate all fields for the generated coroutine frame type;
* make the artificial variables `__promise`, `__coro_frame` visible, so
  that they are present in the `frame var` command;
---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp | 5 -
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 3 ++-
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 3 +++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..c7d9eb37f9b5199 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 3174c18c97d888c..48e85cac7b4256f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3061,7 +3061,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // artificial member with (unnamed bitfield) padding.
   // FIXME: This check should verify that this is indeed an artificial member
   // we are supposed to ignore.
-  if (attrs.is_artificial) {
+  if (attrs.is_artificial &&
+  !TypeSystemClang::IsCoroutineFrameType(class_clang_type)) {
 last_field_info.SetIsArtificial(true);
 return;
   }
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 6f65587c4acedd1..590ba1f6a986ea5 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -771,6 +771,10 @@ TypeSystemClang 
*TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
   return clang_ast;
 }
 
+bool TypeSystemClang::IsCoroutineFrameType(const CompilerType &Type) {
+  return Type.GetTypeName().GetStringRef().ends_with(".coro_frame_ty");
+}
+
 clang::MangleContext *TypeSystemClang::getMangleContext() {
   if (m_mangle_ctx_up == nullptr)
 m_mangle_ctx_up.reset(getASTContext().createMangleContext());
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0ec2d026e996105..6168a065eb522e9 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -154,6 +154,9 @@ class TypeSystemClang : public TypeSystem {
 
   static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
 
+  // Returns true if the given type is a coroutine frame debug type.
+  static bool IsCoroutineFrameType(const CompilerType &Type);
+
   /// Returns the display name of this TypeSystemClang that indicates what
   /// purpose it serves in LLDB. Used for example in logs.
   llvm::StringRef getDisplayName() const { return m_display_name; }

>From ac813b4acd5dbe79fb6d3559e00a454169985067 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 3 Nov 2023 12:07:23 +0100
Subject: [PATCH 2/4] Add and use `ShouldIgnoreArtificialField` API to ignore
 the indeed artificial members we should ignore.

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 ++--
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h   | 5 +++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 48e85cac7b4256f..63260f28a7da85d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3059,10 +3059,8 @@ void DWARFASTParserClang::ParseSingleMember(
   // This needs to be done after updating FieldInfo which keeps track of where
   // field start/end so we don't later try to fill the space of this
   // artificial member with (unnamed bitfield) padding.

[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

hokein wrote:

Thank you very much for the review!

> Are you still going to make the change to CommandObjectFrame such that frame 
> var doesn't hide the artificial fields?

Yes, that's my next step.

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

https://github.com/hokein created 
https://github.com/llvm/llvm-project/pull/71928

See the discussion in #69309.

>From 1ac7e612bf6917af4e347407fb98affa9bb296c6 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 12:35:10 +0100
Subject: [PATCH] [LLDB] Display artificial __promise and __coro_frame
 variables.

See the discussion in #69309.
---
 .../CPlusPlus/CPPLanguageRuntime.cpp|  6 +-
 .../generic/coroutine_handle/TestCoroutineHandle.py | 13 -
 .../generic/coroutine_handle/main.cpp   |  2 +-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..b5dfd07bdff2453 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,11 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+  // Artificial coroutine-related variables emitted by clang.
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 42ee32f9ccca58d..bcb1da6dc3838c8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)
+)
+# Expect artificial variables to be displayed
+self.expect(
+  "frame variable",
+  substrs=['__promise', '__coro_frame']
+)
+
+# Run until after the `co_yield`
 lldbutil.continue_to_source_breakpoint(
 self, process, "// Break after co_yield", 
lldb.SBFileSpec("main.cpp", False)
 )
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c4e..4523b7c7baf80aa 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -33,7 +33,7 @@ struct int_generator {
   ~int_generator() { hdl.destroy(); }
 };
 
-int_generator my_generator_func() { co_yield 42; }
+int_generator my_generator_func() { co_yield 42; } // Break at co_yield
 
 // This is an empty function which we call just so the debugger has
 // a place to reliably set a breakpoint on.

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

hokein wrote:

Is there a way to run the tests under `lldb/test/API/` directory? `ninja 
check-lldb` doesn't seem to run these tests on my linux machine.

```
 ./bin/llvm-lit -sv  
/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/


Testing Time: 0.02s

Total Discovered Tests: 1
  Unsupported: 1 (100.00%)
```

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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


[Lldb-commits] [lldb] 343eb4b - [lldb] Remove the newly-added test in 66acd1e4dc1080015fe6b234226f1d30d6577f04

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

Author: Haojian Wu
Date: 2023-11-10T13:46:36+01:00
New Revision: 343eb4b4253fea31767f6a98e1cf77a7d69c856a

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

LOG: [lldb] Remove the newly-added test in 
66acd1e4dc1080015fe6b234226f1d30d6577f04

The test added causes some buildbot failures:
- https://lab.llvm.org/buildbot/#/builders/17/builds/45077
https://lab.llvm.org/buildbot/#/builders/96/builds/48277

Remove the test for now to make the builtbots happy, and will re-add it after
investigation.

Added: 


Modified: 


Removed: 
lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test



diff  --git a/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test 
b/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test
deleted file mode 100644
index e7d3bc4b796224a..000
--- a/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# UNSUPPORTED: system-darwin, system-windows
-
-# Make sure the artifical field `vptr.ClassName` from gcc debug info is 
ignored.
-# RUN: %build --compiler=gcc %S/Inputs/debug-types-expressions.cpp -o %t
-# RUN: %lldb %t -s %s -o exit | FileCheck %s
-
-breakpoint set -n foo
-process launch
-
-# CHECK: Process {{.*}} stopped
-
-frame variable *a
-# CHECK-LABEL: frame variable *a
-# CHECK:  (B) *a = {
-# CHECK-NEXT:   A = (i = 47)
-# CHECK-NEXT:   j = 42
-# CHECK-NEXT: }



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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

hokein wrote:

> Hi, this is failing on Linaro's Linux LLDB bots: 
> https://lab.llvm.org/buildbot/#/builders/96/builds/48277

> Looks like the -m64 (or -m32) is being passed to an AArch64 (or ARM) g++, and 
> those are X86 only flags.

Sorry for the breakage. I removed this test temporarily in 
343eb4b4253fea31767f6a98e1cf77a7d69c856a to make the builtbots happy again 
while doing the investigation.


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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

hokein wrote:

> I think I have a fix for this, will commit it soon.

Ah, I just saw your new message. If you can fix that, that would be fantastic 
(I don't know too much about lldb).

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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

hokein wrote:

Thank you very much for the fix!

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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

>From 1ac7e612bf6917af4e347407fb98affa9bb296c6 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 12:35:10 +0100
Subject: [PATCH 1/2] [LLDB] Display artificial __promise and __coro_frame
 variables.

See the discussion in #69309.
---
 .../CPlusPlus/CPPLanguageRuntime.cpp|  6 +-
 .../generic/coroutine_handle/TestCoroutineHandle.py | 13 -
 .../generic/coroutine_handle/main.cpp   |  2 +-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..b5dfd07bdff2453 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,11 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+  // Artificial coroutine-related variables emitted by clang.
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 42ee32f9ccca58d..bcb1da6dc3838c8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)
+)
+# Expect artificial variables to be displayed
+self.expect(
+  "frame variable",
+  substrs=['__promise', '__coro_frame']
+)
+
+# Run until after the `co_yield`
 lldbutil.continue_to_source_breakpoint(
 self, process, "// Break after co_yield", 
lldb.SBFileSpec("main.cpp", False)
 )
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c4e..4523b7c7baf80aa 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -33,7 +33,7 @@ struct int_generator {
   ~int_generator() { hdl.destroy(); }
 };
 
-int_generator my_generator_func() { co_yield 42; }
+int_generator my_generator_func() { co_yield 42; } // Break at co_yield
 
 // This is an empty function which we call just so the debugger has
 // a place to reliably set a breakpoint on.

>From d67d907cedbf20d656a4db0658f918e156714170 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 15:16:08 +0100
Subject: [PATCH 2/2] Remove an unneeded FIXME.

---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index b5dfd07bdff2453..2d14cf0d7a62add 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,9 +41,8 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  // FIXME: use a list when the list grows more.
   return name == g_this ||
-  // Artificial coroutine-related variables emitted by clang.
+ // Artificial coroutine-related variables emitted by clang.
  name == ConstString("__promise") ||
  name == ConstString("__coro_frame");
 }

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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


@@ -41,7 +41,11 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.

hokein wrote:

Sure, removed. 

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

hokein wrote:

> Did you configure your build with `LLDB_INCLUDE_TESTS=ON` and 
> `LLDB_INCLUDE_PYTHON=ON`? Those CMake variables are necessary to get the API 
> tests to run

Thanks! I was able to run the test locally now with `-DLLDB_INCLUDE_TESTS=On`,  
`-DLLDB_ENABLE_PYTHON=On`, and all deps installed (`sudo apt-get install 
build-essential swig python3-dev libedit-dev`).




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


[Lldb-commits] [lldb] 81a7690 - [lldb] Only run ignored_artificial_fields.test when gcc is available.

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

Author: Haojian Wu
Date: 2023-11-10T20:56:27+01:00
New Revision: 81a76902ae0fc08138e37212239c5c704eec2f26

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

LOG: [lldb] Only run ignored_artificial_fields.test when gcc is available.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test 
b/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test
index e7d3bc4b796224a..21af535368ee943 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/ignored_artificial_fields.test
@@ -1,4 +1,5 @@
 # UNSUPPORTED: system-darwin, system-windows
+# REQUIRES: gcc
 
 # Make sure the artifical field `vptr.ClassName` from gcc debug info is 
ignored.
 # RUN: %build --compiler=gcc %S/Inputs/debug-types-expressions.cpp -o %t



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


[Lldb-commits] [lldb] [LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (PR #70779)

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

hokein wrote:

@Caslyn , I added the `# REQUIRES: gcc` to the test in 
https://github.com/llvm/llvm-project/commit/81a76902ae0fc08138e37212239c5c704eec2f26

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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

>From 08c3b1a40b508d360f47bed6d7d42050c18b01a0 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 12:35:10 +0100
Subject: [PATCH 1/3] [LLDB] Display artificial __promise and __coro_frame
 variables.

See the discussion in #69309.
---
 .../CPlusPlus/CPPLanguageRuntime.cpp|  6 +-
 .../generic/coroutine_handle/TestCoroutineHandle.py | 13 -
 .../generic/coroutine_handle/main.cpp   |  2 +-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..b5dfd07bdff2453 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,11 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+  // Artificial coroutine-related variables emitted by clang.
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 42ee32f9ccca58d..bcb1da6dc3838c8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)
+)
+# Expect artificial variables to be displayed
+self.expect(
+  "frame variable",
+  substrs=['__promise', '__coro_frame']
+)
+
+# Run until after the `co_yield`
 lldbutil.continue_to_source_breakpoint(
 self, process, "// Break after co_yield", 
lldb.SBFileSpec("main.cpp", False)
 )
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c4e..4523b7c7baf80aa 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -33,7 +33,7 @@ struct int_generator {
   ~int_generator() { hdl.destroy(); }
 };
 
-int_generator my_generator_func() { co_yield 42; }
+int_generator my_generator_func() { co_yield 42; } // Break at co_yield
 
 // This is an empty function which we call just so the debugger has
 // a place to reliably set a breakpoint on.

>From f684e1972eb3dc600603c67bf4a755d07971d7d2 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 15:16:08 +0100
Subject: [PATCH 2/3] Remove an unneeded FIXME.

---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index b5dfd07bdff2453..2d14cf0d7a62add 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,9 +41,8 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  // FIXME: use a list when the list grows more.
   return name == g_this ||
-  // Artificial coroutine-related variables emitted by clang.
+ // Artificial coroutine-related variables emitted by clang.
  name == ConstString("__promise") ||
  name == ConstString("__coro_frame");
 }

>From 43ab6022f2a63a57d8195dcdd83b0c54ae66b1f6 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Mon, 13 Nov 2023 09:29:59 +0100
Subject: [PATCH 3/3] Use static constants for builtin variables.

---
 .../LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp  | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPL

[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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


@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)

hokein wrote:

Do you mean we run the lldb command like `self.runCmd("break 
my_generator_func")` to stop at a break point?

BTW, this file is using this `continue_to_source_breakpoint ` pattern in other 
places, I was following this pattern.  





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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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


@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  return name == g_this ||
+ // Artificial coroutine-related variables emitted by clang.
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");

hokein wrote:

Good point, thanks!

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

https://github.com/hokein commented:

Thanks for the comments.

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


[Lldb-commits] [lldb] 0515ccc - [lldb] Fix a typo in the comment, NFC

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

Author: Haojian Wu
Date: 2023-11-13T10:12:55+01:00
New Revision: 0515ccc0c48b919dae03edc391304e66cdb75d66

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

LOG: [lldb] Fix a typo in the comment, NFC

Added: 


Modified: 

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 42ee32f9ccca58d..2dbbf969dfcdae2 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -83,7 +83,7 @@ def do_test(self, stdlib_type):
 lldbutil.continue_to_source_breakpoint(
 self, process, "// Break after co_yield", 
lldb.SBFileSpec("main.cpp", False)
 )
-# We correctly show the updated value inside `prommise.current_value`.
+# We correctly show the updated value inside `promise.current_value`.
 self.expect_expr(
 "gen.hdl",
 result_children=[



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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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

>From 08c3b1a40b508d360f47bed6d7d42050c18b01a0 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 12:35:10 +0100
Subject: [PATCH 1/4] [LLDB] Display artificial __promise and __coro_frame
 variables.

See the discussion in #69309.
---
 .../CPlusPlus/CPPLanguageRuntime.cpp|  6 +-
 .../generic/coroutine_handle/TestCoroutineHandle.py | 13 -
 .../generic/coroutine_handle/main.cpp   |  2 +-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..b5dfd07bdff2453 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,11 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+  // Artificial coroutine-related variables emitted by clang.
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 42ee32f9ccca58d..bcb1da6dc3838c8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)
+)
+# Expect artificial variables to be displayed
+self.expect(
+  "frame variable",
+  substrs=['__promise', '__coro_frame']
+)
+
+# Run until after the `co_yield`
 lldbutil.continue_to_source_breakpoint(
 self, process, "// Break after co_yield", 
lldb.SBFileSpec("main.cpp", False)
 )
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c4e..4523b7c7baf80aa 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -33,7 +33,7 @@ struct int_generator {
   ~int_generator() { hdl.destroy(); }
 };
 
-int_generator my_generator_func() { co_yield 42; }
+int_generator my_generator_func() { co_yield 42; } // Break at co_yield
 
 // This is an empty function which we call just so the debugger has
 // a place to reliably set a breakpoint on.

>From f684e1972eb3dc600603c67bf4a755d07971d7d2 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 15:16:08 +0100
Subject: [PATCH 2/4] Remove an unneeded FIXME.

---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index b5dfd07bdff2453..2d14cf0d7a62add 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,9 +41,8 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  // FIXME: use a list when the list grows more.
   return name == g_this ||
-  // Artificial coroutine-related variables emitted by clang.
+ // Artificial coroutine-related variables emitted by clang.
  name == ConstString("__promise") ||
  name == ConstString("__coro_frame");
 }

>From 43ab6022f2a63a57d8195dcdd83b0c54ae66b1f6 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Mon, 13 Nov 2023 09:29:59 +0100
Subject: [PATCH 3/4] Use static constants for builtin variables.

---
 .../LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp  | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPL

[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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


@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)

hokein wrote:

I see, thanks for the explanation. Fixed now.

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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

>From 08c3b1a40b508d360f47bed6d7d42050c18b01a0 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 12:35:10 +0100
Subject: [PATCH 1/5] [LLDB] Display artificial __promise and __coro_frame
 variables.

See the discussion in #69309.
---
 .../CPlusPlus/CPPLanguageRuntime.cpp|  6 +-
 .../generic/coroutine_handle/TestCoroutineHandle.py | 13 -
 .../generic/coroutine_handle/main.cpp   |  2 +-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index c2488eaa9f5b50d..b5dfd07bdff2453 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,7 +41,11 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  return name == g_this;
+  // FIXME: use a list when the list grows more.
+  return name == g_this ||
+  // Artificial coroutine-related variables emitted by clang.
+ name == ConstString("__promise") ||
+ name == ConstString("__coro_frame");
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
index 42ee32f9ccca58d..bcb1da6dc3838c8 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py
@@ -78,8 +78,19 @@ def do_test(self, stdlib_type):
 ],
 )
 
-# Run until after the `co_yield`
 process = self.process()
+
+# Break at a coroutine body
+lldbutil.continue_to_source_breakpoint(
+  self, process, "// Break at co_yield", lldb.SBFileSpec("main.cpp", 
False)
+)
+# Expect artificial variables to be displayed
+self.expect(
+  "frame variable",
+  substrs=['__promise', '__coro_frame']
+)
+
+# Run until after the `co_yield`
 lldbutil.continue_to_source_breakpoint(
 self, process, "// Break after co_yield", 
lldb.SBFileSpec("main.cpp", False)
 )
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c4e..4523b7c7baf80aa 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -33,7 +33,7 @@ struct int_generator {
   ~int_generator() { hdl.destroy(); }
 };
 
-int_generator my_generator_func() { co_yield 42; }
+int_generator my_generator_func() { co_yield 42; } // Break at co_yield
 
 // This is an empty function which we call just so the debugger has
 // a place to reliably set a breakpoint on.

>From f684e1972eb3dc600603c67bf4a755d07971d7d2 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Fri, 10 Nov 2023 15:16:08 +0100
Subject: [PATCH 2/5] Remove an unneeded FIXME.

---
 .../Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index b5dfd07bdff2453..2d14cf0d7a62add 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -41,9 +41,8 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
-  // FIXME: use a list when the list grows more.
   return name == g_this ||
-  // Artificial coroutine-related variables emitted by clang.
+ // Artificial coroutine-related variables emitted by clang.
  name == ConstString("__promise") ||
  name == ConstString("__coro_frame");
 }

>From 43ab6022f2a63a57d8195dcdd83b0c54ae66b1f6 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Mon, 13 Nov 2023 09:29:59 +0100
Subject: [PATCH 3/5] Use static constants for builtin variables.

---
 .../LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp  | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPL

[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

hokein wrote:

Thanks for the review.

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


[Lldb-commits] [lldb] [LLDB] Display artificial __promise and __coro_frame variables. (PR #71928)

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

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


[Lldb-commits] [lldb] bf07c33 - Revert "[clang] Instantiate NTTPs and template default arguments with sugar"

2022-10-28 Thread Haojian Wu via lldb-commits

Author: Haojian Wu
Date: 2022-10-28T11:56:19+02:00
New Revision: bf07c338bb78c54b8d96fb42a75b168bf1550ad7

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

LOG: Revert "[clang] Instantiate NTTPs and template default arguments with 
sugar"

This patch reverts
- commit d4b1964f0554046b1e64908e5c1cd701b25f4c9e
- commit 59f0827e2cf3755834620e7e0b6d946832440f80([clang] Instantiate alias 
templates with sugar)

As it makes clang fail to pass some code it used to compile.
See comments: https://reviews.llvm.org/D136564#3891065

Added: 


Modified: 
clang-tools-extra/clangd/unittests/HoverTests.cpp
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/test/AST/ast-dump-template-decls.cpp
clang/test/CXX/drs/dr3xx.cpp
clang/test/CXX/expr/expr.const/p3-0x.cpp
clang/test/CXX/temp/temp.deduct.guide/p3.cpp
clang/test/Misc/diag-template-diffing.cpp
clang/test/SemaCXX/sizeless-1.cpp
clang/test/SemaTemplate/instantiation-default-1.cpp
clang/test/SemaTemplate/make_integer_seq.cpp
clang/test/SemaTemplate/temp_arg_nontype.cpp

lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py

lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py

lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp 
b/clang-tools-extra/clangd/unittests/HoverTests.cpp
index 8bca0dc974539..9f64defaf898f 100644
--- a/clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -1067,7 +1067,7 @@ class Foo final {})cpp";
  HI.LocalScope = "";
  HI.Kind = index::SymbolKind::TypeAlias;
  HI.Definition = "template  using AA = A";
- HI.Type = {"A", "T"};
+ HI.Type = {"A", "type-parameter-0-0"}; // FIXME: should be 'T'
  HI.TemplateParameters = {{{"typename"}, std::string("T"), 
llvm::None}};
}},
   {// Constant array

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index b7a52aeea592c..b32dfe158c8f3 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -8199,11 +8199,14 @@ class Sema final {
 SourceLocation TemplateLoc,
 Declarator &D);
 
-  TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(
-  TemplateDecl *Template, SourceLocation TemplateLoc,
-  SourceLocation RAngleLoc, Decl *Param,
-  ArrayRef SugaredConverted,
-  ArrayRef CanonicalConverted, bool &HasDefaultArg);
+  TemplateArgumentLoc
+  SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template,
+  SourceLocation TemplateLoc,
+  SourceLocation RAngleLoc,
+  Decl *Param,
+  SmallVectorImpl
+&Converted,
+  bool &HasDefaultArg);
 
   /// Specifies the context in which a particular template
   /// argument is being checked.

diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 802c9574745f0..bf6acd52f2856 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3854,8 +3854,8 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
 
 // Only substitute for the innermost template argument list.
 MultiLevelTemplateArgumentList TemplateArgLists;
-TemplateArgLists.addOuterTemplateArguments(Template, SugaredConverted,
-   /*Final=*/true);
+TemplateArgLists.addOuterTemplateArguments(Template, CanonicalConverted,
+   /*Final=*/false);
 TemplateArgLists.addOuterRetainedLevels(
 AliasTemplate->getTemplateParameters()->getDepth());
 
@@ -5261,25 +5261,27 @@ bool Sema::CheckTemplateTypeArgument(
 /// \param Converted the list of template arguments provided for template
 /// parameters that precede \p Param in the template parameter list.
 /// \returns the substituted template argument, or NULL if an error occurred.
-static TypeSourceInfo *SubstDefaultTemplateArgument(
-Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateLoc,
-SourceLocation RAngleLoc, TemplateTypeParmDecl *Param,
-ArrayRef SugaredConverted,
-ArrayRef CanonicalConverted) {
+static TypeSourceInfo *
+SubstDefaultTemplateArgument(Sema &SemaRef,
+ Templa

[Lldb-commits] [lldb] r346841 - Suppress a "-Wliteral-conversion" compiler warning.

2019-10-04 Thread Haojian Wu via lldb-commits
Author: hokein
Date: Wed Nov 14 01:53:45 2018
New Revision: 346841

URL: http://llvm.org/viewvc/llvm-project?rev=346841&view=rev
Log:
Suppress a "-Wliteral-conversion" compiler warning.

error: implicit conversion from 'double' to 'uint64_t' (aka 'unsigned long') 
changes value from -0 to 0 [-Werror,-Wliteral-conversion]

Modified:
lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=346841&r1=346840&r2=346841&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Wed Nov 14 01:53:45 2018
@@ -781,7 +781,7 @@ static uint64_t decodeTaggedTimeInterval
   if (encodedTimeInterval == 0)
 return 0.0;
   if (encodedTimeInterval == std::numeric_limits::max())
-return -0.0;
+return (uint64_t)-0.0;
 
   TaggedDoubleBits encodedBits = { .i = encodedTimeInterval };
   DoubleBits decodedBits;


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


[Lldb-commits] [lldb] r346839 - Fix the "make_unique is ambiguous" compiler error.

2019-10-04 Thread Haojian Wu via lldb-commits
Author: hokein
Date: Wed Nov 14 01:42:28 2018
New Revision: 346839

URL: http://llvm.org/viewvc/llvm-project?rev=346839&view=rev
Log:
Fix the "make_unique is ambiguous" compiler error.

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Utility/Reproducer.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=346839&r1=346838&r2=346839&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Nov 
14 01:42:28 2018
@@ -169,8 +169,8 @@ public:
 GetDirectory().CopyByAppendingPathComponent("gdb-remote.yaml");
 
 std::error_code EC;
-m_stream_up = make_unique(history_file.GetPath(), EC,
-  sys::fs::OpenFlags::F_None);
+m_stream_up = llvm::make_unique(history_file.GetPath(), EC,
+
sys::fs::OpenFlags::F_None);
 return m_stream_up.get();
   }
 

Modified: lldb/trunk/source/Utility/Reproducer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Reproducer.cpp?rev=346839&r1=346838&r2=346839&view=diff
==
--- lldb/trunk/source/Utility/Reproducer.cpp (original)
+++ lldb/trunk/source/Utility/Reproducer.cpp Wed Nov 14 01:42:28 2018
@@ -152,8 +152,8 @@ void Generator::AddProviderToIndex(const
   index.AppendPathComponent("index.yaml");
 
   std::error_code EC;
-  auto strm = make_unique(index.GetPath(), EC,
-  sys::fs::OpenFlags::F_None);
+  auto strm = llvm::make_unique(index.GetPath(), EC,
+sys::fs::OpenFlags::F_None);
   yaml::Output yout(*strm);
   yout << const_cast(provider_info);
 }


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


[Lldb-commits] [lldb] r352035 - Fix potential ODR vialation.

2019-10-04 Thread Haojian Wu via lldb-commits
Author: hokein
Date: Thu Jan 24 01:35:08 2019
New Revision: 352035

URL: http://llvm.org/viewvc/llvm-project?rev=352035&view=rev
Log:
Fix potential ODR vialation.

Modified:
lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h

Modified: lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h?rev=352035&r1=352034&r2=352035&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h Thu Jan 24 
01:35:08 2019
@@ -56,7 +56,7 @@ public:
   UUID ID;
 };
 
-bool operator==(const ModuleRecord &L, const ModuleRecord &R) {
+inline bool operator==(const ModuleRecord &L, const ModuleRecord &R) {
   return L.OS == R.OS && L.Arch == R.Arch && L.ID == R.ID;
 }
 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const ModuleRecord &R);


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


[Lldb-commits] [lldb] ce14ffa - [lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

2020-12-09 Thread Haojian Wu via lldb-commits

Author: Haojian Wu
Date: 2020-12-09T09:32:13+01:00
New Revision: ce14ffa1bba2b609eaba81186c51cf26e9cd60ac

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

LOG: [lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

The behavior of -gsplit-dwarf is changed because of the new commit.

Restore the old behavior by replacing -gsplit-dwarf with -gsplit-dwarf -g.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/split-dwarf-inlining.cpp

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-inlining.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-inlining.cpp
index 5873d896b19a..39c3fd643349 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-inlining.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-inlining.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -fsplit-dwarf-inlining \
+// RUN: %clangxx -target x86_64-pc-linux -gsplit-dwarf -g 
-fsplit-dwarf-inlining \
 // RUN:   -c %s -o %t
 // RUN: %lldb %t -o "breakpoint set -n foo" -b | FileCheck %s
 



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


[Lldb-commits] [lldb] 6883042 - [lldb] Fix one more failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

2020-12-09 Thread Haojian Wu via lldb-commits

Author: Haojian Wu
Date: 2020-12-09T10:43:52+01:00
New Revision: 6883042528d0338b776bb2316e58999650e94892

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

LOG: [lldb] Fix one more failure test after 
843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/split-dwarf-expression-eval-bug.cpp

Removed: 




diff  --git 
a/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-expression-eval-bug.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-expression-eval-bug.cpp
index dcdc81b3e7eb..ef1aa257665d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-expression-eval-bug.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/split-dwarf-expression-eval-bug.cpp
@@ -7,9 +7,9 @@
 
 // UNSUPPORTED: system-darwin, system-windows
 
-// RUN: %clang_host -c -gsplit-dwarf %s -o %t1.o -DONE
-// RUN: %clang_host -c -gsplit-dwarf %s -o %t2.o -DTWO
-// RUN: %clang_host -c -gsplit-dwarf %s -o %t3.o -DTHREE
+// RUN: %clang_host -c -gsplit-dwarf -g %s -o %t1.o -DONE
+// RUN: %clang_host -c -gsplit-dwarf -g %s -o %t2.o -DTWO
+// RUN: %clang_host -c -gsplit-dwarf -g %s -o %t3.o -DTHREE
 // RUN: %clang_host %t1.o %t2.o %t3.o -o %t
 // RUN: %lldb %t -o "br set -n foo" -o run -o "p bool_in_first_cu" -o exit \
 // RUN:   | FileCheck %s



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


[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)

2025-02-06 Thread Haojian Wu via lldb-commits

hokein wrote:

Heads-up: this patch triggers a MSAN failure in an lldb test 
(`lldb/test/API/commands/expression/call-function/TestCallStdStringFunction.py`),
 the stacktrace:

```
==5633==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 in decltype(auto) 
clang::ASTNodeImporter::CallOverloadedCreateFun::operator()&, bool, 
clang::ClassTemplateSpecializationDecl*&>(clang::ASTContext&, 
clang::TagTypeKind&&, clang::DeclContext*&, clang::SourceLocation&, 
clang::SourceLocation&, clang::ClassTemplateDecl*&, 
llvm::SmallVector&, bool&&, 
clang::ClassTemplateSpecializationDecl*&) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:234:16
#1 in bool 
clang::ASTNodeImporter::GetImportedOrCreateSpecialDecl,
 clang::ClassTemplateSpecializationDecl, clang::ASTContext&, 
clang::TagTypeKind, clang::DeclContext*&, clang::SourceLocation&, 
clang::SourceLocation&, clang::ClassTemplateDecl*&, 
llvm::SmallVector&, bool, 
clang::ClassTemplateSpecializationDecl*&>(clang::ClassTemplateSpecializationDecl*&,
 
clang::ASTNodeImporter::CallOverloadedCreateFun,
 clang::ClassTemplateSpecializationDecl*, clang::ASTContext&, 
clang::TagTypeKind&&, clang::DeclContext*&, clang::SourceLocation&, 
clang::SourceLocation&, clang::ClassTemplateDecl*&, 
llvm::SmallVector&, bool&&, 
clang::ClassTemplateSpecializationDecl*&) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:281:13
#2 in GetImportedOrCreateDecl &, bool, 
clang::ClassTemplateSpecializationDecl *&> 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:251:14
#3 in 
clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl*)
 llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:6323:9
#4 in clang::declvisitor::Base>::Visit(clang::Decl*) 
llvm/llvm-project/clang/include/clang/AST/DeclNodes.inc
#5 in clang::ASTImporter::ImportImpl(clang::Decl*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9126:19
#6 in 
lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) 
llvm/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:1134:23
#7 in clang::ASTImporter::Import(clang::Decl*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9521:27
#8 in std::__msan::conditional, llvm::Expected, 
llvm::Expected>::type 
clang::ASTNodeImporter::import(clang::RecordDecl*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:203:31
#9 in clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:1559:40
#10 in clang::TypeVisitor>::Visit(clang::Type const*) 
llvm/llvm-project/clang/include/clang/AST/TypeNodes.inc:76:1
#11 in clang::ASTImporter::Import(clang::Type const*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9157:36
#12 in clang::ASTImporter::Import(clang::QualType) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9171:31
#13 in import 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:217:23
#14 in llvm::Expected 
clang::ASTNodeImporter::import(clang::TemplateArgument 
const&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:832:32
#15 in 
clang::ASTNodeImporter::ImportTemplateArguments(llvm::ArrayRef,
 llvm::SmallVectorImpl&) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:2453:24
#16 in 
clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl*)
 llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:6219:11
#17 in clang::declvisitor::Base>::Visit(clang::Decl*) 
llvm/llvm-project/clang/include/clang/AST/DeclNodes.inc
#18 in clang::ASTImporter::ImportImpl(clang::Decl*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9126:19
#19 in 
lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) 
llvm/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:1134:23
#20 in clang::ASTImporter::Import(clang::Decl*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9521:27
#21 in std::__msan::conditional, llvm::Expected, 
llvm::Expected>::type 
clang::ASTNodeImporter::import(clang::RecordDecl*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:203:31
#22 in clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:1559:40
#23 in clang::TypeVisitor>::Visit(clang::Type const*) 
llvm/llvm-project/clang/include/clang/AST/TypeNodes.inc:76:1
#24 in clang::ASTImporter::Import(clang::Type const*) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9157:36
#25 in clang::ASTImporter::Import(clang::QualType) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9171:31
#26 in import 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:217:23
#27 in clang::QualType 
clang::ASTNodeImporter::importChecked(llvm::Error&, 
clang::QualType const&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:692:30
#28 in 
clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) 
llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:2823:27
#29 in VisitTyped

[Lldb-commits] [clang] [lldb] [lldb][TypeSystemClang] Initialize ClassTemplateSpecializationDecl's StrictPackMatch field (PR #126215)

2025-02-07 Thread Haojian Wu via lldb-commits

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

Thank you!

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