[Lldb-commits] [PATCH] D159504: [lldb][AArch64] Implement resizing of SME's ZA register

2023-09-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

This apparently requires a rebase now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159504/new/

https://reviews.llvm.org/D159504

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


[Lldb-commits] [PATCH] D159502: [lldb][AArch64] Add SME's Array Storage (ZA) register

2023-09-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:566
   TLS,
+  ZA,
+  // SME pseudo registers are read only.

ZA -> SME?



Comment at: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h:112
+
   uint32_t ConfigureVectorLength(uint32_t sve_vq);
 

ConfigureVectorLength -> ConfigureVectorLengthSVE?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159502/new/

https://reviews.llvm.org/D159502

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


[Lldb-commits] [lldb] [lldb] Format Python files in scripts and utils (PR #66053)

2023-09-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I'll be cheeky and assume this is fine to go in.

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


[Lldb-commits] [lldb] [lldb] Format Python files in scripts and utils (PR #66053)

2023-09-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [PATCH] D159502: [lldb][AArch64] Add SME's Array Storage (ZA) register

2023-09-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:597
+  // Here this means, does the system have ZA, not whether it is active.
+  if (GetRegisterInfo().IsZAEnabled()) {
+error = ReadZAHeader();

can you explain why in case of  ZA inactive shouldnt we fill the buffer with 
zeros here as well ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159502/new/

https://reviews.llvm.org/D159502

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


[Lldb-commits] [PATCH] D159502: [lldb][AArch64] Add SME's Array Storage (ZA) register

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:597
+  // Here this means, does the system have ZA, not whether it is active.
+  if (GetRegisterInfo().IsZAEnabled()) {
+error = ReadZAHeader();

omjavaid wrote:
> can you explain why in case of  ZA inactive shouldnt we fill the buffer with 
> zeros here as well ?
Start state: ZA is disabled, reading ptrace gives you just the header.

What we must do to restore that state is to write the header back with no 
register data. So that's why we don't insert 0s here or trust the currently 
cached za buffer.

Unlike SVE, there's no flag to say make this active. The presence of the 
register data is that flag.

...which I will put in a comment as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159502/new/

https://reviews.llvm.org/D159502

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


[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

ping! (in the interest of clearing Phabricator reviews soon)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

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

Running:
$ clang-format -i $(find -regex "\./lldb/.*\.c") $(find -regex 
"\./lldb/.*\.cpp") $(find -regex "\./lldb/.*\.h")

Resulted in:
 1602 files changed, 25090 insertions(+), 25849 deletions(-)
(note: this includes tests which we wouldn't format, just using this as an 
example)

The vast majority of which were whitespace changes. So as far as formatting 
we're not deviating from llvm for any reason other than not churning old code.

Formatting aside, the major features of lldb (single line if, early return) are 
all reflected in llvm's stype. We differ mainly on variable naming (proposed to 
change in https://llvm.org/docs/Proposals/VariableNames.html anyway) and use of 
asserts. Which was already documented.

>From ef69e33b2369e3357f63cf60eea18ead39466062 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Thu, 14 Sep 2023 10:05:44 +0100
Subject: [PATCH] [lldb][Docs] Document our major differences from the LLVM
 style

Running:
$ clang-format -i $(find -regex "\./lldb/.*\.c") $(find -regex 
"\./lldb/.*\.cpp") $(find -regex "\./lldb/.*\.h")

Resulted in:
 1602 files changed, 25090 insertions(+), 25849 deletions(-)
(note: this includes tests which we wouldn't format, just
using this as an example)

The vast majority of which were whitespace changes. So as far
as formatting we're not deviating from llvm for any reason
other than not churning old code.

Formatting aside, the major features of lldb (single line if,
early return) are all reflected in llvm's stype. We differ mainly
on variable naming (proposed to change in 
https://llvm.org/docs/Proposals/VariableNames.html
anyway) and use of asserts. Which was already documented.
---
 lldb/docs/resources/contributing.rst | 39 +---
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/lldb/docs/resources/contributing.rst 
b/lldb/docs/resources/contributing.rst
index 54917f1ce8175b3..9b133706a7fd160 100644
--- a/lldb/docs/resources/contributing.rst
+++ b/lldb/docs/resources/contributing.rst
@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
`_:
+  See the :ref:`section below`.
+
+For any other contradications please follow the existing code's style.
+
+Code in LLDB does aim to conform to clang-format but older code may not yet. As
+always, consider the `golden rule 
`_
+when working with such code. Reformatting before starting work is one possible
+option.
+
+Test Infrastructure

+
+Like LLVM it is  important to submit tests with your patches, but note that 
LLDB
+uses a different system for tests. Refer to the `test documentation 
`_
+for more details and the `lldb/test 
`_
+folder for examples.
+
+.. _Error handling:
 
 Error handling and use of assertions in LLDB
 

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb


Changes
Running:
$ clang-format -i $(find -regex "\./lldb/.*\.c") $(find -regex 
"\./lldb/.*\.cpp") $(find -regex "\./lldb/.*\.h")

Resulted in:
 1602 files changed, 25090 insertions(+), 25849 deletions(-)
(note: this includes tests which we wouldn't format, just using this as an 
example)

The vast majority of which were whitespace changes. So as far as formatting 
we're not deviating from llvm for any reason other than not churning old code.

Formatting aside, the major features of lldb (single line if, early return) are 
all reflected in llvm's stype. We differ mainly on variable naming (proposed to 
change in https://llvm.org/docs/Proposals/VariableNames.html anyway) and use of 
asserts. Which was already documented.
--
Full diff: https://github.com/llvm/llvm-project/pull/66345.diff

1 Files Affected:

- (modified) lldb/docs/resources/contributing.rst (+29-10) 



diff --git a/lldb/docs/resources/contributing.rst 
b/lldb/docs/resources/contributing.rst
index 54917f1ce8175b3..9b133706a7fd160 100644
--- a/lldb/docs/resources/contributing.rst
+++ b/lldb/docs/resources/contributing.rst
@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation <test.html>`_ for more details and the 
``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style 
<https://llvm.org/docs/CodingStandards.html>`_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
<https://llvm.org/docs/CodingStandards.html>`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
<https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly>`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
<https://llvm.org/docs/CodingStandards.html#assert-liberally>`_:
+  See the :ref:`section below<Error Handling>`.
+
+For any other contradications please follow the existing code's style.
+
+Code in LLDB does aim to conform to clang-format but older code may not yet. As
+always, consider the `golden rule 
<https://llvm.org/docs/CodingStandards.html#introduction>`_
+when working with such code. Reformatting before starting work is one possible
+option.
+
+Test Infrastructure

+
+Like LLVM it is  important to submit tests with your patches, but note that 
LLDB
+uses a different system for tests. Refer to the `test documentation 
<test.html>`_
+for more details and the `lldb/test 
<https://github.com/llvm/llvm-project/tree/main/lldb/test>`_
+folder for examples.
+
+.. _Error handling:
 
 Error handling and use of assertions in LLDB
 




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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

@bulbazord This would be a good place to put your plugin dependency / const 
string guidance. Or tell me where it lives now and I'll link to it.

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

If anyone knows the other big differences I'll add them. This is what I came up 
with from my experience and reading the lllvm style doc.

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


[Lldb-commits] [PATCH] D159502: [lldb][AArch64] Add SME's Array Storage (ZA) register

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556752.
DavidSpickett added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159502/new/

https://reviews.llvm.org/D159502

Files:
  lldb/include/lldb/Utility/RegisterValue.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/LinuxPTraceDefines_arm64sve.h
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
  lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
  lldb/source/Plugins/Process/elf-core/RegisterUtilities.h

Index: lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
===
--- lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
+++ lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -119,6 +119,10 @@
 {llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_SVE},
 };
 
+constexpr RegsetDesc AARCH64_ZA_Desc[] = {
+{llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_ZA},
+};
+
 constexpr RegsetDesc AARCH64_PAC_Desc[] = {
 {llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_PAC_MASK},
 };
Index: lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
===
--- lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -113,7 +113,7 @@
 m_sve_state = SVEState::Disabled;
 
   if (m_sve_state != SVEState::Disabled)
-m_register_info_up->ConfigureVectorLength(
+m_register_info_up->ConfigureVectorLengthSVE(
 sve::vq_from_vl(m_sve_vector_length));
 }
 
Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
===
--- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
@@ -30,6 +30,7 @@
 eRegsetMaskPAuth = 4,
 eRegsetMaskMTE = 8,
 eRegsetMaskTLS = 16,
+eRegsetMaskZA = 32,
 eRegsetMaskDynamic = ~1,
   };
 
@@ -106,7 +107,11 @@
 
   void AddRegSetTLS(bool has_tpidr2);
 
-  uint32_t ConfigureVectorLength(uint32_t sve_vq);
+  void AddRegSetSME();
+
+  uint32_t ConfigureVectorLengthSVE(uint32_t sve_vq);
+
+  void ConfigureVectorLengthZA(uint32_t za_vq);
 
   bool VectorSizeIsValid(uint32_t vq) {
 // coverity[unsigned_compare]
@@ -117,6 +122,7 @@
 
   bool IsSVEEnabled() const { return m_opt_regsets.AnySet(eRegsetMaskSVE); }
   bool IsSSVEEnabled() const { return m_opt_regsets.AnySet(eRegsetMaskSSVE); }
+  bool IsZAEnabled() const { return m_opt_regsets.AnySet(eRegsetMaskZA); }
   bool IsPAuthEnabled() const { return m_opt_regsets.AnySet(eRegsetMaskPAuth); }
   bool IsMTEEnabled() const { return m_opt_regsets.AnySet(eRegsetMaskMTE); }
   bool IsTLSEnabled() const { return m_opt_regsets.AnySet(eRegsetMaskTLS); }
@@ -128,6 +134,7 @@
   bool IsPAuthReg(unsigned reg) const;
   bool IsMTEReg(unsigned reg) const;
   bool IsTLSReg(unsigned reg) const;
+  bool IsSMEReg(unsigned reg) const;
 
   uint32_t GetRegNumSVEZ0() const;
   uint32_t GetRegNumSVEFFR() const;
@@ -137,6 +144,7 @@
   uint32_t GetPAuthOffset() const;
   uint32_t GetMTEOffset() const;
   uint32_t GetTLSOffset() const;
+  uint32_t GetSMEOffset() const;
 
 private:
   typedef std::map>
@@ -145,7 +153,10 @@
   per_vq_register_infos m_per_vq_reg_infos;
 
   uint32_t m_vector_reg_vq = eVectorQuadwordAArch64;
+  uint32_t m_za_reg_vq = eVectorQuadwordAArch64;
 
+  // In normal operation this is const. Only when SVE or SME registers change
+  // size is it either replaced or the content modified.
   const lldb_private::RegisterInfo *m_register_info_p;
   uint32_t m_register_info_count;
 
@@ -164,6 +175,7 @@
   std::vector pauth_regnum_collection;
   std::vector m_mte_regnum_collection;
   std::vector m_tls_regnum_collection;
+  std::vector m_sme_regnum_collection;
 };
 
 #endif
Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
===
--- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -83,6 +83,11 @@
 // Only present when SME is present
 DEFINE_EXTENSION_REG(tpidr2)};
 
+static lldb_private::RegisterInfo g_register_infos_sme[] =
+// 16 is a default size we will change later.
+{{"za", nullptr, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8,
+  KIND_ALL_INVALID, nullptr, nullptr, nullptr}};
+
 // Number of regis

[Lldb-commits] [PATCH] D159502: [lldb][AArch64] Add SME's Array Storage (ZA) register

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett marked 3 inline comments as done.
DavidSpickett added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp:597
+  // Here this means, does the system have ZA, not whether it is active.
+  if (GetRegisterInfo().IsZAEnabled()) {
+error = ReadZAHeader();

DavidSpickett wrote:
> omjavaid wrote:
> > can you explain why in case of  ZA inactive shouldnt we fill the buffer 
> > with zeros here as well ?
> Start state: ZA is disabled, reading ptrace gives you just the header.
> 
> What we must do to restore that state is to write the header back with no 
> register data. So that's why we don't insert 0s here or trust the currently 
> cached za buffer.
> 
> Unlike SVE, there's no flag to say make this active. The presence of the 
> register data is that flag.
> 
> ...which I will put in a comment as well.
Comment is a bit below this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159502/new/

https://reviews.llvm.org/D159502

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


[Lldb-commits] [PATCH] D159503: [lldb][AArch64] Add SME streaming vector length pseduo register

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556753.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159503/new/

https://reviews.llvm.org/D159503

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h

Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
===
--- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
@@ -135,12 +135,14 @@
   bool IsMTEReg(unsigned reg) const;
   bool IsTLSReg(unsigned reg) const;
   bool IsSMEReg(unsigned reg) const;
+  bool IsSMERegZA(unsigned reg) const;
 
   uint32_t GetRegNumSVEZ0() const;
   uint32_t GetRegNumSVEFFR() const;
   uint32_t GetRegNumFPCR() const;
   uint32_t GetRegNumFPSR() const;
   uint32_t GetRegNumSVEVG() const;
+  uint32_t GetRegNumSMESVG() const;
   uint32_t GetPAuthOffset() const;
   uint32_t GetMTEOffset() const;
   uint32_t GetTLSOffset() const;
Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
===
--- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -83,10 +83,11 @@
 // Only present when SME is present
 DEFINE_EXTENSION_REG(tpidr2)};
 
-static lldb_private::RegisterInfo g_register_infos_sme[] =
+static lldb_private::RegisterInfo g_register_infos_sme[] = {
+DEFINE_EXTENSION_REG(svg),
 // 16 is a default size we will change later.
-{{"za", nullptr, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8,
-  KIND_ALL_INVALID, nullptr, nullptr, nullptr}};
+{"za", nullptr, 16, 0, lldb::eEncodingVector, lldb::eFormatVectorOfUInt8,
+ KIND_ALL_INVALID, nullptr, nullptr, nullptr}};
 
 // Number of register sets provided by this context.
 enum {
@@ -96,7 +97,7 @@
   k_num_mte_register = 1,
   // Number of TLS registers is dynamic so it is not listed here.
   k_num_pauth_register = 2,
-  k_num_sme_register = 1,
+  k_num_sme_register = 2,
   k_num_register_sets_default = 2,
   k_num_register_sets = 3
 };
@@ -448,7 +449,7 @@
   // dynamic set and is just 1 register so we make an exception to const here.
   lldb_private::RegisterInfo *non_const_reginfo =
   const_cast(m_register_info_p);
-  non_const_reginfo[m_sme_regnum_collection[0]].byte_size =
+  non_const_reginfo[m_sme_regnum_collection[1]].byte_size =
   (za_vq * 16) * (za_vq * 16);
 }
 
@@ -471,6 +472,10 @@
   return sve_vg == reg;
 }
 
+bool RegisterInfoPOSIX_arm64::IsSMERegZA(unsigned reg) const {
+  return reg == m_sme_regnum_collection[1];
+}
+
 bool RegisterInfoPOSIX_arm64::IsPAuthReg(unsigned reg) const {
   return llvm::is_contained(pauth_regnum_collection, reg);
 }
