[Lldb-commits] [lldb] [lldb][AArch64] Do not crash if NT_ARM_TLS is missing (PR #106478)

2024-08-30 Thread David Spickett via lldb-commits

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

LGTM, thanks!

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


[Lldb-commits] [lldb] ce7c828 - [lldb][AArch64] Do not crash if NT_ARM_TLS is missing (#106478)

2024-08-30 Thread via lldb-commits

Author: Igor Kudrin
Date: 2024-08-30T09:00:35+01:00
New Revision: ce7c828e085563f29451ec5fac9626c76ebf70ee

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

LOG: [lldb][AArch64] Do not crash if NT_ARM_TLS is missing (#106478)

[D156118](https://reviews.llvm.org/D156118) states that this note is
always present, but it is better to check it explicitly, as otherwise
`lldb` may crash when trying to read registers.

Added: 
lldb/test/Shell/Process/elf-core/aarch64-no-NT_ARM_TLS.yaml
lldb/test/Shell/Process/elf-core/lit.local.cfg

Modified: 
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
index 054b7d9b2ec575..9f5872e5de7e9f 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -254,9 +254,11 @@ RegisterInfoPOSIX_arm64::RegisterInfoPOSIX_arm64(
   if (m_opt_regsets.AllSet(eRegsetMaskMTE))
 AddRegSetMTE();
 
-  // The TLS set always contains tpidr but only has tpidr2 when SME is
-  // present.
-  AddRegSetTLS(m_opt_regsets.AllSet(eRegsetMaskSSVE));
+  if (m_opt_regsets.AllSet(eRegsetMaskTLS)) {
+// The TLS set always contains tpidr but only has tpidr2 when SME is
+// present.
+AddRegSetTLS(m_opt_regsets.AllSet(eRegsetMaskSSVE));
+  }
 
   if (m_opt_regsets.AnySet(eRegsetMaskSSVE))
 AddRegSetSME(m_opt_regsets.AnySet(eRegsetMaskZT));

diff  --git a/lldb/test/Shell/Process/elf-core/aarch64-no-NT_ARM_TLS.yaml 
b/lldb/test/Shell/Process/elf-core/aarch64-no-NT_ARM_TLS.yaml
new file mode 100644
index 00..3d02eb95f38a1a
--- /dev/null
+++ b/lldb/test/Shell/Process/elf-core/aarch64-no-NT_ARM_TLS.yaml
@@ -0,0 +1,32 @@
+## Check that lldb does not crash if a core file does not contain an NT_ARM_TLS
+## note while there are notes for other dynamic register sets.
+
+# RUN: yaml2obj %s -o %t
+# RUN: %lldb -c %t -o "re r -a" | FileCheck %s
+
+# CHECK:  Pointer Authentication Registers:
+# CHECK-NEXT:   data_mask =
+# CHECK-NEXT:   code_mask =
+# CHECK-NOT:  Thread Local Storage Registers:
+
+--- !ELF
+FileHeader:
+  Class:ELFCLASS64
+  Data: ELFDATA2LSB
+  Type: ET_CORE
+  Machine:  EM_AARCH64
+ProgramHeaders:
+  - Type:   PT_NOTE
+FirstSec:   .note
+LastSec:.note
+Sections:
+  - Name:   .note
+Type:   SHT_NOTE
+Notes:
+  - Name:   CORE
+Desc:   
0b000b0038931b9338931b93e02e11915ee12f00400162e258014000200162e224014100
+Type:   NT_PRSTATUS
+  - Name:   LINUX
+Desc:   7f007f00
+Type:   NT_ARM_PAC_MASK
+...

diff  --git a/lldb/test/Shell/Process/elf-core/lit.local.cfg 
b/lldb/test/Shell/Process/elf-core/lit.local.cfg
new file mode 100644
index 00..8169b9f95e118c
--- /dev/null
+++ b/lldb/test/Shell/Process/elf-core/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.yaml']



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


[Lldb-commits] [lldb] [lldb][AArch64] Do not crash if NT_ARM_TLS is missing (PR #106478)

2024-08-30 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][AArch64][Linux] Add Floating Point Mode Register (PR #106695)

2024-08-30 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/106695

Otherwise known as FEAT_FPMR. This register controls the behaviour of floating 
point operations.

https://developer.arm.com/documentation/ddi0601/2024-06/AArch64-Registers/FPMR--Floating-point-Mode-Register

As the current floating point register contexts are fixed size, this has been 
placed in a new set. Linux kernel patches have landed already, so you can cross 
check with those.

To simplify testing we're not going to do any floating point operations, just 
read and write from the program and debugger to make sure each sees the other's 
values correctly.

>From 32303b41a52db204cab1c0f8a5ab3496a1244674 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Thu, 29 Aug 2024 09:41:39 +0100
Subject: [PATCH] [lldb][AArch64][Linux] Add Floating Point Mode Register

Otherwise known as FEAT_FPMR. This register controls the behaviour
of floating point operations.

https://developer.arm.com/documentation/ddi0601/2024-06/AArch64-Registers/FPMR--Floating-point-Mode-Register

As the current floating point register contexts are fixed size,
this has been placed in a new set. Linux kernel patches have landed
already, so you can cross check with those.

To simplify testing we're not going to do any floating point
operations, just read and write from the program and debugger
to make sure each sees the other's values correctly.
---
 .../Python/lldbsuite/test/lldbtest.py |  3 +
 .../NativeRegisterContextLinux_arm64.cpp  | 92 ++-
 .../Linux/NativeRegisterContextLinux_arm64.h  | 12 +++
 .../Utility/RegisterContextPOSIX_arm64.cpp|  4 +
 .../Utility/RegisterContextPOSIX_arm64.h  |  1 +
 .../Utility/RegisterInfoPOSIX_arm64.cpp   | 33 +++
 .../Process/Utility/RegisterInfoPOSIX_arm64.h |  7 ++
 lldb/test/API/linux/aarch64/fpmr/Makefile |  3 +
 .../aarch64/fpmr/TestAArch64LinuxFPMR.py  | 58 
 lldb/test/API/linux/aarch64/fpmr/main.c   | 41 +
 10 files changed, 252 insertions(+), 2 deletions(-)
 create mode 100644 lldb/test/API/linux/aarch64/fpmr/Makefile
 create mode 100644 lldb/test/API/linux/aarch64/fpmr/TestAArch64LinuxFPMR.py
 create mode 100644 lldb/test/API/linux/aarch64/fpmr/main.c

diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index b57c3bdd87c83c..0d78574da18d79 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1360,6 +1360,9 @@ def isAArch64PAuth(self):
 return True
 return self.isAArch64() and "paca" in self.getCPUInfo()
 
+def isAArch64FPMR(self):
+return self.isAArch64() and "fpmr" in self.getCPUInfo()
+
 def isAArch64Windows(self):
 """Returns true if the architecture is AArch64 and platform windows."""
 if self.getPlatform() == "windows":
diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 1dd4fd41351333..6056f3001fed6e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -60,10 +60,16 @@
 #define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* Tagged address control register */
 #endif
 
+#ifndef NT_ARM_FPMR
+#define NT_ARM_FPMR 0x40e /* Floating point mode register */
+#endif
+
 #define HWCAP_PACA (1 << 30)
 
 #define HWCAP2_MTE (1 << 18)
 
+#define HWCAP2_FPMR (1UL << 48)
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::process_linux;
@@ -139,8 +145,12 @@ 
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
 
 std::optional auxv_at_hwcap2 =
 process.GetAuxValue(AuxVector::AUXV_AT_HWCAP2);
-if (auxv_at_hwcap2 && (*auxv_at_hwcap2 & HWCAP2_MTE))
-  opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
+if (auxv_at_hwcap2) {
+  if (*auxv_at_hwcap2 & HWCAP2_MTE)
+opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
+  if (*auxv_at_hwcap2 & HWCAP2_FPMR)
+opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskFPMR);
+}
 
 opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskTLS);
 
@@ -186,6 +196,7 @@ 
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
   std::fill(m_zt_reg.begin(), m_zt_reg.end(), 0);
 
   m_mte_ctrl_reg = 0;
+  m_fpmr_reg = 0;
 
   // 16 is just a maximum value, query hardware for actual watchpoint count
   m_max_hwp_supported = 16;
@@ -201,6 +212,7 @@ 
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
   m_mte_ctrl_is_valid = false;
   m_tls_is_valid = false;
   m_zt_buffer_is_valid = false;
+  m_fpmr_is_valid = false;
 
   // SME adds the tpidr2 register
   m_tls_size = GetRegisterInfo().IsSSVEPresent() ? sizeof(m_tls_regs)
@@ -413,6 +425,14 @@ NativeRegisterContextLinux_arm64::ReadRegister(const 
Reg

[Lldb-commits] [lldb] [lldb][AArch64][Linux] Add Floating Point Mode Register (PR #106695)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

Otherwise known as FEAT_FPMR. This register controls the behaviour of floating 
point operations.

https://developer.arm.com/documentation/ddi0601/2024-06/AArch64-Registers/FPMR--Floating-point-Mode-Register

As the current floating point register contexts are fixed size, this has been 
placed in a new set. Linux kernel patches have landed already, so you can cross 
check with those.

To simplify testing we're not going to do any floating point operations, just 
read and write from the program and debugger to make sure each sees the other's 
values correctly.

---

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


10 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/lldbtest.py (+3) 
- (modified) 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp (+90-2) 
- (modified) 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h (+12) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp 
(+4) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h 
(+1) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp 
(+33) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h (+7) 
- (added) lldb/test/API/linux/aarch64/fpmr/Makefile (+3) 
- (added) lldb/test/API/linux/aarch64/fpmr/TestAArch64LinuxFPMR.py (+58) 
- (added) lldb/test/API/linux/aarch64/fpmr/main.c (+41) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index b57c3bdd87c83c..0d78574da18d79 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1360,6 +1360,9 @@ def isAArch64PAuth(self):
 return True
 return self.isAArch64() and "paca" in self.getCPUInfo()
 
+def isAArch64FPMR(self):
+return self.isAArch64() and "fpmr" in self.getCPUInfo()
+
 def isAArch64Windows(self):
 """Returns true if the architecture is AArch64 and platform windows."""
 if self.getPlatform() == "windows":
diff --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 1dd4fd41351333..6056f3001fed6e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -60,10 +60,16 @@
 #define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* Tagged address control register */
 #endif
 
+#ifndef NT_ARM_FPMR
+#define NT_ARM_FPMR 0x40e /* Floating point mode register */
+#endif
+
 #define HWCAP_PACA (1 << 30)
 
 #define HWCAP2_MTE (1 << 18)
 
+#define HWCAP2_FPMR (1UL << 48)
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::process_linux;
@@ -139,8 +145,12 @@ 
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
 
 std::optional auxv_at_hwcap2 =
 process.GetAuxValue(AuxVector::AUXV_AT_HWCAP2);
-if (auxv_at_hwcap2 && (*auxv_at_hwcap2 & HWCAP2_MTE))
-  opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
+if (auxv_at_hwcap2) {
+  if (*auxv_at_hwcap2 & HWCAP2_MTE)
+opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
+  if (*auxv_at_hwcap2 & HWCAP2_FPMR)
+opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskFPMR);
+}
 
 opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskTLS);
 
@@ -186,6 +196,7 @@ 
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
   std::fill(m_zt_reg.begin(), m_zt_reg.end(), 0);
 
   m_mte_ctrl_reg = 0;
+  m_fpmr_reg = 0;
 
   // 16 is just a maximum value, query hardware for actual watchpoint count
   m_max_hwp_supported = 16;
@@ -201,6 +212,7 @@ 
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
   m_mte_ctrl_is_valid = false;
   m_tls_is_valid = false;
   m_zt_buffer_is_valid = false;
+  m_fpmr_is_valid = false;
 
   // SME adds the tpidr2 register
   m_tls_size = GetRegisterInfo().IsSSVEPresent() ? sizeof(m_tls_regs)
@@ -413,6 +425,14 @@ NativeRegisterContextLinux_arm64::ReadRegister(const 
RegisterInfo *reg_info,
   assert(offset < GetSMEPseudoBufferSize());
   src = (uint8_t *)GetSMEPseudoBuffer() + offset;
 }
+  } else if (IsFPMR(reg)) {
+error = ReadFPMR();
+if (error.Fail())
+  return error;
+
+offset = reg_info->byte_offset - GetRegisterInfo().GetFPMROffset();
+assert(offset < GetFPMRBufferSize());
+src = (uint8_t *)GetFPMRBuffer() + offset;
   } else
 return Status::FromErrorString(
 "failed - register wasn't recognized to be a GPR or an FPR, "
@@ -626,6 +646,17 @@ Status NativeRegisterContextLinux_arm64::WriteRegister(
 } else
   return Status::FromErrorString(
   "Writing to

[Lldb-commits] [lldb] [lldb][AArch64][Linux] Add Floating Point Mode Register (PR #106695)

2024-08-30 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Follow up PRs will add core file support and register fields.

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


[Lldb-commits] [lldb] Add no-op handing for HLSLAttributedResource switch cases (PR #106698)

2024-08-30 Thread Danial Klimkin via lldb-commits

https://github.com/dklimkin created 
https://github.com/llvm/llvm-project/pull/106698

New value added in e00e9a3f8294c9b96cb0328bf136fab72aeec749

>From 241469a4e639a95caed22605d59728e605d09db5 Mon Sep 17 00:00:00 2001
From: Danial Klimkin 
Date: Fri, 30 Aug 2024 11:36:16 +0200
Subject: [PATCH 1/3] Add no-op handing for HLSLAttributedResource switch case

New value added in e00e9a3f8294c9b96cb0328bf136fab72aeec749
---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 695801da9da69a..2368d6f8aa5b7f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4242,6 +4242,10 @@ 
TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) {
   case clang::Type::PackIndexing:
 break;
   }
+
+  case clang::Type::HLSLAttributedResource:
+break;
+  
   // We don't know hot to display this type...
   return lldb::eTypeClassOther;
 }

>From dd29bc792588fd23000985120e832242c14c07fb Mon Sep 17 00:00:00 2001
From: Danial Klimkin 
Date: Fri, 30 Aug 2024 11:42:03 +0200
Subject: [PATCH 2/3] Two more cases

---
 .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp  | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2368d6f8aa5b7f..6efa1b2c4b7859 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4241,11 +4241,11 @@ 
TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) {
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
-  }
 
   case clang::Type::HLSLAttributedResource:
 break;
-  
+  }
+ 
   // We don't know hot to display this type...
   return lldb::eTypeClassOther;
 }
@@ -5152,6 +5152,9 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   count = 0;
   return lldb::eEncodingInvalid;
@@ -5314,6 +5317,10 @@ lldb::Format 
TypeSystemClang::GetFormat(lldb::opaque_compiler_type_t type) {
   case clang::Type::PackIndexing:
 break;
   }
+
+  case clang::Type::HLSLAttributedResource:
+break;
+  
   // We don't know hot to display this type...
   return lldb::eFormatBytes;
 }

>From af49efdf83539b2819d23626a16f2388b012446a Mon Sep 17 00:00:00 2001
From: Danial Klimkin 
Date: Fri, 30 Aug 2024 11:48:24 +0200
Subject: [PATCH 3/3] Update TypeSystemClang.cpp

---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 6efa1b2c4b7859..b0f49ebf2d2cbb 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4245,7 +4245,6 @@ 
TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) {
   case clang::Type::HLSLAttributedResource:
 break;
   }
- 
   // We don't know hot to display this type...
   return lldb::eTypeClassOther;
 }
@@ -5316,11 +5315,10 @@ lldb::Format 
TypeSystemClang::GetFormat(lldb::opaque_compiler_type_t type) {
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
-  }
 
   case clang::Type::HLSLAttributedResource:
 break;
-  
+  }
   // We don't know hot to display this type...
   return lldb::eFormatBytes;
 }

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


[Lldb-commits] [lldb] Add no-op handing for HLSLAttributedResource switch cases (PR #106698)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Danial Klimkin (dklimkin)


Changes

New value added in e00e9a3f8294c9b96cb0328bf136fab72aeec749

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


1 Files Affected:

- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+9) 


