[Lldb-commits] [lldb] 6e3572c - [lldb] Use llvm::erase_if (NFC)

2023-10-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-20T00:20:30-07:00
New Revision: 6e3572ccd896573a4eb32e3fa1c874a3d947b143

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

LOG: [lldb] Use llvm::erase_if (NFC)

Added: 


Modified: 
lldb/source/Utility/Diagnostics.cpp

Removed: 




diff  --git a/lldb/source/Utility/Diagnostics.cpp 
b/lldb/source/Utility/Diagnostics.cpp
index 1632ae0f9dfd31d..b2a08165dd6ca21 100644
--- a/lldb/source/Utility/Diagnostics.cpp
+++ b/lldb/source/Utility/Diagnostics.cpp
@@ -52,10 +52,8 @@ Diagnostics::CallbackID Diagnostics::AddCallback(Callback 
callback) {
 
 void Diagnostics::RemoveCallback(CallbackID id) {
   std::lock_guard guard(m_callbacks_mutex);
-  m_callbacks.erase(
-  std::remove_if(m_callbacks.begin(), m_callbacks.end(),
- [id](const CallbackEntry &e) { return e.id == id; }),
-  m_callbacks.end());
+  llvm::erase_if(m_callbacks,
+ [id](const CallbackEntry &e) { return e.id == id; });
 }
 
 bool Diagnostics::Dump(raw_ostream &stream) {



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


[Lldb-commits] [lldb] [lldb][AArch64] Read mte_ctrl register from core files (PR #69689)

2023-10-20 Thread David Spickett via lldb-commits

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

This register reports the configuration of the AArch64 Linux tagged address 
ABI, part of which is the memory tagging (MTE) settings.

It will always be present in core files because even without MTE, there are 
parts of the tagged address ABI that can be configured (these parts use the Top 
Byte Ignore feature).

I missed adding this when I previously worked on MTE support. Until now you 
could read memory tags from a core file but not this register.

>From 355e7950a6d07e0c8c44bc2652072148b977d8d1 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 9 Oct 2023 09:58:56 +0100
Subject: [PATCH] [lldb][AArch64] Read mte_ctrl register from core files

This register reports the configuration of the AArch64 Linux
tagged address ABI, part of which is the memory tagging (MTE)
settings.

It will always be present in core files because even without
MTE, there are parts of the tagged address ABI that can be
configured (these parts use the Top Byte Ignore feature).

I missed adding this when I previously worked on MTE support.
Until now you could read memory tags from a core file but
not this register.
---
 .../Utility/RegisterContextPOSIX_arm64.cpp   |  4 
 .../Process/Utility/RegisterContextPOSIX_arm64.h |  1 +
 .../elf-core/RegisterContextPOSIXCore_arm64.cpp  | 12 
 .../elf-core/RegisterContextPOSIXCore_arm64.h|  1 +
 .../Plugins/Process/elf-core/RegisterUtilities.h |  5 +
 .../TestAArch64LinuxMTEMemoryTagCoreFile.py  | 16 
 llvm/docs/ReleaseNotes.rst   |  1 +
 7 files changed, 40 insertions(+)

diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
index b57538e185f71fa..50e25568f2ae012 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
@@ -55,6 +55,10 @@ bool RegisterContextPOSIX_arm64::IsTLS(unsigned reg) const {
   return m_register_info_up->IsTLSReg(reg);
 }
 
+bool RegisterContextPOSIX_arm64::IsMTE(unsigned reg) const {
+  return m_register_info_up->IsMTEReg(reg);
+}
+
 RegisterContextPOSIX_arm64::RegisterContextPOSIX_arm64(
 lldb_private::Thread &thread,
 std::unique_ptr register_info)
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
index aad95f33735f178..b1226b25b4be107 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
@@ -57,6 +57,7 @@ class RegisterContextPOSIX_arm64 : public 
lldb_private::RegisterContext {
   bool IsPAuth(unsigned reg) const;
   bool IsTLS(unsigned reg) const;
   bool IsSME(unsigned reg) const;
+  bool IsMTE(unsigned reg) const;
 
   bool IsSVEZ(unsigned reg) const { return m_register_info_up->IsSVEZReg(reg); 
}
   bool IsSVEP(unsigned reg) const { return m_register_info_up->IsSVEPReg(reg); 
}
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
index 6f6c6d073939a61..790511eea14a586 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -50,6 +50,10 @@ RegisterContextCorePOSIX_arm64::Create(Thread &thread, const 
ArchSpec &arch,
   if (za_data.GetByteSize() >= sizeof(sve::user_za_header))
 opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskZA);
 
+  DataExtractor mte_data = getRegset(notes, arch.GetTriple(), 
AARCH64_MTE_Desc);
+  if (mte_data.GetByteSize() >= sizeof(uint64_t))
+opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
+
   auto register_info_up =
   std::make_unique(arch, opt_regsets);
   return std::unique_ptr(
@@ -91,6 +95,9 @@ 
RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(
   if (m_register_info_up->IsZAEnabled())
 m_za_data = getRegset(notes, target_triple, AARCH64_ZA_Desc);
 
+  if (m_register_info_up->IsMTEEnabled())
+m_mte_data = getRegset(notes, target_triple, AARCH64_MTE_Desc);
+
   ConfigureRegisterContext();
 }
 
@@ -282,6 +289,11 @@ bool RegisterContextCorePOSIX_arm64::ReadRegister(const 
RegisterInfo *reg_info,
 assert(offset < m_tls_data.GetByteSize());
 value.SetFromMemoryData(*reg_info, m_tls_data.GetDataStart() + offset,
 reg_info->byte_size, lldb::eByteOrderLittle, 
error);
+  } else if (IsMTE(reg)) {
+offset = reg_info->byte_offset - m_register_info_up->GetMTEOffset();
+assert(offset < m_mte_data.GetByteSize());
+value.SetFromMemoryData(*reg_info, m_mte_data.GetDataStart() + offset,
+reg_info->byte_size, lldb::eByteOrderLittle, 
error);
   } else if (IsSME(reg)) {
 

[Lldb-commits] [lldb] [lldb][AArch64] Read mte_ctrl register from core files (PR #69689)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

This register reports the configuration of the AArch64 Linux tagged address 
ABI, part of which is the memory tagging (MTE) settings.

It will always be present in core files because even without MTE, there are 
parts of the tagged address ABI that can be configured (these parts use the Top 
Byte Ignore feature).

I missed adding this when I previously worked on MTE support. Until now you 
could read memory tags from a core file but not this register.

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


7 Files Affected:

- (modified) lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp 
(+4) 
- (modified) lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h 
(+1) 
- (modified) 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp (+12) 
- (modified) 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h (+1) 
- (modified) lldb/source/Plugins/Process/elf-core/RegisterUtilities.h (+5) 
- (modified) 
lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py
 (+16) 
- (modified) llvm/docs/ReleaseNotes.rst (+1) 


``diff
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
index b57538e185f71fa..50e25568f2ae012 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
@@ -55,6 +55,10 @@ bool RegisterContextPOSIX_arm64::IsTLS(unsigned reg) const {
   return m_register_info_up->IsTLSReg(reg);
 }
 
+bool RegisterContextPOSIX_arm64::IsMTE(unsigned reg) const {
+  return m_register_info_up->IsMTEReg(reg);
+}
+
 RegisterContextPOSIX_arm64::RegisterContextPOSIX_arm64(
 lldb_private::Thread &thread,
 std::unique_ptr register_info)
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
index aad95f33735f178..b1226b25b4be107 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
@@ -57,6 +57,7 @@ class RegisterContextPOSIX_arm64 : public 
lldb_private::RegisterContext {
   bool IsPAuth(unsigned reg) const;
   bool IsTLS(unsigned reg) const;
   bool IsSME(unsigned reg) const;
+  bool IsMTE(unsigned reg) const;
 
   bool IsSVEZ(unsigned reg) const { return m_register_info_up->IsSVEZReg(reg); 
}
   bool IsSVEP(unsigned reg) const { return m_register_info_up->IsSVEPReg(reg); 
}
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
index 6f6c6d073939a61..790511eea14a586 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
@@ -50,6 +50,10 @@ RegisterContextCorePOSIX_arm64::Create(Thread &thread, const 
ArchSpec &arch,
   if (za_data.GetByteSize() >= sizeof(sve::user_za_header))
 opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskZA);
 
+  DataExtractor mte_data = getRegset(notes, arch.GetTriple(), 
AARCH64_MTE_Desc);
+  if (mte_data.GetByteSize() >= sizeof(uint64_t))
+opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
+
   auto register_info_up =
   std::make_unique(arch, opt_regsets);
   return std::unique_ptr(
@@ -91,6 +95,9 @@ 
RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(
   if (m_register_info_up->IsZAEnabled())
 m_za_data = getRegset(notes, target_triple, AARCH64_ZA_Desc);
 
+  if (m_register_info_up->IsMTEEnabled())
+m_mte_data = getRegset(notes, target_triple, AARCH64_MTE_Desc);
+
   ConfigureRegisterContext();
 }
 
@@ -282,6 +289,11 @@ bool RegisterContextCorePOSIX_arm64::ReadRegister(const 
RegisterInfo *reg_info,
 assert(offset < m_tls_data.GetByteSize());
 value.SetFromMemoryData(*reg_info, m_tls_data.GetDataStart() + offset,
 reg_info->byte_size, lldb::eByteOrderLittle, 
error);
+  } else if (IsMTE(reg)) {
+offset = reg_info->byte_offset - m_register_info_up->GetMTEOffset();
+assert(offset < m_mte_data.GetByteSize());
+value.SetFromMemoryData(*reg_info, m_mte_data.GetDataStart() + offset,
+reg_info->byte_size, lldb::eByteOrderLittle, 
error);
   } else if (IsSME(reg)) {
 // If you had SME in the process, active or otherwise, there will at least
 // be a ZA header. No header, no SME at all.
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
index 73b65a4174290c1..86bdeb426ab3fe0 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
+++ b/lldb/source/Plugins/Pr

[Lldb-commits] [lldb] [lldb] Remove more references to lldb-vscode (PR #69696)

2023-10-20 Thread David Spickett via lldb-commits

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

There are some uses of "vscode" in
`lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py` where I'm 
not sure if it's referring to the adapter or VS Code itself, so those remain.

>From f84ecb7a5054c3af278c2fb5504e7f25d229a6e2 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Fri, 20 Oct 2023 08:02:15 +
Subject: [PATCH] [lldb] Remove more references to lldb-vscode

There are some uses of "vscode" in
`lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py`
where I'm not sure if it's referring to the adaptor or VS Code itself,
so those remain.
---
 lldb/CodeOwners.rst|  4 ++--
 .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 10 +-
 lldb/test/API/lit.cfg.py   |  2 +-
 lldb/test/CMakeLists.txt   |  4 ++--
 lldb/tools/lldb-dap/lldb-dap.cpp   | 10 +-
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lldb/CodeOwners.rst b/lldb/CodeOwners.rst
index 5635f186fad391f..52e3e550523e5b8 100644
--- a/lldb/CodeOwners.rst
+++ b/lldb/CodeOwners.rst
@@ -234,8 +234,8 @@ lldb-server
 | Pavel Labath
 | pavel\@labath.sk (email), labath (Phabricator), labath (GitHub), labath 
(Discourse)
 
-lldb-vscode
-~~~
+lldb-dap
+
 | Greg Clayton
 | gclayton\@fb.com (email), clayborg (Phabricator), clayborg (GitHub), 
clayborg (Discourse)
 
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index ca11f34be450c9a..8c645e0fdca72f8 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -80,7 +80,7 @@ def read_packet(f, verbose=False, trace_file=None):
 # Decode the JSON bytes into a python dictionary
 return json.loads(json_str)
 
-raise Exception("unexpected malformed message from lldb-vscode: " + line)
+raise Exception("unexpected malformed message from lldb-dap: " + line)
 
 
 def packet_type_is(packet, packet_type):
@@ -104,7 +104,7 @@ def read_packet_thread(vs_comm, log_file):
 packet = read_packet(vs_comm.recv, trace_file=vs_comm.trace_file)
 # `packet` will be `None` on EOF. We want to pass it down to
 # handle_recv_packet anyway so the main thread can handle 
unexpected
-# termination of lldb-vscode and stop waiting for new packets.
+# termination of lldb-dap and stop waiting for new packets.
 done = not vs_comm.handle_recv_packet(packet)
 finally:
 dump_dap_log(log_file)
@@ -1172,7 +1172,7 @@ def main():
 dest="debuggerRoot",
 default=None,
 help=(
-"Set the working directory for lldb-vscode for any object files "
+"Set the working directory for lldb-dap for any object files "
 "with relative paths in the Mach-o debug map."
 ),
 )
@@ -1203,7 +1203,7 @@ def main():
 action="store_true",
 dest="sourceInitFile",
 default=False,
-help="Whether lldb-vscode should source .lldbinit file or not",
+help="Whether lldb-dap should source .lldbinit file or not",
 )
 
 parser.add_option(
@@ -1360,7 +1360,7 @@ def main():
 print(
 "error: must either specify a path to a Visual Studio Code "
 "Debug Adaptor vscode executable path using the --vscode "
-"option, or a port to attach to for an existing lldb-vscode "
+"option, or a port to attach to for an existing lldb-dap "
 "using the --port option"
 )
 return
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index c306c5b3c0ec0c6..8b35e8b2a217cf7 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -248,7 +248,7 @@ def delete_module_cache(path):
 "lldb-repro-capture" in config.available_features
 or "lldb-repro-replay" in config.available_features
 ):
-dotest_cmd += ["--skip-category=lldb-vscode", "--skip-category=std-module"]
+dotest_cmd += ["--skip-category=lldb-dap", "--skip-category=std-module"]
 
 if "lldb-simulator-ios" in config.available_features:
 dotest_cmd += ["--apple-sdk", "iphonesimulator", "--platform-name", 
"ios-simulator"]
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index f215704db12c82d..59f87fe0662b207 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -114,8 +114,8 @@ if(TARGET lldb-server)
   add_lldb_test_dependency(lldb-server)
 endif()
 
-if(TARGET lldb-vscode)
-  add_lldb_test_dependency(lldb-vscode)
+if(TARGET lldb-dap)
+  add_lldb_test_dependency(lldb-dap)
 endif()
 
 if(TARGET liblldb)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index d8d81647e81008a..a218e85664b59

[Lldb-commits] [lldb] [lldb] Remove more references to lldb-vscode (PR #69696)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

There are some uses of "vscode" in
`lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py` where I'm 
not sure if it's referring to the adapter or VS Code itself, so those remain.

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


5 Files Affected:

- (modified) lldb/CodeOwners.rst (+2-2) 
- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
(+5-5) 
- (modified) lldb/test/API/lit.cfg.py (+1-1) 
- (modified) lldb/test/CMakeLists.txt (+2-2) 
- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+5-5) 


``diff
diff --git a/lldb/CodeOwners.rst b/lldb/CodeOwners.rst
index 5635f186fad391f..52e3e550523e5b8 100644
--- a/lldb/CodeOwners.rst
+++ b/lldb/CodeOwners.rst
@@ -234,8 +234,8 @@ lldb-server
 | Pavel Labath
 | pavel\@labath.sk (email), labath (Phabricator), labath (GitHub), labath 
(Discourse)
 
-lldb-vscode
-~~~
+lldb-dap
+
 | Greg Clayton
 | gclayton\@fb.com (email), clayborg (Phabricator), clayborg (GitHub), 
clayborg (Discourse)
 
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index ca11f34be450c9a..8c645e0fdca72f8 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -80,7 +80,7 @@ def read_packet(f, verbose=False, trace_file=None):
 # Decode the JSON bytes into a python dictionary
 return json.loads(json_str)
 
-raise Exception("unexpected malformed message from lldb-vscode: " + line)
+raise Exception("unexpected malformed message from lldb-dap: " + line)
 
 
 def packet_type_is(packet, packet_type):
@@ -104,7 +104,7 @@ def read_packet_thread(vs_comm, log_file):
 packet = read_packet(vs_comm.recv, trace_file=vs_comm.trace_file)
 # `packet` will be `None` on EOF. We want to pass it down to
 # handle_recv_packet anyway so the main thread can handle 
unexpected
-# termination of lldb-vscode and stop waiting for new packets.
+# termination of lldb-dap and stop waiting for new packets.
 done = not vs_comm.handle_recv_packet(packet)
 finally:
 dump_dap_log(log_file)
@@ -1172,7 +1172,7 @@ def main():
 dest="debuggerRoot",
 default=None,
 help=(
-"Set the working directory for lldb-vscode for any object files "
+"Set the working directory for lldb-dap for any object files "
 "with relative paths in the Mach-o debug map."
 ),
 )
@@ -1203,7 +1203,7 @@ def main():
 action="store_true",
 dest="sourceInitFile",
 default=False,
-help="Whether lldb-vscode should source .lldbinit file or not",
+help="Whether lldb-dap should source .lldbinit file or not",
 )
 
 parser.add_option(
@@ -1360,7 +1360,7 @@ def main():
 print(
 "error: must either specify a path to a Visual Studio Code "
 "Debug Adaptor vscode executable path using the --vscode "
-"option, or a port to attach to for an existing lldb-vscode "
+"option, or a port to attach to for an existing lldb-dap "
 "using the --port option"
 )
 return
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index c306c5b3c0ec0c6..8b35e8b2a217cf7 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -248,7 +248,7 @@ def delete_module_cache(path):
 "lldb-repro-capture" in config.available_features
 or "lldb-repro-replay" in config.available_features
 ):
-dotest_cmd += ["--skip-category=lldb-vscode", "--skip-category=std-module"]
+dotest_cmd += ["--skip-category=lldb-dap", "--skip-category=std-module"]
 
 if "lldb-simulator-ios" in config.available_features:
 dotest_cmd += ["--apple-sdk", "iphonesimulator", "--platform-name", 
"ios-simulator"]
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index f215704db12c82d..59f87fe0662b207 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -114,8 +114,8 @@ if(TARGET lldb-server)
   add_lldb_test_dependency(lldb-server)
 endif()
 
-if(TARGET lldb-vscode)
-  add_lldb_test_dependency(lldb-vscode)
+if(TARGET lldb-dap)
+  add_lldb_test_dependency(lldb-dap)
 endif()
 
 if(TARGET liblldb)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index d8d81647e81008a..a218e85664b59e6 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -97,9 +97,9 @@ static constexpr llvm::opt::OptTable::Info InfoTable[] = {
 #include "Options.inc"
 #undef OPTION
 };
-class LLDBVSCodeOptTable : public llvm::opt::GenericOptTable {
+class LLDBDAPOptTable : public llvm::opt::GenericOptTable {
 public:
-  LLDBVSCodeOptTable() : llvm::opt::GenericOptTable(In

[Lldb-commits] [lldb] [lldb][AArch64] Add release notes and documentation for SME (PR #66767)

2023-10-20 Thread Omair Javaid via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][AArch64] Add isAArch64SMEFA64 check to SME testing (PR #68094)

2023-10-20 Thread Omair Javaid via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][AArch64] Add release notes and documentation for SME (PR #66767)

2023-10-20 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] bb82695 - [lldb][AArch64] Add release notes and documentation for SME (#66767)

2023-10-20 Thread via lldb-commits

Author: David Spickett
Date: 2023-10-20T14:06:06+01:00
New Revision: bb826951dcf35628cf73235e0e96a0d8ac9c0c49

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

LOG: [lldb][AArch64] Add release notes and documentation for SME (#66767)

This adds a release note for all the SME support now in LLDB and a page
where I have documented the user experience (for want of a better term)
when using SVE and SME.

This includes things like which mode transitions can or cannot be
triggered from within LLDB. I hope this will serve to A: document what
I've implemented and B: be a user's guide to these extensions.

(though it is not a design document, read the commits and code for that
sort of detail)

Added: 
lldb/docs/use/aarch64-linux.rst

Modified: 
lldb/docs/index.rst
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 2eb57cefbd883ea..2fff25b27b974ea 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -125,6 +125,7 @@ interesting areas to contribute to lldb.
use/qemu-testing
use/intel_pt
use/ondemand
+   use/aarch64-linux
use/troubleshooting
use/links
Man Page 

diff  --git a/lldb/docs/use/aarch64-linux.rst b/lldb/docs/use/aarch64-linux.rst
new file mode 100644
index 000..707087a9bd72ea2
--- /dev/null
+++ b/lldb/docs/use/aarch64-linux.rst
@@ -0,0 +1,204 @@
+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 in kernel code or applications, you may see "vq" which is the vector
+length in quadwords (16 bytes). Where you see "vl", it is in bytes.
+
+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.
+
+Changing the Vector Length
+..
+
+The ``vg`` register can be written during a debug session. 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.
+
+You should not assume that SVE state after changing the vector length is in any
+way the same as it was previously. Whether that is done from within the
+debuggee, or by LLDB. If you need to change the vector length, do so before a
+function's first use of SVE.
+
+Z Register Presentation
+...
+
+LLDB makes no attempt to predict how SVE Z registers will be used. Since LLDB
+does not know what sort of elements future instructions will interpret the
+register as. It therefore does not change the visualisation of the register
+and always defaults to showing a vector of byte sized elements.
+
+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 

[Lldb-commits] [lldb] [lldb][docs] Update contributing links (PR #69726)

2023-10-20 Thread David Spickett via lldb-commits

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

Patches now go to PRs, mention the Discord server as well as the forum.

>From 08c246316c2daa7dde701d5c4beb1de77021520a Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Fri, 20 Oct 2023 14:45:06 +0100
Subject: [PATCH] [lldb][docs] Update contributing links

Patches now go to PRs, mention the Discord server as well
as the forum.
---
 lldb/docs/index.rst | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 2fff25b27b974ea..b8715c066599381 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -102,10 +102,13 @@ Additionally it builds:
 See the :doc:`LLDB Build Page ` for build instructions.
 
 Discussions about LLDB should go to the `LLDB forum
-`__. Commit
+`__ or the ``lldb`` channel on
+the LLVM Discord server.
+
+For contributions follow the
+`LLVM contribution process `__. Commit
 messages are automatically sent to the `lldb-commits
-`__ mailing list, and
-this is also the preferred mailing list for patch submissions.
+`__ mailing list.
 
 See the :doc:`Projects page ` if you are looking for some
 interesting areas to contribute to 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] Update contributing links (PR #69726)

2023-10-20 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I thought I saw that the mailing lists would be closed but I must have imagined 
it, so I left them in.

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


[Lldb-commits] [lldb] [lldb][docs] Update contributing links (PR #69726)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

Patches now go to PRs, mention the Discord server as well as the forum.

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


1 Files Affected:

- (modified) lldb/docs/index.rst (+6-3) 


``diff
diff --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 2fff25b27b974ea..b8715c066599381 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -102,10 +102,13 @@ Additionally it builds:
 See the :doc:`LLDB Build Page ` for build instructions.
 
 Discussions about LLDB should go to the `LLDB forum
-`__. Commit
+`__ or the ``lldb`` channel on
+the LLVM Discord server.
+
+For contributions follow the
+`LLVM contribution process `__. Commit
 messages are automatically sent to the `lldb-commits
-`__ mailing list, and
-this is also the preferred mailing list for patch submissions.
+`__ mailing list.
 
 See the :doc:`Projects page ` if you are looking for some
 interesting areas to contribute to lldb.

``




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


[Lldb-commits] [lldb] [lldb] Remove more references to lldb-vscode (PR #69696)

2023-10-20 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo approved this pull request.


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


[Lldb-commits] [lldb] 2a32afd - [lldb] Remove more references to lldb-vscode (#69696)

2023-10-20 Thread via lldb-commits

Author: David Spickett
Date: 2023-10-20T15:08:37+01:00
New Revision: 2a32afddf5594b7ca8c6aa67a5731612134f29f9

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

LOG: [lldb] Remove more references to lldb-vscode (#69696)

There are some uses of "vscode" in
`lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py` where
I'm not sure if it's referring to the adapter or VS Code itself, so
those remain.

Added: 


Modified: 
lldb/CodeOwners.rst
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
lldb/test/API/lit.cfg.py
lldb/test/CMakeLists.txt
lldb/tools/lldb-dap/lldb-dap.cpp

Removed: 




diff  --git a/lldb/CodeOwners.rst b/lldb/CodeOwners.rst
index 5635f186fad391f..52e3e550523e5b8 100644
--- a/lldb/CodeOwners.rst
+++ b/lldb/CodeOwners.rst
@@ -234,8 +234,8 @@ lldb-server
 | Pavel Labath
 | pavel\@labath.sk (email), labath (Phabricator), labath (GitHub), labath 
(Discourse)
 
-lldb-vscode
-~~~
+lldb-dap
+
 | Greg Clayton
 | gclayton\@fb.com (email), clayborg (Phabricator), clayborg (GitHub), 
clayborg (Discourse)
 

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index ca11f34be450c9a..8c645e0fdca72f8 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -80,7 +80,7 @@ def read_packet(f, verbose=False, trace_file=None):
 # Decode the JSON bytes into a python dictionary
 return json.loads(json_str)
 
-raise Exception("unexpected malformed message from lldb-vscode: " + line)
+raise Exception("unexpected malformed message from lldb-dap: " + line)
 
 
 def packet_type_is(packet, packet_type):
@@ -104,7 +104,7 @@ def read_packet_thread(vs_comm, log_file):
 packet = read_packet(vs_comm.recv, trace_file=vs_comm.trace_file)
 # `packet` will be `None` on EOF. We want to pass it down to
 # handle_recv_packet anyway so the main thread can handle 
unexpected
-# termination of lldb-vscode and stop waiting for new packets.
+# termination of lldb-dap and stop waiting for new packets.
 done = not vs_comm.handle_recv_packet(packet)
 finally:
 dump_dap_log(log_file)
@@ -1172,7 +1172,7 @@ def main():
 dest="debuggerRoot",
 default=None,
 help=(
-"Set the working directory for lldb-vscode for any object files "
+"Set the working directory for lldb-dap for any object files "
 "with relative paths in the Mach-o debug map."
 ),
 )
@@ -1203,7 +1203,7 @@ def main():
 action="store_true",
 dest="sourceInitFile",
 default=False,
-help="Whether lldb-vscode should source .lldbinit file or not",
+help="Whether lldb-dap should source .lldbinit file or not",
 )
 
 parser.add_option(
@@ -1360,7 +1360,7 @@ def main():
 print(
 "error: must either specify a path to a Visual Studio Code "
 "Debug Adaptor vscode executable path using the --vscode "
-"option, or a port to attach to for an existing lldb-vscode "
+"option, or a port to attach to for an existing lldb-dap "
 "using the --port option"
 )
 return

diff  --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index c306c5b3c0ec0c6..8b35e8b2a217cf7 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -248,7 +248,7 @@ def delete_module_cache(path):
 "lldb-repro-capture" in config.available_features
 or "lldb-repro-replay" in config.available_features
 ):
-dotest_cmd += ["--skip-category=lldb-vscode", "--skip-category=std-module"]
+dotest_cmd += ["--skip-category=lldb-dap", "--skip-category=std-module"]
 
 if "lldb-simulator-ios" in config.available_features:
 dotest_cmd += ["--apple-sdk", "iphonesimulator", "--platform-name", 
"ios-simulator"]

diff  --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index f215704db12c82d..59f87fe0662b207 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -114,8 +114,8 @@ if(TARGET lldb-server)
   add_lldb_test_dependency(lldb-server)
 endif()
 
-if(TARGET lldb-vscode)
-  add_lldb_test_dependency(lldb-vscode)
+if(TARGET lldb-dap)
+  add_lldb_test_dependency(lldb-dap)
 endif()
 
 if(TARGET liblldb)

diff  --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/lldb-dap.cpp
index d8d81647e81008a..a218e85664b59e6 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -97,9 +97,9 @@ static constexpr llvm::opt::OptTable::Info InfoTable[] = {
 #include "Options.inc"
 #u

[Lldb-commits] [lldb] [lldb] Remove more references to lldb-vscode (PR #69696)

2023-10-20 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][docs] Update contributing links (PR #69726)

2023-10-20 Thread Med Ismail Bennani via lldb-commits


@@ -102,10 +102,13 @@ Additionally it builds:
 See the :doc:`LLDB Build Page ` for build instructions.
 
 Discussions about LLDB should go to the `LLDB forum
-`__. Commit
+`__ or the ``lldb`` channel on
+the LLVM Discord server.

medismailben wrote:

Lets add the link to LLVM Discord server (https://discord.gg/HexWwB5z)

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


[Lldb-commits] [lldb] [Reland] Detect against invalid variant index for LibStdC++ std::variant data formatters (PR #69614)

2023-10-20 Thread Alex Langford via lldb-commits


@@ -7183,7 +7183,8 @@ GetNthTemplateArgument(const 
clang::ClassTemplateSpecializationDecl *decl,
   // (including the ones preceding the parameter pack).
   const auto &pack = args[last_idx];
   const size_t pack_idx = idx - last_idx;
-  assert(pack_idx < pack.pack_size() && "parameter pack index out-of-bounds");
+  if (pack_idx >= pack.pack_size())
+return nullptr;

bulbazord wrote:

+1, we should still include this change. We shouldn't crash if the `idx` 
argument is too high.

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


[Lldb-commits] [lldb] [lldb-vscode] Allow specifying a custom escape prefix for LLDB commands (PR #69238)

2023-10-20 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

@clayborg , friendly ping :)

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


[Lldb-commits] [lldb] [lldb][NFC] Implement llvm-style RTTI for DWARFASTParser (PR #69762)

2023-10-20 Thread Augusto Noronha via lldb-commits

https://github.com/augusto2112 created 
https://github.com/llvm/llvm-project/pull/69762

None

>From 2cc3dc43d5ef705a016b8b7b3c23d99d5f01a5d8 Mon Sep 17 00:00:00 2001
From: Augusto Noronha 
Date: Fri, 20 Oct 2023 12:42:52 -0700
Subject: [PATCH] [lldb][NFC] Implement llvm-style RTTI for DWARFASTParser

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h | 8 
 .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp  | 3 ++-
 .../source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h | 4 
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
index eaafbe169cc8cfc..99527fb83f1fa0a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -29,6 +29,9 @@ class SymbolFileDWARF;
 
 class DWARFASTParser {
 public:
+  enum class Kind { DWARFASTParserClang, DWARFASTParserSwift };
+  DWARFASTParser(Kind kind) : m_kind(kind) {}
+
   virtual ~DWARFASTParser() = default;
 
   virtual lldb::TypeSP ParseTypeFromDWARF(const SymbolContext &sc,
@@ -62,6 +65,11 @@ class DWARFASTParser {
   const ExecutionContext *exe_ctx = nullptr);
 
   static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
+
+  Kind GetKind() const { return m_kind; }
+
+private:
+  const Kind m_kind;
 };
 } // namespace dwarf
 } // namespace lldb_private::plugin
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 545a5dcc7d0fd09..5d107ce63b8bc25 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -63,7 +63,8 @@ using namespace lldb_private::dwarf;
 using namespace lldb_private::plugin::dwarf;
 
 DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)
-: m_ast(ast), m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
+: DWARFASTParser(Kind::DWARFASTParserClang), m_ast(ast),
+  m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
 
 DWARFASTParserClang::~DWARFASTParserClang() = default;
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 3d6912cf56c1779..d58fcf4a64dab3b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -248,6 +248,10 @@ class DWARFASTParserClang : public 
lldb_private::plugin::dwarf::DWARFASTParser {
   lldb::ModuleSP
   GetModuleForType(const lldb_private::plugin::dwarf::DWARFDIE &die);
 
+  static bool classof(const DWARFASTParser *Parser) {
+return Parser->GetKind() == Kind::DWARFASTParserClang;
+  }
+
 private:
   struct FieldInfo {
 uint64_t bit_size = 0;

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


[Lldb-commits] [lldb] [lldb][NFC] Move GetTypeForDIE from to DWARFASTParser (PR #69764)

2023-10-20 Thread Augusto Noronha via lldb-commits

https://github.com/augusto2112 created 
https://github.com/llvm/llvm-project/pull/69764

None

>From c97e0b62a2df5309db707861b5f1fd2c223ac50b Mon Sep 17 00:00:00 2001
From: Augusto Noronha 
Date: Fri, 20 Oct 2023 12:59:00 -0700
Subject: [PATCH] [lldb][NFC] Move GetTypeForDIE from to DWARFASTParser

---
 .../SymbolFile/DWARF/DWARFASTParser.cpp   | 26 +++
 .../Plugins/SymbolFile/DWARF/DWARFASTParser.h |  3 +++
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 24 -
 .../SymbolFile/DWARF/DWARFASTParserClang.h|  3 ---
 4 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
index 1fe0cadecc9e70e..30c0659f00efe92 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -9,6 +9,7 @@
 #include "DWARFASTParser.h"
 #include "DWARFAttribute.h"
 #include "DWARFDIE.h"
+#include "SymbolFileDWARF.h"
 
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Symbol/SymbolFile.h"
@@ -100,6 +101,31 @@ DWARFASTParser::ParseChildArrayInfo(const DWARFDIE 
&parent_die,
   return array_info;
 }
 
+
+Type *DWARFASTParser::GetTypeForDIE(const DWARFDIE &die) {
+  if (!die)
+return nullptr;
+
+  SymbolFileDWARF *dwarf = die.GetDWARF();
+  if (!dwarf)
+return nullptr;
+
+  DWARFAttributes attributes = die.GetAttributes();
+  if (attributes.Size() == 0)
+return nullptr;
+
+  DWARFFormValue type_die_form;
+  for (size_t i = 0; i < attributes.Size(); ++i) {
+dw_attr_t attr = attributes.AttributeAtIndex(i);
+DWARFFormValue form_value;
+
+if (attr == DW_AT_type && attributes.ExtractFormValueAtIndex(i, 
form_value))
+  return dwarf->ResolveTypeUID(form_value.Reference(), true);
+  }
+
+  return nullptr;
+}
+
 AccessType
 DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
   switch (dwarf_accessibility) {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
index eaafbe169cc8cfc..19dcee508d59377 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -61,6 +61,9 @@ class DWARFASTParser {
   ParseChildArrayInfo(const DWARFDIE &parent_die,
   const ExecutionContext *exe_ctx = nullptr);
 
+  lldb_private::Type *
+  GetTypeForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die);
+
   static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
 };
 } // namespace dwarf
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 545a5dcc7d0fd09..72670b9a83f001c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -3292,30 +3292,6 @@ size_t DWARFASTParserClang::ParseChildParameters(
   return arg_idx;
 }
 
-Type *DWARFASTParserClang::GetTypeForDIE(const DWARFDIE &die) {
-  if (!die)
-return nullptr;
-
-  SymbolFileDWARF *dwarf = die.GetDWARF();
-  if (!dwarf)
-return nullptr;
-
-  DWARFAttributes attributes = die.GetAttributes();
-  if (attributes.Size() == 0)
-return nullptr;
-
-  DWARFFormValue type_die_form;
-  for (size_t i = 0; i < attributes.Size(); ++i) {
-dw_attr_t attr = attributes.AttributeAtIndex(i);
-DWARFFormValue form_value;
-
-if (attr == DW_AT_type && attributes.ExtractFormValueAtIndex(i, 
form_value))
-  return dwarf->ResolveTypeUID(form_value.Reference(), true);
-  }
-
-  return nullptr;
-}
-
 clang::Decl *DWARFASTParserClang::GetClangDeclForDIE(const DWARFDIE &die) {
   if (!die)
 return nullptr;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 3d6912cf56c1779..f70868b793e7098 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -199,9 +199,6 @@ class DWARFASTParserClang : public 
lldb_private::plugin::dwarf::DWARFASTParser {
 const lldb_private::plugin::dwarf::DWARFDIE &die,
 ParsedDWARFTypeAttributes &attrs);
 
-  lldb_private::Type *
-  GetTypeForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die);
-
   clang::Decl *
   GetClangDeclForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die);
 

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


[Lldb-commits] [lldb] [lldb][NFC] Move GetTypeForDIE from to DWARFASTParser (PR #69764)

2023-10-20 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 1d4601a1ef84e4ffe2db84d17b53953b25699eef 
c97e0b62a2df5309db707861b5f1fd2c223ac50b -- 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
index 30c0659f00ef..409e9bb37ab2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -101,7 +101,6 @@ DWARFASTParser::ParseChildArrayInfo(const DWARFDIE 
&parent_die,
   return array_info;
 }
 
-
 Type *DWARFASTParser::GetTypeForDIE(const DWARFDIE &die) {
   if (!die)
 return nullptr;

``




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


[Lldb-commits] [lldb] Improve dwo path in missing dwo error when relative (PR #69783)

2023-10-20 Thread Tom Yang via lldb-commits

https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/69783

When the debug info refers to a dwo with relative `DW_AT_comp_dir` and 
`DW_AT_dwo_name`, we only print the `DW_AT_comp_dir` in our error message if we 
can't find it. This often isn't very helpful, especially when the 
`DW_AT_comp_dir` is ".":
```
(lldb) fr v
error: unable to locate .dwo debug file "." for skeleton DIE 0x003c
```

I'm updating the error message to include both `DW_AT_comp_dir` (if it exists) 
and `DW_AT_dwo_name` when the `DW_AT_dwo_name` is relative. The behavior when 
`DW_AT_dwo_name` is absolute should be the same.

>From 95de2c290debe4e52f572d12193906b66cde78e3 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Thu, 19 Oct 2023 15:36:22 -0700
Subject: [PATCH] improve dwo path in missing dwo error

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  8 -
 .../DWARF/Inputs/dwo-missing-error.c  |  1 +
 .../DWARF/relative-dwo-missing-error.test | 34 +++
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 737c65d0712e0db..3f7248c3973e459 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
   }
 
   if (!found) {
+FileSpec error_dwo_path(dwo_name);
+FileSystem::Instance().Resolve(error_dwo_path);
+if (error_dwo_path.IsRelative() && comp_dir != nullptr) {
+  error_dwo_path.PrependPathComponent(comp_dir);
+  FileSystem::Instance().Resolve(error_dwo_path);
+}
 unit.SetDwoError(Status::createWithFormat(
 "unable to locate .dwo debug file \"{0}\" for skeleton DIE "
 "{1:x16}",
-dwo_file.GetPath().c_str(), cu_die.GetOffset()));
+error_dwo_path.GetPath().c_str(), cu_die.GetOffset()));
 
 if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) 
{
   GetObjectFile()->GetModule()->ReportWarning(
diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c 
b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
new file mode 100644
index 000..78f2de106c92b0d
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test 
b/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test
new file mode 100644
index 000..4f7e70e36f719df
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test
@@ -0,0 +1,34 @@
+# Check that LLDB prints an error message containing the DWO_AT_comp_dir and
+# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and
+# DW_AT_dwo_name are relative.
+
+# -gsplit-dwarf is supported only on Linux.
+# REQUIRES: system-linux
+
+# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name.
+# Creating and compiling to %t.compdir makes it easy to remove the dwo files.
+# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be
+# "a.out-dwo-missing-error.dwo".
+# since %T is deprecated.
+# RUN: rm -rf %t.compdir/
+# RUN: mkdir -p %t.compdir/a/b/
+# RUN: cd %t.compdir/a/b/
+# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
+# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out
+# RUN: rm *.dwo
+# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s 
+# RUN: cd -
+
+# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name.
+# RUN: rm -rf %t.compdir/
+# RUN: mkdir -p %t.compdir/a/b/
+# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
+# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out
+# RUN: rm %t.compdir/a/b/*.dwo
+# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s 
+
+b main
+run
+
+fr v
+# CHECK: error: unable to locate .dwo debug file 
"{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}}

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


[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)

2023-10-20 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Tom Yang (zhyty)


Changes

When the debug info refers to a dwo with relative `DW_AT_comp_dir` and 
`DW_AT_dwo_name`, we only print the `DW_AT_comp_dir` in our error message if we 
can't find it. This often isn't very helpful, especially when the 
`DW_AT_comp_dir` is ".":
```
(lldb) fr v
error: unable to locate .dwo debug file "." for skeleton DIE 0x003c
```

I'm updating the error message to include both `DW_AT_comp_dir` (if it exists) 
and `DW_AT_dwo_name` when the `DW_AT_dwo_name` is relative. The behavior when 
`DW_AT_dwo_name` is absolute should be the same.

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


3 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+7-1) 
- (added) lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c (+1) 
- (added) lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test 
(+34) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 737c65d0712e0db..3f7248c3973e459 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
   }
 
   if (!found) {
+FileSpec error_dwo_path(dwo_name);
+FileSystem::Instance().Resolve(error_dwo_path);
+if (error_dwo_path.IsRelative() && comp_dir != nullptr) {
+  error_dwo_path.PrependPathComponent(comp_dir);
+  FileSystem::Instance().Resolve(error_dwo_path);
+}
 unit.SetDwoError(Status::createWithFormat(
 "unable to locate .dwo debug file \"{0}\" for skeleton DIE "
 "{1:x16}",
-dwo_file.GetPath().c_str(), cu_die.GetOffset()));
+error_dwo_path.GetPath().c_str(), cu_die.GetOffset()));
 
 if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) 
{
   GetObjectFile()->GetModule()->ReportWarning(
diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c 
b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
new file mode 100644
index 000..78f2de106c92b0d
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test 
b/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test
new file mode 100644
index 000..4f7e70e36f719df
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test
@@ -0,0 +1,34 @@
+# Check that LLDB prints an error message containing the DWO_AT_comp_dir and
+# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and
+# DW_AT_dwo_name are relative.
+
+# -gsplit-dwarf is supported only on Linux.
+# REQUIRES: system-linux
+
+# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name.
+# Creating and compiling to %t.compdir makes it easy to remove the dwo files.
+# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be
+# "a.out-dwo-missing-error.dwo".
+# since %T is deprecated.
+# RUN: rm -rf %t.compdir/
+# RUN: mkdir -p %t.compdir/a/b/
+# RUN: cd %t.compdir/a/b/
+# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
+# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out
+# RUN: rm *.dwo
+# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s 
+# RUN: cd -
+
+# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name.
+# RUN: rm -rf %t.compdir/
+# RUN: mkdir -p %t.compdir/a/b/
+# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
+# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out
+# RUN: rm %t.compdir/a/b/*.dwo
+# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s 
+
+b main
+run
+
+fr v
+# CHECK: error: unable to locate .dwo debug file 
"{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}}

``




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


[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-20 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-20 Thread Tom Yang via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)

2023-10-20 Thread Tom Yang via lldb-commits

zhyty wrote:

> Because SymbolFile is holding onto the function pointer as a static member, 
> this is a global setting that you can't apply to only just one `SBDebugger` 
> object. It's an all-or-nothing thing. Maybe that's what you want, but LLDB 
> already has architectural issues with certain functionality being difficult 
> to detangle from global state (e.g. Logging). Maybe we could make it a 
> property of the Debugger instead?

That sounds good to me, though I didn't think there was a path to the debugger 
from `SymbolFileDWARF`?

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


[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)

2023-10-20 Thread Tom Yang via lldb-commits

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

>From bee3e22c2b2c57d2a6710741f8a78dff0d8d71e1 Mon Sep 17 00:00:00 2001
From: Tom Yang 
Date: Thu, 19 Oct 2023 15:36:22 -0700
Subject: [PATCH] improve dwo path in missing dwo error

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  8 -
 .../DWARF/Inputs/dwo-missing-error.c  |  1 +
 .../SymbolFile/DWARF/dwo-missing-error.test   | 34 +++
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 737c65d0712e0db..3f7248c3973e459 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
   }
 
   if (!found) {
+FileSpec error_dwo_path(dwo_name);
+FileSystem::Instance().Resolve(error_dwo_path);
+if (error_dwo_path.IsRelative() && comp_dir != nullptr) {
+  error_dwo_path.PrependPathComponent(comp_dir);
+  FileSystem::Instance().Resolve(error_dwo_path);
+}
 unit.SetDwoError(Status::createWithFormat(
 "unable to locate .dwo debug file \"{0}\" for skeleton DIE "
 "{1:x16}",
-dwo_file.GetPath().c_str(), cu_die.GetOffset()));
+error_dwo_path.GetPath().c_str(), cu_die.GetOffset()));
 
 if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) 
{
   GetObjectFile()->GetModule()->ReportWarning(
diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c 
b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
new file mode 100644
index 000..78f2de106c92b0d
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test 
b/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test
new file mode 100644
index 000..4f7e70e36f719df
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test
@@ -0,0 +1,34 @@
+# Check that LLDB prints an error message containing the DWO_AT_comp_dir and
+# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and
+# DW_AT_dwo_name are relative.
+
+# -gsplit-dwarf is supported only on Linux.
+# REQUIRES: system-linux
+
+# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name.
+# Creating and compiling to %t.compdir makes it easy to remove the dwo files.
+# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be
+# "a.out-dwo-missing-error.dwo".
+# since %T is deprecated.
+# RUN: rm -rf %t.compdir/
+# RUN: mkdir -p %t.compdir/a/b/
+# RUN: cd %t.compdir/a/b/
+# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
+# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out
+# RUN: rm *.dwo
+# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s 
+# RUN: cd -
+
+# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name.
+# RUN: rm -rf %t.compdir/
+# RUN: mkdir -p %t.compdir/a/b/
+# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \
+# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out
+# RUN: rm %t.compdir/a/b/*.dwo
+# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s 
+
+b main
+run
+
+fr v
+# CHECK: error: unable to locate .dwo debug file 
"{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}}

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-10-20 Thread Dan McGregor via lldb-commits

dankm wrote:

No _good_ particular reason. I got hung up on the formatting issues then ran 
out of steam, and busy with $job. I just ran clang-format on this change and it 
came up clean.

And now that I've done that the only reason I have left is I'm unable to merge 
my own changes. Would you mind, @jh7370?

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-10-20 Thread Dan McGregor via lldb-commits

dankm wrote:

Hm. I have "fixup" commits in this branch, should I rebase those, or can we 
squash merge as-is?

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


[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)

2023-10-20 Thread via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][test] Turn ObjC string literals to C-style literals (NFC) (PR #69793)

2023-10-20 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/69793

The underlying timezone classes are being reimplemented in Swift, and these 
strings will
be Swift strings, without the ObjC `@` prefix. Leaving off the `@` makes these 
tests
usable both before and after the reimplmentation of Foundation in Swift.


>From adc191f11ab07466f22bbb8a8d45abb9e417913b Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Thu, 20 Jul 2023 19:29:29 -0700
Subject: [PATCH] [lldb][test] Turn ObjC string literals to C-style literals
 (NFC)

The underlying timezone classes are being reimplemented in Swift, and these 
strings will
be Swift strings, without the ObjC `@` prefix. Leaving off the `@` makes these 
tests
usable both before and after the reimplmentation of Foundation in Swift.
---
 .../data-formatter-objc/TestDataFormatterObjCNSDate.py| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
index c4aec10505910ae..a1ffe84ad556f0e 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -53,12 +53,12 @@ def nsdate_data_formatter_commands(self):
 
 self.expect(
 "frame variable cupertino home europe",
-substrs=['@"America/Los_Angeles"', '@"Europe/Rome"', 
'@"Europe/Paris"'],
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
 )
 
 self.expect(
 "frame variable cupertino_ns home_ns europe_ns",
-substrs=['@"America/Los_Angeles"', '@"Europe/Rome"', 
'@"Europe/Paris"'],
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
 )
 
 self.expect(

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


[Lldb-commits] [lldb] [lldb][test] Turn ObjC string literals to C-style literals (NFC) (PR #69793)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes

The underlying timezone classes are being reimplemented in Swift, and these 
strings will
be Swift strings, without the ObjC `@` prefix. Leaving off the `@` makes these 
tests
usable both before and after the reimplmentation of Foundation in Swift.


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


1 Files Affected:

- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 (+2-2) 


``diff
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
index c4aec10505910ae..a1ffe84ad556f0e 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -53,12 +53,12 @@ def nsdate_data_formatter_commands(self):
 
 self.expect(
 "frame variable cupertino home europe",
-substrs=['@"America/Los_Angeles"', '@"Europe/Rome"', 
'@"Europe/Paris"'],
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
 )
 
 self.expect(
 "frame variable cupertino_ns home_ns europe_ns",
-substrs=['@"America/Los_Angeles"', '@"Europe/Rome"', 
'@"Europe/Paris"'],
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
 )
 
 self.expect(

``




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


[Lldb-commits] [lldb] [LLDB] Update breakpoint-command.test to use string instead of number. (PR #69796)

2023-10-20 Thread via lldb-commits

https://github.com/cmtice created 
https://github.com/llvm/llvm-project/pull/69796

lldb/test/Shell/Breakpoint/breakpoint-command.test adds a python command, to be 
executed when a breakpoint hits, that writes out a number. It then runs, hits 
the breakpoint and checks that the number is present exactly once.

The problem is that on some systems the test can be run in a filepath that 
happens to contain the number (e.g. auto-generated directory names). The number 
is then detected multiple times and the test fails.

This patch fixes the issue by using a string instead, particularly a string 
with spaces, which is very unlikely to be auto-generated by any system.

>From df5e5de1a6e5ece5dabb0f03492f0b918205fcdf Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Fri, 20 Oct 2023 16:13:24 -0700
Subject: [PATCH] [LLDB] Update breakpoint-command.test to use string instead
 of number.

lldb/test/Shell/Breakpoint/breakpoint-command.test adds a python command, to be
executed when a breakpoint hits, that writes out a number. It then runs, hits
the breakpoint and checks that the number is present exactly once.

The problem is that on some systems the test can be run in a
filepath that happens to contain the number (e.g. auto-generated directory
names). The number is then detected multiple times and the test fails.

This patch fixes the issue by using a string instead, particularly a
string with spaces, which is very unlikely to be auto-generated by any system.
---
 lldb/test/Shell/Breakpoint/breakpoint-command.test | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/test/Shell/Breakpoint/breakpoint-command.test 
b/lldb/test/Shell/Breakpoint/breakpoint-command.test
index 2bca6a97e691cf3..8031be22dc2b6a2 100644
--- a/lldb/test/Shell/Breakpoint/breakpoint-command.test
+++ b/lldb/test/Shell/Breakpoint/breakpoint-command.test
@@ -1,7 +1,7 @@
 # REQUIRES: lua || python
 
 # RUN: %build %p/Inputs/dummy-target.c -o %t.out
-# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(95000 
+ 126)"' -o 'r' | FileCheck %s
+# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(\"A 
R4Nd0m\" + \" Str1ng\")"' -o 'r' | FileCheck %s
 
-# CHECK: 95126
-# CHECK-NOT: 95126
+# CHECK: A R4Nd0m Str1ng
+# CHECK-NOT: A R4Nd0m Str1ng

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


[Lldb-commits] [lldb] [LLDB] Update breakpoint-command.test to use string instead of number. (PR #69796)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (cmtice)


Changes

lldb/test/Shell/Breakpoint/breakpoint-command.test adds a python command, to be 
executed when a breakpoint hits, that writes out a number. It then runs, hits 
the breakpoint and checks that the number is present exactly once.

The problem is that on some systems the test can be run in a filepath that 
happens to contain the number (e.g. auto-generated directory names). The number 
is then detected multiple times and the test fails.

This patch fixes the issue by using a string instead, particularly a string 
with spaces, which is very unlikely to be auto-generated by any system.

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


1 Files Affected:

- (modified) lldb/test/Shell/Breakpoint/breakpoint-command.test (+3-3) 


``diff
diff --git a/lldb/test/Shell/Breakpoint/breakpoint-command.test 
b/lldb/test/Shell/Breakpoint/breakpoint-command.test
index 2bca6a97e691cf3..8031be22dc2b6a2 100644
--- a/lldb/test/Shell/Breakpoint/breakpoint-command.test
+++ b/lldb/test/Shell/Breakpoint/breakpoint-command.test
@@ -1,7 +1,7 @@
 # REQUIRES: lua || python
 
 # RUN: %build %p/Inputs/dummy-target.c -o %t.out
-# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(95000 
+ 126)"' -o 'r' | FileCheck %s
+# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(\"A 
R4Nd0m\" + \" Str1ng\")"' -o 'r' | FileCheck %s
 
-# CHECK: 95126
-# CHECK-NOT: 95126
+# CHECK: A R4Nd0m Str1ng
+# CHECK-NOT: A R4Nd0m Str1ng

``




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


[Lldb-commits] [lldb] [LLDB] Update breakpoint-command.test to use string instead of number. (PR #69796)

2023-10-20 Thread Alex Langford via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Update breakpoint-command.test to use string instead of number. (PR #69796)

2023-10-20 Thread Alex Langford via lldb-commits

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

What an interesting failure condition 🙂
Some arbitrary string with spaces seems a lot less likely to be a false 
positive compared to a number.

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


[Lldb-commits] [lldb] [LLDB] Update breakpoint-command.test to use string instead of number. (PR #69796)

2023-10-20 Thread Alex Langford via lldb-commits


@@ -1,7 +1,7 @@
 # REQUIRES: lua || python
 
 # RUN: %build %p/Inputs/dummy-target.c -o %t.out
-# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(95000 
+ 126)"' -o 'r' | FileCheck %s
+# RUN: %lldb %t.out -o 'b main' -o 'break command add 1 -o "script print(\"A 
R4Nd0m\" + \" Str1ng\")"' -o 'r' | FileCheck %s

bulbazord wrote:

Interesting, is there a specific reason for doing string concatenation here? Or 
just keeping the `+` from the previous version?

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


[Lldb-commits] [lldb] [lldb][test] Turn ObjC string literals to C-style literals (NFC) (PR #69793)

2023-10-20 Thread Jonas Devlieghere via lldb-commits

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

Nice

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


[Lldb-commits] [lldb] [lldb][test] Turn ObjC string literals to C-style literals (NFC) (PR #69793)

2023-10-20 Thread Augusto Noronha via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][test] Turn ObjC string literals to C-style literals (NFC) (PR #69793)

2023-10-20 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] 3b5d59a - [lldb][test] Turn ObjC string literals to C-style literals (NFC) (#69793)

2023-10-20 Thread via lldb-commits

Author: Dave Lee
Date: 2023-10-20T19:24:53-07:00
New Revision: 3b5d59ab55f885f1e12a9d306de351b798552426

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

LOG: [lldb][test] Turn ObjC string literals to C-style literals (NFC) (#69793)

The underlying timezone classes are being reimplemented in Swift, and these 
strings will be Swift strings, without the ObjC `@` prefix. Leaving off the `@` 
makes these tests usable both before and after the reimplmentation of 
Foundation in Swift.

Added: 


Modified: 

lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
index c4aec10505910ae..a1ffe84ad556f0e 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -53,12 +53,12 @@ def nsdate_data_formatter_commands(self):
 
 self.expect(
 "frame variable cupertino home europe",
-substrs=['@"America/Los_Angeles"', '@"Europe/Rome"', 
'@"Europe/Paris"'],
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
 )
 
 self.expect(
 "frame variable cupertino_ns home_ns europe_ns",
-substrs=['@"America/Los_Angeles"', '@"Europe/Rome"', 
'@"Europe/Paris"'],
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
 )
 
 self.expect(



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


[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)

2023-10-20 Thread Vlad Serebrennikov via lldb-commits

https://github.com/Endilll created 
https://github.com/llvm/llvm-project/pull/69815

This patch adds the value to enumerator dump, e.g. `Enumerator` now dumped as 
`Enumerator(0)`. There are not-so-uncommon cases when value of enumerator is no 
less important than its name. One example can be found in 
https://github.com/llvm/llvm-project/blob/4aae5387a874a55ee491f5dc23ce0506c5cdc678/clang/include/clang/AST/DeclarationName.h#L183
 Another one, number of bits to shift, can be found in 
https://github.com/llvm/llvm-project/blob/4aae5387a874a55ee491f5dc23ce0506c5cdc678/llvm/include/llvm/ADT/PointerIntPair.h#L181

>From 886c627b8675886cfa09745c2441e3ab4aaadaea Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Sat, 21 Oct 2023 09:18:24 +0300
Subject: [PATCH] [lldb] Add number to enumerator dump

---
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TestCastIntToAnonymousEnum.py |  2 +-
 .../API/lang/c/enum_types/TestEnumTypes.py| 10 +-
 .../TestConstStaticIntegralMember.py  | 20 +--
 .../lang/cpp/enum_types/TestCPP11EnumTypes.py |  6 +++---
 .../rust/enum-structs/TestRustEnumStructs.py  |  2 +-
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f1353db2631ddc6..b1ec1cf9a322907 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8550,7 +8550,7 @@ static bool DumpEnumValue(const clang::QualType 
&qual_type, Stream &s,
 ++num_enumerators;
 if (val == enum_svalue) {
   // Found an exact match, that's all we need to do.
-  s.PutCString(enumerator->getNameAsString());
+  s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), 
enum_svalue);
   return true;
 }
   }
diff --git 
a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 
b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
index 923f021d53399cb..00610a29353423f 100644
--- 
a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
+++ 
b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
@@ -18,4 +18,4 @@ def test_cast_int_to_anonymous_enum(self):
 self, "// break here", lldb.SBFileSpec("main.cpp", False)
 )
 
-self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A")
+self.expect_expr("(flow_e)0", result_type="flow_e", 
result_value="A(0)")
diff --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py 
b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
index 33a846c50d7def3..e69cefee2540d47 100644
--- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
@@ -22,12 +22,12 @@ def test_command_line(self):
 self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c")
 )
 
-self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A$"])
-self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B$"])
-self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C$"])
-self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB$"])
+self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A\\(1\\)$"])
+self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B\\(2\\)$"])
+self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C\\(4\\)$"])
+self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB\\(3\\)$"])
 self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A | C$"])
-self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL$"])
+self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL\\(7\\)$"])
 # Test that an enum that doesn't match the heuristic we use in
 # TypeSystemClang::DumpEnumValue, gets printed as a raw integer.
 self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, 
patterns=[" = 7$"])
diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 530191e8a37ba1b..80e81c0df8a5bfd 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -57,12 +57,12 @@ def test(self):
 self.expect_expr("A::wchar_min == wchar_min", result_value="true")
 
 # Test an unscoped enum.
-self.expect_expr("A::enum_val", result_value="enum_case2")
+self.expect_expr("A::enum_val", result_value="enum_case2(2

[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)

2023-10-20 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Vlad Serebrennikov (Endilll)


Changes

This patch adds the value to enumerator dump, e.g. `Enumerator` now dumped as 
`Enumerator(0)`. There are not-so-uncommon cases when value of enumerator is no 
less important than its name. One example can be found in 
https://github.com/llvm/llvm-project/blob/4aae5387a874a55ee491f5dc23ce0506c5cdc678/clang/include/clang/AST/DeclarationName.h#L183
 Another one, number of bits to shift, can be found in 
https://github.com/llvm/llvm-project/blob/4aae5387a874a55ee491f5dc23ce0506c5cdc678/llvm/include/llvm/ADT/PointerIntPair.h#L181

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


6 Files Affected:

- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+1-1) 
- (modified) 
lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 (+1-1) 
- (modified) lldb/test/API/lang/c/enum_types/TestEnumTypes.py (+5-5) 
- (modified) 
lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 (+10-10) 
- (modified) lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py (+3-3) 
- (modified) lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py (+1-1) 


``diff
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f1353db2631ddc6..b1ec1cf9a322907 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8550,7 +8550,7 @@ static bool DumpEnumValue(const clang::QualType 
&qual_type, Stream &s,
 ++num_enumerators;
 if (val == enum_svalue) {
   // Found an exact match, that's all we need to do.
-  s.PutCString(enumerator->getNameAsString());
+  s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), 
enum_svalue);
   return true;
 }
   }
diff --git 
a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 
b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
index 923f021d53399cb..00610a29353423f 100644
--- 
a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
+++ 
b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
@@ -18,4 +18,4 @@ def test_cast_int_to_anonymous_enum(self):
 self, "// break here", lldb.SBFileSpec("main.cpp", False)
 )
 
-self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A")
+self.expect_expr("(flow_e)0", result_type="flow_e", 
result_value="A(0)")
diff --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py 
b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
index 33a846c50d7def3..e69cefee2540d47 100644
--- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
@@ -22,12 +22,12 @@ def test_command_line(self):
 self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c")
 )
 
-self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A$"])
-self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B$"])
-self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C$"])
-self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB$"])
+self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A\\(1\\)$"])
+self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B\\(2\\)$"])
+self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C\\(4\\)$"])
+self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB\\(3\\)$"])
 self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A | C$"])
-self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL$"])
+self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL\\(7\\)$"])
 # Test that an enum that doesn't match the heuristic we use in
 # TypeSystemClang::DumpEnumValue, gets printed as a raw integer.
 self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, 
patterns=[" = 7$"])
diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 530191e8a37ba1b..80e81c0df8a5bfd 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -57,12 +57,12 @@ def test(self):
 self.expect_expr("A::wchar_min == wchar_min", result_value="true")
 
 # Test an unscoped enum.
-self.expect_expr("A::enum_val", result_value="enum_case2")
+self.expect_expr("A:

[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)

2023-10-20 Thread Vlad Serebrennikov via lldb-commits

https://github.com/Endilll updated 
https://github.com/llvm/llvm-project/pull/69815

>From 886c627b8675886cfa09745c2441e3ab4aaadaea Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Sat, 21 Oct 2023 09:18:24 +0300
Subject: [PATCH 1/2] [lldb] Add number to enumerator dump

---
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TestCastIntToAnonymousEnum.py |  2 +-
 .../API/lang/c/enum_types/TestEnumTypes.py| 10 +-
 .../TestConstStaticIntegralMember.py  | 20 +--
 .../lang/cpp/enum_types/TestCPP11EnumTypes.py |  6 +++---
 .../rust/enum-structs/TestRustEnumStructs.py  |  2 +-
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f1353db2631ddc6..b1ec1cf9a322907 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8550,7 +8550,7 @@ static bool DumpEnumValue(const clang::QualType 
&qual_type, Stream &s,
 ++num_enumerators;
 if (val == enum_svalue) {
   // Found an exact match, that's all we need to do.
-  s.PutCString(enumerator->getNameAsString());
+  s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), 
enum_svalue);
   return true;
 }
   }
diff --git 
a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 
b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
index 923f021d53399cb..00610a29353423f 100644
--- 
a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
+++ 
b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
@@ -18,4 +18,4 @@ def test_cast_int_to_anonymous_enum(self):
 self, "// break here", lldb.SBFileSpec("main.cpp", False)
 )
 
-self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A")
+self.expect_expr("(flow_e)0", result_type="flow_e", 
result_value="A(0)")
diff --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py 
b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
index 33a846c50d7def3..e69cefee2540d47 100644
--- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
@@ -22,12 +22,12 @@ def test_command_line(self):
 self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c")
 )
 
-self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A$"])
-self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B$"])
-self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C$"])
-self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB$"])
+self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A\\(1\\)$"])
+self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B\\(2\\)$"])
+self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C\\(4\\)$"])
+self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB\\(3\\)$"])
 self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A | C$"])
-self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL$"])
+self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL\\(7\\)$"])
 # Test that an enum that doesn't match the heuristic we use in
 # TypeSystemClang::DumpEnumValue, gets printed as a raw integer.
 self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, 
patterns=[" = 7$"])
diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 530191e8a37ba1b..80e81c0df8a5bfd 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -57,12 +57,12 @@ def test(self):
 self.expect_expr("A::wchar_min == wchar_min", result_value="true")
 
 # Test an unscoped enum.
-self.expect_expr("A::enum_val", result_value="enum_case2")
+self.expect_expr("A::enum_val", result_value="enum_case2(2)")
 # Test an unscoped enum with bool as the underlying type.
-self.expect_expr("A::enum_bool_val", result_value="enum_bool_case1")
+self.expect_expr("A::enum_bool_val", result_value="enum_bool_case1(0)")
 
 # Test a scoped enum.
-self.expect_expr("A::scoped_enum_val", 
result_value="scoped_enum_case2")
+self.expect_expr("A::scoped_enum_val", 
result_value="scoped_enum_case2(2)")
 # Test an scoped enum with a value that isn't an enumerator.
 self.expect_expr(

[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)

2023-10-20 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 4aae5387a874a55ee491f5dc23ce0506c5cdc678 
886c627b8675886cfa09745c2441e3ab4aaadaea -- 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index b1ec1cf9a322..0edf817e125f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8550,7 +8550,8 @@ static bool DumpEnumValue(const clang::QualType 
&qual_type, Stream &s,
 ++num_enumerators;
 if (val == enum_svalue) {
   // Found an exact match, that's all we need to do.
-  s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), 
enum_svalue);
+  s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(),
+   enum_svalue);
   return true;
 }
   }

``




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


[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)

2023-10-20 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
4aae5387a874a55ee491f5dc23ce0506c5cdc678..886c627b8675886cfa09745c2441e3ab4aaadaea
 
lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py
 lldb/test/API/lang/c/enum_types/TestEnumTypes.py 
lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py 
lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py
``





View the diff from darker here.


``diff
--- lang/c/enum_types/TestEnumTypes.py  2023-10-21 06:18:24.00 +
+++ lang/c/enum_types/TestEnumTypes.py  2023-10-21 06:41:25.794197 +
@@ -20,16 +20,26 @@
 
 lldbutil.run_to_source_breakpoint(
 self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c")
 )
 
-self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A\\(1\\)$"])
-self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B\\(2\\)$"])
-self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C\\(4\\)$"])
-self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB\\(3\\)$"])
+self.expect(
+"fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A\\(1\\)$"]
+)
+self.expect(
+"fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
B\\(2\\)$"]
+)
+self.expect(
+"fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
C\\(4\\)$"]
+)
+self.expect(
+"fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
AB\\(3\\)$"]
+)
 self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
A | C$"])
-self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" 
= ALL\\(7\\)$"])
+self.expect(
+"fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 
ALL\\(7\\)$"]
+)
 # Test that an enum that doesn't match the heuristic we use in
 # TypeSystemClang::DumpEnumValue, gets printed as a raw integer.
 self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, 
patterns=[" = 7$"])
 # Test the behavior in case have a variable of a type considered
 # 'bitfield' by the heuristic, but the value isn't actually fully
--- lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py  
2023-10-21 06:18:24.00 +
+++ lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py  
2023-10-21 06:41:25.867216 +
@@ -73,12 +73,16 @@
 result_value="scoped_enum_case1 | scoped_enum_case2 | 0x4",
 )
 
 # Test an enum with fixed underlying type.
 self.expect_expr("A::scoped_char_enum_val", result_value="case2(2)")
-self.expect_expr("A::scoped_ll_enum_val_neg", 
result_value="case0(-9223372036854775808)")
-self.expect_expr("A::scoped_ll_enum_val", 
result_value="case2(9223372036854775807)")
+self.expect_expr(
+"A::scoped_ll_enum_val_neg", 
result_value="case0(-9223372036854775808)"
+)
+self.expect_expr(
+"A::scoped_ll_enum_val", result_value="case2(9223372036854775807)"
+)
 
 # Test taking address.
 if lldbplatformutil.getPlatform() == "windows":
 # On Windows data members without the out-of-class definitions 
still have
 # valid adresses and the following expression works fine.
--- lang/cpp/enum_types/TestCPP11EnumTypes.py   2023-10-21 06:18:24.00 +
+++ lang/cpp/enum_types/TestCPP11EnumTypes.py   2023-10-21 06:41:25.913160 +
@@ -21,13 +21,22 @@
 "image lookup -t " + enum_name,
 patterns=["enum( struct| class) " + enum_name + " {"],
 substrs=["Case1", "Case2", "Case3"],
 )
 # Test each case in the enum.
-self.expect("expr var1_" + suffix, patterns=[f"\\({enum_name}\\) 
\\$\\d+ = Case1\\(-?\\d+\\)"])
-self.expect("expr var2_" + suffix, patterns=[f"\\({enum_name}\\) 
\\$\\d+ = Case2\\(-?\\d+\\)"])
-self.expect("expr var3_" + suffix, patterns=[f"\\({enum_name}\\) 
\\$\\d+ = Case3\\(-?\\d+\\)"])
+self.expect(
+"expr var1_" + suffix,
+patterns=[f"\\({enum_name}\\) \\$\\d+ = Case1\\(-?\\d+\\)"],
+)
+self.expect(
+"expr var2_" + suffix,
+patterns=[f"\\({enum_name}\\) \\$\\d+ = Case2\\(-?\\d+\\)"],
+)
+self.expect(
+"expr var3_" + suffix,
+patterns=[f"\\({enum_name}\\) \\$\\d+ = Case3\\(-?\\d+\\)"],
+)
 
 if unsigned:
 self.expect_expr(
 "var_below_" + suffix, result_type=enum_name, 
result_value="199"
 )
--- lang/ru