@@ -497,6 +502,10 @@
 
 uint32_t RegisterInfoPOSIX_arm64::GetRegNumSVEVG() const { return sve_vg; }
 
+uint32_t RegisterInfoPOSIX_arm64::GetRegNumSMESVG() const {
+  return m_sme_regnum_collection[0];
+}
+
 uint32_t RegisterInfoPOSIX_arm64::GetPAuthOffset() const {
   return m_register_info_p[pauth_regnum_collection[0]].byte_offset;
 }
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -114,6 +114,12 @@
 
   uint64_t m_mte_ctrl_reg;
 
+  struct sme_regs {
+uint64_t svg_reg;
+  };
+
+  struct sme_regs m_sme_regs;
+
   struct tls_regs {
 uint64_t tpidr_reg;
 // Only valid when SME is present.
@@ -144,6 +150,8 @@
 
   Status WriteTLS();
 
+  Status ReadSMESVG();
+
   Status ReadZAHeader();
 
   Status ReadZA();
@@ -176,6 +184,8 @@
 
   void *GetTLSBuffer() { return &m_tls_regs; }
 
+  void *GetSMEBuffer() { return &m_sme_regs; }
+
   void *GetSVEBuffer() { return m_sve_ptrace_payload.data(); }
 
   size_t GetSVEHeaderSize() { return sizeof(m_sve_header); }
@@ -194,6 +204,8 @@
 
   size_t GetTLSBufferSize() { return m_tls_size; }
 
+  size_t GetSMEBufferSize() { return sizeof(m_sme_regs); }
+
   llvm::Error ReadHardwareDebugInfo() override;
 
   llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -147,6 +147,7 @@
   ::memset(&m_sve_header, 0, sizeof(m_sve_header));
   ::memset(&m_pac_mask, 0, sizeof(m_pac_mask));
   ::me

[Lldb-commits] [PATCH] D159504: [lldb][AArch64] Implement resizing of SME's ZA register

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556754.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159504/new/

https://reviews.llvm.org/D159504

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Target/DynamicRegisterInfo.cpp

Index: lldb/source/Target/DynamicRegisterInfo.cpp
===
--- lldb/source/Target/DynamicRegisterInfo.cpp
+++ lldb/source/Target/DynamicRegisterInfo.cpp
@@ -614,10 +614,11 @@
   ConfigureOffsets();
 
   // Check if register info is reconfigurable
-  // AArch64 SVE register set has configurable register sizes
+  // AArch64 SVE register set has configurable register sizes, as does the ZA
+  // register that SME added (the streaming state of SME reuses the SVE state).
   if (arch.GetTriple().isAArch64()) {
 for (const auto ® : m_regs) {
-  if (strcmp(reg.name, "vg") == 0) {
+  if ((strcmp(reg.name, "vg") == 0) || (strcmp(reg.name, "svg") == 0)) {
 m_is_reconfigurable = true;
 break;
   }
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1660,17 +1660,19 @@
 gdb_thread->PrivateSetRegisterValue(lldb_regnum, buffer_sp->GetData());
   }
 
-  // AArch64 SVE specific code below calls AArch64SVEReconfigure to update
-  // SVE register sizes and offsets if value of VG register has changed
-  // since last stop.
+  // AArch64 SVE/SME specific code below updates SVE and ZA register sizes and
+  // offsets if value of VG or SVG registers has changed since last stop.
   const ArchSpec &arch = GetTarget().GetArchitecture();
   if (arch.IsValid() && arch.GetTriple().isAArch64()) {
 GDBRemoteRegisterContext *reg_ctx_sp =
 static_cast(
 gdb_thread->GetRegisterContext().get());
 
-if (reg_ctx_sp)
+if (reg_ctx_sp) {
   reg_ctx_sp->AArch64SVEReconfigure();
+  reg_ctx_sp->AArch64SMEReconfigure();
+  reg_ctx_sp->InvalidateAllRegisters();
+}
   }
 
   thread_sp->SetName(thread_name.empty() ? nullptr : thread_name.c_str());
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
@@ -39,6 +39,7 @@
   ~GDBRemoteDynamicRegisterInfo() override = default;
 
   void UpdateARM64SVERegistersInfos(uint64_t vg);
+  void UpdateARM64SMERegistersInfos(uint64_t svg);
 };
 
 class GDBRemoteRegisterContext : public RegisterContext {
@@ -77,7 +78,9 @@
   uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
uint32_t num) override;
 
-  bool AArch64SVEReconfigure();
+  void AArch64SVEReconfigure();
+
+  void AArch64SMEReconfigure();
 
 protected:
   friend class ThreadGDBRemote;
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -373,14 +373,14 @@
   if (dst == nullptr)
 return false;
 
-  // Code below is specific to AArch64 target in SVE state
+  // Code below is specific to AArch64 target in SVE or SME state
   // If vector granule (vg) register is being written then thread's
   // register context reconfiguration is triggered on success.
-  bool do_reconfigure_arm64_sve = false;
+  // We do not allow writes to SVG so it is not mentioned here.
   const ArchSpec &arch = process->GetTarget().GetArchitecture();
-  if (arch.IsValid() && arch.GetTriple().isAArch64())
-if (strcmp(reg_info->name, "vg") == 0)
-  do_reconfigure_arm64_sve = true;
+  bool do_reconfigure_arm64_sve = arch.IsValid() &&
+  arch.GetTriple().isAArch64() &&
+  (strcmp(reg_info->name, "vg") == 0);
 
   if (data.CopyByteOrderedData(data_offset,// src offset
reg_info->byte_size,// src length
@@ -400,10 +400,12 @@
 {m_reg_data.GetDataStart(), size_t(m_reg_data.GetByteSize())}))
 
 {
-  SetAllRegisterValid(false);
-
-  if (do_reconfigure_arm64_sve)
+  if (do_reconfigure_arm64_sve) {
 AArch64SVEReconfigure();
+AArch64SMEReconfigure();
+  }
+
+  InvalidateAllRegisters();
 
   return true;
 }
@@ -435,8 +437,11

[Lldb-commits] [PATCH] D159505: [lldb][AArch64] Add testing for SME's ZA and SVG registers

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556755.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159505/new/

https://reviews.llvm.org/D159505

Files:
  
lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/TestSVEThreadedDynamic.py
  
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/Makefile
  
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
  
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/main.c
  
lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/Makefile
  
lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/TestZARegisterSaveRestore.py
  
lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/main.c

Index: lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/main.c
===
--- /dev/null
+++ lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/main.c
@@ -0,0 +1,226 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// Important details for this program:
+// * Making a syscall will disable streaming mode if it is active.
+// * Changing the vector length will make streaming mode and ZA inactive.
+// * ZA can be active independent of streaming mode.
+// * ZA's size is the streaming vector length squared.
+
+#ifndef PR_SME_SET_VL
+#define PR_SME_SET_VL 63
+#endif
+
+#ifndef PR_SME_GET_VL
+#define PR_SME_GET_VL 64
+#endif
+
+#ifndef PR_SME_VL_LEN_MASK
+#define PR_SME_VL_LEN_MASK 0x
+#endif
+
+#define SM_INST(c) asm volatile("msr s0_3_c4_c" #c "_3, xzr")
+#define SMSTART SM_INST(7)
+#define SMSTART_SM SM_INST(3)
+#define SMSTART_ZA SM_INST(5)
+#define SMSTOP SM_INST(6)
+#define SMSTOP_SM SM_INST(2)
+#define SMSTOP_ZA SM_INST(4)
+
+int start_vl = 0;
+int other_vl = 0;
+
+void write_sve_regs() {
+  // We assume the smefa64 feature is present, which allows ffr access
+  // in streaming mode.
+  asm volatile("setffr\n\t");
+  asm volatile("ptrue p0.b\n\t");
+  asm volatile("ptrue p1.h\n\t");
+  asm volatile("ptrue p2.s\n\t");
+  asm volatile("ptrue p3.d\n\t");
+  asm volatile("pfalse p4.b\n\t");
+  asm volatile("ptrue p5.b\n\t");
+  asm volatile("ptrue p6.h\n\t");
+  asm volatile("ptrue p7.s\n\t");
+  asm volatile("ptrue p8.d\n\t");
+  asm volatile("pfalse p9.b\n\t");
+  asm volatile("ptrue p10.b\n\t");
+  asm volatile("ptrue p11.h\n\t");
+  asm volatile("ptrue p12.s\n\t");
+  asm volatile("ptrue p13.d\n\t");
+  asm volatile("pfalse p14.b\n\t");
+  asm volatile("ptrue p15.b\n\t");
+
+  asm volatile("cpy  z0.b, p0/z, #1\n\t");
+  asm volatile("cpy  z1.b, p5/z, #2\n\t");
+  asm volatile("cpy  z2.b, p10/z, #3\n\t");
+  asm volatile("cpy  z3.b, p15/z, #4\n\t");
+  asm volatile("cpy  z4.b, p0/z, #5\n\t");
+  asm volatile("cpy  z5.b, p5/z, #6\n\t");
+  asm volatile("cpy  z6.b, p10/z, #7\n\t");
+  asm volatile("cpy  z7.b, p15/z, #8\n\t");
+  asm volatile("cpy  z8.b, p0/z, #9\n\t");
+  asm volatile("cpy  z9.b, p5/z, #10\n\t");
+  asm volatile("cpy  z10.b, p10/z, #11\n\t");
+  asm volatile("cpy  z11.b, p15/z, #12\n\t");
+  asm volatile("cpy  z12.b, p0/z, #13\n\t");
+  asm volatile("cpy  z13.b, p5/z, #14\n\t");
+  asm volatile("cpy  z14.b, p10/z, #15\n\t");
+  asm volatile("cpy  z15.b, p15/z, #16\n\t");
+  asm volatile("cpy  z16.b, p0/z, #17\n\t");
+  asm volatile("cpy  z17.b, p5/z, #18\n\t");
+  asm volatile("cpy  z18.b, p10/z, #19\n\t");
+  asm volatile("cpy  z19.b, p15/z, #20\n\t");
+  asm volatile("cpy  z20.b, p0/z, #21\n\t");
+  asm volatile("cpy  z21.b, p5/z, #22\n\t");
+  asm volatile("cpy  z22.b, p10/z, #23\n\t");
+  asm volatile("cpy  z23.b, p15/z, #24\n\t");
+  asm volatile("cpy  z24.b, p0/z, #25\n\t");
+  asm volatile("cpy  z25.b, p5/z, #26\n\t");
+  asm volatile("cpy  z26.b, p10/z, #27\n\t");
+  asm volatile("cpy  z27.b, p15/z, #28\n\t");
+  asm volatile("cpy  z28.b, p0/z, #29\n\t");
+  asm volatile("cpy  z29.b, p5/z, #30\n\t");
+  asm volatile("cpy  z30.b, p10/z, #31\n\t");
+  asm volatile("cpy  z31.b, p15/z, #32\n\t");
+}
+
+// Write something different so we will know if we didn't restore them
+// correctly.
+void write_sve_regs_expr() {
+  asm volatile("pfalse p0.b\n\t");
+  asm volatile("wrffr p0.b\n\t");
+  asm volatile("pfalse p1.b\n\t");
+  asm volatile("pfalse p2.b\n\t");
+  asm volatile("pfalse p3.b\n\t");
+  asm volatile("ptrue p4.b\n\t");
+  asm volatile("pfalse p5.b\n\t");
+  asm volatile("pfalse p6.b\n\t");
+  asm volatile("pfalse p7.b\n\t");
+  asm volatile("pfalse p8.b\n\t");
+  asm volatile("ptrue p9.b\n\t");
+  asm volatile("pfalse p10.b\n\t");
+  asm volatile("pfalse p11.b\n\t");
+  asm volatile("pfalse p12.b\n\t");
+  asm volatile("pfalse p13.b\n\t");
+  asm volatile

[Lldb-commits] [PATCH] D154927: [lldb][AArch64] Add SME's streaming vector control register

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556756.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154927/new/

https://reviews.llvm.org/D154927

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  
lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c
  
lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/TestZARegisterSaveRestore.py

Index: lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/TestZARegisterSaveRestore.py
===
--- lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/TestZARegisterSaveRestore.py
+++ lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/TestZARegisterSaveRestore.py
@@ -164,6 +164,10 @@
 self.runCmd("register read " + sve_reg_names)
 sve_values = self.res.GetOutput()
 
+svcr_value = 1 if sve_mode == Mode.SSVE else 0
+if za_state == ZA.Enabled:
+svcr_value += 2
+
 def check_regs():
 if za_state == ZA.Enabled:
 self.check_za(start_vl)
@@ -175,6 +179,7 @@
 self.assertEqual(start_vg, self.read_vg())
 
 self.expect("register read " + sve_reg_names, substrs=[sve_values])
+self.expect("register read svcr", substrs=["0x{:016x}".format(svcr_value)])
 
 for expr in exprs:
 expr_cmd = "expression {}()".format(expr)
Index: lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c
===
--- lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c
@@ -5,7 +5,7 @@
 #define PR_SME_SET_VL 63
 #endif
 
-#define SMSTART() asm volatile("msr  s0_3_c4_c7_3, xzr" /*smstart*/)
+#define SMSTART_SM() asm volatile("msr  s0_3_c4_c3_3, xzr" /*smstart sm*/)
 
 void write_sve_regs() {
   // We assume the smefa64 feature is present, which allows ffr access
@@ -126,18 +126,18 @@
   // Note that doing a syscall brings you back to non-streaming mode, so we
   // don't need to SMSTOP here.
   if (streaming)
-SMSTART();
+SMSTART_SM();
   write_sve_regs_expr();
   prctl(SET_VL_OPT, 8 * 4);
   if (streaming)
-SMSTART();
+SMSTART_SM();
   write_sve_regs_expr();
   return 1;
 }
 
 int main() {
 #ifdef START_SSVE
-  SMSTART();
+  SMSTART_SM();
 #endif
   write_sve_regs();
 
Index: lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
===
--- lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
@@ -24,7 +24,15 @@
 reg_value.GetByteSize(), expected, 'Verify "%s" == %i' % (name, expected)
 )
 
-def check_sve_regs_read(self, z_reg_size):
+def check_sve_regs_read(self, z_reg_size, expected_mode):
+if self.isAArch64SME():
+# This test uses SMSTART SM, which only enables streaming mode,
+# leaving ZA disabled.
+expected_value = "1" if expected_mode == Mode.SSVE else "0"
+self.expect(
+"register read svcr", substrs=["0x000" + expected_value]
+)
+
 p_reg_size = int(z_reg_size / 8)
 
 for i in range(32):
@@ -168,7 +176,7 @@
 
 vg_reg_value = sve_registers.GetChildMemberWithName("vg").GetValueAsUnsigned()
 z_reg_size = vg_reg_value * 8
-self.check_sve_regs_read(z_reg_size)
+self.check_sve_regs_read(z_reg_size, start_mode)
 
 # Evaluate simple expression and print function expr_eval_func address.
 self.expect("expression expr_eval_func", substrs=["= 0x"])
@@ -184,7 +192,7 @@
 
 # We called a jitted function above which must not have changed SVE
 # vector length or register values.
-self.check_sve_regs_read(z_reg_size)
+self.check_sve_regs_read(z_reg_size, start_mode)
 
 self.check_sve_regs_read_after_write(z_reg_size)
 
Index: lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
===
--- lldb/test/API/comma

[Lldb-commits] [PATCH] D158500: [lldb][AArch64] Linux corefile support for SME

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556757.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158500/new/

https://reviews.llvm.org/D158500

Files:
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
  lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
  lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
  lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
  lldb/test/API/linux/aarch64/sme_core_file/TestAArch64LinuxSMECoreFile.py
  lldb/test/API/linux/aarch64/sme_core_file/core_0_16_32_1
  lldb/test/API/linux/aarch64/sme_core_file/core_0_32_16_0
  lldb/test/API/linux/aarch64/sme_core_file/core_1_16_32_0
  lldb/test/API/linux/aarch64/sme_core_file/core_1_32_16_1
  lldb/test/API/linux/aarch64/sme_core_file/main.c

Index: lldb/test/API/linux/aarch64/sme_core_file/main.c
===
--- /dev/null
+++ lldb/test/API/linux/aarch64/sme_core_file/main.c
@@ -0,0 +1,140 @@
+// clang-format off
+// Compile with:
+// clang -target aarch64-unknown-linux-gnu main.c -o a.out -g -march=armv8.6-a+sve+sme
+//
+// For minimal corefile size, do this before running the program:
+// echo 0x20 > /proc/self/coredeump_filter
+//
+// Must be run on a system that has SVE and SME, including the smefa64
+// extension. Example command:
+// main 0 32 64 1
+//
+// This would not enter streaming mode, set non-streaming VL to 32
+// bytes, streaming VL to 64 bytes and enable ZA.
+// clang-format on
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifndef PR_SME_SET_VL
+#define PR_SME_SET_VL 63
+#endif
+
+#define SM_INST(c) asm volatile("msr s0_3_c4_c" #c "_3, xzr")
+#define SMSTART_SM SM_INST(3)
+#define SMSTART_ZA SM_INST(5)
+
+void set_sve_registers() {
+  // We assume the smefa64 feature is present, which allows ffr access
+  // in streaming mode.
+  asm volatile("setffr\n\t");
+  asm volatile("ptrue p0.b\n\t");
+  asm volatile("ptrue p1.h\n\t");
+  asm volatile("ptrue p2.s\n\t");
+  asm volatile("ptrue p3.d\n\t");
+  asm volatile("pfalse p4.b\n\t");
+  asm volatile("ptrue p5.b\n\t");
+  asm volatile("ptrue p6.h\n\t");
+  asm volatile("ptrue p7.s\n\t");
+  asm volatile("ptrue p8.d\n\t");
+  asm volatile("pfalse p9.b\n\t");
+  asm volatile("ptrue p10.b\n\t");
+  asm volatile("ptrue p11.h\n\t");
+  asm volatile("ptrue p12.s\n\t");
+  asm volatile("ptrue p13.d\n\t");
+  asm volatile("pfalse p14.b\n\t");
+  asm volatile("ptrue p15.b\n\t");
+
+  asm volatile("cpy  z0.b, p0/z, #1\n\t");
+  asm volatile("cpy  z1.b, p5/z, #2\n\t");
+  asm volatile("cpy  z2.b, p10/z, #3\n\t");
+  asm volatile("cpy  z3.b, p15/z, #4\n\t");
+  asm volatile("cpy  z4.b, p0/z, #5\n\t");
+  asm volatile("cpy  z5.b, p5/z, #6\n\t");
+  asm volatile("cpy  z6.b, p10/z, #7\n\t");
+  asm volatile("cpy  z7.b, p15/z, #8\n\t");
+  asm volatile("cpy  z8.b, p0/z, #9\n\t");
+  asm volatile("cpy  z9.b, p5/z, #10\n\t");
+  asm volatile("cpy  z10.b, p10/z, #11\n\t");
+  asm volatile("cpy  z11.b, p15/z, #12\n\t");
+  asm volatile("cpy  z12.b, p0/z, #13\n\t");
+  asm volatile("cpy  z13.b, p5/z, #14\n\t");
+  asm volatile("cpy  z14.b, p10/z, #15\n\t");
+  asm volatile("cpy  z15.b, p15/z, #16\n\t");
+  asm volatile("cpy  z16.b, p0/z, #17\n\t");
+  asm volatile("cpy  z17.b, p5/z, #18\n\t");
+  asm volatile("cpy  z18.b, p10/z, #19\n\t");
+  asm volatile("cpy  z19.b, p15/z, #20\n\t");
+  asm volatile("cpy  z20.b, p0/z, #21\n\t");
+  asm volatile("cpy  z21.b, p5/z, #22\n\t");
+  asm volatile("cpy  z22.b, p10/z, #23\n\t");
+  asm volatile("cpy  z23.b, p15/z, #24\n\t");
+  asm volatile("cpy  z24.b, p0/z, #25\n\t");
+  asm volatile("cpy  z25.b, p5/z, #26\n\t");
+  asm volatile("cpy  z26.b, p10/z, #27\n\t");
+  asm volatile("cpy  z27.b, p15/z, #28\n\t");
+  asm volatile("cpy  z28.b, p0/z, #29\n\t");
+  asm volatile("cpy  z29.b, p5/z, #30\n\t");
+  asm volatile("cpy  z30.b, p10/z, #31\n\t");
+  asm volatile("cpy  z31.b, p15/z, #32\n\t");
+}
+
+void set_za_register(int streaming_vl) {
+#define MAX_VL_BYTES 256
+  uint8_t data[MAX_VL_BYTES];
+
+  for (unsigned i = 0; i < streaming_vl; ++i) {
+for (unsigned j = 0; j < MAX_VL_BYTES; ++j)
+  data[j] = i + 1;
+asm volatile("mov w12, %w0\n\t"
+ "ldr za[w12, 0], [%1]\n\t" ::"r"(i),
+ "r"(&data)
+ : "w12");
+  }
+}
+
+void set_tpidr2(uint64_t value) {
+  __asm__ volatile("msr S3_3_C13_C0_5, %0" ::"r"(value));
+}
+
+int main(int argc, char **argv) {
+  // Arguments:
+  //  SVE mode: 1 for streaming SVE (SSVE), any other value
+  //  for non-streaming SVE mode.
+  //   Non-Streaming Vector length: In bytes, an integer e.g. "32".
+  //   Streaming Vector length: As above, but for streaming mode.
+  //   ZA mode: 1 for enabled, any other value for disabled.
+  if (argc != 5)
+return 1;
+
+  // We assume this is run on 

[Lldb-commits] [PATCH] D158506: [lldb][AArch64] Add release notes and documentation for SME

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556758.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158506/new/

https://reviews.llvm.org/D158506

Files:
  lldb/docs/index.rst
  lldb/docs/use/aarch64-linux.rst
  llvm/docs/ReleaseNotes.rst

Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -183,6 +183,10 @@
 * Methods in SBHostOS related to threads have had their implementations
   removed. These methods will return a value indicating failure.
 
+* LLDB now supports debugging the Scalable Matrix Extension (SME) on AArch64
+  Linux for both running processes and core files. For details refer to the
+  `AArch64 Linux documentation `_.
+
 Changes to Sanitizers
 -
 * HWASan now defaults to detecting use-after-scope bugs.
Index: lldb/docs/use/aarch64-linux.rst
===
--- /dev/null
+++ lldb/docs/use/aarch64-linux.rst
@@ -0,0 +1,190 @@
+Using LLDB On AArch64 Linux
+===
+
+This page explains the details of debugging certain AArch64 extensions using
+LLDB. If something is not mentioned here, it likely works as you would expect.
+
+This is not a replacement for ptrace and Linux Kernel documentation. This covers
+how LLDB has chosen to use those things and how that effects your experience as
+a user.
+
+Scalable Vector Extension (SVE)
+---
+
+See `here `__
+to learn about the extension and `here `__
+for the Linux Kernel's handling of it.
+
+In LLDB you will be able to see the following new registers:
+
+* ``z0-z31`` vector registers, each one has size equal to the vector length.
+* ``p0-p15`` predicate registers, each one containing 1 bit per byte in the vector
+  length. Making each one vector length / 8 sized.
+* ``ffr`` the first fault register, same size as a predicate register.
+* ``vg``, the vector length in "granules". Each granule is 8 bytes.
+
+.. code-block::
+
+   Scalable Vector Extension Registers:
+ vg = 0x0002
+ z0 = {0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 <...> }
+   <...>
+ p0 = {0xff 0xff}
+   <...>
+ffr = {0xff 0xff}
+
+The example above has a vector length of 16 bytes. Within LLDB you will always
+see "vg" as in the ``vg`` register, which is 2 in this case (8*2 = 16).
+Elsewhere you may see "vq" which is the vector length in quadwords (16 bytes)
+elsewhere. Where you see "vl", it is in bytes.
+
+Changing the Vector Length
+..
+
+While you can count the size of a P or Z register, it is intended that ``vg`` be
+used to find the current vector length.
+
+vg can be written. Writing the current vector length changes nothing. If you
+increase the vector length, the registers will likely be reset to 0. If you
+decrease it, LLDB will truncate the Z registers but everything else will be reset
+to 0.
+
+Generally you should not assume that SVE state after changing the vector length
+is in any way the same as it was previously. If you need to do it, do it before
+a function's first use of SVE.
+
+Z Register Presentation
+...
+
+LLDB makes no attempt to predict how an SVE Z register will be used. Even if the
+next SVE instruction (which may some distance away) would use, for example, 32
+bit elements, LLDB prints ``z0`` as single bytes.
+
+If you know what format you are going to use, give a format option::
+
+  (lldb) register read z0 -f uint32_t[]
+  z0 = {0x01010101 0x01010101 0x01010101 0x01010101}
+
+FPSIMD and SVE Modes
+
+
+Prior to the debugee's first use of SVE, it is in what the Linux Kernel terms
+SIMD mode. Only the FPU is being used. In this state LLDB will still show the
+SVE registers however the values are simply the FPU values zero extended up to
+the vector length.
+
+On first access to SVE, the process goes into SVE mode. Now the Z values are
+in the real Z registers.
+
+You can also trigger this with LLDB by writing to an SVE register. Note that
+there is no way to undo this change from within LLDB. However, the debugee
+itself could do something to end up back in SIMD mode.
+
+Expression evaluation
+.
+
+If you evaluate an expression, all SVE state is saved prior to, and restored
+after the expression has been evaluated. Including the register values and
+vector length.
+
+Scalable Matrix Extension (SME)
+---
+
+See `here `__
+to learn about the extension and `h

[Lldb-commits] [PATCH] D158514: [lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef

2023-09-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 556759.
DavidSpickett added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158514/new/

https://reviews.llvm.org/D158514

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py


Index: 
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
===
--- 
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
+++ 
lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
@@ -125,11 +125,13 @@
 self.runCmd("thread select %d" % (idx + 1))
 self.check_za_register(4, 2)
 self.runCmd("register write vg 2")
+self.check_disabled_za_register(2)
 
 elif stopped_at_line_number == thY_break_line1:
 self.runCmd("thread select %d" % (idx + 1))
 self.check_za_register(2, 3)
 self.runCmd("register write vg 4")
+self.check_disabled_za_register(4)
 
 self.runCmd("thread continue 2")
 self.runCmd("thread continue 3")
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -799,6 +799,11 @@
   if (!reg_info)
 return;
 
+  // When vg is written it is automatically made invalid. Writing vg will also
+  // change svg if we're in streaming mode, so we must fetch the latest value
+  // from the remote.
+  SetRegisterIsValid(reg_info, false);
+
   uint64_t fail_value = LLDB_INVALID_ADDRESS;
   uint32_t svg_reg_num = reg_info->kinds[eRegisterKindLLDB];
   uint64_t svg_reg_value = ReadRegisterAsUnsigned(svg_reg_num, fail_value);


Index: lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
===
--- lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
+++ lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py
@@ -125,11 +125,13 @@
 self.runCmd("thread select %d" % (idx + 1))
 self.check_za_register(4, 2)
 self.runCmd("register write vg 2")
+self.check_disabled_za_register(2)
 
 elif stopped_at_line_number == thY_break_line1:
 self.runCmd("thread select %d" % (idx + 1))
 self.check_za_register(2, 3)
 self.runCmd("register write vg 4")
+self.check_disabled_za_register(4)
 
 self.runCmd("thread continue 2")
 self.runCmd("thread continue 3")
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -799,6 +799,11 @@
   if (!reg_info)
 return;
 
+  // When vg is written it is automatically made invalid. Writing vg will also
+  // change svg if we're in streaming mode, so we must fetch the latest value
+  // from the remote.
+  SetRegisterIsValid(reg_info, false);
+
   uint64_t fail_value = LLDB_INVALID_ADDRESS;
   uint32_t svg_reg_num = reg_info->kinds[eRegisterKindLLDB];
   uint64_t svg_reg_value = ReadRegisterAsUnsigned(svg_reg_num, fail_value);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett updated 
https://github.com/llvm/llvm-project/pull/66345:

>From bcabec98725255c4abed93311d73837d09ac8dde Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Thu, 14 Sep 2023 10:05:44 +0100
Subject: [PATCH] [lldb][Docs] Document our major differences from the LLVM
 style

Running:
$ clang-format -i $(find -regex "\./lldb/.*\.c") $(find -regex 
"\./lldb/.*\.cpp") $(find -regex "\./lldb/.*\.h")

Resulted in:
 1602 files changed, 25090 insertions(+), 25849 deletions(-)
(note: this includes tests which we wouldn't format, just
using this as an example)

The vast majority of which were whitespace changes. So as far
as formatting we're not deviating from llvm for any reason
other than not churning old code.

Formatting aside, the major features of lldb (single line if,
early return) are all reflected in llvm's style. We differ mainly
on variable naming (proposed to change in 
https://llvm.org/docs/Proposals/VariableNames.html
anyway) and use of asserts. Which was already documented.
---
 lldb/docs/resources/contributing.rst | 39 +---
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/lldb/docs/resources/contributing.rst 
b/lldb/docs/resources/contributing.rst
index 54917f1ce8175b3..9b133706a7fd160 100644
--- a/lldb/docs/resources/contributing.rst
+++ b/lldb/docs/resources/contributing.rst
@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
`_:
+  See the :ref:`section below`.
+
+For any other contradications please follow the existing code's style.
+
+Code in LLDB does aim to conform to clang-format but older code may not yet. As
+always, consider the `golden rule 
`_
+when working with such code. Reformatting before starting work is one possible
+option.
+
+Test Infrastructure

+
+Like LLVM it is  important to submit tests with your patches, but note that 
LLDB
+uses a different system for tests. Refer to the `test documentation 
`_
+for more details and the `lldb/test 
`_
+folder for examples.
+
+.. _Error handling:
 
 Error handling and use of assertions in LLDB
 

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] 3ae76e4 - [lldb][Docs] Link to testing page from debugging page

2023-09-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-09-14T11:16:33+01:00
New Revision: 3ae76e4fdc17ad7a7bb94d84cd746e7a98f7d105

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

LOG: [lldb][Docs] Link to testing page from debugging page

The testing page already has some page about debugging failures.

I'm not linking directly to that section because:
* The earlier sections about running single tests and such
  are just as useful for debugging in general.
* The new theme has a nice sidebar on the right that makes
  it really easy to find what you want once on the page.
* We'll probably add more content to the testing page later.

Added: 


Modified: 
lldb/docs/resources/debugging.rst

Removed: 




diff  --git a/lldb/docs/resources/debugging.rst 
b/lldb/docs/resources/debugging.rst
index c4f5594096f573b..0af1de1581c4bd0 100644
--- a/lldb/docs/resources/debugging.rst
+++ b/lldb/docs/resources/debugging.rst
@@ -580,3 +580,8 @@ reproduction steps.
 Finally, that "thing" is the ptrace calls you got from the ``lldb-server`` 
logs.
 Add those to the debugger function and you now have a reproducer that doesn't
 need any part of LLDB.
+
+Debugging Tests
+---
+
+See :doc:`/resources/test`.
\ No newline at end of file



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


[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-09-14 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve accepted this revision.
fdeazeve added a comment.

LGTM!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits

https://github.com/gchatelet updated 
https://github.com/llvm/llvm-project/pull/65750:

>From 5023264dce58aaa46b18404a4578b7a777962758 Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet 
Date: Fri, 8 Sep 2023 13:10:05 +
Subject: [PATCH 1/4] [libc] add invoke / invoke_result type traits

---
 libc/src/__support/CPP/CMakeLists.txt |  2 +
 libc/src/__support/CPP/type_traits.h  |  2 +
 libc/src/__support/CPP/type_traits/invoke.h   | 58 +
 .../__support/CPP/type_traits/invoke_result.h | 26 ++
 .../src/__support/CPP/type_traits_test.cpp| 86 +++
 .../llvm-project-overlay/libc/BUILD.bazel |  3 +
 6 files changed, 177 insertions(+)
 create mode 100644 libc/src/__support/CPP/type_traits/invoke.h
 create mode 100644 libc/src/__support/CPP/type_traits/invoke_result.h

diff --git a/libc/src/__support/CPP/CMakeLists.txt 
b/libc/src/__support/CPP/CMakeLists.txt
index d24c023ec28ebc9..bb330a7b0ac5106 100644
--- a/libc/src/__support/CPP/CMakeLists.txt
+++ b/libc/src/__support/CPP/CMakeLists.txt
@@ -104,6 +104,8 @@ add_header_library(
 type_traits/enable_if.h
 type_traits/false_type.h
 type_traits/integral_constant.h
+type_traits/invoke.h
+type_traits/invoke_result.h
 type_traits/is_arithmetic.h
 type_traits/is_array.h
 type_traits/is_base_of.h
diff --git a/libc/src/__support/CPP/type_traits.h 
b/libc/src/__support/CPP/type_traits.h
index 9deb08b221593e1..3de2ca58903184c 100644
--- a/libc/src/__support/CPP/type_traits.h
+++ b/libc/src/__support/CPP/type_traits.h
@@ -18,6 +18,8 @@
 #include "src/__support/CPP/type_traits/enable_if.h"
 #include "src/__support/CPP/type_traits/false_type.h"
 #include "src/__support/CPP/type_traits/integral_constant.h"
+#include "src/__support/CPP/type_traits/invoke.h"
+#include "src/__support/CPP/type_traits/invoke_result.h"
 #include "src/__support/CPP/type_traits/is_arithmetic.h"
 #include "src/__support/CPP/type_traits/is_array.h"
 #include "src/__support/CPP/type_traits/is_base_of.h"
diff --git a/libc/src/__support/CPP/type_traits/invoke.h 
b/libc/src/__support/CPP/type_traits/invoke.h
new file mode 100644
index 000..e1f661339f349e7
--- /dev/null
+++ b/libc/src/__support/CPP/type_traits/invoke.h
@@ -0,0 +1,58 @@
+//===-- invoke type_traits --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
+#define LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
+
+#include "src/__support/CPP/type_traits/decay.h"
+#include "src/__support/CPP/type_traits/is_base_of.h"
+#include "src/__support/CPP/utility/forward.h"
+
+// BEWARE : this implementation is not fully conformant as it doesn't take
+// `cpp::reference_wrapper` into account.
+
+namespace __llvm_libc::cpp {
+
+namespace detail {
+
+// Catch all function types.
+template  struct invoke_dispatcher {
+  template 
+  static auto call(FunctionPtrType &&fun, Args &&...args) {
+return cpp::forward(fun)(cpp::forward(args)...);
+  }
+};
+
+// Catch pointer to member function types.
+template 
+struct invoke_dispatcher {
+  using FunctionPtrType = FunctionReturnType Class::*;
+
+  template >
+  static auto call(FunctionPtrType fun, T &&t1, Args &&...args) {
+if constexpr (cpp::is_base_of_v) {
+  // T is a (possibly cv ref) type.
+  return (cpp::forward(t1).*fun)(cpp::forward(args)...);
+} else {
+  // T is assumed to be a pointer type.
+  return (*cpp::forward(t1).*fun)(cpp::forward(args)...);
+}
+  }
+};
+
+} // namespace detail
+
+template 
+auto invoke(Function &&fun, Args &&...args) {
+  return detail::invoke_dispatcher>::call(
+  cpp::forward(fun), cpp::forward(args)...);
+}
+
+} // namespace __llvm_libc::cpp
+
+#endif // LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
diff --git a/libc/src/__support/CPP/type_traits/invoke_result.h 
b/libc/src/__support/CPP/type_traits/invoke_result.h
new file mode 100644
index 000..1a071f5cb94836f
--- /dev/null
+++ b/libc/src/__support/CPP/type_traits/invoke_result.h
@@ -0,0 +1,26 @@
+//===-- invoke_result type_traits ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#ifndef LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H
+#define LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H
+
+#include "src/__support/CPP/type_traits/invoke.h"
+#include "src/__support/CPP/utility/declval.h"
+
+namespace __llvm_libc::cpp {
+
+template  st

[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits


@@ -0,0 +1,26 @@
+//===-- invoke_result type_traits ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#ifndef LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H
+#define LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H
+
+#include "src/__support/CPP/type_traits/invoke.h"
+#include "src/__support/CPP/utility/declval.h"
+
+namespace __llvm_libc::cpp {
+
+template  struct invoke_result {
+  using type =
+  decltype(cpp::invoke(cpp::declval(), cpp::declval()...));

gchatelet wrote:

FTR this has been discussed off line.

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits

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


[Lldb-commits] [lldb] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)

2023-09-14 Thread Louis Dionne via lldb-commits

ldionne wrote:

There shouldn't be any changes under libcxxabi. Those changes are not necessary.

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits


@@ -0,0 +1,59 @@
+//===-- invoke type_traits --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
+#define LLVM_LIBC_SRC_SUPPORT_CPP_TYPE_TRAITS_INVOKE_H
+
+#include "src/__support/CPP/type_traits/decay.h"
+#include "src/__support/CPP/type_traits/enable_if.h"
+#include "src/__support/CPP/type_traits/is_base_of.h"
+#include "src/__support/CPP/type_traits/is_same.h"
+#include "src/__support/CPP/utility/forward.h"
+
+namespace __llvm_libc::cpp {
+
+namespace detail {
+
+// Catch all function and functor types.
+template  struct invoke_dispatcher {
+  template , FunctionPtrType>>>
+  static auto call(T &&fun, Args &&...args) {
+return cpp::forward(fun)(cpp::forward(args)...);
+  }
+};
+
+// Catch pointer to member function types.
+template 
+struct invoke_dispatcher {
+  using FunctionPtrType = FunctionReturnType Class::*;
+
+  template >
+  static auto call(FunctionPtrType fun, T &&t1, Args &&...args) {
+if constexpr (cpp::is_base_of_v) {
+  // T is a (possibly cv ref) type.
+  return (cpp::forward(t1).*fun)(cpp::forward(args)...);
+} else {
+  // T is assumed to be a pointer type.

gchatelet wrote:

Done

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Clement Courbet via lldb-commits


@@ -145,6 +145,110 @@ TEST(LlvmLibcTypeTraitsTest, integral_constant) {
   EXPECT_EQ((integral_constant::value), 4);
 }
 
+namespace invoke_detail {
+
+enum State { INIT = 0, A_APPLY_CALLED, B_APPLY_CALLED };
+
+struct A {
+  State state = INIT;
+  virtual ~A() {}
+  virtual void apply() { state = A_APPLY_CALLED; }
+};
+
+struct B : public A {
+  virtual ~B() {}
+  virtual void apply() { state = B_APPLY_CALLED; }
+};
+
+void free_function() {}
+int free_function_return_5() { return 5; }
+int free_function_passtrough(int value) { return value; }
+
+struct Delegate {
+  int (*ptr)(int) = &free_function_passtrough;
+};
+
+template  struct Tag {
+  static int value() { return tag; }

legrosbuffle wrote:

`static constexpr int value = tag;` ?

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Clement Courbet via lldb-commits


@@ -145,6 +145,110 @@ TEST(LlvmLibcTypeTraitsTest, integral_constant) {
   EXPECT_EQ((integral_constant::value), 4);
 }
 
+namespace invoke_detail {
+
+enum State { INIT = 0, A_APPLY_CALLED, B_APPLY_CALLED };
+
+struct A {
+  State state = INIT;
+  virtual ~A() {}
+  virtual void apply() { state = A_APPLY_CALLED; }
+};
+
+struct B : public A {
+  virtual ~B() {}
+  virtual void apply() { state = B_APPLY_CALLED; }
+};
+
+void free_function() {}
+int free_function_return_5() { return 5; }
+int free_function_passtrough(int value) { return value; }
+
+struct Delegate {
+  int (*ptr)(int) = &free_function_passtrough;
+};
+
+template  struct Tag {
+  static int value() { return tag; }
+};
+
+struct Functor {
+  auto operator()() & { return Tag<0>(); }
+  auto operator()() const & { return Tag<1>(); }
+  auto operator()() && { return Tag<2>(); }
+  auto operator()() const && { return Tag<3>(); }
+};
+
+} // namespace invoke_detail
+
+TEST(LlvmLibcTypeTraitsTest, invoke) {
+  using namespace invoke_detail;
+  { // member function call
+A a;
+EXPECT_EQ(a.state, INIT);
+invoke(&A::apply, a);
+EXPECT_EQ(a.state, A_APPLY_CALLED);
+  }
+  { // overriden member function call
+B b;
+EXPECT_EQ(b.state, INIT);
+invoke(&A::apply, b);
+EXPECT_EQ(b.state, B_APPLY_CALLED);
+  }
+  { // free function
+invoke(&free_function);
+EXPECT_EQ(invoke(&free_function_return_5), 5);
+EXPECT_EQ(invoke(&free_function_passtrough, 1), 1);
+  }
+  { // pointer member function call
+Delegate d;
+EXPECT_EQ(invoke(&Delegate::ptr, d, 2), 2);
+  }
+  { // Functor with several ref qualifier

legrosbuffle wrote:

qualifiers

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Clement Courbet via lldb-commits


@@ -145,6 +145,110 @@ TEST(LlvmLibcTypeTraitsTest, integral_constant) {
   EXPECT_EQ((integral_constant::value), 4);
 }
 
+namespace invoke_detail {
+
+enum State { INIT = 0, A_APPLY_CALLED, B_APPLY_CALLED };
+
+struct A {
+  State state = INIT;
+  virtual ~A() {}
+  virtual void apply() { state = A_APPLY_CALLED; }
+};
+
+struct B : public A {
+  virtual ~B() {}
+  virtual void apply() { state = B_APPLY_CALLED; }
+};
+
+void free_function() {}
+int free_function_return_5() { return 5; }
+int free_function_passtrough(int value) { return value; }
+
+struct Delegate {
+  int (*ptr)(int) = &free_function_passtrough;
+};
+
+template  struct Tag {
+  static int value() { return tag; }
+};
+
+struct Functor {
+  auto operator()() & { return Tag<0>(); }
+  auto operator()() const & { return Tag<1>(); }
+  auto operator()() && { return Tag<2>(); }
+  auto operator()() const && { return Tag<3>(); }
+};
+
+} // namespace invoke_detail
+
+TEST(LlvmLibcTypeTraitsTest, invoke) {
+  using namespace invoke_detail;
+  { // member function call
+A a;
+EXPECT_EQ(a.state, INIT);
+invoke(&A::apply, a);
+EXPECT_EQ(a.state, A_APPLY_CALLED);
+  }
+  { // overriden member function call
+B b;
+EXPECT_EQ(b.state, INIT);
+invoke(&A::apply, b);
+EXPECT_EQ(b.state, B_APPLY_CALLED);
+  }
+  { // free function
+invoke(&free_function);
+EXPECT_EQ(invoke(&free_function_return_5), 5);
+EXPECT_EQ(invoke(&free_function_passtrough, 1), 1);
+  }
+  { // pointer member function call
+Delegate d;
+EXPECT_EQ(invoke(&Delegate::ptr, d, 2), 2);
+  }
+  { // Functor with several ref qualifier
+Functor f;
+const Functor cf;
+EXPECT_EQ(invoke(f).value(), 0);
+EXPECT_EQ(invoke(cf).value(), 1);
+EXPECT_EQ(invoke(move(f)).value(), 2);
+EXPECT_EQ(invoke(move(cf)).value(), 3);
+  }
+  { // lambda
+EXPECT_EQ(invoke([]() -> int { return 2; }), 2);
+EXPECT_EQ(invoke([](int value) -> int { return value; }, 1), 1);
+
+const auto lambda = [](int) { return 0; };
+EXPECT_EQ(invoke(lambda, 1), 0);
+  }
+}
+
+TEST(LlvmLibcTypeTraitsTest, invoke_result) {
+  using namespace invoke_detail;
+  EXPECT_TRUE((is_same_v, void>));
+  EXPECT_TRUE((is_same_v, void>));
+  EXPECT_TRUE((is_same_v, void>));
+  EXPECT_TRUE((is_same_v, int>));
+  EXPECT_TRUE((is_same_v, int>));
+  EXPECT_TRUE((
+  is_same_v, 
int>));
+  // Functor with several ref qualifier
+  EXPECT_TRUE((is_same_v, Tag<0>>));
+  EXPECT_TRUE((is_same_v, Tag<1>>));
+  EXPECT_TRUE((is_same_v, Tag<2>>));
+  EXPECT_TRUE((is_same_v, Tag<3>>));
+  {
+auto lambda = []() {};
+EXPECT_TRUE((is_same_v, void>));
+  }
+  {
+auto lambda = []() { return 0; };
+EXPECT_TRUE((is_same_v, int>));
+  }
+  {
+auto lambda = [](int) -> double { return 0; };
+EXPECT_TRUE((is_same_v, double>));
+  }
+}

legrosbuffle wrote:

We're missing tests for a functor with overloaded types:

```
auto lambda = [](auto a) { return a; };
EXPECT_TRUE((is_same_v, int>));
EXPECT_TRUE((is_same_v, double>));
```

maybe also with `auto&` and `auto&&`.



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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits

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


[Lldb-commits] [lldb] [libc] Add invoke / invoke_result type traits (PR #65750)

2023-09-14 Thread Guillaume Chatelet via lldb-commits

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


[Lldb-commits] [lldb] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)

2023-09-14 Thread Paul T Robinson via lldb-commits


@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation 
&Invocation,
 
 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
  DiagnosticsEngine &Diags) {
-  unsigned DefaultOpt = llvm::CodeGenOpt::None;
+  unsigned DefaultOpt = 0;
   if ((IK.getLanguage() == Language::OpenCL ||
IK.getLanguage() == Language::OpenCLCXX) &&
   !Args.hasArg(OPT_cl_opt_disable))
-DefaultOpt = llvm::CodeGenOpt::Default;
+DefaultOpt = 2;

pogo59 wrote:

I'm not keen on having these as magic numbers. Surely you can 
`static_cast(CodeGenOptLevel::Default)` or whatever.

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


[Lldb-commits] [lldb] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)

2023-09-14 Thread Andrzej Warzyński via lldb-commits


@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation 
&Invocation,
 
 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
  DiagnosticsEngine &Diags) {
-  unsigned DefaultOpt = llvm::CodeGenOpt::None;
+  unsigned DefaultOpt = 0;
   if ((IK.getLanguage() == Language::OpenCL ||
IK.getLanguage() == Language::OpenCLCXX) &&
   !Args.hasArg(OPT_cl_opt_disable))
-DefaultOpt = llvm::CodeGenOpt::Default;
+DefaultOpt = 2;

banach-space wrote:

+1

Otherwise the the default is effectively defined twice in two different places.

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


[Lldb-commits] [lldb] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)

2023-09-14 Thread Andrzej Warzyński via lldb-commits

https://github.com/banach-space approved this pull request.

Flang driver changes LGTM, thanks!

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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?,?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?Bäder?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?Bäder?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?,?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Björn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


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


[Lldb-commits] [lldb] [LSAN][NFC] Add a new line to a log (PR #66305)

2023-09-14 Thread Matt Arsenault via lldb-commits
Valentin Clement =?utf-8?b?KOODkOODrOODsw==?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw==?=,Jonas Devlieghere
 ,Douglas Yung ,daisy202309
 <144047963+daisy202...@users.noreply.github.com>,Jonas Devlieghere
 ,Mehdi Amini ,Siva Chandra
 ,Jonas Devlieghere ,
Valentin Clement =?utf-8?b?KOODkOODrOODsw==?=,Tom Stellard
 ,Siva Chandra ,Tom Stellard
 
,https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
 =?utf-8?q?=2C?=Pierre van Houtryve ,Antonio
 Frighetto ,Owen Pan ,Nikita
 Popov ,Antonio Frighetto ,
Timm =?utf-8?q?B=C3=A4der?= ,Cullen Rhodes
 ,Jianjian Guan ,Weining Lu
 ,Matthias Springer ,David Spickett
 ,Hans ,Guillaume Chatelet
 ,vic ,David Green
 ,Benjamin Kramer ,David
 Spickett ,Bill Wendling
 <5993918+bwendl...@users.noreply.github.com>,martinboehme
 ,Sergio Afonso ,Sergio Afonso
 ,Sergio Afonso ,Carlo Bramini
 ,DonatNagyE 
,Balazs
 Benics ,Balazs Benics ,Balazs
 Benics ,M Iyengar ,Martin
 Erhart ,David Spickett ,Balazs
 Benics ,khei4 ,Felix
 Schneider ,Felix Schneider ,Benjamin
 Kramer ,Felix Schneider ,Oleg
 Shyshkov ,
Timm =?utf-8?q?B=C3=A4der?= ,Martin Erhart
 ,paulwalker-arm ,Louis Dionne
 ,Kohei Asano 
<32860920+kh...@users.noreply.github.com>,Martin
 Erhart ,sstwcw ,Alex Brachet
 ,Martin Erhart ,Matthias Springer
 ,"Mikhail R. Gadelha" ,Louis Dionne
 ,Nicolas Vasilache
 ,Paul Walker 
 =?utf-8?q?=2C?="Joel E. Denny" ,Martin Erhart
 ,Matthias Springer ,
=?utf-8?q?Bj=C3=B6rn?= Pettersson ,Slava
 Zakharin ,Slava Zakharin ,Manos
 Anagnostakis ,
Duncan P. N. =?utf-8?q?Exon=C2=A0Smith?=,Matt Arsenault
 ,Kirill Stoimenov ;


arsenm wrote:

Why does this have 87 unrelated commits pulled in?

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


[Lldb-commits] [lldb] [lldb] Support Unicode in the prompt (PR #66312)

2023-09-14 Thread via lldb-commits

gulfemsavrun wrote:

We started seeing a test failure after this commit.
```
UNRESOLVED: lldb-api :: terminal/TestEditline.py (2430 of 2430)
 TEST 'lldb-api :: terminal/TestEditline.py' FAILED 

Script:
--
/b/s/w/ir/x/w/lldb_install/python3/bin/python3 
/b/s/w/ir/x/w/llvm-llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS 
--env ARCHIVER=/b/s/w/ir/x/w/cipd/bin/llvm-ar --env 
OBJCOPY=/b/s/w/ir/x/w/cipd/bin/llvm-objcopy --env 
LLVM_LIBS_DIR=/b/s/w/ir/x/w/llvm_build/./lib --env 
LLVM_INCLUDE_DIR=/b/s/w/ir/x/w/llvm_build/include --env 
LLVM_TOOLS_DIR=/b/s/w/ir/x/w/llvm_build/./bin --libcxx-include-dir 
/b/s/w/ir/x/w/llvm_build/include/c++/v1 --libcxx-include-target-dir 
/b/s/w/ir/x/w/llvm_build/include/x86_64-unknown-linux-gnu/c++/v1 
--libcxx-library-dir /b/s/w/ir/x/w/llvm_build/./lib/x86_64-unknown-linux-gnu 
--arch x86_64 --build-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex/module-cache-lldb/lldb-api 
--clang-module-cache-dir 
/b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex/module-cache-clang/lldb-api 
--executable /b/s/w/ir/x/w/llvm_build/./bin/lldb --compiler 
/b/s/w/ir/x/w/llvm_build/./bin/clang --dsymutil 
/b/s/w/ir/x/w/llvm_build/./bin/dsymutil --llvm-tools-dir 
/b/s/w/ir/x/w/llvm_build/./bin --lldb-libs-dir /b/s/w/ir/x/w/llvm_build/./lib 
/b/s/w/ir/x/w/llvm-llvm-project/lldb/test/API/terminal -p TestEditline.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 18.0.0git (https://llvm.googlesource.com/a/llvm-project revision 
850e90c47b3caaadb78581fb7a93655a8a60cbe0)
  clang revision 850e90c47b3caaadb78581fb7a93655a8a60cbe0
  llvm revision 850e90c47b3caaadb78581fb7a93655a8a60cbe0
Skipping the following test categories: ['dsym', 'gmodules', 'debugserver', 
'objc']

--
Command Output (stderr):
--
PASS: LLDB (/b/s/w/ir/x/w/llvm_build/bin/clang-x86_64) :: test_left_right_arrow 
(TestEditline.EditlineTest)
FAIL: LLDB (/b/s/w/ir/x/w/llvm_build/bin/clang-x86_64) :: test_prompt_unicode 
(TestEditline.EditlineTest)
==
ERROR: test_prompt_unicode (TestEditline.EditlineTest)
```

https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8770012743174630257/+/u/lldb/test/stdout

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits

https://github.com/bulbazord commented:

Excellent write up, thanks for taking care of that!

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
`_:
+  See the :ref:`section below`.
+
+For any other contradications please follow the existing code's style.
+
+Code in LLDB does aim to conform to clang-format but older code may not yet. As
+always, consider the `golden rule 
`_
+when working with such code. Reformatting before starting work is one possible
+option.
+
+Test Infrastructure

+
+Like LLVM it is  important to submit tests with your patches, but note that 
LLDB

bulbazord wrote:

nit: remove extra space between `is` and `important`

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.

bulbazord wrote:

You could also mention the other prefixes that are often used in lldb: `g_` for 
global and `s_` for static. I sometimes see people using `g_` for static too, 
but I think we should write something down for guidance.

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for

bulbazord wrote:

Might be helpful to write down that this is sometimes referred to as "snake 
case"?

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
`_:
+  See the :ref:`section below`.
+
+For any other contradications please follow the existing code's style.
+
+Code in LLDB does aim to conform to clang-format but older code may not yet. As
+always, consider the `golden rule 
`_
+when working with such code. Reformatting before starting work is one possible
+option.
+
+Test Infrastructure

+
+Like LLVM it is  important to submit tests with your patches, but note that 
LLDB
+uses a different system for tests. Refer to the `test documentation 
`_

bulbazord wrote:

Hmm... This is only partially true now. The only test type differing from LLVM 
is the API tests, the unit tests and shell tests are the same as the rest of 
the LLVM project. I think it would be worth updating the docs to talk about 
that.

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Alex Langford via lldb-commits

bulbazord wrote:

> @bulbazord This would be a good place to put your plugin dependency / const 
> string guidance. Or tell me where it lives now and I'll link to it.

Oh, yes! I'd be happy to take care of that after this goes in, thanks for 
pointing that out! :)

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-14 Thread Alex Langford via lldb-commits


@@ -211,6 +212,35 @@ bool Watchpoint::CaptureWatchedValue(const 
ExecutionContext &exe_ctx) {
   return (m_new_value_sp && m_new_value_sp->GetError().Success());
 }
 
+bool Watchpoint::WatchedValueReportable(const ExecutionContext &exe_ctx) {
+  if (!m_watch_modify)
+return true;
+  if (!m_type.IsValid())
+return true;
+
+  ConstString watch_name("$__lldb__watch_value");

bulbazord wrote:

I've been reading through ValueObject and I'm not sure yet what the 
implications of removing ConstString from ValueObject are. If and when we can 
remove it from ValueObject, we'll be able to clean up this one too, so I would 
say don't worry about it right now.

As a suggestion, if you anticipate `WatchedValueReportable` being called many 
times, it would be less work to create that ConstString once as a `static` 
rather than creating one on each invocation. 

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-14 Thread Alex Langford via lldb-commits


@@ -3109,14 +3109,15 @@ static GDBStoppointType GetGDBStoppointType(Watchpoint 
*wp) {
   assert(wp);
   bool watch_read = wp->WatchpointRead();
   bool watch_write = wp->WatchpointWrite();
+  bool watch_modify = wp->WatchpointModify();
 
-  // watch_read and watch_write cannot both be false.
-  assert(watch_read || watch_write);
-  if (watch_read && watch_write)
+  // watch_read, watch_write, watch_modify cannot all be false.
+  assert(watch_read || watch_write || watch_modify);

bulbazord wrote:

It might be worth putting that comment into the assertion so it's a little 
easier to understand at first glance?

```
  assert((watch_read || watch_write || watch_modify) && "watch_read, 
watch_write, watch_modify cannot all be false.");
  ```

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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread Adrian Prantl via lldb-commits

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

None

>From d14e5d08571ea206b1ee8dd0ffc66f896306d15e Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Thu, 14 Sep 2023 09:44:15 -0700
Subject: [PATCH] Clean up test case

---
 .../Makefile  |  3 ---
 .../TestCharStarDynType.py}   | 24 ---
 .../main.m|  0
 3 files changed, 5 insertions(+), 22 deletions(-)
 rename lldb/test/API/lang/objc/{rdar-11355592 => charstar_dyntype}/Makefile 
(96%)
 rename lldb/test/API/lang/objc/{rdar-11355592/TestRdar11355592.py => 
charstar_dyntype/TestCharStarDynType.py} (75%)
 rename lldb/test/API/lang/objc/{rdar-11355592 => charstar_dyntype}/main.m 
(100%)

diff --git a/lldb/test/API/lang/objc/rdar-11355592/Makefile 
b/lldb/test/API/lang/objc/charstar_dyntype/Makefile
similarity index 96%
rename from lldb/test/API/lang/objc/rdar-11355592/Makefile
rename to lldb/test/API/lang/objc/charstar_dyntype/Makefile
index 37dd8f40a9d4ac8..a3198db9e8e8847 100644
--- a/lldb/test/API/lang/objc/rdar-11355592/Makefile
+++ b/lldb/test/API/lang/objc/charstar_dyntype/Makefile
@@ -1,6 +1,3 @@
 OBJC_SOURCES := main.m
-
-
-
 LD_EXTRAS := -framework Foundation
 include Makefile.rules
diff --git a/lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py 
b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
similarity index 75%
rename from lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
rename to lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
index 9378929eeda2153..ab6f0c27fb52372 100644
--- a/lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
+++ b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
@@ -2,37 +2,23 @@
 Test that we do not attempt to make a dynamic type for a 'const char*'
 """
 
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
-class Rdar10967107TestCase(TestBase):
+class TestCaseCharStarDynType(TestBase):
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
-# We'll use the test method name as the exe_name.
-self.exe_name = self.testMethodName
-# Find the line number to break inside main().
-self.main_source = "main.m"
-self.line = line_number(self.main_source, "// Set breakpoint here.")
 
 def test_charstar_dyntype(self):
 """Test that we do not attempt to make a dynamic type for a 'const 
char*'"""
-d = {"EXE": self.exe_name}
-self.build(dictionary=d)
-self.setTearDownCleanup(dictionary=d)
-
-exe = self.getBuildArtifact(self.exe_name)
-self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
-lldbutil.run_break_set_by_file_and_line(
-self, self.main_source, self.line, num_expected_locations=1, 
loc_exact=True
+self.build()
+lldbutil.run_to_source_breakpoint(
+self, "// Set breakpoint here.", lldb.SBFileSpec("main.m")
 )
 
-self.runCmd("run", RUN_SUCCEEDED)
 # check that we correctly see the const char*, even with dynamic types
 # on
 self.expect("frame variable -raw-output my_string", substrs=["const 
char *"])
@@ -41,7 +27,7 @@ def test_charstar_dyntype(self):
 substrs=["const char *"],
 )
 # check that expr also gets it right
-self.expect("e -R -- my_string", substrs=["const char *"])
+self.expect("expr -R -- my_string", substrs=["const char *"])
 self.expect("expr -R -d run -- my_string", substrs=["const char *"])
 # but check that we get the real Foolie as such
 self.expect("frame variable my_foolie", substrs=["FoolMeOnce *"])
diff --git a/lldb/test/API/lang/objc/rdar-11355592/main.m 
b/lldb/test/API/lang/objc/charstar_dyntype/main.m
similarity index 100%
rename from lldb/test/API/lang/objc/rdar-11355592/main.m
rename to lldb/test/API/lang/objc/charstar_dyntype/main.m

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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] 9dfc6d3 - Clean up test case (#66400)

2023-09-14 Thread via lldb-commits

Author: Adrian Prantl
Date: 2023-09-14T09:48:36-07:00
New Revision: 9dfc6d37da65b94208bf81b06908bb20d92de8fb

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

LOG: Clean up test case (#66400)

Added: 
lldb/test/API/lang/objc/charstar_dyntype/Makefile
lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
lldb/test/API/lang/objc/charstar_dyntype/main.m

Modified: 


Removed: 
lldb/test/API/lang/objc/rdar-11355592/Makefile
lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
lldb/test/API/lang/objc/rdar-11355592/main.m



diff  --git a/lldb/test/API/lang/objc/rdar-11355592/Makefile 
b/lldb/test/API/lang/objc/charstar_dyntype/Makefile
similarity index 96%
rename from lldb/test/API/lang/objc/rdar-11355592/Makefile
rename to lldb/test/API/lang/objc/charstar_dyntype/Makefile
index 37dd8f40a9d4ac8..a3198db9e8e8847 100644
--- a/lldb/test/API/lang/objc/rdar-11355592/Makefile
+++ b/lldb/test/API/lang/objc/charstar_dyntype/Makefile
@@ -1,6 +1,3 @@
 OBJC_SOURCES := main.m
-
-
-
 LD_EXTRAS := -framework Foundation
 include Makefile.rules

diff  --git a/lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py 
b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
similarity index 75%
rename from lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
rename to lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
index 9378929eeda2153..ab6f0c27fb52372 100644
--- a/lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
+++ b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
@@ -2,37 +2,23 @@
 Test that we do not attempt to make a dynamic type for a 'const char*'
 """
 
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
-class Rdar10967107TestCase(TestBase):
+class TestCaseCharStarDynType(TestBase):
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
-# We'll use the test method name as the exe_name.
-self.exe_name = self.testMethodName
-# Find the line number to break inside main().
-self.main_source = "main.m"
-self.line = line_number(self.main_source, "// Set breakpoint here.")
 
 def test_charstar_dyntype(self):
 """Test that we do not attempt to make a dynamic type for a 'const 
char*'"""
-d = {"EXE": self.exe_name}
-self.build(dictionary=d)
-self.setTearDownCleanup(dictionary=d)
-
-exe = self.getBuildArtifact(self.exe_name)
-self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
-lldbutil.run_break_set_by_file_and_line(
-self, self.main_source, self.line, num_expected_locations=1, 
loc_exact=True
+self.build()
+lldbutil.run_to_source_breakpoint(
+self, "// Set breakpoint here.", lldb.SBFileSpec("main.m")
 )
 
-self.runCmd("run", RUN_SUCCEEDED)
 # check that we correctly see the const char*, even with dynamic types
 # on
 self.expect("frame variable -raw-output my_string", substrs=["const 
char *"])
@@ -41,7 +27,7 @@ def test_charstar_dyntype(self):
 substrs=["const char *"],
 )
 # check that expr also gets it right
-self.expect("e -R -- my_string", substrs=["const char *"])
+self.expect("expr -R -- my_string", substrs=["const char *"])
 self.expect("expr -R -d run -- my_string", substrs=["const char *"])
 # but check that we get the real Foolie as such
 self.expect("frame variable my_foolie", substrs=["FoolMeOnce *"])

diff  --git a/lldb/test/API/lang/objc/rdar-11355592/main.m 
b/lldb/test/API/lang/objc/charstar_dyntype/main.m
similarity index 100%
rename from lldb/test/API/lang/objc/rdar-11355592/main.m
rename to lldb/test/API/lang/objc/charstar_dyntype/main.m



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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Clean up test case (PR #66400)

2023-09-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb


Changes
None
--
Full diff: https://github.com/llvm/llvm-project/pull/66400.diff

3 Files Affected:

- (renamed) lldb/test/API/lang/objc/charstar_dyntype/Makefile (-3) 
- (renamed) lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py 
(+5-19) 
- (renamed) lldb/test/API/lang/objc/charstar_dyntype/main.m () 



diff --git a/lldb/test/API/lang/objc/rdar-11355592/Makefile 
b/lldb/test/API/lang/objc/charstar_dyntype/Makefile
similarity index 96%
rename from lldb/test/API/lang/objc/rdar-11355592/Makefile
rename to lldb/test/API/lang/objc/charstar_dyntype/Makefile
index 37dd8f40a9d4ac8..a3198db9e8e8847 100644
--- a/lldb/test/API/lang/objc/rdar-11355592/Makefile
+++ b/lldb/test/API/lang/objc/charstar_dyntype/Makefile
@@ -1,6 +1,3 @@
 OBJC_SOURCES := main.m
-
-
-
 LD_EXTRAS := -framework Foundation
 include Makefile.rules
diff --git a/lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py 
b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
similarity index 75%
rename from lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
rename to lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
index 9378929eeda2153..ab6f0c27fb52372 100644
--- a/lldb/test/API/lang/objc/rdar-11355592/TestRdar11355592.py
+++ b/lldb/test/API/lang/objc/charstar_dyntype/TestCharStarDynType.py
@@ -2,37 +2,23 @@
 Test that we do not attempt to make a dynamic type for a 'const 
char*'
 """
 
-
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-
-class Rdar10967107TestCase(TestBase):
+class TestCaseCharStarDynType(TestBase):
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
-# We'll use the test method name as the exe_name.
-self.exe_name = self.testMethodName
-# Find the line number to break inside main().
-self.main_source = "main.m"
-self.line = line_number(self.main_source, "// Set breakpoint 
here.")
 
 def test_charstar_dyntype(self):
 """Test that we do not attempt to make a 
dynamic type for a 'const char*'"""
-d = {"EXE": self.exe_name}
-self.build(dictionary=d)
-self.setTearDownCleanup(dictionary=d)
-
-exe = self.getBuildArtifact(self.exe_name)
-self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
-lldbutil.run_break_set_by_file_and_line(
-self, self.main_source, self.line, num_expected_locations=1, 
loc_exact=True
+self.build()
+lldbutil.run_to_source_breakpoint(
+self, "// Set breakpoint here.", 
lldb.SBFileSpec("main.m")
 )
 
-self.runCmd("run", RUN_SUCCEEDED)
 # check that we correctly see the const char*, even with dynamic types
 # on
 self.expect("frame variable -raw-output my_string", 
substrs=["const char *"])
@@ -41,7 +27,7 @@ def test_charstar_dyntype(self):
 substrs=["const char *"],
 )
 # check that expr also gets it right
-self.expect("e -R -- my_string", 
substrs=["const char *"])
+self.expect("expr -R -- my_string", 
substrs=["const char *"])
 self.expect("expr -R -d run -- my_string", 
substrs=["const char *"])
 # but check that we get the real Foolie as such
 self.expect("frame variable my_foolie", 
substrs=["FoolMeOnce *"])
diff --git a/lldb/test/API/lang/objc/rdar-11355592/main.m 
b/lldb/test/API/lang/objc/charstar_dyntype/main.m
similarity index 100%
rename from lldb/test/API/lang/objc/rdar-11355592/main.m
rename to lldb/test/API/lang/objc/charstar_dyntype/main.m




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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Jonas Devlieghere via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
`_:
+  See the :ref:`section below`.
+
+For any other contradications please follow the existing code's style.
+
+Code in LLDB does aim to conform to clang-format but older code may not yet. As
+always, consider the `golden rule 
`_
+when working with such code. Reformatting before starting work is one possible
+option.

JDevlieghere wrote:

1. I would move the *golden rule* to the previous paragraph where you mention 
following the existing coding style. 
2. I would prefer a stronger statement about clang-format. All new code should 
be clang formatted. Existing code might not conform and will be updated as we 
modify it. Bulk reformatting is discouraged. 

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Jonas Devlieghere via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.
+
+* `Use of asserts 
`_:
+  See the :ref:`section below`.

JDevlieghere wrote:

I don't actually think our way of using asserts is all that different from how 
they are (should be?) used in LLVM. I think it's fair to call it out here as we 
have extensive documentation below. 

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


[Lldb-commits] [lldb] [lldb][Docs] Document our major differences from the LLVM style (PR #66345)

2023-09-14 Thread Jonas Devlieghere via lldb-commits


@@ -18,19 +18,38 @@ Please refer to the `LLVM Developer Policy
 authoring and uploading a patch. LLDB differs from the LLVM Developer
 Policy in the following respects.
 
- - **Test infrastructure**: Like LLVM it is  important to submit tests with 
your
-   patches, but note that LLDB uses a different system for tests. Refer to the
-   `test documentation `_ for more details and the ``lldb/test``
-   folder on disk for examples.
-
- - **Coding Style**: LLDB's code style differs from
-   `LLVM's coding style `_.
-   Unfortunately there is no document describing the differences. Please be
-   consistent with the existing code.
-
 For anything not explicitly listed here, assume that LLDB follows the LLVM
 policy.
 
+Coding Style
+
+
+LLDB's code style differs from `LLVM's coding style 
`_
+in a few ways. The 2 main ones are:
+
+* `Variable naming 
`_:
+  LLDB prefers variables to be ``named_like_this`` and uses the ``m_`` prefix 
for
+  member variables.

JDevlieghere wrote:

Another difference is function/method names using UpperCamelCase in LLDB while 
LLVM uses lowerCamelCase. 

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


[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-09-14 Thread Alex Langford via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2f377c5bd713: [lldb][NFCI] Remove use of ConstString from 
UnixSignals (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

Files:
  lldb/include/lldb/Target/UnixSignals.h
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Target/UnixSignals.cpp

Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -18,17 +18,13 @@
 using namespace lldb_private;
 using namespace llvm;
 
-UnixSignals::Signal::Signal(const char *name, bool default_suppress,
+UnixSignals::Signal::Signal(llvm::StringRef name, bool default_suppress,
 bool default_stop, bool default_notify,
-const char *description, const char *alias)
-: m_name(name), m_alias(alias), m_description(),
+llvm::StringRef description, llvm::StringRef alias)
+: m_name(name), m_alias(alias), m_description(description),
   m_suppress(default_suppress), m_stop(default_stop),
-  m_notify(default_notify),
-  m_default_suppress(default_suppress), m_default_stop(default_stop),
-  m_default_notify(default_notify) {
-  if (description)
-m_description.assign(description);
-}
+  m_notify(default_notify), m_default_suppress(default_suppress),
+  m_default_stop(default_stop), m_default_notify(default_notify) {}
 
 lldb::UnixSignalsSP UnixSignals::Create(const ArchSpec &arch) {
   const auto &triple = arch.GetTriple();
@@ -104,9 +100,10 @@
   // clang-format on
 }
 
-void UnixSignals::AddSignal(int signo, const char *name, bool default_suppress,
-bool default_stop, bool default_notify,
-const char *description, const char *alias) {
+void UnixSignals::AddSignal(int signo, llvm::StringRef name,
+bool default_suppress, bool default_stop,
+bool default_notify, llvm::StringRef description,
+llvm::StringRef alias) {
   Signal new_signal(name, default_suppress, default_stop, default_notify,
 description, alias);
   m_signals.insert(std::make_pair(signo, new_signal));
@@ -135,7 +132,7 @@
   const auto pos = m_signals.find(signo);
   if (pos == m_signals.end())
 return {};
-  return pos->second.m_name.GetStringRef();
+  return pos->second.m_name;
 }
 
 std::string
@@ -147,7 +144,7 @@
 
   collection::const_iterator pos = m_signals.find(signo);
   if (pos != m_signals.end()) {
-str = pos->second.m_name.GetCString();
+str = pos->second.m_name.str();
 
 if (code) {
   std::map::const_iterator cpos =
@@ -199,14 +196,13 @@
 }
 
 int32_t UnixSignals::GetSignalNumberFromName(const char *name) const {
-  ConstString const_name(name);
+  llvm::StringRef name_ref(name);
 
   collection::const_iterator pos, end = m_signals.end();
   for (pos = m_signals.begin(); pos != end; pos++) {
-if ((const_name == pos->second.m_name) ||
-(const_name == pos->second.m_alias) ||
-(const_name == GetShortName(pos->second.m_name)) ||
-(const_name == GetShortName(pos->second.m_alias)))
+if ((name_ref == pos->second.m_name) || (name_ref == pos->second.m_alias) ||
+(name_ref == GetShortName(pos->second.m_name)) ||
+(name_ref == GetShortName(pos->second.m_alias)))
   return pos->first;
   }
 
@@ -373,11 +369,10 @@
 
 json::Value UnixSignals::GetHitCountStatistics() const {
   json::Array json_signals;
-  for (const auto &pair: m_signals) {
+  for (const auto &pair : m_signals) {
 if (pair.second.m_hit_count > 0)
-  json_signals.emplace_back(json::Object{
-{ pair.second.m_name.GetCString(), pair.second.m_hit_count }
-  });
+  json_signals.emplace_back(
+  json::Object{{pair.second.m_name, pair.second.m_hit_count}});
   }
   return std::move(json_signals);
 }
Index: lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
===
--- lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -28,10 +28,12 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/UriParser.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/FormatAdapters.h"
 
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include 
 #include 
 
 using namespace lldb;
@@ -41,6 +43,11 @@
 LLDB_PLUGIN_DEFINE_ADV(PlatformRemoteGDBServer, PlatformGDB)
 
 static bool g_initialized = false;
+// U

[Lldb-commits] [lldb] 2f377c5 - [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-09-14 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-09-14T10:19:53-07:00
New Revision: 2f377c5bd713e9ee72faa6a99088bb81358059e3

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

LOG: [lldb][NFCI] Remove use of ConstString from UnixSignals

The majority of UnixSignals strings are static in the sense that they do
not change. The overwhelming majority of these strings are string
literals. Using ConstString to manage their lifetime does not make
sense. The only exception to this is one of the subclasses of
UnixSignals, for which I have created a StringSet local to that file
which will guarantee the lifetimes of these StringRefs.

As for the other benefits of ConstString, string uniqueness is not a
concern (as many of them are already string literals) and comparing
signal names and aliases should not be a hot path.

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

Added: 


Modified: 
lldb/include/lldb/Target/UnixSignals.h
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Target/UnixSignals.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/UnixSignals.h 
b/lldb/include/lldb/Target/UnixSignals.h
index b227b67e289229f..b3605ccefddbea4 100644
--- a/lldb/include/lldb/Target/UnixSignals.h
+++ b/lldb/include/lldb/Target/UnixSignals.h
@@ -14,7 +14,6 @@
 #include 
 #include 
 
-#include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
 
@@ -101,9 +100,10 @@ class UnixSignals {
   // your subclass of UnixSignals or in your Process Plugin's GetUnixSignals
   // method before you return the UnixSignal object.
 
-  void AddSignal(int signo, const char *name, bool default_suppress,
+  void AddSignal(int signo, llvm::StringRef name, bool default_suppress,
  bool default_stop, bool default_notify,
- const char *description, const char *alias = nullptr);
+ llvm::StringRef description,
+ llvm::StringRef alias = llvm::StringRef());
 
   enum SignalCodePrintOption { None, Address, Bounds };
 
@@ -147,17 +147,20 @@ class UnixSignals {
 const SignalCodePrintOption m_print_option;
   };
 
+  // The StringRefs in Signal are either backed by string literals or reside in
+  // persistent storage (e.g. a StringSet).
   struct Signal {
-ConstString m_name;
-ConstString m_alias;
-std::string m_description;
+llvm::StringRef m_name;
+llvm::StringRef m_alias;
+llvm::StringRef m_description;
 std::map m_codes;
 uint32_t m_hit_count = 0;
 bool m_suppress : 1, m_stop : 1, m_notify : 1;
 bool m_default_suppress : 1, m_default_stop : 1, m_default_notify : 1;
 
-Signal(const char *name, bool default_suppress, bool default_stop,
-   bool default_notify, const char *description, const char *alias);
+Signal(llvm::StringRef name, bool default_suppress, bool default_stop,
+   bool default_notify, llvm::StringRef description,
+   llvm::StringRef alias);
 
 ~Signal() = default;
 void Reset(bool reset_stop, bool reset_notify, bool reset_suppress);

diff  --git 
a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp 
b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 8734a3666a6d8b5..88f1ad15b6b485d 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -28,10 +28,12 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/UriParser.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/FormatAdapters.h"
 
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include 
 #include 
 
 using namespace lldb;
@@ -41,6 +43,11 @@ using namespace lldb_private::platform_gdb_server;
 LLDB_PLUGIN_DEFINE_ADV(PlatformRemoteGDBServer, PlatformGDB)
 
 static bool g_initialized = false;
+// UnixSignals does not store the signal names or descriptions itself.
+// It holds onto StringRefs. Becaue we may get signal information dynamically
+// from the remote, these strings need persistent storage client-side.
+static std::mutex g_signal_string_mutex;
+static llvm::StringSet<> g_signal_string_storage;
 
 void PlatformRemoteGDBServer::Initialize() {
   Platform::Initialize();
@@ -749,8 +756,18 @@ const UnixSignalsSP 
&PlatformRemoteGDBServer::GetRemoteUnixSignals() {
 if (object_sp && object_sp->IsValid())
   description = std::string(object_sp->GetStringValue());
 
-remote_signals_sp->AddSignal(signo, name.str().c_str(), suppress, stop,
- notify, description.c_str());
+llvm::StringRef name_backed, description_ba

[Lldb-commits] [PATCH] D159313: [lldb][NFCI] Remove use of ConstString in StructuredData

2023-09-14 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added inline comments.



Comment at: lldb/source/Utility/StructuredData.cpp:249-251
+  llvm::sort(sorted_entries, [&](const Entry &lhs, const Entry &rhs) -> bool {
+return lhs.first < rhs.first;
+  });

Oh I can remove this lambda too -- Let me update.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159313/new/

https://reviews.llvm.org/D159313

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


[Lldb-commits] [PATCH] D159313: [lldb][NFCI] Remove use of ConstString in StructuredData

2023-09-14 Thread Alex Langford via Phabricator via lldb-commits
bulbazord updated this revision to Diff 556798.
bulbazord added a comment.

Remove unneeded lambda


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159313/new/

https://reviews.llvm.org/D159313

Files:
  lldb/include/lldb/Utility/StructuredData.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Utility/StructuredData.cpp

Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -162,8 +162,18 @@
 
 void StructuredData::Dictionary::Serialize(json::OStream &s) const {
   s.objectBegin();
-  for (const auto &pair : m_dict) {
-s.attributeBegin(pair.first.GetStringRef());
+
+  // To ensure the output format is always stable, we sort the dictionary by key
+  // first.
+  using Entry = std::pair;
+  std::vector sorted_entries;
+  for (const auto &pair : m_dict)
+sorted_entries.push_back({pair.first(), pair.second});
+
+  llvm::sort(sorted_entries);
+
+  for (const auto &pair : sorted_entries) {
+s.attributeBegin(pair.first);
 pair.second->Serialize(s);
 s.attributeEnd();
   }
@@ -228,9 +238,20 @@
 
 void StructuredData::Dictionary::GetDescription(lldb_private::Stream &s) const {
   size_t indentation_level = s.GetIndentLevel();
-  for (auto iter = m_dict.begin(); iter != m_dict.end(); iter++) {
+
+  // To ensure the output format is always stable, we sort the dictionary by key
+  // first.
+  using Entry = std::pair;
+  std::vector sorted_entries;
+  for (const auto &pair : m_dict)
+sorted_entries.push_back({pair.first(), pair.second});
+
+  llvm::sort(sorted_entries);
+
+  for (auto iter = sorted_entries.begin(); iter != sorted_entries.end();
+   iter++) {
 // Sanitize.
-if (iter->first.IsNull() || iter->first.IsEmpty() || !iter->second)
+if (iter->first.empty() || !iter->second)
   continue;
 
 // Reset original indentation level.
@@ -238,7 +259,7 @@
 s.Indent();
 
 // Print key.
-s.Printf("%s:", iter->first.AsCString());
+s.Format("{0}:", iter->first);
 
 // Return to new line and increase indentation if value is record type.
 // Otherwise add spacing.
@@ -252,7 +273,7 @@
 
 // Print value and new line if now last pair.
 iter->second->GetDescription(s);
-if (std::next(iter) != m_dict.end())
+if (std::next(iter) != sorted_entries.end())
   s.EOL();
 
 // Reset indentation level if it was incremented previously.
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3859,11 +3859,10 @@
   s.Indent("Args:\n");
   s.SetIndentLevel(s.GetIndentLevel() + 4);
 
-  auto print_one_element = [&s](ConstString key,
+  auto print_one_element = [&s](llvm::StringRef key,
 StructuredData::Object *object) {
 s.Indent();
-s.Printf("%s : %s\n", key.GetCString(),
-  object->GetStringValue().str().c_str());
+s.Format("{0} : {1}\n", key, object->GetStringValue());
 return true;
   };
 
Index: lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
===
--- lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -224,7 +224,7 @@
   [&module_sp, new_style_source_remapping_dictionary,
original_DBGSourcePath_value,
do_truncate_remapping_names](
-  ConstString key,
+  llvm::StringRef key,
   StructuredData::Object *object) -> bool {
 if (object && object->GetAsString()) {
 
@@ -237,7 +237,7 @@
 DBGSourcePath = original_DBGSourcePath_value;
   }
   module_sp->GetSourceMappingList().Append(
-  key.GetStringRef(), DBGSourcePath, true);
+  key, DBGSourcePath, true);
   // With version 2 of DBGSourcePathRemapping, we
   // can chop off the last two filename parts
   // from the source remapping and get a more
@@ -245,7 +245,7 @@
   // Add this as another option in addition to
   // the full source path remap.
   if (do_truncate_remapping_names) {
-FileSpec build_path(key.AsCString());
+FileSpec 

[Lldb-commits] [PATCH] D159313: [lldb][NFCI] Remove use of ConstString in StructuredData

2023-09-14 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve accepted this revision.
fdeazeve added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159313/new/

https://reviews.llvm.org/D159313

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


[Lldb-commits] [lldb] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-14 Thread via lldb-commits


@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a
+`std::unique_ptr`, it's possible to move the contents of 
the

EugeneZelenko wrote:

Please use double back-ticks for language constructs. Same in other places.

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


[Lldb-commits] [lldb] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-14 Thread via lldb-commits


@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a

EugeneZelenko wrote:

Please synchronize first statement with Release Notes.

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


[Lldb-commits] [lldb] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-14 Thread via lldb-commits


@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a
+`std::unique_ptr`, it's possible to move the contents of 
the
+pointer rather than the pointer itself (ie `std::move(*p)` rather than

EugeneZelenko wrote:

`i.e.`?

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


[Lldb-commits] [lldb] a5a2a5a - [lldb][NFCI] Remove use of ConstString in StructuredData

2023-09-14 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-09-14T10:53:39-07:00
New Revision: a5a2a5a3eca06998d9f71186db2ce78ae2716022

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

LOG: [lldb][NFCI] Remove use of ConstString in StructuredData

The remaining use of ConstString in StructuredData is the Dictionary
class. Internally it's backed by a `std::map`.
I propose that we replace it with a `llvm::StringMap`.

Many StructuredData::Dictionary objects are ephemeral and only exist for
a short amount of time. Many of these Dictionaries are only produced
once and are never used again. That leaves us with a lot of string data
in the ConstString StringPool that is sitting there never to be used
again. Even if the same string is used many times for keys of different
Dictionary objects, that is something we can measure and adjust for
instead of assuming that every key may be reused at some point in the
future.

Quick comparisons of key data is likely not a concern with Dictionary,
but the use of `llvm::StringMap` means that lookups should be fast with
its hashing strategy.

Switching to a llvm::StringMap meant that the iteration order may be
different. To account for this when serializing/dumping the dictionary,
I added some code to sort the output by key before emitting anything.

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

Added: 


Modified: 
lldb/include/lldb/Utility/StructuredData.h
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/source/Target/Target.cpp
lldb/source/Utility/StructuredData.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/StructuredData.h 
b/lldb/include/lldb/Utility/StructuredData.h
index 4133c0e036a22a1..279238f9af76e01 100644
--- a/lldb/include/lldb/Utility/StructuredData.h
+++ b/lldb/include/lldb/Utility/StructuredData.h
@@ -9,10 +9,10 @@
 #ifndef LLDB_UTILITY_STRUCTUREDDATA_H
 #define LLDB_UTILITY_STRUCTUREDDATA_H
 
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/JSON.h"
 
-#include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/lldb-enumerations.h"
@@ -423,34 +423,25 @@ class StructuredData {
 
 size_t GetSize() const { return m_dict.size(); }
 
-void ForEach(std::function const
+void ForEach(std::function const
  &callback) const {
   for (const auto &pair : m_dict) {
-if (!callback(pair.first, pair.second.get()))
+if (!callback(pair.first(), pair.second.get()))
   break;
   }
 }
 
 ArraySP GetKeys() const {
   auto array_sp = std::make_shared();
-  collection::const_iterator iter;
-  for (iter = m_dict.begin(); iter != m_dict.end(); ++iter) {
-auto key_object_sp = std::make_shared();
-key_object_sp->SetValue(iter->first.AsCString());
+  for (auto iter = m_dict.begin(); iter != m_dict.end(); ++iter) {
+auto key_object_sp = std::make_shared(iter->first());
 array_sp->Push(key_object_sp);
   }
   return array_sp;
 }
 
 ObjectSP GetValueForKey(llvm::StringRef key) const {
-  ObjectSP value_sp;
-  if (!key.empty()) {
-ConstString key_cs(key);
-collection::const_iterator iter = m_dict.find(key_cs);
-if (iter != m_dict.end())
-  value_sp = iter->second;
-  }
-  return value_sp;
+  return m_dict.lookup(key);
 }
 
 bool GetValueForKeyAsBoolean(llvm::StringRef key, bool &result) const {
@@ -539,15 +530,10 @@ class StructuredData {
   return false;
 }
 
-bool HasKey(llvm::StringRef key) const {
-  ConstString key_cs(key);
-  collection::const_iterator search = m_dict.find(key_cs);
-  return search != m_dict.end();
-}
+bool HasKey(llvm::StringRef key) const { return m_dict.contains(key); }
 
 void AddItem(llvm::StringRef key, ObjectSP value_sp) {
-  ConstString key_cs(key);
-  m_dict[key_cs] = std::move(value_sp);
+  m_dict.insert_or_assign(key, std::move(value_sp));
 }
 
 template  void AddIntegerItem(llvm::StringRef key, T value) {
@@ -577,8 +563,7 @@ class StructuredData {
 void GetDescription(lldb_private::Stream &s) const override;
 
   protected:
-typedef std::map collection;
-collection m_dict;
+llvm::StringMap m_dict;
   };
 
   class Null : public Object {

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index ed617fe79fb476c..765902c7cf29b87 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/Platform

[Lldb-commits] [PATCH] D159313: [lldb][NFCI] Remove use of ConstString in StructuredData

2023-09-14 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa5a2a5a3eca0: [lldb][NFCI] Remove use of ConstString in 
StructuredData (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159313/new/

https://reviews.llvm.org/D159313

Files:
  lldb/include/lldb/Utility/StructuredData.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Utility/StructuredData.cpp

Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -162,8 +162,18 @@
 
 void StructuredData::Dictionary::Serialize(json::OStream &s) const {
   s.objectBegin();
-  for (const auto &pair : m_dict) {
-s.attributeBegin(pair.first.GetStringRef());
+
+  // To ensure the output format is always stable, we sort the dictionary by key
+  // first.
+  using Entry = std::pair;
+  std::vector sorted_entries;
+  for (const auto &pair : m_dict)
+sorted_entries.push_back({pair.first(), pair.second});
+
+  llvm::sort(sorted_entries);
+
+  for (const auto &pair : sorted_entries) {
+s.attributeBegin(pair.first);
 pair.second->Serialize(s);
 s.attributeEnd();
   }
@@ -228,9 +238,20 @@
 
 void StructuredData::Dictionary::GetDescription(lldb_private::Stream &s) const {
   size_t indentation_level = s.GetIndentLevel();
-  for (auto iter = m_dict.begin(); iter != m_dict.end(); iter++) {
+
+  // To ensure the output format is always stable, we sort the dictionary by key
+  // first.
+  using Entry = std::pair;
+  std::vector sorted_entries;
+  for (const auto &pair : m_dict)
+sorted_entries.push_back({pair.first(), pair.second});
+
+  llvm::sort(sorted_entries);
+
+  for (auto iter = sorted_entries.begin(); iter != sorted_entries.end();
+   iter++) {
 // Sanitize.
-if (iter->first.IsNull() || iter->first.IsEmpty() || !iter->second)
+if (iter->first.empty() || !iter->second)
   continue;
 
 // Reset original indentation level.
@@ -238,7 +259,7 @@
 s.Indent();
 
 // Print key.
-s.Printf("%s:", iter->first.AsCString());
+s.Format("{0}:", iter->first);
 
 // Return to new line and increase indentation if value is record type.
 // Otherwise add spacing.
@@ -252,7 +273,7 @@
 
 // Print value and new line if now last pair.
 iter->second->GetDescription(s);
-if (std::next(iter) != m_dict.end())
+if (std::next(iter) != sorted_entries.end())
   s.EOL();
 
 // Reset indentation level if it was incremented previously.
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -3859,11 +3859,10 @@
   s.Indent("Args:\n");
   s.SetIndentLevel(s.GetIndentLevel() + 4);
 
-  auto print_one_element = [&s](ConstString key,
+  auto print_one_element = [&s](llvm::StringRef key,
 StructuredData::Object *object) {
 s.Indent();
-s.Printf("%s : %s\n", key.GetCString(),
-  object->GetStringValue().str().c_str());
+s.Format("{0} : {1}\n", key, object->GetStringValue());
 return true;
   };
 
Index: lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
===
--- lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -224,7 +224,7 @@
   [&module_sp, new_style_source_remapping_dictionary,
original_DBGSourcePath_value,
do_truncate_remapping_names](
-  ConstString key,
+  llvm::StringRef key,
   StructuredData::Object *object) -> bool {
 if (object && object->GetAsString()) {
 
@@ -237,7 +237,7 @@
 DBGSourcePath = original_DBGSourcePath_value;
   }
   module_sp->GetSourceMappingList().Append(
-  key.GetStringRef(), DBGSourcePath, true);
+  key, DBGSourcePath, true);
   // With version 2 of DBGSourcePathRemapping, we
   // can chop off the last two filename parts
   // from the source remapping and get a more
@@ -245,7 +245,7 @@
   // Add this as another option in addition to
   // the full source path remap.
   if (do_truncate_remapping_names) {
-  

[Lldb-commits] [lldb] [lldb] Accept optional module in Value::ResolveValue (PR #66286)

2023-09-14 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

IIUC, this is an infrastructure change that fixes a test failure in swift 
branch. Augusto can speak to whether it's testable on `main`.

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


[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-14 Thread Greg Clayton via lldb-commits

clayborg wrote:

> > > Just to be clear, I need to find a solution for 
> > > SBTarget::CreateWatchpoint before this PR is ready to land. I'm inclined 
> > > towards adding a third bool parameter 'modify', but I'm not sure that's 
> > > the best choice.
> > 
> > 
> > Anytime we keep adding more options to an API call we have two options:
> 
> Yeah exactly, I wasn't restating the options as clearly in that last comment, 
> that's exactly what I meant. I can't think of other options we would want to 
> build in to a Watchpoint at creation time - but the argument for 
> SBWatchpointOptions is that ten-years-in-the-future-Jason may want another 
> flag.

The SBTarget::Launch(SBLaunchInfo) and SBTarget::Attach(SBAttachInfo) are some 
of the best example of using an options class. Breakpoints never tried to use 
an options class, we just kept adding new APIs which makes our API a bit 
messier, but we must keep APIs after they are added. So I would vote for the 
SBWatchpointOptions method. 

In the future we might have move complex ways to track watchpoints or want to 
track multiple address ranges with a single watchpoint? 
> 
> Probably the best thing is to look at the SBTarget BreakpointCreate* methods; 
> there are a dozen different methods for the different types of breakpoints 
> you might want to create (address breakpoint, file & line breakpoint, symbol 
> name breakpoint etc). An interesting aside is that none of the SB API methods 
> take a flag for whether breakpoint should be set using a software or hardware 
> breakpoint. Jonas added that feature to debugserver a few years ago for 
> x86_64 and aarch64, and I think he added the 
> `target.require-hardware-breakpoint` setting then. Otherwise the only way to 
> set a hardware breakpoint is through the commandline `breakpoint set` command.

Yeah, we probably didn't want to add yet another API call to just add access to 
the flag.
> 
> For a watchpoint, we only have `SBTarget::WatchAddress`, which takes and 
> address and size. If we were trying to follow the breakpoint API naming 
> style, we would add `SBTarget::WatchpointCreateByAddress`, 
> `SBTarget::WatchpointCreateByVariable`, and 
> `SBTarget::WatchpointCreateByExpression` methods. All of them would take the 
> same read/write/modify flags, which might be the strongest argument for an 
> options class even if it seems a little bit much for a few bools.

Yeah, it isn't too hard and it allows us great flexibility in the future. I 
have a patch coming for improving the saving of core files that allows users to 
specify a custom memory region list. I am creating a new options class named 
SBProcessSaveCoreOptions for the SBProcess::SaveCore(SBProcessSaveCoreOptions 
options) function as we can always add more flags to this class. 



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


[Lldb-commits] [lldb] [lldb] Accept optional module in Value::ResolveValue (PR #66286)

2023-09-14 Thread Augusto Noronha via lldb-commits

augusto2112 wrote:

@clayborg as Adrian said, this fixes a test failure downstream. I don't there's 
any visible change in behavior to test in main, unfortunately.

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


[Lldb-commits] [lldb] [lldb] Accept optional module in Value::ResolveValue (PR #66286)

2023-09-14 Thread Greg Clayton via lldb-commits

clayborg wrote:

> @clayborg as Adrian said, this fixes a test failure downstream. I don't 
> there's any visible change in behavior to test in main, unfortunately.

Gotcha. Let me guess: Swift? :-)


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


[Lldb-commits] [lldb] [lldb] Accept optional module in Value::ResolveValue (PR #66286)

2023-09-14 Thread Augusto Noronha via lldb-commits

augusto2112 wrote:

> > @clayborg as Adrian said, this fixes a test failure downstream. I don't 
> > there's any visible change in behavior to test in main, unfortunately.
> 
> Gotcha. Let me guess: Swift? :-)

Exactly :)

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

https://github.com/zhyty updated 
https://github.com/llvm/llvm-project/pull/66035:

>From d0538bc86ec02819ed9a24d06a2e7fc355447f4b Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Mon, 11 Sep 2023 17:17:13 -0700
Subject: [PATCH] Add `target modules dump separate-debug-info`

Summary:

Add a new command
```
target modules dump separate-debug-info [-j] [ [ [...]]]
```
or
```
image dump separate-debug-info [-j] [ [ [...]]]
```
(since `image` is an alias for `target modules`).

This lists the separate debug info files and their current status (loaded or 
not loaded) for the specified modules. This diff implements this command for 
mach-O files with OSO and ELF files with dwo.

Example dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo
0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo"
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo"
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example dwo with missing dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae error: unable to locate .dwo debug file 
"/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 
0x0014
0xbcc129959e76ff33 error: unable to locate .dwo debug file 
"/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 
0x003c

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"error": "unable to locate .dwo debug file 
\"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 
0x0014",
"loaded": false
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"error": "unable to locate .dwo debug file 
\"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 
0x003c",
"loaded": false
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example output with dwp:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo)
0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo)

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example oso on my Mac (after manipulating the mod times with `touch`):
```
(lldb) image dump separate-debug-info
Symbol file: /Users/toyang/workspace/scratch/a.out
Type: "oso"
Mod Time   Oso Path
-- -
0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o)
0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o)

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"loaded": true,
"oso_mod_time": 1692813416,
"oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)",
"so_file": "/Users/toyang/workspace/scratch/foo.cpp"
  },
  {
"loaded": true,
"oso_mod_time": 1692813416,
"oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)",
"so_file": "/Users/toyang/workspace/scratch/main.cpp"
  }
],
"symfile": "/Users/toyang/workspace/scratch/a.out",
"

[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

https://github.com/zhyty updated 
https://github.com/llvm/llvm-project/pull/66035:

>From 94b834f747fe66a50288e23fec2d00918f4fc8ef Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Mon, 11 Sep 2023 17:17:13 -0700
Subject: [PATCH] Add `target modules dump separate-debug-info`

Summary:

Add a new command
```
target modules dump separate-debug-info [-j] [ [ [...]]]
```
or
```
image dump separate-debug-info [-j] [ [ [...]]]
```
(since `image` is an alias for `target modules`).

This lists the separate debug info files and their current status (loaded or 
not loaded) for the specified modules. This diff implements this command for 
mach-O files with OSO and ELF files with dwo.

Example dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo
0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo"
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo"
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example dwo with missing dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae error: unable to locate .dwo debug file 
"/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 
0x0014
0xbcc129959e76ff33 error: unable to locate .dwo debug file 
"/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 
0x003c

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"error": "unable to locate .dwo debug file 
\"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 
0x0014",
"loaded": false
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"error": "unable to locate .dwo debug file 
\"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 
0x003c",
"loaded": false
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example output with dwp:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID Dwo Path
-- -
0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo)
0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo)

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 5620165179865774,
"dwo_name": "a-main.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
  },
  {
"comp_dir": "/home/toyang/workspace/dwo-scratch",
"dwo_id": 13601198072221073203,
"dwo_name": "a-foo.dwo",
"loaded": true,
"resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
  }
],
"symfile": "/home/toyang/workspace/dwo-scratch/a.out",
"type": "dwo"
  }
]
```

Example oso on my Mac (after manipulating the mod times with `touch`):
```
(lldb) image dump separate-debug-info
Symbol file: /Users/toyang/workspace/scratch/a.out
Type: "oso"
Mod Time   Oso Path
-- -
0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o)
0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o)

(lldb) image dump separate-debug-info -j
[
  {
"separate-debug-info-files": [
  {
"loaded": true,
"oso_mod_time": 1692813416,
"oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)",
"so_file": "/Users/toyang/workspace/scratch/foo.cpp"
  },
  {
"loaded": true,
"oso_mod_time": 1692813416,
"oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)",
"so_file": "/Users/toyang/workspace/scratch/main.cpp"
  }
],
"symfile": "/Users/toyang/workspace/scratch/a.out",
"

[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)

2023-09-14 Thread Tom Yang via lldb-commits

zhyty wrote:

Updated to show a more human-readable format @jimingham.
Also addressed comments by @DavidSpickett.

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


[Lldb-commits] [lldb] Revert "[lldb] Fix the way we set up the lldb modules infrastructure." (PR #66271)

2023-09-14 Thread Ben Barham via lldb-commits

bnbarham wrote:

Everything seems to work fine without it, so I'll put up that PR again without 
that check and close this PR.

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


[Lldb-commits] [lldb] Revert "[lldb] Fix the way we set up the lldb modules infrastructure." (PR #66271)

2023-09-14 Thread Ben Barham via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Commands] Show symbol change bit in SB API (PR #66144)

2023-09-14 Thread Chelsea Cassanova via lldb-commits


@@ -57,6 +57,29 @@ def test_add_dsym_with_dSYM_bundle(self):
 self.exe_name = "a.out"
 self.do_add_dsym_with_dSYM_bundle(self.exe_name)
 
+@no_debug_info_test
+def test_report_symbol_load(self):
+"""Test that when adding a symbol file, the eBroadcastBitSymbolsLoaded 
event gets broadcasted."""
+self.generate_main_cpp(version=1)
+self.build(debug_info="dsym")
+
+listener = lldb.SBListener("listener")
+listener.StartListeningForEventClass(
+self.dbg,
+lldb.SBTarget.GetBroadcasterClassName(),
+lldb.SBTarget.eBroadcastBitSymbolsLoaded,
+)
+
+# Add the dSYM
+self.do_add_dsym_with_success(self.exe_name)
+
+# Get the next event
+event = lldb.SBEvent()
+listener.WaitForEvent(1, event)
+
+# Check that the event is valid
+self.assertTrue(event.IsValid(), "Got a valid 
eBroadcastBitSymbolsLoaded event.")

chelcassanova wrote:

We can get the SBModules from the event using 
`SBTarget::GetModuleAtIndexFromEvent` and `SBTarget::GetNumModulesFromEvent`, 
unfortunately there's no way to get an SBModuleSpec from an SBModule.

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


[Lldb-commits] [lldb] [lldb][Commands] Show symbol change bit in SB API (PR #66144)

2023-09-14 Thread Chelsea Cassanova via lldb-commits

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

>From 8754d93a72bdff94f95f991d9bf1112e5f9fe692 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Tue, 12 Sep 2023 13:49:50 -0700
Subject: [PATCH 1/4] [lldb][Commands] Show symbol change bit in SB API

This exposes the `eBroadcastBitSymbolChange` bit to the SB
API to show when a symbol change event has been broadcast as
this wasn't being done before. Also refactors `eBroadcastSymbolChange`
to `eBroadcastBitSymbolChange` to match the naming convention
for other event bits used in the debugger.
---
 lldb/include/lldb/API/SBDebugger.h|  2 ++
 lldb/include/lldb/Core/Debugger.h |  2 +-
 lldb/source/Commands/CommandObjectTarget.cpp  |  4 
 lldb/source/Core/Debugger.cpp |  4 ++--
 .../add-dsym/uuid/TestAddDsymCommand.py   | 24 +++
 5 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h 
b/lldb/include/lldb/API/SBDebugger.h
index 29cf2c16fad4bd7..abb08e93d197a18 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -13,6 +13,7 @@
 
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBStructuredData.h"
 
 namespace lldb_private {
 class CommandPluginInterfaceImplementation;
@@ -46,6 +47,7 @@ class LLDB_API SBDebugger {
   eBroadcastBitProgress = (1 << 0),
   eBroadcastBitWarning = (1 << 1),
   eBroadcastBitError = (1 << 2),
+  eBroadcastBitSymbolChange = (1 << 3),
   };
 
   SBDebugger();
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 5532cace606bfed..6cdf1a183b18e54 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -83,7 +83,7 @@ class Debugger : public 
std::enable_shared_from_this,
 eBroadcastBitProgress = (1 << 0),
 eBroadcastBitWarning = (1 << 1),
 eBroadcastBitError = (1 << 2),
-eBroadcastSymbolChange = (1 << 3),
+eBroadcastBitSymbolChange = (1 << 3),
   };
 
   using DebuggerList = std::vector;
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 3e024ff91b382d7..8051b3826294ab3 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -4504,6 +4504,10 @@ class CommandObjectTargetSymbolsAdd : public 
CommandObjectParsed {
   if (process)
 process->Flush();
 }
+
+if (result.Succeeded())
+  Debugger::ReportSymbolChange(module_spec);
+
 return result.Succeeded();
   }
 
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 7ec1efc64fe9383..924741f45040bf0 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1536,7 +1536,7 @@ void Debugger::ReportSymbolChange(const ModuleSpec 
&module_spec) {
 std::lock_guard guard(*g_debugger_list_mutex_ptr);
 for (DebuggerSP debugger_sp : *g_debugger_list_ptr) {
   EventSP event_sp = std::make_shared(
-  Debugger::eBroadcastSymbolChange,
+  Debugger::eBroadcastBitSymbolChange,
   new SymbolChangeEventData(debugger_sp, module_spec));
   debugger_sp->GetBroadcaster().BroadcastEvent(event_sp);
 }
@@ -1844,7 +1844,7 @@ lldb::thread_result_t Debugger::DefaultEventHandler() {
 
   listener_sp->StartListeningForEvents(
   &m_broadcaster, eBroadcastBitProgress | eBroadcastBitWarning |
-  eBroadcastBitError | eBroadcastSymbolChange);
+  eBroadcastBitError | eBroadcastBitSymbolChange);
 
   // Let the thread that spawned us know that we have started up and that we
   // are now listening to all required events so no events get missed
diff --git a/lldb/test/API/commands/add-dsym/uuid/TestAddDsymCommand.py 
b/lldb/test/API/commands/add-dsym/uuid/TestAddDsymCommand.py
index d16ca32d79e6808..01b7d41f85c1185 100644
--- a/lldb/test/API/commands/add-dsym/uuid/TestAddDsymCommand.py
+++ b/lldb/test/API/commands/add-dsym/uuid/TestAddDsymCommand.py
@@ -57,6 +57,30 @@ def test_add_dsym_with_dSYM_bundle(self):
 self.exe_name = "a.out"
 self.do_add_dsym_with_dSYM_bundle(self.exe_name)
 
+@no_debug_info_test
+def test_report_symbol_change(self):
+"""Test that when adding a symbol file, the eBroadcastBitSymbolChange 
event gets broadcasted."""
+self.generate_main_cpp(version=1)
+self.build(debug_info="dsym")
+
+self.exe_name = "a.out"
+
+# Get the broadcaster and listen for the symbol change event
+self.broadcaster = self.dbg.GetBroadcaster()
+self.listener = lldbutil.start_listening_from(
+self.broadcaster, lldb.SBDebugger.eBroadcastBitSymbolChange
+)
+
+# Add the dSYM
+self.do_add_dsym_with_success(self.exe_name)
+
+# Get the next event
+event = lldbutil.fetch_next_event(self, self.listener,

[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)

2023-09-14 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:


> ```
>SBWatchpoint SBTarget::WatchpointCreateByAddress(addr_t address, size_t 
> size, uint32_t access_flags, SBError &error);
> ```
> 
> with `eWatchpointAccess{Read,Write,Modify}` flags defined.

@bulbazord what do you think about this suggestion?  Would you still prefer an 
Options class?

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


  1   2   >