``diff
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 695801da9da69a..b0f49ebf2d2cbb 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4241,6 +4241,9 @@ 
TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) {
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   // We don't know hot to display this type...
   return lldb::eTypeClassOther;
@@ -5148,6 +5151,9 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   count = 0;
   return lldb::eEncodingInvalid;
@@ -5309,6 +5315,9 @@ lldb::Format 
TypeSystemClang::GetFormat(lldb::opaque_compiler_type_t type) {
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   // We don't know hot to display this type...
   return lldb::eFormatBytes;

``




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


[Lldb-commits] [lldb] 1b32c3e - Add no-op handing for HLSLAttributedResource switch cases (#106698)

2024-08-30 Thread via lldb-commits

Author: Danial Klimkin
Date: 2024-08-30T11:51:44+02:00
New Revision: 1b32c3e2985f89900030289eaa44e3d92cab85af

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

LOG: Add no-op handing for HLSLAttributedResource switch cases (#106698)

New value added in e00e9a3f8294c9b96cb0328bf136fab72aeec749

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 695801da9da69a..b0f49ebf2d2cbb 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4241,6 +4241,9 @@ 
TypeSystemClang::GetTypeClass(lldb::opaque_compiler_type_t type) {
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   // We don't know hot to display this type...
   return lldb::eTypeClassOther;
@@ -5148,6 +5151,9 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   count = 0;
   return lldb::eEncodingInvalid;
@@ -5309,6 +5315,9 @@ lldb::Format 
TypeSystemClang::GetFormat(lldb::opaque_compiler_type_t type) {
   // We don't handle pack indexing yet
   case clang::Type::PackIndexing:
 break;
+
+  case clang::Type::HLSLAttributedResource:
+break;
   }
   // We don't know hot to display this type...
   return lldb::eFormatBytes;



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


[Lldb-commits] [lldb] Add no-op handing for HLSLAttributedResource switch cases (PR #106698)

2024-08-30 Thread Danial Klimkin via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-08-30 Thread via lldb-commits

https://github.com/dlav-sc updated 
https://github.com/llvm/llvm-project/pull/99336

>From b7f51237438285b1be922ae754618b8c6b0b0ea3 Mon Sep 17 00:00:00 2001
From: Daniil Avdeev 
Date: Thu, 11 Jul 2024 11:21:36 +
Subject: [PATCH 1/6] [lldb][RISCV] add jitted function calls to ABI

Function calls support in LLDB expressions for RISCV: 1 of 6

Augments corresponding functionality to RISCV ABI, which allows to jit
lldb expressions and thus make function calls inside them. Only function
calls with integer and void function arguments and return value are
supported.
---
 .../Plugins/ABI/RISCV/ABISysV_riscv.cpp   | 89 +--
 lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h |  3 +
 2 files changed, 85 insertions(+), 7 deletions(-)

diff --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp 
b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
index 6395f5bb5bd9b0..f3edee1dd6dc14 100644
--- a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
@@ -10,7 +10,9 @@
 
 #include 
 #include 
+#include 
 
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/DerivedTypes.h"
 
 #include "lldb/Core/PluginManager.h"
@@ -19,6 +21,7 @@
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/RegisterValue.h"
 
 #define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
@@ -163,11 +166,83 @@ TotalArgsSizeInWords(bool is_rv64,
   return total_size;
 }
 
+static bool UpdateRegister(RegisterContext *reg_ctx,
+   const lldb::RegisterKind reg_kind,
+   const uint32_t reg_num, const addr_t value) {
+  Log *log = GetLog(LLDBLog::Expressions);
+
+  const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(reg_kind, reg_num);
+
+  LLDB_LOG(log, "Writing %s: 0x%" PRIx64, reg_info->name,
+   static_cast(value));
+  if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, value)) {
+LLDB_LOG(log, "Writing %s: failed", reg_info->name);
+return false;
+  }
+  return true;
+}
+
+static void LogInitInfo(Log *log, const Thread &thread, addr_t sp,
+addr_t func_addr, addr_t return_addr,
+const llvm::ArrayRef args) {
+  assert(log);
+  std::stringstream ss;
+  ss << "ABISysV_riscv::PrepareTrivialCall"
+ << " (tid = 0x%" << std::hex << thread.GetID() << ", sp = 0x%" << sp
+ << ", func_addr = 0x%" << func_addr << ", return_addr = 0x%"
+ << return_addr;
+
+  for (auto &&[idx, arg] : enumerate(args))
+ss << ", arg" << std::dec << idx << " = 0x%" << std::hex << arg;
+  ss << ")";
+  log->PutString(ss.str());
+}
+
 bool ABISysV_riscv::PrepareTrivialCall(Thread &thread, addr_t sp,
addr_t func_addr, addr_t return_addr,
llvm::ArrayRef args) const {
-  // TODO: Implement
-  return false;
+  Log *log = GetLog(LLDBLog::Expressions);
+  if (log)
+LogInitInfo(log, thread, sp, func_addr, return_addr, args);
+
+  const auto reg_ctx_sp = thread.GetRegisterContext();
+  if (!reg_ctx_sp) {
+LLDB_LOG(log, "Failed to get RegisterContext");
+return false;
+  }
+
+  if (args.size() > s_regs_for_args_count) {
+LLDB_LOG(log, "Function has %lu arguments, but only %lu are allowed!",
+ args.size(), s_regs_for_args_count);
+return false;
+  }
+
+  // Write arguments to registers
+  for (auto &&[idx, arg] : enumerate(args)) {
+const RegisterInfo *reg_info = reg_ctx_sp->GetRegisterInfo(
+eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + idx);
+LLDB_LOG(log, "About to write arg%lu (0x%" PRIx64 ") into %s", idx, arg,
+ reg_info->name);
+
+if (!reg_ctx_sp->WriteRegisterFromUnsigned(reg_info, arg)) {
+  LLDB_LOG(log, "Failed to write arg%lu (0x%" PRIx64 ") into %s", idx, arg,
+   reg_info->name);
+  return false;
+}
+  }
+
+  if (!UpdateRegister(reg_ctx_sp.get(), eRegisterKindGeneric,
+  LLDB_REGNUM_GENERIC_PC, func_addr))
+return false;
+  if (!UpdateRegister(reg_ctx_sp.get(), eRegisterKindGeneric,
+  LLDB_REGNUM_GENERIC_SP, sp))
+return false;
+  if (!UpdateRegister(reg_ctx_sp.get(), eRegisterKindGeneric,
+  LLDB_REGNUM_GENERIC_RA, return_addr))
+return false;
+
+  LLDB_LOG(log, "ABISysV_riscv::%s: success", __func__);
+  return true;
 }
 
 bool ABISysV_riscv::PrepareTrivialCall(
@@ -221,14 +296,14 @@ bool ABISysV_riscv::PrepareTrivialCall(
   assert(prototype.getFunctionNumParams() == args.size());
 
   const size_t num_args = args.size();
-  const size_t regs_for_args_count = 8U;
   const size_t num_args_in_regs =
-  num_args > regs_for_args_count ?  regs_for_args_count : num_args;
+  num_args > s_regs_for_args_count ? s_regs_for_args_count : num_args;
 
   // Number of arguments passed on stack.
   size_t args_size = TotalArgsSizeInW

[Lldb-commits] [clang] [compiler-rt] [libcxx] [lldb] [llvm] Rename Sanitizer Coverage => Coverage Sanitizer (PR #106505)

2024-08-30 Thread Aaron Ballman via lldb-commits

https://github.com/AaronBallman commented:

Thank you for working on this; it's a minor inconsistency, but a needless one 
as best I can tell. The changes mostly look good, but there are a bunch of 
binary files (.exe) that seem to have changed; do you know why?

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


[Lldb-commits] [clang] [compiler-rt] [libcxx] [lldb] [llvm] Rename Sanitizer Coverage => Coverage Sanitizer (PR #106505)

2024-08-30 Thread via lldb-commits

cor3ntin wrote:

> Thank you for working on this; it's a minor inconsistency, but a needless one 
> as best I can tell. The changes mostly look good, but there are a bunch of 
> binary files (.exe) that seem to have changed; do you know why?

Global find of replace in the binaries.
Sadly I'm not sure how you can review that beside by inspecting the diff 
locally (using `git diff -- text` in an ascii terminal)


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


[Lldb-commits] [lldb] ab40ae8 - [lldb] Store SupportFiles in SourceManager::File (NFC) (#106639)

2024-08-30 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-08-30T07:18:55-07:00
New Revision: ab40ae8ff9f87b6e3d68cab2c47d692016ede958

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

LOG: [lldb] Store SupportFiles in SourceManager::File (NFC) (#106639)

To support detecting MD5 checksum mismatches, store a SupportFile rather
than a plain FileSpec in SourceManager::File.

Added: 


Modified: 
lldb/include/lldb/Core/SourceManager.h
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/SourceManager.cpp
lldb/unittests/Core/SourceManagerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index 5239ac6f4055f5..8feeb4347dd52e 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -37,8 +37,8 @@ class SourceManager {
const SourceManager::File &rhs);
 
   public:
-File(const FileSpec &file_spec, lldb::TargetSP target_sp);
-File(const FileSpec &file_spec, lldb::DebuggerSP debugger_sp);
+File(lldb::SupportFileSP support_file_sp, lldb::TargetSP target_sp);
+File(lldb::SupportFileSP support_file_sp, lldb::DebuggerSP debugger_sp);
 
 bool ModificationTimeIsStale() const;
 bool PathRemappingIsStale() const;
@@ -56,7 +56,10 @@ class SourceManager {
 
 bool LineIsValid(uint32_t line);
 
-const FileSpec &GetFileSpec() { return m_file_spec; }
+lldb::SupportFileSP GetSupportFile() const {
+  assert(m_support_file_sp && "SupportFileSP must always be valid");
+  return m_support_file_sp;
+}
 
 uint32_t GetSourceMapModificationID() const { return m_source_map_mod_id; }
 
@@ -70,15 +73,13 @@ class SourceManager {
 
   protected:
 /// Set file and update modification time.
-void SetFileSpec(FileSpec file_spec);
+void SetSupportFile(lldb::SupportFileSP support_file_sp);
 
 bool CalculateLineOffsets(uint32_t line = UINT32_MAX);
 
-FileSpec m_file_spec_orig; // The original file spec that was used (can be
-   // 
diff erent from m_file_spec)
-FileSpec m_file_spec; // The actually file spec being used (if the target
-  // has source mappings, this might be 
diff erent from
-  // m_file_spec_orig)
+/// The support file. If the target has source mappings, this might be
+/// 
diff erent from the original support file passed to the constructor.
+lldb::SupportFileSP m_support_file_sp;
 
 // Keep the modification time that this file data is valid for
 llvm::sys::TimePoint<> m_mod_time;
@@ -93,7 +94,8 @@ class SourceManager {
 lldb::TargetWP m_target_wp;
 
   private:
-void CommonInitializer(const FileSpec &file_spec, lldb::TargetSP 
target_sp);
+void CommonInitializer(lldb::SupportFileSP support_file_sp,
+   lldb::TargetSP target_sp);
   };
 
   typedef std::shared_ptr FileSP;

diff  --git a/lldb/source/Commands/CommandObjectSource.cpp 
b/lldb/source/Commands/CommandObjectSource.cpp
index 5ddd46ac5fdc07..1a0629c6765d41 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -1076,8 +1076,8 @@ class CommandObjectSourceList : public 
CommandObjectParsed {
   target.GetSourceManager().GetLastFile());
   if (last_file_sp) {
 const bool show_inlines = true;
-m_breakpoint_locations.Reset(last_file_sp->GetFileSpec(), 0,
- show_inlines);
+m_breakpoint_locations.Reset(
+last_file_sp->GetSupportFile()->GetSpecOnly(), 0, 
show_inlines);
 SearchFilterForUnconstrainedSearches target_search_filter(
 target.shared_from_this());
 target_search_filter.Search(m_breakpoint_locations);

diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index d922d32f910583..8f44e3d0cd016b 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -6894,8 +6894,8 @@ class SourceFileWindowDelegate : public WindowDelegate {
   if (context_changed)
 m_selected_line = m_pc_line;
 
-  if (m_file_sp &&
-  m_file_sp->GetFileSpec() == m_sc.line_entry.GetFile()) {
+  if (m_file_sp && m_file_sp->GetSupportFile()->GetSpecOnly() ==
+   m_sc.line_entry.GetFile()) {
 // Same file, nothing to do, we should either have the lines or
 // not (source file missing)
 if (m_selected_line >= static_cast(m_first_visible_line)) {
@@ -7001,7 +7001,8 @@ class SourceFileWindowDelegate : pu

[Lldb-commits] [lldb] [lldb] Store SupportFiles in SourceManager::File (NFC) (PR #106639)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] b0eefb4 - [lldb] Update SupportFile documentation (NFC)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2024-08-30T07:21:45-07:00
New Revision: b0eefb4c4e5136fd606cf4cff566df9dbc0fa051

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

LOG: [lldb] Update SupportFile documentation (NFC)

Added: 


Modified: 
lldb/include/lldb/Utility/SupportFile.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/SupportFile.h 
b/lldb/include/lldb/Utility/SupportFile.h
index 334a0aaac2c27e..6a091bb84ada35 100644
--- a/lldb/include/lldb/Utility/SupportFile.h
+++ b/lldb/include/lldb/Utility/SupportFile.h
@@ -14,10 +14,10 @@
 
 namespace lldb_private {
 
-/// Wraps either a FileSpec that represents a local file or a source
-/// file whose contents is known (for example because it can be
-/// reconstructed from debug info), but that hasn't been written to a
-/// file yet. This also stores an optional checksum of the on-disk content.
+/// Wraps a FileSpec and an optional Checksum. The FileSpec represents either a
+/// path to a file or a source file whose contents is known (for example 
because
+/// it can be reconstructed from debug info), but that hasn't been written to a
+/// file yet.
 class SupportFile {
 public:
   SupportFile() : m_file_spec(), m_checksum() {}



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


[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/106740

To support detecting MD5 checksum mismatches, deal with SupportFiles rather 
than a plain FileSpecs in the SourceManager.

>From f7b0874d6bd83c85f4fb6411fc4da7dfb4dd8453 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 30 Aug 2024 07:20:26 -0700
Subject: [PATCH] [lldb] Deal with SupportFiles in SourceManager (NFC)

To support detecting MD5 checksum mismatches, deal with SupportFiles
rather than a plain FileSpecs in the SourceManager.
---
 lldb/include/lldb/Core/SourceManager.h| 36 
 lldb/source/API/SBSourceManager.cpp   | 10 +--
 .../BreakpointResolverFileRegex.cpp   |  3 +-
 .../Commands/CommandObjectBreakpoint.cpp  | 16 ++--
 lldb/source/Commands/CommandObjectSource.cpp  | 26 +++---
 lldb/source/Core/Disassembler.cpp |  3 +-
 lldb/source/Core/IOHandlerCursesGUI.cpp   |  4 +-
 lldb/source/Core/SourceManager.cpp| 84 +--
 lldb/source/Expression/REPL.cpp   | 15 ++--
 lldb/source/Target/StackFrame.cpp |  2 +-
 lldb/source/Target/StackFrameList.cpp |  2 +-
 11 files changed, 107 insertions(+), 94 deletions(-)

diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index 8feeb4347dd52e..b1c9b3d054ef9f 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -141,14 +141,13 @@ class SourceManager {
 
   ~SourceManager();
 
-  FileSP GetLastFile() { return GetFile(m_last_file_spec); }
+  FileSP GetLastFile() { return GetFile(m_last_support_file_sp); }
 
-  size_t
-  DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
-uint32_t column, uint32_t context_before,
-uint32_t context_after,
-const char *current_line_cstr, Stream *s,
-const SymbolContextList *bp_locs = 
nullptr);
+  size_t DisplaySourceLinesWithLineNumbers(
+  lldb::SupportFileSP support_file_sp, uint32_t line, uint32_t column,
+  uint32_t context_before, uint32_t context_after,
+  const char *current_line_cstr, Stream *s,
+  const SymbolContextList *bp_locs = nullptr);
 
   // This variant uses the last file we visited.
   size_t DisplaySourceLinesWithLineNumbersUsingLastFile(
@@ -159,22 +158,31 @@ class SourceManager {
   size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
 const SymbolContextList *bp_locs = 
nullptr);
 
-  bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+  bool SetDefaultFileAndLine(lldb::SupportFileSP support_file_sp,
+ uint32_t line);
+
+  struct SupportFileAndLine {
+lldb::SupportFileSP support_file_sp;
+uint32_t line;
+SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
+: support_file_sp(support_file_sp), line(line){};
+  };
 
-  bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
+  std::optional GetDefaultFileAndLine();
 
   bool DefaultFileAndLineSet() {
-return (GetFile(m_last_file_spec).get() != nullptr);
+return (GetFile(m_last_support_file_sp).get() != nullptr);
   }
 
-  void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
-  uint32_t start_line, uint32_t end_line,
+  void FindLinesMatchingRegex(lldb::SupportFileSP support_file_sp,
+  RegularExpression ®ex, uint32_t start_line,
+  uint32_t end_line,
   std::vector &match_lines);
 
-  FileSP GetFile(const FileSpec &file_spec);
+  FileSP GetFile(lldb::SupportFileSP support_file_sp);
 
 protected:
-  FileSpec m_last_file_spec;
+  lldb::SupportFileSP m_last_support_file_sp;
   uint32_t m_last_line;
   uint32_t m_last_count;
   bool m_default_set;
diff --git a/lldb/source/API/SBSourceManager.cpp 
b/lldb/source/API/SBSourceManager.cpp
index e46f990698d826..4b96f1222bc88f 100644
--- a/lldb/source/API/SBSourceManager.cpp
+++ b/lldb/source/API/SBSourceManager.cpp
@@ -46,15 +46,15 @@ class SourceManagerImpl {
 lldb::TargetSP target_sp(m_target_wp.lock());
 if (target_sp) {
   return target_sp->GetSourceManager().DisplaySourceLinesWithLineNumbers(
-  file, line, column, context_before, context_after, current_line_cstr,
-  s);
+  std::make_shared(file), line, column, context_before,
+  context_after, current_line_cstr, s);
 } else {
   lldb::DebuggerSP debugger_sp(m_debugger_wp.lock());
   if (debugger_sp) {
 return debugger_sp->GetSourceManager()
-.DisplaySourceLinesWithLineNumbers(file, line, column,
-   context_before, context_after,
-   current_line_cstr, s

[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

To support detecting MD5 checksum mismatches, deal with SupportFiles rather 
than a plain FileSpecs in the SourceManager.

---

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


11 Files Affected:

- (modified) lldb/include/lldb/Core/SourceManager.h (+22-14) 
- (modified) lldb/source/API/SBSourceManager.cpp (+5-5) 
- (modified) lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp (+2-1) 
- (modified) lldb/source/Commands/CommandObjectBreakpoint.cpp (+10-6) 
- (modified) lldb/source/Commands/CommandObjectSource.cpp (+15-11) 
- (modified) lldb/source/Core/Disassembler.cpp (+2-1) 
- (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+2-2) 
- (modified) lldb/source/Core/SourceManager.cpp (+40-44) 
- (modified) lldb/source/Expression/REPL.cpp (+7-8) 
- (modified) lldb/source/Target/StackFrame.cpp (+1-1) 
- (modified) lldb/source/Target/StackFrameList.cpp (+1-1) 


``diff
diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index 8feeb4347dd52e..b1c9b3d054ef9f 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -141,14 +141,13 @@ class SourceManager {
 
   ~SourceManager();
 
-  FileSP GetLastFile() { return GetFile(m_last_file_spec); }
+  FileSP GetLastFile() { return GetFile(m_last_support_file_sp); }
 
-  size_t
-  DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
-uint32_t column, uint32_t context_before,
-uint32_t context_after,
-const char *current_line_cstr, Stream *s,
-const SymbolContextList *bp_locs = 
nullptr);
+  size_t DisplaySourceLinesWithLineNumbers(
+  lldb::SupportFileSP support_file_sp, uint32_t line, uint32_t column,
+  uint32_t context_before, uint32_t context_after,
+  const char *current_line_cstr, Stream *s,
+  const SymbolContextList *bp_locs = nullptr);
 
   // This variant uses the last file we visited.
   size_t DisplaySourceLinesWithLineNumbersUsingLastFile(
@@ -159,22 +158,31 @@ class SourceManager {
   size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
 const SymbolContextList *bp_locs = 
nullptr);
 
-  bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+  bool SetDefaultFileAndLine(lldb::SupportFileSP support_file_sp,
+ uint32_t line);
+
+  struct SupportFileAndLine {
+lldb::SupportFileSP support_file_sp;
+uint32_t line;
+SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
+: support_file_sp(support_file_sp), line(line){};
+  };
 
-  bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
+  std::optional GetDefaultFileAndLine();
 
   bool DefaultFileAndLineSet() {
-return (GetFile(m_last_file_spec).get() != nullptr);
+return (GetFile(m_last_support_file_sp).get() != nullptr);
   }
 
-  void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
-  uint32_t start_line, uint32_t end_line,
+  void FindLinesMatchingRegex(lldb::SupportFileSP support_file_sp,
+  RegularExpression ®ex, uint32_t start_line,
+  uint32_t end_line,
   std::vector &match_lines);
 
-  FileSP GetFile(const FileSpec &file_spec);
+  FileSP GetFile(lldb::SupportFileSP support_file_sp);
 
 protected:
-  FileSpec m_last_file_spec;
+  lldb::SupportFileSP m_last_support_file_sp;
   uint32_t m_last_line;
   uint32_t m_last_count;
   bool m_default_set;
diff --git a/lldb/source/API/SBSourceManager.cpp 
b/lldb/source/API/SBSourceManager.cpp
index e46f990698d826..4b96f1222bc88f 100644
--- a/lldb/source/API/SBSourceManager.cpp
+++ b/lldb/source/API/SBSourceManager.cpp
@@ -46,15 +46,15 @@ class SourceManagerImpl {
 lldb::TargetSP target_sp(m_target_wp.lock());
 if (target_sp) {
   return target_sp->GetSourceManager().DisplaySourceLinesWithLineNumbers(
-  file, line, column, context_before, context_after, current_line_cstr,
-  s);
+  std::make_shared(file), line, column, context_before,
+  context_after, current_line_cstr, s);
 } else {
   lldb::DebuggerSP debugger_sp(m_debugger_wp.lock());
   if (debugger_sp) {
 return debugger_sp->GetSourceManager()
-.DisplaySourceLinesWithLineNumbers(file, line, column,
-   context_before, context_after,
-   current_line_cstr, s);
+.DisplaySourceLinesWithLineNumbers(
+std::make_shared(file), line, column,
+context_before, context_after, current_line_cstr, s);

[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff b0eefb4c4e5136fd606cf4cff566df9dbc0fa051 
f7b0874d6bd83c85f4fb6411fc4da7dfb4dd8453 --extensions h,cpp -- 
lldb/include/lldb/Core/SourceManager.h lldb/source/API/SBSourceManager.cpp 
lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp 
lldb/source/Commands/CommandObjectBreakpoint.cpp 
lldb/source/Commands/CommandObjectSource.cpp lldb/source/Core/Disassembler.cpp 
lldb/source/Core/IOHandlerCursesGUI.cpp lldb/source/Core/SourceManager.cpp 
lldb/source/Expression/REPL.cpp lldb/source/Target/StackFrame.cpp 
lldb/source/Target/StackFrameList.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index b1c9b3d054..a9958ab1a3 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -165,7 +165,7 @@ public:
 lldb::SupportFileSP support_file_sp;
 uint32_t line;
 SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
-: support_file_sp(support_file_sp), line(line){};
+: support_file_sp(support_file_sp), line(line) {};
   };
 
   std::optional GetDefaultFileAndLine();

``




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


[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/106740

>From f7b0874d6bd83c85f4fb6411fc4da7dfb4dd8453 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 30 Aug 2024 07:20:26 -0700
Subject: [PATCH 1/2] [lldb] Deal with SupportFiles in SourceManager (NFC)

To support detecting MD5 checksum mismatches, deal with SupportFiles
rather than a plain FileSpecs in the SourceManager.
---
 lldb/include/lldb/Core/SourceManager.h| 36 
 lldb/source/API/SBSourceManager.cpp   | 10 +--
 .../BreakpointResolverFileRegex.cpp   |  3 +-
 .../Commands/CommandObjectBreakpoint.cpp  | 16 ++--
 lldb/source/Commands/CommandObjectSource.cpp  | 26 +++---
 lldb/source/Core/Disassembler.cpp |  3 +-
 lldb/source/Core/IOHandlerCursesGUI.cpp   |  4 +-
 lldb/source/Core/SourceManager.cpp| 84 +--
 lldb/source/Expression/REPL.cpp   | 15 ++--
 lldb/source/Target/StackFrame.cpp |  2 +-
 lldb/source/Target/StackFrameList.cpp |  2 +-
 11 files changed, 107 insertions(+), 94 deletions(-)

diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index 8feeb4347dd52e..b1c9b3d054ef9f 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -141,14 +141,13 @@ class SourceManager {
 
   ~SourceManager();
 
-  FileSP GetLastFile() { return GetFile(m_last_file_spec); }
+  FileSP GetLastFile() { return GetFile(m_last_support_file_sp); }
 
-  size_t
-  DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
-uint32_t column, uint32_t context_before,
-uint32_t context_after,
-const char *current_line_cstr, Stream *s,
-const SymbolContextList *bp_locs = 
nullptr);
+  size_t DisplaySourceLinesWithLineNumbers(
+  lldb::SupportFileSP support_file_sp, uint32_t line, uint32_t column,
+  uint32_t context_before, uint32_t context_after,
+  const char *current_line_cstr, Stream *s,
+  const SymbolContextList *bp_locs = nullptr);
 
   // This variant uses the last file we visited.
   size_t DisplaySourceLinesWithLineNumbersUsingLastFile(
@@ -159,22 +158,31 @@ class SourceManager {
   size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
 const SymbolContextList *bp_locs = 
nullptr);
 
-  bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+  bool SetDefaultFileAndLine(lldb::SupportFileSP support_file_sp,
+ uint32_t line);
+
+  struct SupportFileAndLine {
+lldb::SupportFileSP support_file_sp;
+uint32_t line;
+SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
+: support_file_sp(support_file_sp), line(line){};
+  };
 
-  bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
+  std::optional GetDefaultFileAndLine();
 
   bool DefaultFileAndLineSet() {
-return (GetFile(m_last_file_spec).get() != nullptr);
+return (GetFile(m_last_support_file_sp).get() != nullptr);
   }
 
-  void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
-  uint32_t start_line, uint32_t end_line,
+  void FindLinesMatchingRegex(lldb::SupportFileSP support_file_sp,
+  RegularExpression ®ex, uint32_t start_line,
+  uint32_t end_line,
   std::vector &match_lines);
 
-  FileSP GetFile(const FileSpec &file_spec);
+  FileSP GetFile(lldb::SupportFileSP support_file_sp);
 
 protected:
-  FileSpec m_last_file_spec;
+  lldb::SupportFileSP m_last_support_file_sp;
   uint32_t m_last_line;
   uint32_t m_last_count;
   bool m_default_set;
diff --git a/lldb/source/API/SBSourceManager.cpp 
b/lldb/source/API/SBSourceManager.cpp
index e46f990698d826..4b96f1222bc88f 100644
--- a/lldb/source/API/SBSourceManager.cpp
+++ b/lldb/source/API/SBSourceManager.cpp
@@ -46,15 +46,15 @@ class SourceManagerImpl {
 lldb::TargetSP target_sp(m_target_wp.lock());
 if (target_sp) {
   return target_sp->GetSourceManager().DisplaySourceLinesWithLineNumbers(
-  file, line, column, context_before, context_after, current_line_cstr,
-  s);
+  std::make_shared(file), line, column, context_before,
+  context_after, current_line_cstr, s);
 } else {
   lldb::DebuggerSP debugger_sp(m_debugger_wp.lock());
   if (debugger_sp) {
 return debugger_sp->GetSourceManager()
-.DisplaySourceLinesWithLineNumbers(file, line, column,
-   context_before, context_after,
-   current_line_cstr, s);
+.DisplaySourceLinesWithLineNumbers(
+std::make_shared(file), line, column,
+   

[Lldb-commits] [lldb] 9aa25b8 - [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (#106609)

2024-08-30 Thread via lldb-commits

Author: Walter Erquinigo
Date: 2024-08-30T12:51:56-04:00
New Revision: 9aa25b8c15c99d8e717121837a2559801e311e2d

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

LOG: [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings 
(#106609)

My build of LLDB is all the time loading targets with a version of
libc++ that was built with gcc that uses the DW_FORM 0x1e that is not
implemented by LLVM, and I doubt it'll ever implement it. It's used for
some 128 bit encoding of numbers, which is just very weird. Because of
this, LLDB is showing some warnings all the time for my users, so I'm
adding a flag to control the enablement of this warning.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index ff44329d081caa..2af6dc880842a4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-//#define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
+// #define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
 
 #ifdef ENABLE_DEBUG_PRINTF
 #include 
@@ -129,6 +129,11 @@ class PluginProperties : public Properties {
   bool IgnoreFileIndexes() const {
 return GetPropertyAtIndexAs(ePropertyIgnoreIndexes, false);
   }
+
+  bool EmitUnsupportedDWFormValueWarning() const {
+return GetPropertyAtIndexAs(
+ePropertyEmitUnsupportedDWFormValueWarning, true);
+  }
 };
 
 } // namespace
@@ -624,12 +629,14 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
   llvm::DWARFDebugAbbrev *abbrev = DebugAbbrev();
   std::set unsupported_forms = GetUnsupportedForms(abbrev);
   if (!unsupported_forms.empty()) {
-StreamString error;
-error.Printf("unsupported DW_FORM value%s:",
- unsupported_forms.size() > 1 ? "s" : "");
-for (auto form : unsupported_forms)
-  error.Printf(" %#x", form);
-m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
+if (GetGlobalPluginProperties().EmitUnsupportedDWFormValueWarning()) {
+  StreamString error;
+  error.Printf("unsupported DW_FORM value%s:",
+   unsupported_forms.size() > 1 ? "s" : "");
+  for (auto form : unsupported_forms)
+error.Printf(" %#x", form);
+  m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
+}
 return 0;
   }
 
@@ -1770,16 +1777,17 @@ SymbolFileDWARF 
*SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
 return this;
 
   if (file_index) {
-  // We have a SymbolFileDWARFDebugMap, so let it find the right file
+// We have a SymbolFileDWARFDebugMap, so let it find the right file
 if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile())
   return debug_map->GetSymbolFileByOSOIndex(*file_index);
-
+
 // Handle the .dwp file case correctly
 if (*file_index == DIERef::k_file_index_mask)
   return GetDwpSymbolFile().get(); // DWP case
 
 // Handle the .dwo file case correctly
-return DebugInfo().GetUnitAtIndex(*die_ref.file_index())
+return DebugInfo()
+.GetUnitAtIndex(*die_ref.file_index())
 ->GetDwoSymbolFile(); // DWO case
   }
   return this;
@@ -3621,7 +3629,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
 lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS;
 if (!location_is_const_value_data) {
   bool op_error = false;
-  const DWARFExpression* location = location_list.GetAlwaysValidExpr();
+  const DWARFExpression *location = location_list.GetAlwaysValidExpr();
   if (location)
 location_DW_OP_addr =
 location->GetLocation_DW_OP_addr(location_form.GetUnit(), 
op_error);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
index 2f1ce88808b763..0f980a514b6720 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
@@ -5,4 +5,8 @@ let Definition = "symbolfiledwarf" in {
 Global,
 DefaultFalse,
 Desc<"Ignore indexes present in the object files and always index DWARF 
manually.">;
+  def EmitUnsupportedDWFormValueWarning: 
Property<"emit-unsupported-dwform-value", "Boolean">,
+Global,
+DefaultTrue,
+Desc<"Emit warnings about unsupported DW_Form values.">;
 }



_

[Lldb-commits] [lldb] [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (PR #106609)

2024-08-30 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Merging because of time constraints, but happy to get follow up feedback.

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


[Lldb-commits] [lldb] [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (PR #106609)

2024-08-30 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (PR #106609)

2024-08-30 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

Please fix and revert this, we do not want this in open source. Very easy to 
fix and the warning does nothing to improve the situation and actually will be 
bad for the product. Happy to discuss over VC and get a real fix in quickly

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


[Lldb-commits] [lldb] [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (PR #106609)

2024-08-30 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

@clayborg , sure!

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


[Lldb-commits] [lldb] Revert "[LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings" (PR #106765)

2024-08-30 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/106765

Reverts llvm/llvm-project#106609

>From c6ff3f00afa70a47853af3e420aa8a99f76db3a9 Mon Sep 17 00:00:00 2001
From: Walter Erquinigo 
Date: Fri, 30 Aug 2024 13:17:47 -0400
Subject: [PATCH] =?UTF-8?q?Revert=20"[LLDB][DWARF]=20Add=20an=20option=20t?=
 =?UTF-8?q?o=20silence=20unsupported=20DW=5FFORM=20warnings=20(=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 9aa25b8c15c99d8e717121837a2559801e311e2d.
---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 30 +++
 .../DWARF/SymbolFileDWARFProperties.td|  4 ---
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 2af6dc880842a4..ff44329d081caa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-// #define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
+//#define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
 
 #ifdef ENABLE_DEBUG_PRINTF
 #include 
@@ -129,11 +129,6 @@ class PluginProperties : public Properties {
   bool IgnoreFileIndexes() const {
 return GetPropertyAtIndexAs(ePropertyIgnoreIndexes, false);
   }
-
-  bool EmitUnsupportedDWFormValueWarning() const {
-return GetPropertyAtIndexAs(
-ePropertyEmitUnsupportedDWFormValueWarning, true);
-  }
 };
 
 } // namespace
@@ -629,14 +624,12 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
   llvm::DWARFDebugAbbrev *abbrev = DebugAbbrev();
   std::set unsupported_forms = GetUnsupportedForms(abbrev);
   if (!unsupported_forms.empty()) {
-if (GetGlobalPluginProperties().EmitUnsupportedDWFormValueWarning()) {
-  StreamString error;
-  error.Printf("unsupported DW_FORM value%s:",
-   unsupported_forms.size() > 1 ? "s" : "");
-  for (auto form : unsupported_forms)
-error.Printf(" %#x", form);
-  m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
-}
+StreamString error;
+error.Printf("unsupported DW_FORM value%s:",
+ unsupported_forms.size() > 1 ? "s" : "");
+for (auto form : unsupported_forms)
+  error.Printf(" %#x", form);
+m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
 return 0;
   }
 
@@ -1777,17 +1770,16 @@ SymbolFileDWARF 
*SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
 return this;
 
   if (file_index) {
-// We have a SymbolFileDWARFDebugMap, so let it find the right file
+  // We have a SymbolFileDWARFDebugMap, so let it find the right file
 if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile())
   return debug_map->GetSymbolFileByOSOIndex(*file_index);
-
+
 // Handle the .dwp file case correctly
 if (*file_index == DIERef::k_file_index_mask)
   return GetDwpSymbolFile().get(); // DWP case
 
 // Handle the .dwo file case correctly
-return DebugInfo()
-.GetUnitAtIndex(*die_ref.file_index())
+return DebugInfo().GetUnitAtIndex(*die_ref.file_index())
 ->GetDwoSymbolFile(); // DWO case
   }
   return this;
@@ -3629,7 +3621,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
 lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS;
 if (!location_is_const_value_data) {
   bool op_error = false;
-  const DWARFExpression *location = location_list.GetAlwaysValidExpr();
+  const DWARFExpression* location = location_list.GetAlwaysValidExpr();
   if (location)
 location_DW_OP_addr =
 location->GetLocation_DW_OP_addr(location_form.GetUnit(), 
op_error);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
index 0f980a514b6720..2f1ce88808b763 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
@@ -5,8 +5,4 @@ let Definition = "symbolfiledwarf" in {
 Global,
 DefaultFalse,
 Desc<"Ignore indexes present in the object files and always index DWARF 
manually.">;
-  def EmitUnsupportedDWFormValueWarning: 
Property<"emit-unsupported-dwform-value", "Boolean">,
-Global,
-DefaultTrue,
-Desc<"Emit warnings about unsupported DW_Form values.">;
 }

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


[Lldb-commits] [lldb] [LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (PR #106609)

2024-08-30 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Revert commit: https://github.com/llvm/llvm-project/pull/106765

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


[Lldb-commits] [lldb] Revert "[LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings" (PR #106765)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Walter Erquinigo (walter-erquinigo)


Changes

Reverts llvm/llvm-project#106609

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


2 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+11-19) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td 
(-4) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 2af6dc880842a4..ff44329d081caa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-// #define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
+//#define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
 
 #ifdef ENABLE_DEBUG_PRINTF
 #include 
@@ -129,11 +129,6 @@ class PluginProperties : public Properties {
   bool IgnoreFileIndexes() const {
 return GetPropertyAtIndexAs(ePropertyIgnoreIndexes, false);
   }
-
-  bool EmitUnsupportedDWFormValueWarning() const {
-return GetPropertyAtIndexAs(
-ePropertyEmitUnsupportedDWFormValueWarning, true);
-  }
 };
 
 } // namespace
@@ -629,14 +624,12 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
   llvm::DWARFDebugAbbrev *abbrev = DebugAbbrev();
   std::set unsupported_forms = GetUnsupportedForms(abbrev);
   if (!unsupported_forms.empty()) {
-if (GetGlobalPluginProperties().EmitUnsupportedDWFormValueWarning()) {
-  StreamString error;
-  error.Printf("unsupported DW_FORM value%s:",
-   unsupported_forms.size() > 1 ? "s" : "");
-  for (auto form : unsupported_forms)
-error.Printf(" %#x", form);
-  m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
-}
+StreamString error;
+error.Printf("unsupported DW_FORM value%s:",
+ unsupported_forms.size() > 1 ? "s" : "");
+for (auto form : unsupported_forms)
+  error.Printf(" %#x", form);
+m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
 return 0;
   }
 
@@ -1777,17 +1770,16 @@ SymbolFileDWARF 
*SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
 return this;
 
   if (file_index) {
-// We have a SymbolFileDWARFDebugMap, so let it find the right file
+  // We have a SymbolFileDWARFDebugMap, so let it find the right file
 if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile())
   return debug_map->GetSymbolFileByOSOIndex(*file_index);
-
+
 // Handle the .dwp file case correctly
 if (*file_index == DIERef::k_file_index_mask)
   return GetDwpSymbolFile().get(); // DWP case
 
 // Handle the .dwo file case correctly
-return DebugInfo()
-.GetUnitAtIndex(*die_ref.file_index())
+return DebugInfo().GetUnitAtIndex(*die_ref.file_index())
 ->GetDwoSymbolFile(); // DWO case
   }
   return this;
@@ -3629,7 +3621,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
 lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS;
 if (!location_is_const_value_data) {
   bool op_error = false;
-  const DWARFExpression *location = location_list.GetAlwaysValidExpr();
+  const DWARFExpression* location = location_list.GetAlwaysValidExpr();
   if (location)
 location_DW_OP_addr =
 location->GetLocation_DW_OP_addr(location_form.GetUnit(), 
op_error);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
index 0f980a514b6720..2f1ce88808b763 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
@@ -5,8 +5,4 @@ let Definition = "symbolfiledwarf" in {
 Global,
 DefaultFalse,
 Desc<"Ignore indexes present in the object files and always index DWARF 
manually.">;
-  def EmitUnsupportedDWFormValueWarning: 
Property<"emit-unsupported-dwform-value", "Boolean">,
-Global,
-DefaultTrue,
-Desc<"Emit warnings about unsupported DW_Form values.">;
 }

``




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


[Lldb-commits] [lldb] 5500e21 - Revert "[LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings" (#106765)

2024-08-30 Thread via lldb-commits

Author: Walter Erquinigo
Date: 2024-08-30T13:18:23-04:00
New Revision: 5500e21942f7047344b6fee62d3e08c0ba2f9182

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

LOG: Revert "[LLDB][DWARF] Add an option to silence unsupported DW_FORM 
warnings" (#106765)

Reverts llvm/llvm-project#106609

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 2af6dc880842a4..ff44329d081caa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-// #define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
+//#define ENABLE_DEBUG_PRINTF // COMMENT OUT THIS LINE PRIOR TO CHECKIN
 
 #ifdef ENABLE_DEBUG_PRINTF
 #include 
@@ -129,11 +129,6 @@ class PluginProperties : public Properties {
   bool IgnoreFileIndexes() const {
 return GetPropertyAtIndexAs(ePropertyIgnoreIndexes, false);
   }
-
-  bool EmitUnsupportedDWFormValueWarning() const {
-return GetPropertyAtIndexAs(
-ePropertyEmitUnsupportedDWFormValueWarning, true);
-  }
 };
 
 } // namespace
@@ -629,14 +624,12 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
   llvm::DWARFDebugAbbrev *abbrev = DebugAbbrev();
   std::set unsupported_forms = GetUnsupportedForms(abbrev);
   if (!unsupported_forms.empty()) {
-if (GetGlobalPluginProperties().EmitUnsupportedDWFormValueWarning()) {
-  StreamString error;
-  error.Printf("unsupported DW_FORM value%s:",
-   unsupported_forms.size() > 1 ? "s" : "");
-  for (auto form : unsupported_forms)
-error.Printf(" %#x", form);
-  m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
-}
+StreamString error;
+error.Printf("unsupported DW_FORM value%s:",
+ unsupported_forms.size() > 1 ? "s" : "");
+for (auto form : unsupported_forms)
+  error.Printf(" %#x", form);
+m_objfile_sp->GetModule()->ReportWarning("{0}", error.GetString());
 return 0;
   }
 
@@ -1777,17 +1770,16 @@ SymbolFileDWARF 
*SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
 return this;
 
   if (file_index) {
-// We have a SymbolFileDWARFDebugMap, so let it find the right file
+  // We have a SymbolFileDWARFDebugMap, so let it find the right file
 if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile())
   return debug_map->GetSymbolFileByOSOIndex(*file_index);
-
+
 // Handle the .dwp file case correctly
 if (*file_index == DIERef::k_file_index_mask)
   return GetDwpSymbolFile().get(); // DWP case
 
 // Handle the .dwo file case correctly
-return DebugInfo()
-.GetUnitAtIndex(*die_ref.file_index())
+return DebugInfo().GetUnitAtIndex(*die_ref.file_index())
 ->GetDwoSymbolFile(); // DWO case
   }
   return this;
@@ -3629,7 +3621,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
 lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS;
 if (!location_is_const_value_data) {
   bool op_error = false;
-  const DWARFExpression *location = location_list.GetAlwaysValidExpr();
+  const DWARFExpression* location = location_list.GetAlwaysValidExpr();
   if (location)
 location_DW_OP_addr =
 location->GetLocation_DW_OP_addr(location_form.GetUnit(), 
op_error);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
index 0f980a514b6720..2f1ce88808b763 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td
@@ -5,8 +5,4 @@ let Definition = "symbolfiledwarf" in {
 Global,
 DefaultFalse,
 Desc<"Ignore indexes present in the object files and always index DWARF 
manually.">;
-  def EmitUnsupportedDWFormValueWarning: 
Property<"emit-unsupported-dwform-value", "Boolean">,
-Global,
-DefaultTrue,
-Desc<"Emit warnings about unsupported DW_Form values.">;
 }



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


[Lldb-commits] [lldb] Revert "[LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings" (PR #106765)

2024-08-30 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond created 
https://github.com/llvm/llvm-project/pull/106767

A follow up to #106473 Minidump wasn't collecting fs or gs_base. This patch 
extends the x86_64 register context and gated reading it behind an lldb 
specific flag. Additionally these registers are explicitly checked in the tests.

>From ceb20d62d9cef3090e34e8b9fc0bc620a7d9da3d Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Fri, 30 Aug 2024 10:33:08 -0700
Subject: [PATCH 1/2] Extend the minidump x86_64 registers to include fs_base
 and gs_base

---
 .../Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp| 5 -
 .../Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp   | 2 +-
 .../Process/minidump/RegisterContextMinidump_x86_64.cpp| 7 +++
 .../Process/minidump/RegisterContextMinidump_x86_64.h  | 7 ++-
 .../TestProcessSaveCoreMinidump.py | 7 +++
 5 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 13355afb58dbd1..5c9ba223ad143e 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -473,7 +473,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Control |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Segments |
-  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer);
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer |
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::LLDBSpecific);
   thread_context.rax = read_register_u64(reg_ctx, "rax");
   thread_context.rbx = read_register_u64(reg_ctx, "rbx");
   thread_context.rcx = read_register_u64(reg_ctx, "rcx");
@@ -499,6 +500,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   thread_context.gs = read_register_u64(reg_ctx, "gs");
   thread_context.ss = read_register_u64(reg_ctx, "ss");
   thread_context.ds = read_register_u64(reg_ctx, "ds");
+  thread_context.fs_base = read_register_u64(reg_ctx, "fs_base");
+  thread_context.gs_base = read_register_u64(reg_ctx, "gs_base");
   return thread_context;
 }
 
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
index 845312f4c1eddc..f60757a52c6310 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
@@ -21,7 +21,7 @@ 
RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(
 
   size = GetGPRSize();
   m_gpregset.reset(new uint8_t[size]);
-  len =
+  len = 
   gpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_gpregset.get());
   if (len != size)
 m_gpregset.reset();
diff --git 
a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp 
b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
index 917140cab29767..4db049ff7e64e7 100644
--- a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
+++ b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
@@ -67,6 +67,7 @@ lldb::DataBufferSP 
lldb_private::minidump::ConvertMinidumpContext_x86_64(
   auto ControlFlag = MinidumpContext_x86_64_Flags::Control;
   auto IntegerFlag = MinidumpContext_x86_64_Flags::Integer;
   auto SegmentsFlag = MinidumpContext_x86_64_Flags::Segments;
+  auto LLDBSpecificFlag = MinidumpContext_x86_64_Flags::LLDBSpecific;
 
   if ((context_flags & x86_64_Flag) != x86_64_Flag)
 return nullptr;
@@ -104,6 +105,12 @@ lldb::DataBufferSP 
lldb_private::minidump::ConvertMinidumpContext_x86_64(
 writeRegister(&context->r15, result_base, reg_info[lldb_r15_x86_64]);
   }
 
+  if ((context_flags & LLDBSpecificFlag) == LLDBSpecificFlag) {
+writeRegister(&context->fs_base, result_base, 
reg_info[x86_64_with_base::lldb_fs_base]);
+writeRegister(&context->gs_base, result_base,
+  reg_info[x86_64_with_base::lldb_gs_base]);
+  }
+
   // TODO parse the floating point registers
 
   return result_context_buf;
diff --git 
a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h 
b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
index d920ea9d823f4f..f214e04a315a8e 100644
--- a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
+++ b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
@@ -153,6 +153,10 @@ struct MinidumpContext_x86_64 {
   llvm::support::ulittle64_t last_branch_from_rip;
   llvm::support::ulittle64_t last_exception_to_rip;
   llvm::support::ulittle64_t last_exception_from_rip;
+
+  // These registers are LLDB specific.
+  llvm::support::ulittle64_t fs_bas

[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)


Changes

A follow up to #106473 Minidump wasn't collecting fs or gs_base. This 
patch extends the x86_64 register context and gated reading it behind an lldb 
specific flag. Additionally these registers are explicitly checked in the tests.

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


4 Files Affected:

- (modified) lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
(+4-1) 
- (modified) 
lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp (+8) 
- (modified) 
lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h (+6-1) 
- (modified) 
lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
 (+12) 


``diff
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 13355afb58dbd1..5c9ba223ad143e 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -473,7 +473,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Control |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Segments |
-  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer);
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer |
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::LLDBSpecific);
   thread_context.rax = read_register_u64(reg_ctx, "rax");
   thread_context.rbx = read_register_u64(reg_ctx, "rbx");
   thread_context.rcx = read_register_u64(reg_ctx, "rcx");
@@ -499,6 +500,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   thread_context.gs = read_register_u64(reg_ctx, "gs");
   thread_context.ss = read_register_u64(reg_ctx, "ss");
   thread_context.ds = read_register_u64(reg_ctx, "ds");
+  thread_context.fs_base = read_register_u64(reg_ctx, "fs_base");
+  thread_context.gs_base = read_register_u64(reg_ctx, "gs_base");
   return thread_context;
 }
 
diff --git 
a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp 
b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
index 917140cab29767..e879c493156593 100644
--- a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
+++ b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
@@ -67,6 +67,7 @@ lldb::DataBufferSP 
lldb_private::minidump::ConvertMinidumpContext_x86_64(
   auto ControlFlag = MinidumpContext_x86_64_Flags::Control;
   auto IntegerFlag = MinidumpContext_x86_64_Flags::Integer;
   auto SegmentsFlag = MinidumpContext_x86_64_Flags::Segments;
+  auto LLDBSpecificFlag = MinidumpContext_x86_64_Flags::LLDBSpecific;
 
   if ((context_flags & x86_64_Flag) != x86_64_Flag)
 return nullptr;
@@ -104,6 +105,13 @@ lldb::DataBufferSP 
lldb_private::minidump::ConvertMinidumpContext_x86_64(
 writeRegister(&context->r15, result_base, reg_info[lldb_r15_x86_64]);
   }
 
+  if ((context_flags & LLDBSpecificFlag) == LLDBSpecificFlag) {
+writeRegister(&context->fs_base, result_base,
+  reg_info[x86_64_with_base::lldb_fs_base]);
+writeRegister(&context->gs_base, result_base,
+  reg_info[x86_64_with_base::lldb_gs_base]);
+  }
+
   // TODO parse the floating point registers
 
   return result_context_buf;
diff --git 
a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h 
b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
index d920ea9d823f4f..f214e04a315a8e 100644
--- a/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
+++ b/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.h
@@ -153,6 +153,10 @@ struct MinidumpContext_x86_64 {
   llvm::support::ulittle64_t last_branch_from_rip;
   llvm::support::ulittle64_t last_exception_to_rip;
   llvm::support::ulittle64_t last_exception_from_rip;
+
+  // These registers are LLDB specific.
+  llvm::support::ulittle64_t fs_base;
+  llvm::support::ulittle64_t gs_base;
 };
 
 // For context_flags. These values indicate the type of
@@ -168,9 +172,10 @@ enum class MinidumpContext_x86_64_Flags : uint32_t {
   FloatingPoint = x86_64_Flag | 0x0008,
   DebugRegisters = x86_64_Flag | 0x0010,
   XState = x86_64_Flag | 0x0040,
+  LLDBSpecific = x86_64_Flag | 0x8000,
 
   Full = Control | Integer | FloatingPoint,
-  All = Full | Segments | DebugRegisters,
+  All = Full | Segments | DebugRegisters | LLDBSpecific,
 
   LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ All)
 };
diff --git 
a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
 
b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
index ea59aef004aff5..ed15793

[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -769,20 +769,26 @@ class CommandObjectBreakpointSet : public 
CommandObjectParsed {
 private:
   bool GetDefaultFile(Target &target, FileSpec &file,
   CommandReturnObject &result) {
-uint32_t default_line;
 // First use the Source Manager's default file. Then use the current stack
 // frame's file.
-if (!target.GetSourceManager().GetDefaultFileAndLine(file, default_line)) {
+auto file_and_line = target.GetSourceManager().GetDefaultFileAndLine();

bulbazord wrote:

Suggestion: It's not obvious this is an optional type. Maybe name it 
`maybe_file_and_line`? 😄 

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


[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Alex Langford via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -159,22 +158,31 @@ class SourceManager {
   size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
 const SymbolContextList *bp_locs = 
nullptr);
 
-  bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+  bool SetDefaultFileAndLine(lldb::SupportFileSP support_file_sp,
+ uint32_t line);
+
+  struct SupportFileAndLine {
+lldb::SupportFileSP support_file_sp;
+uint32_t line;
+SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
+: support_file_sp(support_file_sp), line(line) {};

bulbazord wrote:

There's an extra semicolon at the end of the constructor. This may introduce a 
warning.

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


[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Alex Langford via lldb-commits

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

LGTM overall, I looked at the previous PR to get some context.

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


[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/106740

>From f7b0874d6bd83c85f4fb6411fc4da7dfb4dd8453 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 30 Aug 2024 07:20:26 -0700
Subject: [PATCH 1/3] [lldb] Deal with SupportFiles in SourceManager (NFC)

To support detecting MD5 checksum mismatches, deal with SupportFiles
rather than a plain FileSpecs in the SourceManager.
---
 lldb/include/lldb/Core/SourceManager.h| 36 
 lldb/source/API/SBSourceManager.cpp   | 10 +--
 .../BreakpointResolverFileRegex.cpp   |  3 +-
 .../Commands/CommandObjectBreakpoint.cpp  | 16 ++--
 lldb/source/Commands/CommandObjectSource.cpp  | 26 +++---
 lldb/source/Core/Disassembler.cpp |  3 +-
 lldb/source/Core/IOHandlerCursesGUI.cpp   |  4 +-
 lldb/source/Core/SourceManager.cpp| 84 +--
 lldb/source/Expression/REPL.cpp   | 15 ++--
 lldb/source/Target/StackFrame.cpp |  2 +-
 lldb/source/Target/StackFrameList.cpp |  2 +-
 11 files changed, 107 insertions(+), 94 deletions(-)

diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index 8feeb4347dd52e..b1c9b3d054ef9f 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -141,14 +141,13 @@ class SourceManager {
 
   ~SourceManager();
 
-  FileSP GetLastFile() { return GetFile(m_last_file_spec); }
+  FileSP GetLastFile() { return GetFile(m_last_support_file_sp); }
 
-  size_t
-  DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
-uint32_t column, uint32_t context_before,
-uint32_t context_after,
-const char *current_line_cstr, Stream *s,
-const SymbolContextList *bp_locs = 
nullptr);
+  size_t DisplaySourceLinesWithLineNumbers(
+  lldb::SupportFileSP support_file_sp, uint32_t line, uint32_t column,
+  uint32_t context_before, uint32_t context_after,
+  const char *current_line_cstr, Stream *s,
+  const SymbolContextList *bp_locs = nullptr);
 
   // This variant uses the last file we visited.
   size_t DisplaySourceLinesWithLineNumbersUsingLastFile(
@@ -159,22 +158,31 @@ class SourceManager {
   size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
 const SymbolContextList *bp_locs = 
nullptr);
 
-  bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+  bool SetDefaultFileAndLine(lldb::SupportFileSP support_file_sp,
+ uint32_t line);
+
+  struct SupportFileAndLine {
+lldb::SupportFileSP support_file_sp;
+uint32_t line;
+SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
+: support_file_sp(support_file_sp), line(line){};
+  };
 
-  bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
+  std::optional GetDefaultFileAndLine();
 
   bool DefaultFileAndLineSet() {
-return (GetFile(m_last_file_spec).get() != nullptr);
+return (GetFile(m_last_support_file_sp).get() != nullptr);
   }
 
-  void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
-  uint32_t start_line, uint32_t end_line,
+  void FindLinesMatchingRegex(lldb::SupportFileSP support_file_sp,
+  RegularExpression ®ex, uint32_t start_line,
+  uint32_t end_line,
   std::vector &match_lines);
 
-  FileSP GetFile(const FileSpec &file_spec);
+  FileSP GetFile(lldb::SupportFileSP support_file_sp);
 
 protected:
-  FileSpec m_last_file_spec;
+  lldb::SupportFileSP m_last_support_file_sp;
   uint32_t m_last_line;
   uint32_t m_last_count;
   bool m_default_set;
diff --git a/lldb/source/API/SBSourceManager.cpp 
b/lldb/source/API/SBSourceManager.cpp
index e46f990698d826..4b96f1222bc88f 100644
--- a/lldb/source/API/SBSourceManager.cpp
+++ b/lldb/source/API/SBSourceManager.cpp
@@ -46,15 +46,15 @@ class SourceManagerImpl {
 lldb::TargetSP target_sp(m_target_wp.lock());
 if (target_sp) {
   return target_sp->GetSourceManager().DisplaySourceLinesWithLineNumbers(
-  file, line, column, context_before, context_after, current_line_cstr,
-  s);
+  std::make_shared(file), line, column, context_before,
+  context_after, current_line_cstr, s);
 } else {
   lldb::DebuggerSP debugger_sp(m_debugger_wp.lock());
   if (debugger_sp) {
 return debugger_sp->GetSourceManager()
-.DisplaySourceLinesWithLineNumbers(file, line, column,
-   context_before, context_after,
-   current_line_cstr, s);
+.DisplaySourceLinesWithLineNumbers(
+std::make_shared(file), line, column,
+   

[Lldb-commits] [lldb] 130eddf - [lldb] Deal with SupportFiles in SourceManager (NFC) (#106740)

2024-08-30 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-08-30T10:58:32-07:00
New Revision: 130eddf7a13f15c9c48b7fa7faf60e9bbee4f703

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

LOG: [lldb] Deal with SupportFiles in SourceManager (NFC) (#106740)

To support detecting MD5 checksum mismatches, deal with SupportFiles
rather than a plain FileSpecs in the SourceManager.

Added: 


Modified: 
lldb/include/lldb/Core/SourceManager.h
lldb/source/API/SBSourceManager.cpp
lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
lldb/source/Commands/CommandObjectBreakpoint.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Core/Disassembler.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/SourceManager.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/StackFrameList.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index 8feeb4347dd52e..ae7bd3d2311f96 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -141,14 +141,13 @@ class SourceManager {
 
   ~SourceManager();
 
-  FileSP GetLastFile() { return GetFile(m_last_file_spec); }
+  FileSP GetLastFile() { return GetFile(m_last_support_file_sp); }
 
-  size_t
-  DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
-uint32_t column, uint32_t context_before,
-uint32_t context_after,
-const char *current_line_cstr, Stream *s,
-const SymbolContextList *bp_locs = 
nullptr);
+  size_t DisplaySourceLinesWithLineNumbers(
+  lldb::SupportFileSP support_file_sp, uint32_t line, uint32_t column,
+  uint32_t context_before, uint32_t context_after,
+  const char *current_line_cstr, Stream *s,
+  const SymbolContextList *bp_locs = nullptr);
 
   // This variant uses the last file we visited.
   size_t DisplaySourceLinesWithLineNumbersUsingLastFile(
@@ -159,22 +158,31 @@ class SourceManager {
   size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
 const SymbolContextList *bp_locs = 
nullptr);
 
-  bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+  bool SetDefaultFileAndLine(lldb::SupportFileSP support_file_sp,
+ uint32_t line);
+
+  struct SupportFileAndLine {
+lldb::SupportFileSP support_file_sp;
+uint32_t line;
+SupportFileAndLine(lldb::SupportFileSP support_file_sp, uint32_t line)
+: support_file_sp(support_file_sp), line(line) {}
+  };
 
-  bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
+  std::optional GetDefaultFileAndLine();
 
   bool DefaultFileAndLineSet() {
-return (GetFile(m_last_file_spec).get() != nullptr);
+return (GetFile(m_last_support_file_sp).get() != nullptr);
   }
 
-  void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
-  uint32_t start_line, uint32_t end_line,
+  void FindLinesMatchingRegex(lldb::SupportFileSP support_file_sp,
+  RegularExpression ®ex, uint32_t start_line,
+  uint32_t end_line,
   std::vector &match_lines);
 
-  FileSP GetFile(const FileSpec &file_spec);
+  FileSP GetFile(lldb::SupportFileSP support_file_sp);
 
 protected:
-  FileSpec m_last_file_spec;
+  lldb::SupportFileSP m_last_support_file_sp;
   uint32_t m_last_line;
   uint32_t m_last_count;
   bool m_default_set;

diff  --git a/lldb/source/API/SBSourceManager.cpp 
b/lldb/source/API/SBSourceManager.cpp
index e46f990698d826..4b96f1222bc88f 100644
--- a/lldb/source/API/SBSourceManager.cpp
+++ b/lldb/source/API/SBSourceManager.cpp
@@ -46,15 +46,15 @@ class SourceManagerImpl {
 lldb::TargetSP target_sp(m_target_wp.lock());
 if (target_sp) {
   return target_sp->GetSourceManager().DisplaySourceLinesWithLineNumbers(
-  file, line, column, context_before, context_after, current_line_cstr,
-  s);
+  std::make_shared(file), line, column, context_before,
+  context_after, current_line_cstr, s);
 } else {
   lldb::DebuggerSP debugger_sp(m_debugger_wp.lock());
   if (debugger_sp) {
 return debugger_sp->GetSourceManager()
-.DisplaySourceLinesWithLineNumbers(file, line, column,
-   context_before, context_after,
-   current_line_cstr, s);
+.DisplaySourceLinesWithLineNumbers(
+std::make_shared(file), line, column,
+context_bef

[Lldb-commits] [lldb] [lldb] Deal with SupportFiles in SourceManager (NFC) (PR #106740)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread via lldb-commits


@@ -473,7 +473,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Control |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Segments |
-  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer);
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer |
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::LLDBSpecific);

jeffreytan81 wrote:

I do not think fs_base/gs_base is lldb specific. They are virtual registers but 
they are returned as part of ptrace call on Linux. For example, gdb and other 
debugger tools are showing them. I think we should include them as part of 
`MinidumpContext_x86_64_Flags::x86_64_Flag` flag.

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread Jacob Lalonde via lldb-commits


@@ -473,7 +473,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Control |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Segments |
-  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer);
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer |
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::LLDBSpecific);

Jlalond wrote:

I agree, the concern is extending the registers and other consumers/producers 
being unable to consume the new registers. @clayborg and I talked about this 
and the concern was if MSFT added new fields to the register context. However 
looking at the [minidump 
docs](https://learn.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_thread)
 Thread Context is actually just an RVA. So we should be able to get away with 
this.

@labath does Google or Brakepad include fs/gs_base and if they do can you point 
me to some docs so we follow suite?

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


[Lldb-commits] [lldb] [lldb] Include checksum in source cache dump (PR #106773)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/106773

This patch updates the source cache dump command to print both the actual 
(on-disk) checksum and the expected (line table) checksum. To achieve that we 
now read and store the on-disk checksum in the cached object. The same 
information will be used in a future path to print a warning when the checksums 
differ.

>From a73b63a4b3e74b92b9ef5f913c75b4710859bca6 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 30 Aug 2024 11:07:50 -0700
Subject: [PATCH] [lldb] Include checksum in source cache dump

This patch updates the source cache dump command to print both the
actual (on-disk) checksum and the expected (line table) checksum. To
achieve that we now read and store the on-disk checksum in the cached
object. The same information will be used in a future path to print a
warning when the checksums differ.
---
 lldb/include/lldb/Core/SourceManager.h | 12 
 lldb/source/Core/SourceManager.cpp | 27 +++---
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index ae7bd3d2311f96..70325f134f2a68 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_SOURCEMANAGER_H
 #define LLDB_CORE_SOURCEMANAGER_H
 
+#include "lldb/Utility/Checksum.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
@@ -42,6 +43,7 @@ class SourceManager {
 
 bool ModificationTimeIsStale() const;
 bool PathRemappingIsStale() const;
+bool ChecksumIsStale() const;
 
 size_t DisplaySourceLines(uint32_t line, std::optional column,
   uint32_t context_before, uint32_t context_after,
@@ -71,6 +73,10 @@ class SourceManager {
 
 llvm::sys::TimePoint<> GetTimestamp() const { return m_mod_time; }
 
+const Checksum &GetChecksum() const { return m_checksum; }
+
+llvm::once_flag &GetChecksumOnceFlag() { return m_checksum_once_flag; }
+
   protected:
 /// Set file and update modification time.
 void SetSupportFile(lldb::SupportFileSP support_file_sp);
@@ -81,6 +87,12 @@ class SourceManager {
 /// different from the original support file passed to the constructor.
 lldb::SupportFileSP m_support_file_sp;
 
+/// Keep track of the on-disk checksum.
+Checksum m_checksum;
+
+/// Only warn once of checksum mismatch.
+llvm::once_flag m_checksum_once_flag;
+
 // Keep the modification time that this file data is valid for
 llvm::sys::TimePoint<> m_mod_time;
 
diff --git a/lldb/source/Core/SourceManager.cpp 
b/lldb/source/Core/SourceManager.cpp
index c427bb91f4643a..f6e59ce731a573 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -447,13 +447,14 @@ void SourceManager::FindLinesMatchingRegex(SupportFileSP 
support_file_sp,
 
 SourceManager::File::File(SupportFileSP support_file_sp,
   lldb::DebuggerSP debugger_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
-  m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(), m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
   CommonInitializer(support_file_sp, {});
 }
 
 SourceManager::File::File(SupportFileSP support_file_sp, TargetSP target_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(),
   m_debugger_wp(target_sp ? target_sp->GetDebugger().shared_from_this()
   : DebuggerSP()),
   m_target_wp(target_sp) {
@@ -532,9 +533,11 @@ void SourceManager::File::CommonInitializer(SupportFileSP 
support_file_sp,
   }
 
   // If the file exists, read in the data.
-  if (m_mod_time != llvm::sys::TimePoint<>())
+  if (m_mod_time != llvm::sys::TimePoint<>()) {
 m_data_sp = FileSystem::Instance().CreateDataBuffer(
 m_support_file_sp->GetSpecOnly());
+m_checksum = llvm::MD5::hash(m_data_sp->GetData());
+  }
 }
 
 void SourceManager::File::SetSupportFile(lldb::SupportFileSP support_file_sp) {
@@ -835,14 +838,24 @@ SourceManager::FileSP 
SourceManager::SourceFileCache::FindSourceFile(
   return {};
 }
 
+static std::string toString(const Checksum &checksum) {
+  if (!checksum)
+return "";
+  return std::string(llvm::formatv("{0}", checksum.digest()));
+}
+
 void SourceManager::SourceFileCache::Dump(Stream &stream) const {
-  stream << "Modification time   LinesPath\n";
-  stream << "---  \n";
+  // clang-format off
+  stream << "Modification time   MD5 Checksum (on-disk)   MD5 Checksum 
(line table)LinesPath\n";
+  stream << "---  

[Lldb-commits] [lldb] [lldb] Include checksum in source cache dump (PR #106773)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

This patch updates the source cache dump command to print both the actual 
(on-disk) checksum and the expected (line table) checksum. To achieve that we 
now read and store the on-disk checksum in the cached object. The same 
information will be used in a future path to print a warning when the checksums 
differ.

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


2 Files Affected:

- (modified) lldb/include/lldb/Core/SourceManager.h (+12) 
- (modified) lldb/source/Core/SourceManager.cpp (+20-7) 


``diff
diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index ae7bd3d2311f96..70325f134f2a68 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_SOURCEMANAGER_H
 #define LLDB_CORE_SOURCEMANAGER_H
 
+#include "lldb/Utility/Checksum.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
@@ -42,6 +43,7 @@ class SourceManager {
 
 bool ModificationTimeIsStale() const;
 bool PathRemappingIsStale() const;
+bool ChecksumIsStale() const;
 
 size_t DisplaySourceLines(uint32_t line, std::optional column,
   uint32_t context_before, uint32_t context_after,
@@ -71,6 +73,10 @@ class SourceManager {
 
 llvm::sys::TimePoint<> GetTimestamp() const { return m_mod_time; }
 
+const Checksum &GetChecksum() const { return m_checksum; }
+
+llvm::once_flag &GetChecksumOnceFlag() { return m_checksum_once_flag; }
+
   protected:
 /// Set file and update modification time.
 void SetSupportFile(lldb::SupportFileSP support_file_sp);
@@ -81,6 +87,12 @@ class SourceManager {
 /// different from the original support file passed to the constructor.
 lldb::SupportFileSP m_support_file_sp;
 
+/// Keep track of the on-disk checksum.
+Checksum m_checksum;
+
+/// Only warn once of checksum mismatch.
+llvm::once_flag m_checksum_once_flag;
+
 // Keep the modification time that this file data is valid for
 llvm::sys::TimePoint<> m_mod_time;
 
diff --git a/lldb/source/Core/SourceManager.cpp 
b/lldb/source/Core/SourceManager.cpp
index c427bb91f4643a..f6e59ce731a573 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -447,13 +447,14 @@ void SourceManager::FindLinesMatchingRegex(SupportFileSP 
support_file_sp,
 
 SourceManager::File::File(SupportFileSP support_file_sp,
   lldb::DebuggerSP debugger_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
-  m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(), m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
   CommonInitializer(support_file_sp, {});
 }
 
 SourceManager::File::File(SupportFileSP support_file_sp, TargetSP target_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(),
   m_debugger_wp(target_sp ? target_sp->GetDebugger().shared_from_this()
   : DebuggerSP()),
   m_target_wp(target_sp) {
@@ -532,9 +533,11 @@ void SourceManager::File::CommonInitializer(SupportFileSP 
support_file_sp,
   }
 
   // If the file exists, read in the data.
-  if (m_mod_time != llvm::sys::TimePoint<>())
+  if (m_mod_time != llvm::sys::TimePoint<>()) {
 m_data_sp = FileSystem::Instance().CreateDataBuffer(
 m_support_file_sp->GetSpecOnly());
+m_checksum = llvm::MD5::hash(m_data_sp->GetData());
+  }
 }
 
 void SourceManager::File::SetSupportFile(lldb::SupportFileSP support_file_sp) {
@@ -835,14 +838,24 @@ SourceManager::FileSP 
SourceManager::SourceFileCache::FindSourceFile(
   return {};
 }
 
+static std::string toString(const Checksum &checksum) {
+  if (!checksum)
+return "";
+  return std::string(llvm::formatv("{0}", checksum.digest()));
+}
+
 void SourceManager::SourceFileCache::Dump(Stream &stream) const {
-  stream << "Modification time   LinesPath\n";
-  stream << "---  \n";
+  // clang-format off
+  stream << "Modification time   MD5 Checksum (on-disk)   MD5 Checksum 
(line table)LinesPath\n";
+  stream << "---  
  \n";
+  // clang-format on
   for (auto &entry : m_file_cache) {
 if (!entry.second)
   continue;
 FileSP file = entry.second;
-stream.Format("{0:%Y-%m-%d %H:%M:%S} {1,8:d} {2}\n", file->GetTimestamp(),
+stream.Format("{0:%Y-%m-%d %H:%M:%S} {1,32} {2,32} {3,8:d} {4}\n",
+  file->GetTimestamp(), toString(file->GetChecksum()),
+  toString(file->GetSupportFile()->GetC

[Lldb-commits] [lldb] [lldb] Include checksum in source cache dump (PR #106773)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/106773

>From a73b63a4b3e74b92b9ef5f913c75b4710859bca6 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 30 Aug 2024 11:07:50 -0700
Subject: [PATCH 1/2] [lldb] Include checksum in source cache dump

This patch updates the source cache dump command to print both the
actual (on-disk) checksum and the expected (line table) checksum. To
achieve that we now read and store the on-disk checksum in the cached
object. The same information will be used in a future path to print a
warning when the checksums differ.
---
 lldb/include/lldb/Core/SourceManager.h | 12 
 lldb/source/Core/SourceManager.cpp | 27 +++---
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index ae7bd3d2311f96..70325f134f2a68 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_SOURCEMANAGER_H
 #define LLDB_CORE_SOURCEMANAGER_H
 
+#include "lldb/Utility/Checksum.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
@@ -42,6 +43,7 @@ class SourceManager {
 
 bool ModificationTimeIsStale() const;
 bool PathRemappingIsStale() const;
+bool ChecksumIsStale() const;
 
 size_t DisplaySourceLines(uint32_t line, std::optional column,
   uint32_t context_before, uint32_t context_after,
@@ -71,6 +73,10 @@ class SourceManager {
 
 llvm::sys::TimePoint<> GetTimestamp() const { return m_mod_time; }
 
+const Checksum &GetChecksum() const { return m_checksum; }
+
+llvm::once_flag &GetChecksumOnceFlag() { return m_checksum_once_flag; }
+
   protected:
 /// Set file and update modification time.
 void SetSupportFile(lldb::SupportFileSP support_file_sp);
@@ -81,6 +87,12 @@ class SourceManager {
 /// different from the original support file passed to the constructor.
 lldb::SupportFileSP m_support_file_sp;
 
+/// Keep track of the on-disk checksum.
+Checksum m_checksum;
+
+/// Only warn once of checksum mismatch.
+llvm::once_flag m_checksum_once_flag;
+
 // Keep the modification time that this file data is valid for
 llvm::sys::TimePoint<> m_mod_time;
 
diff --git a/lldb/source/Core/SourceManager.cpp 
b/lldb/source/Core/SourceManager.cpp
index c427bb91f4643a..f6e59ce731a573 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -447,13 +447,14 @@ void SourceManager::FindLinesMatchingRegex(SupportFileSP 
support_file_sp,
 
 SourceManager::File::File(SupportFileSP support_file_sp,
   lldb::DebuggerSP debugger_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
-  m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(), m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
   CommonInitializer(support_file_sp, {});
 }
 
 SourceManager::File::File(SupportFileSP support_file_sp, TargetSP target_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(),
   m_debugger_wp(target_sp ? target_sp->GetDebugger().shared_from_this()
   : DebuggerSP()),
   m_target_wp(target_sp) {
@@ -532,9 +533,11 @@ void SourceManager::File::CommonInitializer(SupportFileSP 
support_file_sp,
   }
 
   // If the file exists, read in the data.
-  if (m_mod_time != llvm::sys::TimePoint<>())
+  if (m_mod_time != llvm::sys::TimePoint<>()) {
 m_data_sp = FileSystem::Instance().CreateDataBuffer(
 m_support_file_sp->GetSpecOnly());
+m_checksum = llvm::MD5::hash(m_data_sp->GetData());
+  }
 }
 
 void SourceManager::File::SetSupportFile(lldb::SupportFileSP support_file_sp) {
@@ -835,14 +838,24 @@ SourceManager::FileSP 
SourceManager::SourceFileCache::FindSourceFile(
   return {};
 }
 
+static std::string toString(const Checksum &checksum) {
+  if (!checksum)
+return "";
+  return std::string(llvm::formatv("{0}", checksum.digest()));
+}
+
 void SourceManager::SourceFileCache::Dump(Stream &stream) const {
-  stream << "Modification time   LinesPath\n";
-  stream << "---  \n";
+  // clang-format off
+  stream << "Modification time   MD5 Checksum (on-disk)   MD5 Checksum 
(line table)LinesPath\n";
+  stream << "---  
  \n";
+  // clang-format on
   for (auto &entry : m_file_cache) {
 if (!entry.second)
   continue;
 FileSP file = entry.second;
-stream.Format("{0:%Y-%m-%d %H:%M:%S} {1,8:d} {2}\n", file->GetTimestamp(),
+stream.Format("{0:%Y-%m-%d %H:%M:%S} {1,32

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl created 
https://github.com/llvm/llvm-project/pull/106774

(based on a conversation I had with @labath yesterday in 
https://github.com/llvm/llvm-project/pull/106442)

Most APIs that currently vend a Status would be better served by returning 
llvm::Expected<> instead. If possibles APIs should be refactored to avoid 
Status. The only legitimate long-term uses of Status are objects that need to 
store an error for a long time (which should be questioned as a design 
decision, too).

This patch makes the transition to llvm::Error easier by making the places that 
cannot switch to llvm::Error explicit: They are marked with a call to 
Status::clone(). Every other API can and should be refactored to use 
llvm::Expected. In the end Status should only be used in very few places.

Whenever an unchecked Error is dropped by Status it logs this to the verbose 
API channel.

Implementation notes:

This patch introduces two new kinds of error_category as well as new 
llvm::Error types. Here is the mapping of lldb::ErrorType to llvm::Errors:
```
   (eErrorTypeInvalid)
   eErrorTypeGeneric  llvm::StringError
   eErrorTypePOSIXllvm::ECError
   eErrorTypeMachKernel   MachKernelError
   eErrorTypeExpression   llvm::ErrorList
   eErrorTypeWin32Win32Error
```

>From 705e24eea0f40a4dce1e56a8cdf2abd2280aae57 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Thu, 29 Aug 2024 17:29:10 -0700
Subject: [PATCH] [lldb] Change the implementation of Status to store an
 llvm::Error (NFC)

Most APIs that currently vend a Status would be better served by
returning llvm::Expected<> instead. If possibles APIs should be
refactored to avoid Status. The only legitimate long-term uses of
Status are objects that need to store an error for a long time
(which should be questioned as a design decision, too).

This patch makes the transition to llvm::Error easier by making the
places that cannot switch to llvm::Error explicit: They are marked
with a call to Status::clone(). Every other API can and should be
refactored to use llvm::Expected. In the end Status should only be
used in very few places.

Whenever an unchecked Error is dropped by Status it logs this to the
verbose API channel.

Implementation notes:

This patch introduces two new kinds of error_category as well as new
llvm::Error types. Here is the mapping of lldb::ErrorType to
llvm::Errors:

   (eErrorTypeInvalid)
   eErrorTypeGeneric  llvm::StringError
   eErrorTypePOSIXllvm::ECError
   eErrorTypeMachKernel   MachKernelError
   eErrorTypeExpression   llvm::ErrorList
   eErrorTypeWin32Win32Error
---
 lldb/bindings/python/python-swigsafecast.swig |   2 +-
 lldb/include/lldb/API/SBError.h   |   4 +-
 lldb/include/lldb/API/SBValueList.h   |   2 +-
 .../lldb/Core/ValueObjectConstResult.h|   4 +-
 lldb/include/lldb/Target/Process.h|   2 -
 lldb/include/lldb/Utility/Status.h|  71 +-
 lldb/source/API/SBBreakpoint.cpp  |   6 +-
 lldb/source/API/SBBreakpointLocation.cpp  |   4 +-
 lldb/source/API/SBBreakpointName.cpp  |  17 +-
 lldb/source/API/SBDebugger.cpp|   4 +-
 lldb/source/API/SBError.cpp   |  15 +-
 lldb/source/API/SBFile.cpp|  15 +-
 lldb/source/API/SBFormat.cpp  |   2 +-
 lldb/source/API/SBFrame.cpp   |   9 +-
 lldb/source/API/SBPlatform.cpp|   4 +-
 lldb/source/API/SBProcess.cpp |   2 +-
 lldb/source/API/SBSaveCoreOptions.cpp |   3 +-
 lldb/source/API/SBStructuredData.cpp  |   2 +-
 lldb/source/API/SBTarget.cpp  |   7 +-
 lldb/source/API/SBThread.cpp  |   2 +-
 lldb/source/API/SBValue.cpp   |   4 +-
 lldb/source/API/SBValueList.cpp   |  13 +-
 lldb/source/API/SBWatchpoint.cpp  |   2 +-
 .../source/Commands/CommandObjectCommands.cpp |   4 +-
 .../Commands/CommandObjectMemoryTag.cpp   |  10 +-
 lldb/source/Core/Debugger.cpp |   2 +-
 lldb/source/Core/ModuleList.cpp   |   5 +-
 lldb/source/Core/PluginManager.cpp|   2 +-
 lldb/source/Core/ThreadedCommunication.cpp|   2 +-
 lldb/source/Core/ValueObject.cpp  |   4 +-
 lldb/source/Core/ValueObjectCast.cpp  |   2 +-
 lldb/source/Core/ValueObjectConstResult.cpp   |   9 +-
 lldb/source/Core/ValueObjectDynamicValue.cpp  |   2 +-
 .../Core/ValueObjectSyntheticFilter.cpp   |   2 +-
 lldb/source/DataFormatters/VectorType.cpp |   2 +-
 lldb/source/Expression/FunctionCaller.cpp |   3 +-
 lldb/source/Expression/LLVMUserExpression.cpp |   6 +-
 lldb/source/Expression/Materializer.cpp   |   2 +-
 lldb/source/Expression/UserExpression.cpp |   8 +-
 lldb/source/Host/common/LockFileBase.cpp  |   4 +-
 .../Host/common/NativeProcessProtocol.cpp |  10 +-
 lldb/source/Host/common/TCPSocket.cpp |   4 +-
 lldb/

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)


Changes

(based on a conversation I had with @labath yesterday in 
https://github.com/llvm/llvm-project/pull/106442)

Most APIs that currently vend a Status would be better served by returning 
llvm::Expected<> instead. If possibles APIs should be refactored to avoid 
Status. The only legitimate long-term uses of Status are objects that need to 
store an error for a long time (which should be questioned as a design 
decision, too).

This patch makes the transition to llvm::Error easier by making the places that 
cannot switch to llvm::Error explicit: They are marked with a call to 
Status::clone(). Every other API can and should be refactored to use 
llvm::Expected. In the end Status should only be used in very few places.

Whenever an unchecked Error is dropped by Status it logs this to the verbose 
API channel.

Implementation notes:

This patch introduces two new kinds of error_category as well as new 
llvm::Error types. Here is the mapping of lldb::ErrorType to llvm::Errors:
```
   (eErrorTypeInvalid)
   eErrorTypeGeneric  llvm::StringError
   eErrorTypePOSIXllvm::ECError
   eErrorTypeMachKernel   MachKernelError
   eErrorTypeExpression   llvm::ErrorList
   eErrorTypeWin32Win32Error
```

---

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


81 Files Affected:

- (modified) lldb/bindings/python/python-swigsafecast.swig (+1-1) 
- (modified) lldb/include/lldb/API/SBError.h (+2-2) 
- (modified) lldb/include/lldb/API/SBValueList.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResult.h (+2-2) 
- (modified) lldb/include/lldb/Target/Process.h (-2) 
- (modified) lldb/include/lldb/Utility/Status.h (+61-10) 
- (modified) lldb/source/API/SBBreakpoint.cpp (+3-3) 
- (modified) lldb/source/API/SBBreakpointLocation.cpp (+2-2) 
- (modified) lldb/source/API/SBBreakpointName.cpp (+8-9) 
- (modified) lldb/source/API/SBDebugger.cpp (+2-2) 
- (modified) lldb/source/API/SBError.cpp (+9-6) 
- (modified) lldb/source/API/SBFile.cpp (+5-10) 
- (modified) lldb/source/API/SBFormat.cpp (+1-1) 
- (modified) lldb/source/API/SBFrame.cpp (+5-4) 
- (modified) lldb/source/API/SBPlatform.cpp (+2-2) 
- (modified) lldb/source/API/SBProcess.cpp (+1-1) 
- (modified) lldb/source/API/SBSaveCoreOptions.cpp (+1-2) 
- (modified) lldb/source/API/SBStructuredData.cpp (+1-1) 
- (modified) lldb/source/API/SBTarget.cpp (+4-3) 
- (modified) lldb/source/API/SBThread.cpp (+1-1) 
- (modified) lldb/source/API/SBValue.cpp (+2-2) 
- (modified) lldb/source/API/SBValueList.cpp (+7-6) 
- (modified) lldb/source/API/SBWatchpoint.cpp (+1-1) 
- (modified) lldb/source/Commands/CommandObjectCommands.cpp (+2-2) 
- (modified) lldb/source/Commands/CommandObjectMemoryTag.cpp (+5-5) 
- (modified) lldb/source/Core/Debugger.cpp (+1-1) 
- (modified) lldb/source/Core/ModuleList.cpp (+2-3) 
- (modified) lldb/source/Core/PluginManager.cpp (+1-1) 
- (modified) lldb/source/Core/ThreadedCommunication.cpp (+1-1) 
- (modified) lldb/source/Core/ValueObject.cpp (+2-2) 
- (modified) lldb/source/Core/ValueObjectCast.cpp (+1-1) 
- (modified) lldb/source/Core/ValueObjectConstResult.cpp (+5-4) 
- (modified) lldb/source/Core/ValueObjectDynamicValue.cpp (+1-1) 
- (modified) lldb/source/Core/ValueObjectSyntheticFilter.cpp (+1-1) 
- (modified) lldb/source/DataFormatters/VectorType.cpp (+1-1) 
- (modified) lldb/source/Expression/FunctionCaller.cpp (+1-2) 
- (modified) lldb/source/Expression/LLVMUserExpression.cpp (+3-3) 
- (modified) lldb/source/Expression/Materializer.cpp (+1-1) 
- (modified) lldb/source/Expression/UserExpression.cpp (+4-4) 
- (modified) lldb/source/Host/common/LockFileBase.cpp (+2-2) 
- (modified) lldb/source/Host/common/NativeProcessProtocol.cpp (+5-5) 
- (modified) lldb/source/Host/common/TCPSocket.cpp (+2-2) 
- (modified) lldb/source/Host/macosx/objcxx/Host.mm (+1-1) 
- (modified) lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp (+6-6) 
- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+1-1) 
- (modified) lldb/source/Interpreter/OptionValueRegex.cpp (+1-1) 
- (modified) lldb/source/Interpreter/ScriptInterpreter.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp (+1-1) 
- (modified) lldb/source/Plugins/Platform/Android/AdbClient.cpp (+4-4) 
- (modified) 
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp (+2-2) 
- (modified) 
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
 (+1-1) 
- (modified) 
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
 (+7-7) 
- (modified) lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (+2-2) 
- (modified) lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp (+2-2) 
- (modified) 
lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp (+5-5) 
- (modified) lldb/source/Plugin

[Lldb-commits] [lldb] c49770c - [NFC] Prefer subprocess.DEVNULL over os.devnull (#106500)

2024-08-30 Thread via lldb-commits

Author: Nicolas van Kempen
Date: 2024-08-30T19:26:49+01:00
New Revision: c49770c60f26e449379447109f7d915bd8de0384

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

LOG: [NFC] Prefer subprocess.DEVNULL over os.devnull (#106500)

There is no need to support Python 2.7 anymore, Python 3.3+ has
`subprocess.DEVNULL`. This is good practice and also prevents file
handles from
staying open unnecessarily.

Also remove a couple unused or unneeded `__future__` imports.

Added: 


Modified: 
clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
clang/docs/tools/generate_formatted_state.py
clang/tools/scan-view/share/startfile.py
clang/utils/creduce-clang-crash.py
lldb/bindings/interface/SBErrorDocstrings.i
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
llvm/utils/UpdateTestChecks/common.py
llvm/utils/git/pre-push.py
llvm/utils/gn/gn.py

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py 
b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index 48401ba5ea42a9..b702eece37002b 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -511,12 +511,10 @@ async def main() -> None:
 )
 invocation.append("-list-checks")
 invocation.append("-")
-if args.quiet:
-# Even with -quiet we still want to check if we can call 
clang-tidy.
-with open(os.devnull, "w") as dev_null:
-subprocess.check_call(invocation, stdout=dev_null)
-else:
-subprocess.check_call(invocation)
+# Even with -quiet we still want to check if we can call clang-tidy.
+subprocess.check_call(
+invocation, stdout=subprocess.DEVNULL if args.quiet else None
+)
 except:
 print("Unable to run clang-tidy.", file=sys.stderr)
 sys.exit(1)

diff  --git a/clang/docs/tools/generate_formatted_state.py 
b/clang/docs/tools/generate_formatted_state.py
index 66cebbf7af33a4..2de43dc383f557 100755
--- a/clang/docs/tools/generate_formatted_state.py
+++ b/clang/docs/tools/generate_formatted_state.py
@@ -78,8 +78,6 @@ def get_style(count, passed):
  - {style2}`{percent}%`
 """
 
-FNULL = open(os.devnull, "w")
-
 
 with open(DOC_FILE, "wb") as output:
 cleanfiles = open(CLEAN_FILE, "wb")
@@ -101,8 +99,8 @@ def get_style(count, passed):
 # interested in it, just the return code.
 git_check = subprocess.Popen(
 ["git", "ls-files", "--error-unmatch", act_sub_dir],
-stdout=FNULL,
-stderr=FNULL,
+stdout=subprocess.DEVNULL,
+stderr=subprocess.DEVNULL,
 )
 if git_check.wait() != 0:
 print("Skipping directory: ", act_sub_dir)

diff  --git a/clang/tools/scan-view/share/startfile.py 
b/clang/tools/scan-view/share/startfile.py
index d63e69280e90dd..c72475e8b6212e 100644
--- a/clang/tools/scan-view/share/startfile.py
+++ b/clang/tools/scan-view/share/startfile.py
@@ -48,7 +48,7 @@ def _invoke(self, cmdline):
 or sys.platform[:3] == "win"
 or sys.platform == "darwin"
 ):
-inout = file(os.devnull, "r+")
+inout = subprocess.DEVNULL
 else:
 # for TTY programs, we need stdin/out
 inout = None

diff  --git a/clang/utils/creduce-clang-crash.py 
b/clang/utils/creduce-clang-crash.py
index db4a3435a3aef7..180dfbeab224e9 100755
--- a/clang/utils/creduce-clang-crash.py
+++ b/clang/utils/creduce-clang-crash.py
@@ -8,7 +8,6 @@
   *.test.sh -- interestingness test for C-Reduce
 """
 
-from __future__ import print_function
 from argparse import ArgumentParser, RawTextHelpFormatter
 import os
 import re
@@ -228,8 +227,7 @@ def check_interestingness(self):
 testfile = os.path.abspath(self.testfile)
 
 # Check that the test considers the original file interesting
-with open(os.devnull, "w") as devnull:
-returncode = subprocess.call(testfile, stdout=devnull)
+returncode = subprocess.call(testfile, stdout=subprocess.DEVNULL)
 if returncode:
 sys.exit("The interestingness test does not pass for the original 
file.")
 

diff  --git a/lldb/bindings/interface/SBErrorDocstrings.i 
b/lldb/bindings/interface/SBErrorDocstrings.i
index b64c3d64c6c77b..c272ffb7605ffb 100644
--- a/lldb/bindings/interface/SBErrorDocstrings.i
+++ b/lldb/bindings/interface/SBErrorDocstrings.i
@@ -10,8 +10,10 @@ For example (from 
test/python_api/hello_world/TestHelloWorld.py), ::
 
 # Spawn a new process and don't display the stdout if not in TraceO

[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [NFC] Prefer subprocess.DEVNULL over os.devnull (PR #106500)

2024-08-30 Thread Alexander Richardson via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Jonas Devlieghere via lldb-commits


@@ -37,49 +39,75 @@ class raw_ostream;
 using namespace lldb;
 using namespace lldb_private;
 
-Status::Status() {}
+char MachKernelError::ID;
+char Win32Error::ID;
+char ExpressionError::ID;
+
+namespace {
+/// A std::error_code category for eErrorTypeGeneric.
+class GenericCategory : public std::error_category {
+  const char *name() const override { return "LLDBGenericCategory"; }
+  std::string message(int __ev) const override { return "generic LLDB error"; 
};
+};
+GenericCategory &generic_category() {
+  static GenericCategory g_generic_category;
+  return g_generic_category;
+}
+
+/// A std::error_code category for eErrorTypeExpression.
+class ExpressionCategory : public std::error_category {
+  const char *name() const override { return "LLDBExpressionCategory"; }
+  std::string message(int __ev) const override {
+return 
ExecutionResultAsCString(static_cast(__ev));
+  };
+};
+ExpressionCategory &expression_category() {
+  static ExpressionCategory g_expression_category;
+  return g_expression_category;
+}
+} // namespace
+
+Status::Status() : m_error(llvm::Error::success()) {}
 
 Status::Status(ValueType err, ErrorType type, std::string msg)
-: m_code(err), m_type(type), m_string(std::move(msg)) {}
+: m_error(
+  type == eErrorTypeMachKernel
+  ? llvm::make_error(
+std::error_code(err, std::system_category()), msg)
+  : (type == eErrorTypePOSIX
+ ? llvm::errorCodeToError(
+   std::error_code(err, std::generic_category()))
+ : (type == eErrorTypeWin32
+? llvm::make_error(
+  std::error_code(err, std::system_category()),
+  msg)
+: llvm::createStringError(
+  std::move(msg),
+  std::error_code(err, generic_category()) 
{

JDevlieghere wrote:

lol

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Jonas Devlieghere via lldb-commits


@@ -91,10 +136,14 @@ class Status {
 
   ~Status();
 
-  // llvm::Error support
-  explicit Status(llvm::Error error) { *this = std::move(error); }
+  /// Try not to use this in new code. Migrate APIs to llvm::Expected instead.

JDevlieghere wrote:

[nit] I'd word this even stronger: "Avoid using this in new code.  Migrate APIs 
to use llvm::Error or llvm::Expected directly."

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Jonas Devlieghere via lldb-commits


@@ -145,10 +194,12 @@ class Status {
   bool Success() const;
 
 protected:
-  /// Status code as an integer value.
-  ValueType m_code = 0;
-  /// The type of the above error code.
-  lldb::ErrorType m_type = lldb::eErrorTypeInvalid;
+  Status(llvm::Error &&error) : m_error(std::move(error)) {}
+  mutable llvm::Error m_error;
+  //  /// Status code as an integer value.
+  //  ValueType m_code = 0;
+  //  /// The type of the above error code.
+  //  lldb::ErrorType m_type = lldb::eErrorTypeInvalid;

JDevlieghere wrote:

I guess this can go now. 

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Jonas Devlieghere via lldb-commits


@@ -96,16 +124,44 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
-return llvm::Error::success();
-  if (m_type == ErrorType::eErrorTypePOSIX)
-return llvm::errorCodeToError(
-std::error_code(m_code, std::generic_category()));
-  return llvm::createStringError(AsCString());
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
 }
 
-Status::~Status() = default;
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {
+  llvm::Error result = llvm::Error::success();
+  llvm::consumeError(std::move(result));
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &error) {
+if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode(),
+ error.message());
+else
+  result =
+  llvm::createStringError(error.convertToErrorCode(), error.message());
+  });
+  return result;
+}
+
+Status Status::FromError(llvm::Error &&error) {
+  // Existing clients assume that the conversion to Status consumes
+  // and destroys the error. Use cloneError to convert all unnown
+  // errors to strings.
+  llvm::Error clone = cloneError(error);
+  llvm::consumeError(std::move(error));

JDevlieghere wrote:

This looks like a use-after-move. Doesn't `cloneError` already "consume" the 
error anyway by means of `visitErrors`?
Edit: no, apparently not. I would just call consumeError there then?

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Jonas Devlieghere via lldb-commits


@@ -96,16 +124,44 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
-return llvm::Error::success();
-  if (m_type == ErrorType::eErrorTypePOSIX)
-return llvm::errorCodeToError(
-std::error_code(m_code, std::generic_category()));
-  return llvm::createStringError(AsCString());
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
 }
 
-Status::~Status() = default;
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {
+  llvm::Error result = llvm::Error::success();
+  llvm::consumeError(std::move(result));
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &error) {
+if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode(),
+ error.message());
+else
+  result =
+  llvm::createStringError(error.convertToErrorCode(), error.message());

JDevlieghere wrote:

I assume this works because we don't user Errors that are ErrorLists. But If we 
did, wouldn't the callback get called multiple times, resulting in the result 
getting overridden (and an unchecked-error assertion)?

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -37,49 +39,75 @@ class raw_ostream;
 using namespace lldb;
 using namespace lldb_private;
 
-Status::Status() {}
+char MachKernelError::ID;
+char Win32Error::ID;
+char ExpressionError::ID;
+
+namespace {
+/// A std::error_code category for eErrorTypeGeneric.
+class GenericCategory : public std::error_category {
+  const char *name() const override { return "LLDBGenericCategory"; }
+  std::string message(int __ev) const override { return "generic LLDB error"; 
};
+};
+GenericCategory &generic_category() {
+  static GenericCategory g_generic_category;
+  return g_generic_category;
+}
+
+/// A std::error_code category for eErrorTypeExpression.
+class ExpressionCategory : public std::error_category {
+  const char *name() const override { return "LLDBExpressionCategory"; }
+  std::string message(int __ev) const override {
+return 
ExecutionResultAsCString(static_cast(__ev));
+  };
+};
+ExpressionCategory &expression_category() {
+  static ExpressionCategory g_expression_category;
+  return g_expression_category;
+}
+} // namespace
+
+Status::Status() : m_error(llvm::Error::success()) {}
 
 Status::Status(ValueType err, ErrorType type, std::string msg)
-: m_code(err), m_type(type), m_string(std::move(msg)) {}
+: m_error(
+  type == eErrorTypeMachKernel
+  ? llvm::make_error(
+std::error_code(err, std::system_category()), msg)
+  : (type == eErrorTypePOSIX
+ ? llvm::errorCodeToError(
+   std::error_code(err, std::generic_category()))
+ : (type == eErrorTypeWin32
+? llvm::make_error(
+  std::error_code(err, std::system_category()),
+  msg)
+: llvm::createStringError(
+  std::move(msg),
+  std::error_code(err, generic_category()) 
{

adrian-prantl wrote:

The price of non-copyable data structures!

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread Greg Clayton via lldb-commits


@@ -153,6 +153,10 @@ struct MinidumpContext_x86_64 {
   llvm::support::ulittle64_t last_branch_from_rip;
   llvm::support::ulittle64_t last_exception_to_rip;
   llvm::support::ulittle64_t last_exception_from_rip;
+
+  // These registers are LLDB specific.

clayborg wrote:

Maybe expand this comment a bit:
```
// LLDB can save core files and save extra information that isn't available from
// Google breakpad minidump files. 
```

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread Greg Clayton via lldb-commits


@@ -473,7 +473,8 @@ GetThreadContext_x86_64(RegisterContext *reg_ctx) {
   lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Control |
   lldb_private::minidump::MinidumpContext_x86_64_Flags::Segments |
-  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer);
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::Integer |
+  lldb_private::minidump::MinidumpContext_x86_64_Flags::LLDBSpecific);

clayborg wrote:

@jeffreytan81 we made this LLDB specific because this doesn't match the 
registers that are saved by Breakpad. I just checked the breakpad sources 
(https://github.com/google/breakpad.git) and they don't support fs_base or 
gs_base.

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread Greg Clayton via lldb-commits


@@ -67,6 +67,18 @@ def verify_core_file(
 self.assertIn(thread_id, stacks_to_registers_map)
 register_val_list = stacks_to_registers_map[thread_id]
 frame_register_list = frame.GetRegisters()
+# explicitly verify we collected fs and gs base for x86_64

clayborg wrote:

Don't we need some logic here to do this only for x86_64 core files? Or is this 
test somehow x86_64 only? I didn't see anything in the test that made this 
x86_64 specific

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -96,16 +124,44 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
-return llvm::Error::success();
-  if (m_type == ErrorType::eErrorTypePOSIX)
-return llvm::errorCodeToError(
-std::error_code(m_code, std::generic_category()));
-  return llvm::createStringError(AsCString());
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
 }
 
-Status::~Status() = default;
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {
+  llvm::Error result = llvm::Error::success();
+  llvm::consumeError(std::move(result));
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &error) {
+if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode(),
+ error.message());
+else
+  result =
+  llvm::createStringError(error.convertToErrorCode(), error.message());
+  });
+  return result;
+}
+
+Status Status::FromError(llvm::Error &&error) {
+  // Existing clients assume that the conversion to Status consumes
+  // and destroys the error. Use cloneError to convert all unnown
+  // errors to strings.
+  llvm::Error clone = cloneError(error);
+  llvm::consumeError(std::move(error));

adrian-prantl wrote:

The better fix is to create a variant of the visitor that can return a result.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -96,16 +124,44 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
-return llvm::Error::success();
-  if (m_type == ErrorType::eErrorTypePOSIX)
-return llvm::errorCodeToError(
-std::error_code(m_code, std::generic_category()));
-  return llvm::createStringError(AsCString());
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
 }
 
-Status::~Status() = default;
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {
+  llvm::Error result = llvm::Error::success();
+  llvm::consumeError(std::move(result));
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &error) {
+if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode(),
+ error.message());
+else
+  result =
+  llvm::createStringError(error.convertToErrorCode(), error.message());

adrian-prantl wrote:

My plan is to use ErrorList for 
https://github.com/llvm/llvm-project/pull/106442 so I'll need to support this 
case soon.

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


[Lldb-commits] [lldb] [LLDB][Minidump] Extend the minidump x86_64 registers to include fs_base and gs_base (PR #106767)

2024-08-30 Thread Jacob Lalonde via lldb-commits


@@ -67,6 +67,18 @@ def verify_core_file(
 self.assertIn(thread_id, stacks_to_registers_map)
 register_val_list = stacks_to_registers_map[thread_id]
 frame_register_list = frame.GetRegisters()
+# explicitly verify we collected fs and gs base for x86_64

Jlalond wrote:

This test has a x86_64 restriction. This is the verification method called by 
several test, but all are x86_64.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -96,16 +124,44 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
-return llvm::Error::success();
-  if (m_type == ErrorType::eErrorTypePOSIX)
-return llvm::errorCodeToError(
-std::error_code(m_code, std::generic_category()));
-  return llvm::createStringError(AsCString());
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
 }
 
-Status::~Status() = default;
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {
+  llvm::Error result = llvm::Error::success();
+  llvm::consumeError(std::move(result));
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &error) {
+if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode(),
+ error.message());
+else
+  result =
+  llvm::createStringError(error.convertToErrorCode(), error.message());
+  });
+  return result;
+}
+
+Status Status::FromError(llvm::Error &&error) {
+  // Existing clients assume that the conversion to Status consumes
+  // and destroys the error. Use cloneError to convert all unnown
+  // errors to strings.
+  llvm::Error clone = cloneError(error);
+  llvm::consumeError(std::move(error));

adrian-prantl wrote:

.. which is not actually possible, due to ErrorList.

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


[Lldb-commits] [lldb] [lldb] Fix and speedup the `memory find` command (PR #104193)

2024-08-30 Thread Greg Clayton via lldb-commits

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

LGTM.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -96,16 +124,44 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
-return llvm::Error::success();
-  if (m_type == ErrorType::eErrorTypePOSIX)
-return llvm::errorCodeToError(
-std::error_code(m_code, std::generic_category()));
-  return llvm::createStringError(AsCString());
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
 }
 
-Status::~Status() = default;
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {
+  llvm::Error result = llvm::Error::success();
+  llvm::consumeError(std::move(result));
+  llvm::visitErrors(error, [&](const llvm::ErrorInfoBase &error) {
+if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode());
+else if (error.isA())
+  result = llvm::make_error(error.convertToErrorCode(),
+ error.message());
+else
+  result =
+  llvm::createStringError(error.convertToErrorCode(), error.message());
+  });
+  return result;
+}
+
+Status Status::FromError(llvm::Error &&error) {
+  // Existing clients assume that the conversion to Status consumes
+  // and destroys the error. Use cloneError to convert all unnown
+  // errors to strings.
+  llvm::Error clone = cloneError(error);
+  llvm::consumeError(std::move(error));

adrian-prantl wrote:

Found a better solution.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/106774

>From 1151a01022c860c4e098752e35f5eb5c022fbff3 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Thu, 29 Aug 2024 17:29:10 -0700
Subject: [PATCH] [lldb] Change the implementation of Status to store an
 llvm::Error (NFC)

Most APIs that currently vend a Status would be better served by
returning llvm::Expected<> instead. If possibles APIs should be
refactored to avoid Status. The only legitimate long-term uses of
Status are objects that need to store an error for a long time
(which should be questioned as a design decision, too).

This patch makes the transition to llvm::Error easier by making the
places that cannot switch to llvm::Error explicit: They are marked
with a call to Status::clone(). Every other API can and should be
refactored to use llvm::Expected. In the end Status should only be
used in very few places.

Whenever an unchecked Error is dropped by Status it logs this to the
verbose API channel.

Implementation notes:

This patch introduces two new kinds of error_category as well as new
llvm::Error types. Here is the mapping of lldb::ErrorType to
llvm::Errors:

   (eErrorTypeInvalid)
   eErrorTypeGeneric  llvm::StringError
   eErrorTypePOSIXllvm::ECError
   eErrorTypeMachKernel   MachKernelError
   eErrorTypeExpression   llvm::ErrorList
   eErrorTypeWin32Win32Error
---
 lldb/bindings/python/python-swigsafecast.swig |   2 +-
 lldb/include/lldb/API/SBError.h   |   4 +-
 lldb/include/lldb/API/SBValueList.h   |   2 +-
 .../lldb/Core/ValueObjectConstResult.h|   4 +-
 lldb/include/lldb/Target/Process.h|   2 -
 lldb/include/lldb/Utility/Status.h|  68 -
 lldb/source/API/SBBreakpoint.cpp  |   6 +-
 lldb/source/API/SBBreakpointLocation.cpp  |   4 +-
 lldb/source/API/SBBreakpointName.cpp  |  17 +-
 lldb/source/API/SBDebugger.cpp|   4 +-
 lldb/source/API/SBError.cpp   |  15 +-
 lldb/source/API/SBFile.cpp|  15 +-
 lldb/source/API/SBFormat.cpp  |   2 +-
 lldb/source/API/SBFrame.cpp   |   9 +-
 lldb/source/API/SBPlatform.cpp|   4 +-
 lldb/source/API/SBProcess.cpp |   2 +-
 lldb/source/API/SBSaveCoreOptions.cpp |   3 +-
 lldb/source/API/SBStructuredData.cpp  |   2 +-
 lldb/source/API/SBTarget.cpp  |   7 +-
 lldb/source/API/SBThread.cpp  |   2 +-
 lldb/source/API/SBValue.cpp   |   4 +-
 lldb/source/API/SBValueList.cpp   |  13 +-
 lldb/source/API/SBWatchpoint.cpp  |   2 +-
 .../source/Commands/CommandObjectCommands.cpp |   4 +-
 .../Commands/CommandObjectMemoryTag.cpp   |  10 +-
 lldb/source/Core/Debugger.cpp |   2 +-
 lldb/source/Core/ModuleList.cpp   |   5 +-
 lldb/source/Core/PluginManager.cpp|   2 +-
 lldb/source/Core/ThreadedCommunication.cpp|   2 +-
 lldb/source/Core/ValueObject.cpp  |   4 +-
 lldb/source/Core/ValueObjectCast.cpp  |   2 +-
 lldb/source/Core/ValueObjectConstResult.cpp   |   9 +-
 lldb/source/Core/ValueObjectDynamicValue.cpp  |   2 +-
 .../Core/ValueObjectSyntheticFilter.cpp   |   2 +-
 lldb/source/DataFormatters/VectorType.cpp |   2 +-
 lldb/source/Expression/FunctionCaller.cpp |   3 +-
 lldb/source/Expression/LLVMUserExpression.cpp |   6 +-
 lldb/source/Expression/Materializer.cpp   |   2 +-
 lldb/source/Expression/UserExpression.cpp |   8 +-
 lldb/source/Host/common/LockFileBase.cpp  |   4 +-
 .../Host/common/NativeProcessProtocol.cpp |  10 +-
 lldb/source/Host/common/TCPSocket.cpp |   4 +-
 lldb/source/Host/macosx/objcxx/Host.mm|   2 +-
 .../posix/ConnectionFileDescriptorPosix.cpp   |  12 +-
 .../source/Interpreter/CommandInterpreter.cpp |   2 +-
 lldb/source/Interpreter/OptionValueRegex.cpp  |   2 +-
 lldb/source/Interpreter/ScriptInterpreter.cpp |   2 +-
 .../Language/CPlusPlus/BlockPointer.cpp   |   2 +-
 .../Plugins/Platform/Android/AdbClient.cpp|   8 +-
 .../PlatformAndroidRemoteGDBServer.cpp|   4 +-
 ...PlatformiOSSimulatorCoreSimulatorSupport.h |   2 +-
 ...latformiOSSimulatorCoreSimulatorSupport.mm |  14 +-
 .../Plugins/Platform/POSIX/PlatformPOSIX.cpp  |   4 +-
 .../Platform/Windows/PlatformWindows.cpp  |   4 +-
 .../NativeRegisterContextDBReg_arm64.cpp  |  10 +-
 .../Process/elf-core/ProcessElfCore.cpp   |   2 +-
 .../gdb-remote/GDBRemoteCommunication.cpp |   2 +-
 .../GDBRemoteCommunicationClient.cpp  |   2 +-
 .../GDBRemoteCommunicationServer.cpp  |   2 +-
 .../GDBRemoteCommunicationServerLLGS.cpp  |   8 +-
 .../GDBRemoteCommunicationServerPlatform.cpp  |   2 +-
 .../Process/minidump/ProcessMinidump.cpp  |   2 +-
 .../ScriptedProcessPythonInterface.cpp|   6 +-
 .../Interfaces/ScriptedPythonInterface.h  |  10 

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/106774

>From 089f8e83cf5bbb9bf2e4846298709665e7cc2ee0 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Thu, 29 Aug 2024 17:29:10 -0700
Subject: [PATCH] [lldb] Change the implementation of Status to store an
 llvm::Error (NFC)

Most APIs that currently vend a Status would be better served by
returning llvm::Expected<> instead. If possibles APIs should be
refactored to avoid Status. The only legitimate long-term uses of
Status are objects that need to store an error for a long time
(which should be questioned as a design decision, too).

This patch makes the transition to llvm::Error easier by making the
places that cannot switch to llvm::Error explicit: They are marked
with a call to Status::clone(). Every other API can and should be
refactored to use llvm::Expected. In the end Status should only be
used in very few places.

Whenever an unchecked Error is dropped by Status it logs this to the
verbose API channel.

Implementation notes:

This patch introduces two new kinds of error_category as well as new
llvm::Error types. Here is the mapping of lldb::ErrorType to
llvm::Errors:

   (eErrorTypeInvalid)
   eErrorTypeGeneric  llvm::StringError
   eErrorTypePOSIXllvm::ECError
   eErrorTypeMachKernel   MachKernelError
   eErrorTypeExpression   llvm::ErrorList
   eErrorTypeWin32Win32Error
---
 lldb/bindings/python/python-swigsafecast.swig |   2 +-
 lldb/include/lldb/API/SBError.h   |   4 +-
 lldb/include/lldb/API/SBValueList.h   |   2 +-
 .../lldb/Core/ValueObjectConstResult.h|   4 +-
 lldb/include/lldb/Target/Process.h|   2 -
 lldb/include/lldb/Utility/Status.h|  68 -
 lldb/source/API/SBBreakpoint.cpp  |   6 +-
 lldb/source/API/SBBreakpointLocation.cpp  |   4 +-
 lldb/source/API/SBBreakpointName.cpp  |  17 +-
 lldb/source/API/SBDebugger.cpp|   4 +-
 lldb/source/API/SBError.cpp   |  15 +-
 lldb/source/API/SBFile.cpp|  15 +-
 lldb/source/API/SBFormat.cpp  |   2 +-
 lldb/source/API/SBFrame.cpp   |   9 +-
 lldb/source/API/SBPlatform.cpp|   4 +-
 lldb/source/API/SBProcess.cpp |   2 +-
 lldb/source/API/SBSaveCoreOptions.cpp |   3 +-
 lldb/source/API/SBStructuredData.cpp  |   2 +-
 lldb/source/API/SBTarget.cpp  |   7 +-
 lldb/source/API/SBThread.cpp  |   2 +-
 lldb/source/API/SBValue.cpp   |   4 +-
 lldb/source/API/SBValueList.cpp   |  13 +-
 lldb/source/API/SBWatchpoint.cpp  |   2 +-
 .../source/Commands/CommandObjectCommands.cpp |   4 +-
 .../Commands/CommandObjectMemoryTag.cpp   |  10 +-
 lldb/source/Core/Debugger.cpp |   2 +-
 lldb/source/Core/ModuleList.cpp   |   5 +-
 lldb/source/Core/PluginManager.cpp|   2 +-
 lldb/source/Core/ThreadedCommunication.cpp|   2 +-
 lldb/source/Core/ValueObject.cpp  |   4 +-
 lldb/source/Core/ValueObjectCast.cpp  |   2 +-
 lldb/source/Core/ValueObjectConstResult.cpp   |   9 +-
 lldb/source/Core/ValueObjectDynamicValue.cpp  |   2 +-
 .../Core/ValueObjectSyntheticFilter.cpp   |   2 +-
 lldb/source/DataFormatters/VectorType.cpp |   2 +-
 lldb/source/Expression/FunctionCaller.cpp |   3 +-
 lldb/source/Expression/LLVMUserExpression.cpp |   6 +-
 lldb/source/Expression/Materializer.cpp   |   2 +-
 lldb/source/Expression/UserExpression.cpp |   8 +-
 lldb/source/Host/common/LockFileBase.cpp  |   4 +-
 .../Host/common/NativeProcessProtocol.cpp |  10 +-
 lldb/source/Host/common/TCPSocket.cpp |   4 +-
 lldb/source/Host/macosx/objcxx/Host.mm|   2 +-
 .../posix/ConnectionFileDescriptorPosix.cpp   |  12 +-
 .../source/Interpreter/CommandInterpreter.cpp |   2 +-
 lldb/source/Interpreter/OptionValueRegex.cpp  |   2 +-
 lldb/source/Interpreter/ScriptInterpreter.cpp |   2 +-
 .../Language/CPlusPlus/BlockPointer.cpp   |   2 +-
 .../Plugins/Platform/Android/AdbClient.cpp|   8 +-
 .../PlatformAndroidRemoteGDBServer.cpp|   4 +-
 ...PlatformiOSSimulatorCoreSimulatorSupport.h |   2 +-
 ...latformiOSSimulatorCoreSimulatorSupport.mm |  14 +-
 .../Plugins/Platform/POSIX/PlatformPOSIX.cpp  |   4 +-
 .../Platform/Windows/PlatformWindows.cpp  |   4 +-
 .../NativeRegisterContextDBReg_arm64.cpp  |  10 +-
 .../Process/elf-core/ProcessElfCore.cpp   |   2 +-
 .../gdb-remote/GDBRemoteCommunication.cpp |   2 +-
 .../GDBRemoteCommunicationClient.cpp  |   2 +-
 .../GDBRemoteCommunicationServer.cpp  |   2 +-
 .../GDBRemoteCommunicationServerLLGS.cpp  |   8 +-
 .../GDBRemoteCommunicationServerPlatform.cpp  |   2 +-
 .../Process/minidump/ProcessMinidump.cpp  |   2 +-
 .../ScriptedProcessPythonInterface.cpp|   6 +-
 .../Interfaces/ScriptedPythonInterface.h  |  10 

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -96,7 +96,7 @@ class LLDB_API SBValueList {
 
   std::unique_ptr m_opaque_up;
 
-  void SetError(const lldb_private::Status &status);
+  void SetError(lldb_private::Status &&status);

bulbazord wrote:

This also breaks ABI.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -97,7 +97,7 @@ class LLDB_API SBError {
   friend class lldb_private::ScriptInterpreter;
   friend class lldb_private::python::SWIGBridge;
 
-  SBError(const lldb_private::Status &error);
+  SBError(lldb_private::Status &&error);

bulbazord wrote:

This breaks ABI, is this absolutely required?

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -37,49 +39,75 @@ class raw_ostream;
 using namespace lldb;
 using namespace lldb_private;
 
-Status::Status() {}
+char MachKernelError::ID;
+char Win32Error::ID;
+char ExpressionError::ID;
+
+namespace {
+/// A std::error_code category for eErrorTypeGeneric.
+class GenericCategory : public std::error_category {
+  const char *name() const override { return "LLDBGenericCategory"; }
+  std::string message(int __ev) const override { return "generic LLDB error"; 
};
+};
+GenericCategory &generic_category() {
+  static GenericCategory g_generic_category;
+  return g_generic_category;
+}
+
+/// A std::error_code category for eErrorTypeExpression.
+class ExpressionCategory : public std::error_category {
+  const char *name() const override { return "LLDBExpressionCategory"; }
+  std::string message(int __ev) const override {
+return 
ExecutionResultAsCString(static_cast(__ev));
+  };
+};
+ExpressionCategory &expression_category() {
+  static ExpressionCategory g_expression_category;
+  return g_expression_category;
+}
+} // namespace
+
+Status::Status() : m_error(llvm::Error::success()) {}
 
 Status::Status(ValueType err, ErrorType type, std::string msg)
-: m_code(err), m_type(type), m_string(std::move(msg)) {}
+: m_error(

bulbazord wrote:

Suggestion: Create a function to return the correct kind of error and call it 
to initialize `m_error` instead of doing... this. 😄 

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -107,7 +107,7 @@ class LLDB_API SBError {
 
   lldb_private::Status &ref();
 
-  void SetError(const lldb_private::Status &lldb_error);
+  void SetError(lldb_private::Status &&lldb_error);

bulbazord wrote:

This also breaks ABI.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -22,13 +22,14 @@ class ValueListImpl {
 public:
   ValueListImpl() = default;
 
-  ValueListImpl(const ValueListImpl &rhs) = default;
+  ValueListImpl(const ValueListImpl &rhs)

bulbazord wrote:

This may be an ABI break if compilers generate different code or symbols for 
this constructor.

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


[Lldb-commits] [lldb] [lldb] Include checksum in source cache dump (PR #106773)

2024-08-30 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-dap] show dialog when executable is not found (PR #104711)

2024-08-30 Thread via lldb-commits

tedwoodward wrote:

Does the version number in package.json need to be updated, to automatically 
publish the change to the marketplace?

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/106774

>From 01e0a8e65c63b47251eca72092e04cc20bf20986 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Thu, 29 Aug 2024 17:29:10 -0700
Subject: [PATCH] [lldb] Change the implementation of Status to store an
 llvm::Error (NFC)

Most APIs that currently vend a Status would be better served by
returning llvm::Expected<> instead. If possibles APIs should be
refactored to avoid Status. The only legitimate long-term uses of
Status are objects that need to store an error for a long time
(which should be questioned as a design decision, too).

This patch makes the transition to llvm::Error easier by making the
places that cannot switch to llvm::Error explicit: They are marked
with a call to Status::clone(). Every other API can and should be
refactored to use llvm::Expected. In the end Status should only be
used in very few places.

Whenever an unchecked Error is dropped by Status it logs this to the
verbose API channel.

Implementation notes:

This patch introduces two new kinds of error_category as well as new
llvm::Error types. Here is the mapping of lldb::ErrorType to
llvm::Errors:

   (eErrorTypeInvalid)
   eErrorTypeGeneric  llvm::StringError
   eErrorTypePOSIXllvm::ECError
   eErrorTypeMachKernel   MachKernelError
   eErrorTypeExpression   llvm::ErrorList
   eErrorTypeWin32Win32Error
---
 lldb/bindings/python/python-swigsafecast.swig |   2 +-
 lldb/include/lldb/API/SBError.h   |   4 +-
 lldb/include/lldb/API/SBValueList.h   |   2 +-
 .../lldb/Core/ValueObjectConstResult.h|   4 +-
 lldb/include/lldb/Target/Process.h|   2 -
 lldb/include/lldb/Utility/Status.h|  70 -
 lldb/source/API/SBBreakpoint.cpp  |   6 +-
 lldb/source/API/SBBreakpointLocation.cpp  |   4 +-
 lldb/source/API/SBBreakpointName.cpp  |  17 +-
 lldb/source/API/SBDebugger.cpp|   4 +-
 lldb/source/API/SBError.cpp   |  15 +-
 lldb/source/API/SBFile.cpp|  15 +-
 lldb/source/API/SBFormat.cpp  |   2 +-
 lldb/source/API/SBFrame.cpp   |   9 +-
 lldb/source/API/SBPlatform.cpp|   4 +-
 lldb/source/API/SBProcess.cpp |   2 +-
 lldb/source/API/SBSaveCoreOptions.cpp |   3 +-
 lldb/source/API/SBStructuredData.cpp  |   2 +-
 lldb/source/API/SBTarget.cpp  |   7 +-
 lldb/source/API/SBThread.cpp  |   2 +-
 lldb/source/API/SBValue.cpp   |   4 +-
 lldb/source/API/SBValueList.cpp   |  13 +-
 lldb/source/API/SBWatchpoint.cpp  |   2 +-
 .../source/Commands/CommandObjectCommands.cpp |   4 +-
 .../Commands/CommandObjectMemoryTag.cpp   |  10 +-
 lldb/source/Core/Debugger.cpp |   2 +-
 lldb/source/Core/ModuleList.cpp   |   5 +-
 lldb/source/Core/PluginManager.cpp|   2 +-
 lldb/source/Core/ThreadedCommunication.cpp|   2 +-
 lldb/source/Core/ValueObject.cpp  |   4 +-
 lldb/source/Core/ValueObjectCast.cpp  |   2 +-
 lldb/source/Core/ValueObjectConstResult.cpp   |   9 +-
 lldb/source/Core/ValueObjectDynamicValue.cpp  |   2 +-
 .../Core/ValueObjectSyntheticFilter.cpp   |   2 +-
 lldb/source/DataFormatters/VectorType.cpp |   2 +-
 lldb/source/Expression/FunctionCaller.cpp |   3 +-
 lldb/source/Expression/LLVMUserExpression.cpp |   6 +-
 lldb/source/Expression/Materializer.cpp   |   2 +-
 lldb/source/Expression/UserExpression.cpp |   8 +-
 lldb/source/Host/common/LockFileBase.cpp  |   4 +-
 .../Host/common/NativeProcessProtocol.cpp |  10 +-
 lldb/source/Host/common/TCPSocket.cpp |   4 +-
 lldb/source/Host/macosx/objcxx/Host.mm|   2 +-
 .../posix/ConnectionFileDescriptorPosix.cpp   |  12 +-
 .../source/Interpreter/CommandInterpreter.cpp |   2 +-
 lldb/source/Interpreter/OptionValueRegex.cpp  |   2 +-
 lldb/source/Interpreter/ScriptInterpreter.cpp |   2 +-
 .../Language/CPlusPlus/BlockPointer.cpp   |   2 +-
 .../Plugins/Platform/Android/AdbClient.cpp|   8 +-
 .../PlatformAndroidRemoteGDBServer.cpp|   4 +-
 ...PlatformiOSSimulatorCoreSimulatorSupport.h |   2 +-
 ...latformiOSSimulatorCoreSimulatorSupport.mm |  14 +-
 .../Plugins/Platform/POSIX/PlatformPOSIX.cpp  |   4 +-
 .../Platform/Windows/PlatformWindows.cpp  |   4 +-
 .../NativeRegisterContextDBReg_arm64.cpp  |  10 +-
 .../Process/elf-core/ProcessElfCore.cpp   |   2 +-
 .../gdb-remote/GDBRemoteCommunication.cpp |   2 +-
 .../GDBRemoteCommunicationClient.cpp  |   2 +-
 .../GDBRemoteCommunicationServer.cpp  |   2 +-
 .../GDBRemoteCommunicationServerLLGS.cpp  |   8 +-
 .../GDBRemoteCommunicationServerPlatform.cpp  |   2 +-
 .../Process/minidump/ProcessMinidump.cpp  |   2 +-
 .../ScriptedProcessPythonInterface.cpp|   6 +-
 .../Interfaces/ScriptedPythonInterface.h  |  10 

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -22,13 +22,14 @@ class ValueListImpl {
 public:
   ValueListImpl() = default;
 
-  ValueListImpl(const ValueListImpl &rhs) = default;
+  ValueListImpl(const ValueListImpl &rhs)

adrian-prantl wrote:

Isn't `ValueListImpl` an implementation detail?

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


[Lldb-commits] [lldb] 5e7f0dc - [lldb] Include checksum in source cache dump (#106773)

2024-08-30 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-08-30T13:16:26-07:00
New Revision: 5e7f0dcd69fd666bbb2a93d20e6a56a11261b519

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

LOG: [lldb] Include checksum in source cache dump (#106773)

This patch updates the source cache dump command to print both the
actual (on-disk) checksum and the expected (line table) checksum. To
achieve that we now read and store the on-disk checksum in the cached
object. The same information will be used in a future path to print a
warning when the checksums differ.

Added: 


Modified: 
lldb/include/lldb/Core/SourceManager.h
lldb/source/Core/SourceManager.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/SourceManager.h 
b/lldb/include/lldb/Core/SourceManager.h
index ae7bd3d2311f96..172824dc78a6bc 100644
--- a/lldb/include/lldb/Core/SourceManager.h
+++ b/lldb/include/lldb/Core/SourceManager.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_SOURCEMANAGER_H
 #define LLDB_CORE_SOURCEMANAGER_H
 
+#include "lldb/Utility/Checksum.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
@@ -71,6 +72,8 @@ class SourceManager {
 
 llvm::sys::TimePoint<> GetTimestamp() const { return m_mod_time; }
 
+const Checksum &GetChecksum() const { return m_checksum; }
+
   protected:
 /// Set file and update modification time.
 void SetSupportFile(lldb::SupportFileSP support_file_sp);
@@ -81,6 +84,9 @@ class SourceManager {
 /// 
diff erent from the original support file passed to the constructor.
 lldb::SupportFileSP m_support_file_sp;
 
+/// Keep track of the on-disk checksum.
+Checksum m_checksum;
+
 // Keep the modification time that this file data is valid for
 llvm::sys::TimePoint<> m_mod_time;
 

diff  --git a/lldb/source/Core/SourceManager.cpp 
b/lldb/source/Core/SourceManager.cpp
index c427bb91f4643a..f6e59ce731a573 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -447,13 +447,14 @@ void SourceManager::FindLinesMatchingRegex(SupportFileSP 
support_file_sp,
 
 SourceManager::File::File(SupportFileSP support_file_sp,
   lldb::DebuggerSP debugger_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
-  m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(), m_debugger_wp(debugger_sp), m_target_wp(TargetSP()) {
   CommonInitializer(support_file_sp, {});
 }
 
 SourceManager::File::File(SupportFileSP support_file_sp, TargetSP target_sp)
-: m_support_file_sp(std::make_shared()), m_mod_time(),
+: m_support_file_sp(std::make_shared()), m_checksum(),
+  m_mod_time(),
   m_debugger_wp(target_sp ? target_sp->GetDebugger().shared_from_this()
   : DebuggerSP()),
   m_target_wp(target_sp) {
@@ -532,9 +533,11 @@ void SourceManager::File::CommonInitializer(SupportFileSP 
support_file_sp,
   }
 
   // If the file exists, read in the data.
-  if (m_mod_time != llvm::sys::TimePoint<>())
+  if (m_mod_time != llvm::sys::TimePoint<>()) {
 m_data_sp = FileSystem::Instance().CreateDataBuffer(
 m_support_file_sp->GetSpecOnly());
+m_checksum = llvm::MD5::hash(m_data_sp->GetData());
+  }
 }
 
 void SourceManager::File::SetSupportFile(lldb::SupportFileSP support_file_sp) {
@@ -835,14 +838,24 @@ SourceManager::FileSP 
SourceManager::SourceFileCache::FindSourceFile(
   return {};
 }
 
+static std::string toString(const Checksum &checksum) {
+  if (!checksum)
+return "";
+  return std::string(llvm::formatv("{0}", checksum.digest()));
+}
+
 void SourceManager::SourceFileCache::Dump(Stream &stream) const {
-  stream << "Modification time   LinesPath\n";
-  stream << "---  \n";
+  // clang-format off
+  stream << "Modification time   MD5 Checksum (on-disk)   MD5 Checksum 
(line table)LinesPath\n";
+  stream << "---  
  \n";
+  // clang-format on
   for (auto &entry : m_file_cache) {
 if (!entry.second)
   continue;
 FileSP file = entry.second;
-stream.Format("{0:%Y-%m-%d %H:%M:%S} {1,8:d} {2}\n", file->GetTimestamp(),
+stream.Format("{0:%Y-%m-%d %H:%M:%S} {1,32} {2,32} {3,8:d} {4}\n",
+  file->GetTimestamp(), toString(file->GetChecksum()),
+  toString(file->GetSupportFile()->GetChecksum()),
   file->GetNumLines(), entry.first.GetPath());
   }
 }



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

[Lldb-commits] [lldb] [lldb] Include checksum in source cache dump (PR #106773)

2024-08-30 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (PR #106791)

2024-08-30 Thread Alex Langford via lldb-commits

https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/106791

Summary:
This improves the performance of ObjectFileMacho::ParseSymtab by removing eager 
and expensive work in favor of doing it later in a less-expensive fashion.

Experiment:
My goal was to understand LLDB's startup time.
First, I produced a Debug build of LLDB (no dSYM) and a Release+NoAsserts build 
of LLDB. The Release build debugged the Debug build as it debugged a small C++ 
program. I found that ObjectFileMachO::ParseSymtab accounted for somewhere 
between 1.2 and 1.3 seconds consistently. After applying this change, I 
consistently measured a reduction of approximately 100ms, putting the time 
closer to 1.1s and 1.2s on average.

Background:
ObjectFileMachO::ParseSymtab will incrementally create symbols by parsing nlist 
entries from the symtab section of a MachO binary. As it does this, it eagerly 
tries to determine the size of symbols (e.g. how long a function is) using 
LC_FUNCTION_STARTS data (or eh_frame if LC_FUNCTION_STARTS is unavailable). 
Concretely, this is done by performing a binary search on the function starts 
array and calculating the distance to the next function or the end of the 
section (whichever is smaller).

However, this work is unnecessary for 2 reasons:
1. If you have debug symbol entries (i.e. STABs), the size of a function is 
usually stored right after the function's entry. Performing this work right 
before parsing the next entry is unnecessary work.
2. Calculating symbol sizes for symbols of size 0 is already performed in 
`Symtab::InitAddressIndexes` after all the symbols are added to the Symtab. It 
also does this more efficiently by walking over a list of symbols sorted by 
address, so the work to calculate the size per symbol is constant instead of 
O(log n).

>From 48ddf0984a1d253bab60421852752a7ab7740af4 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Fri, 30 Aug 2024 12:49:33 -0700
Subject: [PATCH] [lldb] Do not use LC_FUNCTION_STARTS data to determine symbol
 size as symbols are created

Summary:
This improves the performance of ObjectFileMacho::ParseSymtab by removing
eager and expensive work in favor of doing it later in a less-expensive
fashion.

Experiment:
My goal was to understand LLDB's startup time.
First, I produced a Debug build of LLDB (no dSYM) and a
Release+NoAsserts build of LLDB. The Release build debugged
the Debug build as it debugged a small C++ program.
I found that ObjectFileMachO::ParseSymtab accounted for
somewhere between 1.2 and 1.3 seconds consistently. After
applying this change, I consistently measured a reduction of
approximately 100ms, putting the time closer to 1.1s and 1.2s
on average.

Background:
ObjectFileMachO::ParseSymtab will incrementally create symbols by
parsing nlist entries from the symtab section of a MachO binary.
As it does this, it eagerly tries to determine the size of symbols
(e.g. how long a function is) using LC_FUNCTION_STARTS data (or eh_frame
if LC_FUNCTION_STARTS is unavailable). Concretely, this is done by
performing a binary search on the function starts array and calculating
the distance to the next function or the end of the section (whichever
is smaller).

However, this work is unnecessary for 2 reasons:
1. If you have debug symbol entries (i.e. STABs), the size of a
   function is usually stored right after the function's entry.
   Performing this work right before parsing the next entry is
   unnecessary work.
2. Calculating symbol sizes for symbols of size 0 is already
   performed in `Symtab::InitAddressIndexes` after
   all the symbols are added to the Symtab. It also does this more
   efficiently by walking over a list of symbols sorted by address, so
   the work to calculate the size per symbol is constant instead of
   O(log n).
---
 .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 45 ---
 1 file changed, 45 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 2004622e547be9..f53108ff6340aa 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -3768,7 +3768,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 
   SymbolType type = eSymbolTypeInvalid;
   SectionSP symbol_section;
-  lldb::addr_t symbol_byte_size = 0;
   bool add_nlist = true;
   bool is_gsym = false;
   bool demangled_is_synthesized = false;
@@ -4354,47 +4353,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 
   if (symbol_section) {
 const addr_t section_file_addr = symbol_section->GetFileAddress();
-if (symbol_byte_size == 0 && function_starts_count > 0) {
-  addr_t symbol_lookup_file_addr = nlist.n_value;
-  // Do an exact address match for non-ARM addresses, else get the
-  // closest since the symbol might be a thumb symbol which has an
-  // addr

[Lldb-commits] [lldb] [lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (PR #106791)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)


Changes

Summary:
This improves the performance of ObjectFileMacho::ParseSymtab by removing eager 
and expensive work in favor of doing it later in a less-expensive fashion.

Experiment:
My goal was to understand LLDB's startup time.
First, I produced a Debug build of LLDB (no dSYM) and a Release+NoAsserts build 
of LLDB. The Release build debugged the Debug build as it debugged a small C++ 
program. I found that ObjectFileMachO::ParseSymtab accounted for somewhere 
between 1.2 and 1.3 seconds consistently. After applying this change, I 
consistently measured a reduction of approximately 100ms, putting the time 
closer to 1.1s and 1.2s on average.

Background:
ObjectFileMachO::ParseSymtab will incrementally create symbols by parsing nlist 
entries from the symtab section of a MachO binary. As it does this, it eagerly 
tries to determine the size of symbols (e.g. how long a function is) using 
LC_FUNCTION_STARTS data (or eh_frame if LC_FUNCTION_STARTS is unavailable). 
Concretely, this is done by performing a binary search on the function starts 
array and calculating the distance to the next function or the end of the 
section (whichever is smaller).

However, this work is unnecessary for 2 reasons:
1. If you have debug symbol entries (i.e. STABs), the size of a function is 
usually stored right after the function's entry. Performing this work right 
before parsing the next entry is unnecessary work.
2. Calculating symbol sizes for symbols of size 0 is already performed in 
`Symtab::InitAddressIndexes` after all the symbols are added to the Symtab. It 
also does this more efficiently by walking over a list of symbols sorted by 
address, so the work to calculate the size per symbol is constant instead of 
O(log n).

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


1 Files Affected:

- (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (-45) 


``diff
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 2004622e547be9..f53108ff6340aa 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -3768,7 +3768,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 
   SymbolType type = eSymbolTypeInvalid;
   SectionSP symbol_section;
-  lldb::addr_t symbol_byte_size = 0;
   bool add_nlist = true;
   bool is_gsym = false;
   bool demangled_is_synthesized = false;
@@ -4354,47 +4353,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 
   if (symbol_section) {
 const addr_t section_file_addr = symbol_section->GetFileAddress();
-if (symbol_byte_size == 0 && function_starts_count > 0) {
-  addr_t symbol_lookup_file_addr = nlist.n_value;
-  // Do an exact address match for non-ARM addresses, else get the
-  // closest since the symbol might be a thumb symbol which has an
-  // address with bit zero set.
-  FunctionStarts::Entry *func_start_entry =
-  function_starts.FindEntry(symbol_lookup_file_addr, !is_arm);
-  if (is_arm && func_start_entry) {
-// Verify that the function start address is the symbol address
-// (ARM) or the symbol address + 1 (thumb).
-if (func_start_entry->addr != symbol_lookup_file_addr &&
-func_start_entry->addr != (symbol_lookup_file_addr + 1)) {
-  // Not the right entry, NULL it out...
-  func_start_entry = nullptr;
-}
-  }
-  if (func_start_entry) {
-func_start_entry->data = true;
-
-addr_t symbol_file_addr = func_start_entry->addr;
-if (is_arm)
-  symbol_file_addr &= THUMB_ADDRESS_BIT_MASK;
-
-const FunctionStarts::Entry *next_func_start_entry =
-function_starts.FindNextEntry(func_start_entry);
-const addr_t section_end_file_addr =
-section_file_addr + symbol_section->GetByteSize();
-if (next_func_start_entry) {
-  addr_t next_symbol_file_addr = next_func_start_entry->addr;
-  // Be sure the clear the Thumb address bit when we calculate the
-  // size from the current and next address
-  if (is_arm)
-next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK;
-  symbol_byte_size = std::min(
-  next_symbol_file_addr - symbol_file_addr,
-  section_end_file_addr - symbol_file_addr);
-} else {
-  symbol_byte_size = section_end_file_addr - symbol_file_addr;
-}
-  }
-}
 symbol_value -= section_file_addr;
   }
 
@@ -4501,9 +4459,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
   if (nlist.n_desc & N_WEAK_REF)
   

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -22,13 +22,14 @@ class ValueListImpl {
 public:
   ValueListImpl() = default;
 
-  ValueListImpl(const ValueListImpl &rhs) = default;
+  ValueListImpl(const ValueListImpl &rhs)

bulbazord wrote:

Actually you're right here, ValueListImpl is an implementation detail and 
shouldn't matter. This one is fine.

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


[Lldb-commits] [lldb] [lldb] Remove limit on max memory read size (PR #105765)

2024-08-30 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

@clayborg what do you think about removing the memory limit from memory read?  
I know this is code you originally wrote, and I might not be thinking of a way 
for someone to do a huge memory read unintentionally.  But it seems like this 
cap just gets in people's way more than anything else.

(I have complaints about our other safety limits like the 1024 byte c-string 
formatter cap which is really easy to hit with long strings, but those are more 
debatable ;)

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Alex Langford via lldb-commits


@@ -97,7 +97,7 @@ class LLDB_API SBError {
   friend class lldb_private::ScriptInterpreter;
   friend class lldb_private::python::SWIGBridge;
 
-  SBError(const lldb_private::Status &error);
+  SBError(lldb_private::Status &&error);

bulbazord wrote:

I have no concerns about Unix-ish platforms, but Windows may be a problem. I 
know that MSVC's mangling scheme includes access level 
(private/protected/public), which makes me think that private/protected symbols 
may be difficult to change while keeping ABI stable on MSVC.
Certainly SBAPI users and libraries shouldn't even be able to use this symbol, 
but I don't know if Windows will be unhappy that a private symbol changed.

@compnerd Do you have any insight here?

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


[Lldb-commits] [lldb] [LLDB] Fix implementing support for DW_FORM_data16 (PR #106799)

2024-08-30 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/106799

This FORM already has support within LLDB to be parsed as a 16-byte
BLOCK, and all that is left to properly support it in the DWARFParser is
to add it to some enums.

With this, I can debug programs that use libstdc++.so.6.0.33 built with
GCC.

Sadly, I haven't figured out a good way to test this.


>From 07ca931aac5fd6e777fbf57b9a838fa6e500160b Mon Sep 17 00:00:00 2001
From: Walter Erquinigo 
Date: Fri, 30 Aug 2024 21:14:43 +
Subject: [PATCH] [LLDB] Fix implementing support for DW_FORM_data16

This FORM already has support within LLDB to be parsed as a 16-byte
BLOCK, and all that is left to properly support it in the DWARFParser is
to add it to some enums.

With this, I can debug programs that use libstdc++.so.6.0.33 built with
GCC.

Sadly, I haven't figured out a good way to test this.
---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index e1f73f1997e369..e1fcbda469f16d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -306,6 +306,11 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
   *offset_ptr += 8;
   return true;
 
+// 16 byte values
+case DW_FORM_data16:
+  *offset_ptr += 16;
+  return true;
+
 // signed or unsigned LEB 128 values
 case DW_FORM_addrx:
 case DW_FORM_loclistx:
@@ -578,6 +583,7 @@ bool DWARFFormValue::IsBlockForm(const dw_form_t form) {
   case DW_FORM_block1:
   case DW_FORM_block2:
   case DW_FORM_block4:
+  case DW_FORM_data16:
 return true;
   default:
 return false;
@@ -611,6 +617,7 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) {
 case DW_FORM_data2:
 case DW_FORM_data4:
 case DW_FORM_data8:
+case DW_FORM_data16:
 case DW_FORM_string:
 case DW_FORM_block:
 case DW_FORM_block1:

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


[Lldb-commits] [lldb] [LLDB] Fix implementing support for DW_FORM_data16 (PR #106799)

2024-08-30 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Walter Erquinigo (walter-erquinigo)


Changes

This FORM already has support within LLDB to be parsed as a 16-byte
BLOCK, and all that is left to properly support it in the DWARFParser is
to add it to some enums.

With this, I can debug programs that use libstdc++.so.6.0.33 built with
GCC.

Sadly, I haven't figured out a good way to test this.


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


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+7) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index e1f73f1997e369..e1fcbda469f16d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -306,6 +306,11 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
   *offset_ptr += 8;
   return true;
 
+// 16 byte values
+case DW_FORM_data16:
+  *offset_ptr += 16;
+  return true;
+
 // signed or unsigned LEB 128 values
 case DW_FORM_addrx:
 case DW_FORM_loclistx:
@@ -578,6 +583,7 @@ bool DWARFFormValue::IsBlockForm(const dw_form_t form) {
   case DW_FORM_block1:
   case DW_FORM_block2:
   case DW_FORM_block4:
+  case DW_FORM_data16:
 return true;
   default:
 return false;
@@ -611,6 +617,7 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) {
 case DW_FORM_data2:
 case DW_FORM_data4:
 case DW_FORM_data8:
+case DW_FORM_data16:
 case DW_FORM_string:
 case DW_FORM_block:
 case DW_FORM_block1:

``




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


[Lldb-commits] [lldb] [LLDB] Finish implementing support for DW_FORM_data16 (PR #106799)

2024-08-30 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Med Ismail Bennani via lldb-commits


@@ -33,16 +33,16 @@ class RemoteAwarePlatformTester : public 
RemoteAwarePlatform {
   MOCK_METHOD0(CalculateTrapHandlerSymbolNames, void());
 
   MOCK_METHOD2(ResolveExecutable,
-   std::pair(const ModuleSpec &,
-   const FileSpecList *));
+   std::pair(const ModuleSpec &,
+ const FileSpecList *));
   Status
   ResolveExecutable(const ModuleSpec &module_spec,
 lldb::ModuleSP &exe_module_sp,
 const FileSpecList *module_search_paths_ptr) /*override*/
   { // NOLINT(modernize-use-override)
 auto pair = ResolveExecutable(module_spec, module_search_paths_ptr);
 exe_module_sp = pair.second;
-return pair.first;
+return pair.first ? Status() : Status::FromErrorString("error");

medismailben wrote:

```suggestion
return pair.first ? {} : Status::FromErrorString("error");
```

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


[Lldb-commits] [lldb] [lldb] Inline expression evaluator error visualization (PR #106470)

2024-08-30 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

Rebased on top of https://github.com/llvm/llvm-project/pull/106442!

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Med Ismail Bennani via lldb-commits


@@ -96,16 +128,49 @@ Status Status::FromErrorStringWithFormat(const char 
*format, ...) {
   return Status(string);
 }
 
-llvm::Error Status::ToError() const {
-  if (Success())
+Status Status::FromExpressionError(lldb::ExpressionResults result,
+   std::string msg) {
+  return Status(llvm::make_error(
+  std::error_code(result, expression_category()), msg));
+}
+
+/// Creates a deep copy of all known errors and converts all other
+/// errors to a new llvm::StringError.
+static llvm::Error cloneError(llvm::Error &error) {

medismailben wrote:

nit: why isn't this starting with a capital letter like the other methods 
(camelCase vs. PascalCase) ?

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Med Ismail Bennani via lldb-commits


@@ -27,15 +27,15 @@ TEST(StatusTest, Formatv) {
 }
 
 TEST(StatusTest, ErrorConstructor) {
-  EXPECT_TRUE(Status(llvm::Error::success()).Success());
+  EXPECT_TRUE(Status::FromError(llvm::Error::success()).Success());
 
-  Status eagain(
+  Status eagain = Status::FromError(
   llvm::errorCodeToError(std::error_code(EAGAIN, 
std::generic_category(;
   EXPECT_TRUE(eagain.Fail());
   EXPECT_EQ(eErrorTypePOSIX, eagain.GetType());
   EXPECT_EQ(Status::ValueType(EAGAIN), eagain.GetError());
 
-  Status foo(llvm::make_error(
+  Status foo = Status::FromError(llvm::make_error(
   "foo", llvm::inconvertibleErrorCode()));

medismailben wrote:

```suggestion
  Status foo = Status::FromError(createStringError("foo"));
```

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


[Lldb-commits] [lldb] [lldb] Store expression evaluator diagnostics in an llvm::Error (NFC) (PR #106442)

2024-08-30 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff a777a93118a0ca71e19ac764a57a94f1be227dbb 
854bd34a797fabe0f03234d23eb566eb10d4b593 --extensions h,cpp -- 
lldb/include/lldb/API/SBError.h lldb/include/lldb/API/SBValueList.h 
lldb/include/lldb/Core/ValueObjectConstResult.h 
lldb/include/lldb/Expression/DiagnosticManager.h 
lldb/include/lldb/Target/Process.h lldb/include/lldb/Utility/Status.h 
lldb/source/API/SBBreakpoint.cpp lldb/source/API/SBBreakpointLocation.cpp 
lldb/source/API/SBBreakpointName.cpp lldb/source/API/SBDebugger.cpp 
lldb/source/API/SBError.cpp lldb/source/API/SBFile.cpp 
lldb/source/API/SBFormat.cpp lldb/source/API/SBFrame.cpp 
lldb/source/API/SBPlatform.cpp lldb/source/API/SBProcess.cpp 
lldb/source/API/SBSaveCoreOptions.cpp lldb/source/API/SBStructuredData.cpp 
lldb/source/API/SBTarget.cpp lldb/source/API/SBThread.cpp 
lldb/source/API/SBValue.cpp lldb/source/API/SBValueList.cpp 
lldb/source/API/SBWatchpoint.cpp lldb/source/Breakpoint/BreakpointLocation.cpp 
lldb/source/Commands/CommandObjectCommands.cpp 
lldb/source/Commands/CommandObjectMemoryTag.cpp lldb/source/Core/Debugger.cpp 
lldb/source/Core/ModuleList.cpp lldb/source/Core/PluginManager.cpp 
lldb/source/Core/ThreadedCommunication.cpp lldb/source/Core/ValueObject.cpp 
lldb/source/Core/ValueObjectCast.cpp 
lldb/source/Core/ValueObjectConstResult.cpp 
lldb/source/Core/ValueObjectDynamicValue.cpp 
lldb/source/Core/ValueObjectSyntheticFilter.cpp 
lldb/source/DataFormatters/VectorType.cpp 
lldb/source/Expression/DiagnosticManager.cpp 
lldb/source/Expression/ExpressionParser.cpp 
lldb/source/Expression/FunctionCaller.cpp 
lldb/source/Expression/LLVMUserExpression.cpp 
lldb/source/Expression/Materializer.cpp 
lldb/source/Expression/UserExpression.cpp 
lldb/source/Expression/UtilityFunction.cpp 
lldb/source/Host/common/LockFileBase.cpp 
lldb/source/Host/common/NativeProcessProtocol.cpp 
lldb/source/Host/common/TCPSocket.cpp 
lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp 
lldb/source/Interpreter/CommandInterpreter.cpp 
lldb/source/Interpreter/OptionValueRegex.cpp 
lldb/source/Interpreter/ScriptInterpreter.cpp 
lldb/source/Plugins/ExpressionParser/Clang/ClangDiagnostic.h 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp 
lldb/source/Plugins/Platform/Android/AdbClient.cpp 
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp 
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
 lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp 
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp 
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp 
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp
 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
 lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
lldb/source/Target/ModuleCache.cpp lldb/source/Target/Platform.cpp 
lldb/source/Target/Process.cpp lldb/source/Target/StackFrame.cpp 
lldb/source/Target/Target.cpp lldb/source/Target/Thread.cpp 
lldb/source/Utility/Status.cpp lldb/source/Utility/StructuredData.cpp 
lldb/unittests/Expression/DiagnosticManagerTest.cpp 
lldb/unittests/Target/RemoteAwarePlatformTest.cpp 
lldb/unittests/TestingSupport/Host/NativeProcessTestUtils.h 
lldb/unittests/Utility/StatusTest.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Expression/DiagnosticManager.cpp 
b/lldb/source/Expression/DiagnosticManager.cpp
index 6ad589aa7f..10d2be4678 100644
--- a/lldb/source/Expression/DiagnosticManager.cpp
+++ b/lldb/source/Expression/DiagnosticManager.cpp
@@ -19,7 +19,6 @@ std::string DetailedExpressionError::message() const {
   return m_detail.rendered;
 }
 
-
 static const char *StringForSeverity(lldb::Severity severity) {
   switch (severity) {
   // this should be exhaustive
@@ -33,7 +32,6 @@ static const char *StringForSeverity(lldb:

[Lldb-commits] [clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] [polly] [NFC] Add explicit #include llvm-config.h where its macros are used. (PR #106810)

2024-08-30 Thread Daniil Fukalov via lldb-commits

https://github.com/dfukalov created 
https://github.com/llvm/llvm-project/pull/106810

This is the second part.

Without these explicit includes, removing other headers, who implicitly include 
llvm-config.h, may have non-trivial side effects. For example, `clagd` may 
report even `llvm-config.h` as "no used" in case it defines a macro, that is 
expicitly used with #ifdef. It is actually amplified with different build 
configs which use different set of macros.

>From 0221e97459534f0f7396e7970663e1a4f1f98cca Mon Sep 17 00:00:00 2001
From: dfukalov 
Date: Sat, 31 Aug 2024 01:45:27 +0200
Subject: [PATCH] [NFC] Add explicit #include llvm-config.h where its macros
 are used, part 2.

Without these explicit includes, removing other headers, who implicitly include 
llvm-config.h, may have non-trivial side effects.
For example, `clagd` may report even `llvm-config.h` as "no used" in case it 
defines a macro, that is expicitly used with #ifdef.
It is actually amplified with different build configs which use different set 
of macros.
---
 bolt/include/bolt/Core/BinaryBasicBlock.h | 1 +
 clang-tools-extra/clangd/Feature.cpp  | 1 +
 clang-tools-extra/clangd/unittests/ClangdTests.cpp| 1 +
 clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp   | 1 +
 clang-tools-extra/clangd/unittests/SerializationTests.cpp | 1 +
 clang/include/clang/Interpreter/Value.h   | 1 +
 clang/lib/Driver/ToolChains/Cuda.cpp  | 1 +
 clang/lib/Driver/ToolChains/MinGW.cpp | 1 +
 clang/lib/Driver/ToolChains/WebAssembly.cpp   | 1 +
 clang/lib/Frontend/FrontendActions.cpp| 1 +
 clang/tools/driver/driver.cpp | 2 ++
 clang/unittests/Driver/GCCVersionTest.cpp | 1 +
 lld/ELF/OutputSections.cpp| 2 +-
 lldb/source/API/SBDebugger.cpp| 1 +
 lldb/source/Host/common/Host.cpp  | 1 +
 .../Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 1 +
 .../Process/gdb-remote/GDBRemoteCommunicationClient.cpp   | 1 +
 lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp  | 1 +
 lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp  | 1 +
 lldb/unittests/Host/MainLoopTest.cpp  | 1 +
 llvm/include/llvm/Debuginfod/HTTPClient.h | 1 +
 llvm/include/llvm/Debuginfod/HTTPServer.h | 1 +
 llvm/include/llvm/Support/ErrorHandling.h | 1 +
 llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp| 1 +
 llvm/lib/Analysis/InlineAdvisor.cpp   | 1 +
 llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp | 1 +
 llvm/lib/Analysis/ModelUnderTrainingRunner.cpp| 1 +
 llvm/lib/Analysis/TFLiteUtils.cpp | 1 +
 llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp   | 1 +
 llvm/lib/CodeGen/MLRegAllocPriorityAdvisor.cpp| 1 +
 llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp  | 1 +
 llvm/lib/CodeGen/RegAllocPriorityAdvisor.cpp  | 1 +
 llvm/lib/DebugInfo/PDB/PDB.cpp| 1 +
 llvm/lib/Debuginfod/HTTPClient.cpp| 1 +
 llvm/lib/Debuginfod/HTTPServer.cpp| 1 +
 llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp  | 1 +
 llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp | 1 +
 llvm/lib/IR/Core.cpp  | 1 +
 llvm/lib/MC/SPIRVObjectWriter.cpp | 1 +
 llvm/lib/Support/CRC.cpp  | 1 +
 llvm/lib/Support/Compression.cpp  | 1 +
 llvm/lib/Support/Z3Solver.cpp | 1 +
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 1 +
 llvm/lib/TargetParser/Unix/Host.inc   | 1 +
 llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp| 1 +
 llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp| 1 +
 .../Analysis/InlineAdvisorPlugin/InlineAdvisorPlugin.cpp  | 4 ++--
 .../Analysis/InlineOrderPlugin/InlineOrderPlugin.cpp  | 4 ++--
 llvm/unittests/Analysis/PluginInlineAdvisorAnalysisTest.cpp   | 1 +
 llvm/unittests/Analysis/PluginInlineOrderAnalysisTest.cpp | 1 +
 llvm/unittests/Debuginfod/HTTPServerTests.cpp | 1 +
 llvm/unittests/Passes/Plugins/PluginsTest.cpp | 1 +
 llvm/unittests/Support/CompressionTest.cpp| 1 +
 llvm/unittests/TargetParser/Host.cpp  | 2 +-
 llvm/unittests/tools/llvm-profdata/OutputSizeLimitTest.cpp| 1 +
 mlir/include/mlir/Bytecode/BytecodeWriter.h   | 1 +
 mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp| 1 +
 mlir/unitt

[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Med Ismail Bennani via lldb-commits


@@ -133,36 +198,30 @@ static std::string RetrieveWin32ErrorString(uint32_t 
error_code) {
 }
 #endif
 
+std::string MachKernelError::message() const {
+#if defined(__APPLE__)
+  if (const char *s = ::mach_error_string(convertToErrorCode().value()))
+return s;
+#endif
+  return "MachKernelError";
+}
+
+std::string Win32Error::message() const {
+#if defined(_WIN32)
+  return RetrieveWin32ErrorString(convertToErrorCode().value());
+#endif
+  return "Win32Error";
+}
+
 // Get the error value as a NULL C string. The error string will be fetched and
 // cached on demand. The cached error string value will remain until the error
 // value is changed or cleared.
 const char *Status::AsCString(const char *default_error_str) const {
   if (Success())
 return nullptr;
 
-  if (m_string.empty()) {
-switch (m_type) {
-case eErrorTypeMachKernel:
-#if defined(__APPLE__)
-  if (const char *s = ::mach_error_string(m_code))
-m_string.assign(s);
-#endif
-  break;
-
-case eErrorTypePOSIX:
-  m_string = llvm::sys::StrError(m_code);
-  break;
+  m_string = llvm::toStringWithoutConsuming(m_error);

medismailben wrote:

TIL

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


[Lldb-commits] [lldb] [lldb] Inline expression evaluator error visualization (PR #106470)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -2076,7 +2077,11 @@ bool CommandInterpreter::HandleCommand(const char 
*command_line,
 }
 
 ElapsedTime elapsed(execute_time);
-cmd_obj->Execute(remainder.c_str(), result);
+size_t nchar = real_original_command_string.find(remainder);
+std::optional pos_in_cmd;
+if (nchar != std::string::npos)
+  pos_in_cmd = nchar + GetDebugger().GetPrompt().size();
+cmd_obj->Execute(remainder.c_str(), pos_in_cmd, result);

adrian-prantl wrote:

@jimingham @medismailben I hopefully have resolved both of your concerns by 
storing the original command string as a member in CommandObject. This way the 
`expr -i 0 -u 0 -- not a valid expression` works.
```
(lldb) expr -i 0 -u 0 -- not a valid expression
 ^
 ╰─ error: use of undeclared identifier 'not'
```

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Med Ismail Bennani via lldb-commits

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

This is great! LGTM with comments.

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


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-08-30 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add Status::Detail to store expression evaluator diagnostics [… (PR #106442)

2024-08-30 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

Rebased on top of https://github.com/llvm/llvm-project/pull/106774!

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


[Lldb-commits] [lldb] [lldb] Store expression evaluator diagnostics in an llvm::Error (NFC) (PR #106442)

2024-08-30 Thread Adrian Prantl via lldb-commits


@@ -130,13 +120,17 @@ class DiagnosticManager {
   m_diagnostics.back()->AppendMessage(str);
   }
 
-  // Returns a string containing errors in this format:
-  //
-  // "error: error text\n
-  // warning: warning text\n
-  // remark text\n"
+  /// Returns a string containing errors in this format:
+  ///
+  /// "error: error text\n
+  /// warning: warning text\n
+  /// remark text\n"
+  LLVM_DEPRECATED("Use GetAsStatus instead", "GetAsStatus()")

adrian-prantl wrote:

Done!

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