[Lldb-commits] [lldb] [lldb] Skip remote PutFile when MD5 hashes equal (PR #88812)

2024-04-19 Thread Anthony Ha via lldb-commits

Awfa wrote:

I got an email that the build failed and I should revert because of this: 
https://lab.llvm.org/buildbot/#/builders/68/builds/72623

@bulbazord can you or someone with write permissions revert this PR so I have 
time to triage the issue?

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


[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)

2024-04-19 Thread Vlad Serebrennikov via lldb-commits

Endilll wrote:

@Michael137 suggested that I check that performance of `FindDirectNestedType` 
doesn't regress (at least for my use case), since I have custom instrumentation 
in my formatter. I can confirm that 3 versions of this function (#68705, 
#74786, and this PR) exhibit the same level of performance. Raw numbers 
fluctuate a lot, but I don't see anything concerning:
```
This PR
---
2,611,025
1,988,893
2,878,981
1,873,220

main branch (#74786)

1,973,071
2,542,073
1,509,624

Initial implementation (#68705)
--
2,029,233
2,477,041
1,315,462
```

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread David Spickett via lldb-commits

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

These are extensions the lldb platform has to:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Host-I_002fO-Packets.html#Host-I_002fO-Packets

>From 518cb052ee364192fc5c813a2962f80f39345cd5 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Fri, 19 Apr 2024 09:15:54 +
Subject: [PATCH] [lldb][Docs] Document vFile:exists and vFile:MD5

These are extensions the lldb platform has to:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Host-I_002fO-Packets.html#Host-I_002fO-Packets
---
 lldb/docs/lldb-platform-packets.txt | 36 +
 1 file changed, 36 insertions(+)

diff --git a/lldb/docs/lldb-platform-packets.txt 
b/lldb/docs/lldb-platform-packets.txt
index 4cf575e5ee8adb..fa6ec720c7ed42 100644
--- a/lldb/docs/lldb-platform-packets.txt
+++ b/lldb/docs/lldb-platform-packets.txt
@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64
+//  bits of the result, then the high 64 bits of the result. Both are hex
+//  without a prefix.
+//
+//  The response is "F,", followed by "x" if the file did not exist
+//  or failed to hash.
 
+//--
+// vFile:exists:
+//
+// BRIEF
+//  Check whether the file at the given path exists.
+//
+// EXAMPLE
+//
+//  receive: vFile:exists:2f746d702f61
+//  send (exists): F,1
+//  send (does not exist): F,0
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  The response is a return code where 1 means the file exists
+//  and 0 means it does not.
 
 
 

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

These are extensions the lldb platform has to:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Host-I_002fO-Packets.html#Host-I_002fO-Packets

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


1 Files Affected:

- (modified) lldb/docs/lldb-platform-packets.txt (+36) 


``diff
diff --git a/lldb/docs/lldb-platform-packets.txt 
b/lldb/docs/lldb-platform-packets.txt
index 4cf575e5ee8adb..fa6ec720c7ed42 100644
--- a/lldb/docs/lldb-platform-packets.txt
+++ b/lldb/docs/lldb-platform-packets.txt
@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64
+//  bits of the result, then the high 64 bits of the result. Both are hex
+//  without a prefix.
+//
+//  The response is "F,", followed by "x" if the file did not exist
+//  or failed to hash.
 
+//--
+// vFile:exists:
+//
+// BRIEF
+//  Check whether the file at the given path exists.
+//
+// EXAMPLE
+//
+//  receive: vFile:exists:2f746d702f61
+//  send (exists): F,1
+//  send (does not exist): F,0
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  The response is a return code where 1 means the file exists
+//  and 0 means it does not.
 
 
 

``




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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Ideally they'd be in some sort of order but they are already not, and I'm 
thinking it would be good to get these on the website anyway. So I'm leaving 
concerns like that until later.

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


[Lldb-commits] [lldb] [lldb] Skip remote PutFile when MD5 hashes equal (PR #88812)

2024-04-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> So a good follow up PR would be to list it in that document. It's self 
> explanatory but still, weird that it's not there.

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

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


[Lldb-commits] [lldb] [lldb] Skip remote PutFile when MD5 hashes equal (PR #88812)

2024-04-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> @bulbazord can you or someone with write permissions revert this PR so I have 
> time to triage the issue?

The next build is green, those DAP tests do fail once in a while so it's 
unrelated to your change.

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


[Lldb-commits] [lldb] [lldb] Skip remote PutFile when MD5 hashes equal (PR #88812)

2024-04-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Please address @JDevlieghere's comments in a new PR.

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


[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)

2024-04-19 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/89183

>From 80ba4f24cdfe8b5f2aa44a016ea69ad08f56d558 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Thu, 18 Apr 2024 07:34:45 +
Subject: [PATCH 1/2] [lldb] Make SBType::FindDirectNestedType work with
 expression ASTs

The types we get out of expressions will not have an associated symbol
file, so the current method of looking up the type will fail. Instead, I
plumb the query through the TypeSystem class. This correctly finds the
type in both cases (importing it into the expression AST if needed). I
haven't measured, but it should also be more efficient than doing a type
lookup (at least, after the type has already been found once).
---
 lldb/include/lldb/Symbol/TypeSystem.h |  7 
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 30 +++
 .../TypeSystem/Clang/TypeSystemClang.h|  3 ++
 lldb/source/Symbol/Type.cpp   | 16 +---
 lldb/test/API/python_api/type/TestTypeList.py | 37 +++
 5 files changed, 63 insertions(+), 30 deletions(-)

diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index f647fcbf1636ea..3a927d313b823d 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -28,6 +28,7 @@
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/lldb-private.h"
+#include "lldb/lldb-types.h"
 
 class PDBASTParser;
 
@@ -363,6 +364,12 @@ class TypeSystem : public PluginInterface,
   lldb::opaque_compiler_type_t type, llvm::StringRef name,
   bool omit_empty_base_classes, std::vector &child_indexes) = 0;
 
+  virtual CompilerType
+  GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+  llvm::StringRef name) {
+return CompilerType();
+  }
+
   virtual bool IsTemplateType(lldb::opaque_compiler_type_t type);
 
   virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index be0ddb06f82c18..2621f682011b41 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -6997,6 +6997,36 @@ 
TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
   return UINT32_MAX;
 }
 
+CompilerType
+TypeSystemClang::GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+ llvm::StringRef name) {
+  if (!type || name.empty())
+return CompilerType();
+
+  clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
+  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+
+  switch (type_class) {
+  case clang::Type::Record: {
+if (!GetCompleteType(type))
+  return CompilerType();
+const clang::RecordType *record_type =
+llvm::cast(qual_type.getTypePtr());
+const clang::RecordDecl *record_decl = record_type->getDecl();
+
+clang::DeclarationName decl_name(&getASTContext().Idents.get(name));
+for (NamedDecl *decl : record_decl->lookup(decl_name)) {
+  if (auto *tag_decl = dyn_cast(decl))
+return GetType(getASTContext().getTagDeclType(tag_decl));
+}
+break;
+  }
+  default:
+break;
+  }
+  return CompilerType();
+}
+
 bool TypeSystemClang::IsTemplateType(lldb::opaque_compiler_type_t type) {
   if (!type)
 return false;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 05c303baa41640..68b82e9688f12b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -897,6 +897,9 @@ class TypeSystemClang : public TypeSystem {
 bool omit_empty_base_classes,
 std::vector &child_indexes) override;
 
+  CompilerType GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+   llvm::StringRef name) override;
+
   bool IsTemplateType(lldb::opaque_compiler_type_t type) override;
 
   size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 44a24d7178f562..d9894ac355c6f0 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -1177,20 +1177,8 @@ CompilerType 
TypeImpl::FindDirectNestedType(llvm::StringRef name) {
   if (name.empty())
 return CompilerType();
   auto type_system = GetTypeSystem(/*prefer_dynamic*/ false);
-  auto *symbol_file = type_system->GetSymbolFile();
-  if (!symbol_file)
-return CompilerType();
-  auto decl_context = 
type_system->GetCompilerDeclContextForType(m_static_type);
-  if (!decl_context.IsValid())
-return CompilerType();
-  TypeQuery query(decl_con

[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)

2024-04-19 Thread Pavel Labath via lldb-commits

labath wrote:

> @Michael137 suggested that I check that performance of `FindDirectNestedType` 
> doesn't regress (at least for my use case), since I have custom 
> instrumentation in my formatter. I can confirm that 3 versions of this 
> function (#68705, #74786, and this PR) exhibit the same level of performance. 
> Raw numbers (in nanoseconds) fluctuate a lot, but I don't see anything 
> concerning:
> 
> ```
> This PR
> ---
> 2,611,025
> 1,988,893
> 2,878,981
> 1,873,220
> 
> main branch (#74786)
> 
> 1,973,071
> 2,542,073
> 1,509,624
> 
> Initial implementation (#68705)
> --
> 2,029,233
> 2,477,041
> 1,315,462
> ```

Cool. Thanks for confirming that.

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


[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)

2024-04-19 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/89183

>From 80ba4f24cdfe8b5f2aa44a016ea69ad08f56d558 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Thu, 18 Apr 2024 07:34:45 +
Subject: [PATCH 1/2] [lldb] Make SBType::FindDirectNestedType work with
 expression ASTs

The types we get out of expressions will not have an associated symbol
file, so the current method of looking up the type will fail. Instead, I
plumb the query through the TypeSystem class. This correctly finds the
type in both cases (importing it into the expression AST if needed). I
haven't measured, but it should also be more efficient than doing a type
lookup (at least, after the type has already been found once).
---
 lldb/include/lldb/Symbol/TypeSystem.h |  7 
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 30 +++
 .../TypeSystem/Clang/TypeSystemClang.h|  3 ++
 lldb/source/Symbol/Type.cpp   | 16 +---
 lldb/test/API/python_api/type/TestTypeList.py | 37 +++
 5 files changed, 63 insertions(+), 30 deletions(-)

diff --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index f647fcbf1636ea..3a927d313b823d 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -28,6 +28,7 @@
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/lldb-private.h"
+#include "lldb/lldb-types.h"
 
 class PDBASTParser;
 
@@ -363,6 +364,12 @@ class TypeSystem : public PluginInterface,
   lldb::opaque_compiler_type_t type, llvm::StringRef name,
   bool omit_empty_base_classes, std::vector &child_indexes) = 0;
 
+  virtual CompilerType
+  GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+  llvm::StringRef name) {
+return CompilerType();
+  }
+
   virtual bool IsTemplateType(lldb::opaque_compiler_type_t type);
 
   virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index be0ddb06f82c18..2621f682011b41 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -6997,6 +6997,36 @@ 
TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
   return UINT32_MAX;
 }
 
+CompilerType
+TypeSystemClang::GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+ llvm::StringRef name) {
+  if (!type || name.empty())
+return CompilerType();
+
+  clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
+  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+
+  switch (type_class) {
+  case clang::Type::Record: {
+if (!GetCompleteType(type))
+  return CompilerType();
+const clang::RecordType *record_type =
+llvm::cast(qual_type.getTypePtr());
+const clang::RecordDecl *record_decl = record_type->getDecl();
+
+clang::DeclarationName decl_name(&getASTContext().Idents.get(name));
+for (NamedDecl *decl : record_decl->lookup(decl_name)) {
+  if (auto *tag_decl = dyn_cast(decl))
+return GetType(getASTContext().getTagDeclType(tag_decl));
+}
+break;
+  }
+  default:
+break;
+  }
+  return CompilerType();
+}
+
 bool TypeSystemClang::IsTemplateType(lldb::opaque_compiler_type_t type) {
   if (!type)
 return false;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 05c303baa41640..68b82e9688f12b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -897,6 +897,9 @@ class TypeSystemClang : public TypeSystem {
 bool omit_empty_base_classes,
 std::vector &child_indexes) override;
 
+  CompilerType GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+   llvm::StringRef name) override;
+
   bool IsTemplateType(lldb::opaque_compiler_type_t type) override;
 
   size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type,
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 44a24d7178f562..d9894ac355c6f0 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -1177,20 +1177,8 @@ CompilerType 
TypeImpl::FindDirectNestedType(llvm::StringRef name) {
   if (name.empty())
 return CompilerType();
   auto type_system = GetTypeSystem(/*prefer_dynamic*/ false);
-  auto *symbol_file = type_system->GetSymbolFile();
-  if (!symbol_file)
-return CompilerType();
-  auto decl_context = 
type_system->GetCompilerDeclContextForType(m_static_type);
-  if (!decl_context.IsValid())
-return CompilerType();
-  TypeQuery query(decl_con

[Lldb-commits] [lldb] e7c042f - [lldb] Make SBType::FindDirectNestedType work with expression ASTs (#89183)

2024-04-19 Thread via lldb-commits

Author: Pavel Labath
Date: 2024-04-19T14:16:09+02:00
New Revision: e7c042f12fd6f3e9aeb37854d499aada8457

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

LOG: [lldb] Make SBType::FindDirectNestedType work with expression ASTs (#89183)

The types we get out of expressions will not have an associated symbol
file, so the current method of looking up the type will fail. Instead, I
plumb the query through the TypeSystem class. This correctly finds the
type in both cases (importing it into the expression AST if needed). I
haven't measured, but it should also be more efficient than doing a type
lookup (at least, after the type has already been found once).

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp
lldb/source/Symbol/Type.cpp
lldb/test/API/python_api/type/TestTypeList.py

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index c1dce4ccbf79c2..b71c531f21633a 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -447,6 +447,8 @@ class CompilerType {
 bool omit_empty_base_classes,
 std::vector &child_indexes) const;
 
+  CompilerType GetDirectNestedTypeWithName(llvm::StringRef name) const;
+
   /// Return the number of template arguments the type has.
   /// If expand_pack is true, then variadic argument packs are automatically
   /// expanded to their supplied arguments. If it is false an argument pack

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index f647fcbf1636ea..3a927d313b823d 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -28,6 +28,7 @@
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/lldb-private.h"
+#include "lldb/lldb-types.h"
 
 class PDBASTParser;
 
@@ -363,6 +364,12 @@ class TypeSystem : public PluginInterface,
   lldb::opaque_compiler_type_t type, llvm::StringRef name,
   bool omit_empty_base_classes, std::vector &child_indexes) = 0;
 
+  virtual CompilerType
+  GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+  llvm::StringRef name) {
+return CompilerType();
+  }
+
   virtual bool IsTemplateType(lldb::opaque_compiler_type_t type);
 
   virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type,

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index be0ddb06f82c18..2621f682011b41 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -6997,6 +6997,36 @@ 
TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
   return UINT32_MAX;
 }
 
+CompilerType
+TypeSystemClang::GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+ llvm::StringRef name) {
+  if (!type || name.empty())
+return CompilerType();
+
+  clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
+  const clang::Type::TypeClass type_class = qual_type->getTypeClass();
+
+  switch (type_class) {
+  case clang::Type::Record: {
+if (!GetCompleteType(type))
+  return CompilerType();
+const clang::RecordType *record_type =
+llvm::cast(qual_type.getTypePtr());
+const clang::RecordDecl *record_decl = record_type->getDecl();
+
+clang::DeclarationName decl_name(&getASTContext().Idents.get(name));
+for (NamedDecl *decl : record_decl->lookup(decl_name)) {
+  if (auto *tag_decl = dyn_cast(decl))
+return GetType(getASTContext().getTagDeclType(tag_decl));
+}
+break;
+  }
+  default:
+break;
+  }
+  return CompilerType();
+}
+
 bool TypeSystemClang::IsTemplateType(lldb::opaque_compiler_type_t type) {
   if (!type)
 return false;

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 05c303baa41640..68b82e9688f12b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -897,6 +897,9 @@ class TypeSystemClang : public TypeSystem {
 bool omit_empty_base_classes,
 std::vector &child_indexes) override;
 
+  CompilerType GetDirectNestedTypeWithName(lldb::opaque_compiler_type_t type,
+

[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)

2024-04-19 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] fix python extension debug suffix on Win (PR #89037)

2024-04-19 Thread Alexander M. via lldb-commits

https://github.com/amordo updated 
https://github.com/llvm/llvm-project/pull/89037

>From 1a2ae41cf5004439c534bc71eb6b8911f7bf0a0a Mon Sep 17 00:00:00 2001
From: Alexander Mordovskiy 
Date: Fri, 19 Apr 2024 17:21:05 +0200
Subject: [PATCH] [lldb] check python extension debug suffix on Win

ae389b2450bd604a3f3bbe5b09b333b2d99801dd relies on
LLDB_PYTHON_EXT_SUFFIX of Python3_EXECUTABLE for naming the result lldb
python lib.

Debug python is used in Debug LLDB on Windows, so the result lib name
requires "_d". LLDB_PYTHON_EXT_SUFFIX doesn't start with "_d" if
Python3_EXECUTABLE wasn't set to Debug executable explicitly. Perhaps a
better solution can be found after solving "debug python executable is
not currently handled" issue
(https://gitlab.kitware.com/cmake/cmake/-/issues/25874#note_1506658).
---
 lldb/CMakeLists.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 7844d93d78d29a..35100b790b2aca 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -75,6 +75,12 @@ if (LLDB_ENABLE_PYTHON)
   endif()
 endif()
   endforeach()
+  if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL Debug)
+string(SUBSTRING ${LLDB_PYTHON_EXT_SUFFIX} 0 2 FIRST_2_CHARS)
+if(NOT FIRST_2_CHARS STREQUAL "_d")
+  set(LLDB_PYTHON_EXT_SUFFIX "_d${LLDB_PYTHON_EXT_SUFFIX}")
+endif()
+  endif()
 endif ()
 
 if (LLDB_ENABLE_LUA)

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


[Lldb-commits] [lldb] [lldb] fix python extension debug suffix on Win (PR #89037)

2024-04-19 Thread Alexander M. via lldb-commits

amordo wrote:

Applied @DavidSpickett's remark

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Miro Bucko via lldb-commits

https://github.com/mbucko created 
https://github.com/llvm/llvm-project/pull/89405

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
`Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM`
lldb-dap on the other hand does not emit a similar message. This PR adds the 
same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following: Process 2167677 exited with 
status = -1 (0x) debugserver died with signal SIGTERM

Reviewers:
jeffreytan81,clayborg,kusmour,

Subscribers:

Tasks:
lldb-dap

Tags:

>From 93ed3f24ce581f94820900cfa3aaa082cba6f37f Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 lldb/tools/lldb-dap/lldb-dap.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..76c7fb17a793cb 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,13 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char * const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(OutputType::Console,
+  "Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+  process.GetProcessID(), exit_status, exit_status,
+  exit_description ? exit_description : "");
+
 // When restarting, we can get an "exited" event for the process we
 // just killed with the old PID, or even with no PID. In that case
 // we don't have to terminate the session.

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread via lldb-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Miro Bucko (mbucko)


Changes

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
`Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM`
lldb-dap on the other hand does not emit a similar message. This PR adds the 
same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following: Process 2167677 exited with 
status = -1 (0x) debugserver died with signal SIGTERM

Reviewers:
jeffreytan81,clayborg,kusmour,

Subscribers:

Tasks:
lldb-dap

Tags:

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


1 Files Affected:

- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+7) 


``diff
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..76c7fb17a793cb 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,13 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char * const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(OutputType::Console,
+  "Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+  process.GetProcessID(), exit_status, exit_status,
+  exit_description ? exit_description : "");
+
 // When restarting, we can get an "exited" event for the process we
 // just killed with the old PID, or even with no PID. In that case
 // we don't have to terminate the session.

``




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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Kevin Frei via lldb-commits

kevinfrei wrote:

You generally have to tag people with an at sign to get their attention :) 
@jeffreytan81  @clayborg  @kusmour 

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Is it possible to test this, for example by explicitly killing the debug stub? 

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Yep, please write a python test. A possible idea is to have a target that does 
nothing for 10 seconds, during which you kill the debug server (lldb-server or 
debugserver) and then you assert on the final message sent by lldb-vscode.

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/88335

>From 210b1e85f2d827a7c57f3b1106d876d2e0f18511 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 10 Apr 2024 18:03:57 -0700
Subject: [PATCH] [lldb/test] Add basic ld.lld --debug-names tests

Test that ld.lld --debug-names (#86508) built per-module index can be
consumed by lldb. This has uncovered a bug during the development of the
lld feature.
---
 lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp | 5 +
 lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp | 5 +
 2 files changed, 10 insertions(+)

diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
index 30143a41d5e734..b9a63525d0711d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
@@ -59,6 +59,11 @@
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+/// Test a per-module index built by lld.
+// RUN: ld.lld --debug-names %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t 
| \
+// RUN:   FileCheck --check-prefix=BASE %s
+
 // NAMES: Name: .debug_names
 
 // BASE: Found 4 functions:
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
index 98b4097cdda01f..e46fa14489d32d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
@@ -33,6 +33,11 @@
 // RUN: lldb-test symbols --name=not_there --find=variable %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+/// Test a per-module index built by lld.
+// RUN: ld.lld --debug-names %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+
 // NAMES: Name: .debug_names
 
 // EMPTY: Found 0 variables:

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Fangrui Song (MaskRay)


Changes

Test that ld.lld --debug-names (#86508) built per-module index can be
consumed by lldb. This has uncovered a bug during the development of the
lld feature.

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


2 Files Affected:

- (modified) lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp (+5) 
- (modified) lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp (+5) 


``diff
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
index 30143a41d5e734..b9a63525d0711d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
@@ -59,6 +59,11 @@
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+/// Test a per-module index built by lld.
+// RUN: ld.lld --debug-names %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t 
| \
+// RUN:   FileCheck --check-prefix=BASE %s
+
 // NAMES: Name: .debug_names
 
 // BASE: Found 4 functions:
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
index 98b4097cdda01f..e46fa14489d32d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
@@ -33,6 +33,11 @@
 // RUN: lldb-test symbols --name=not_there --find=variable %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+/// Test a per-module index built by lld.
+// RUN: ld.lld --debug-names %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+
 // NAMES: Name: .debug_names
 
 // EMPTY: Found 0 variables:

``




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


[Lldb-commits] [lldb] [lldb] Skip remote PutFile when MD5 hashes equal (PR #88812)

2024-04-19 Thread Alex Langford via lldb-commits

bulbazord wrote:

> I got an email that the build failed and I should revert because of this: 
> https://lab.llvm.org/buildbot/#/builders/68/builds/72623
> 
> @bulbazord can you or someone with write permissions revert this PR so I have 
> time to triage the issue?

As David said, no need since that was unrelated to your change. Jonas makes a 
good point in his review though (that I totally missed when I reviewed), please 
open a new PR that addresses his feedback.

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread Ed Maste via lldb-commits


@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64

emaste wrote:

As an aside does this mean that the hash as seen in the packet has the low and 
high 64 bits swapped from what would be displayed by e.g. the md5 command? For 
example `e9800998ecf8427ed41d8cd98f00b204` for an empty file rather than 
`d41d8cd98f00b204e9800998ecf8427e`



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


[Lldb-commits] [lldb] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (PR #89427)

2024-04-19 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu created 
https://github.com/llvm/llvm-project/pull/89427

This removes `m_forward_decl_die_to_compiler_type` which is a map from `const 
DWARFDebugInfoEntry *` to `lldb::opaque_compiler_type_t`. This map is currently 
used in `DWARFASTParserClang::ParseEnum` and 
`DWARFASTParserClang::ParseStructureLikeDIE` to avoid creating duplicate 
CompilerType for the specific DIE. But before entering these two functions in 
`DWARFASTParserClang::ParseTypeFromDWARF`, we already checked with 
`SymbolFileDWARF::GetDIEToType()`  if we have a Type created from this DIE to 
avoid creating two CompilerTypes for the same DIE. So, this map is unnecessary 
and unseful.

>From 200e0caa806ca7d84e8722d6408c8c37ffb9f598 Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Fri, 19 Apr 2024 13:57:06 -0400
Subject: [PATCH] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as
 it never actually being used.

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 148 --
 .../SymbolFile/DWARF/SymbolFileDWARF.h|   9 --
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp   |   5 -
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |   2 -
 4 files changed, 65 insertions(+), 99 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 54d06b1115a229..41d81fbcf1b087 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -854,36 +854,26 @@ TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext 
&sc,
DW_TAG_value_to_name(tag), type_name_cstr);
 
   CompilerType enumerator_clang_type;
-  CompilerType clang_type;
-  clang_type = CompilerType(
-  m_ast.weak_from_this(),
-  dwarf->GetForwardDeclDIEToCompilerType().lookup(die.GetDIE()));
-  if (!clang_type) {
-if (attrs.type.IsValid()) {
-  Type *enumerator_type =
-  dwarf->ResolveTypeUID(attrs.type.Reference(), true);
-  if (enumerator_type)
-enumerator_clang_type = enumerator_type->GetFullCompilerType();
-}
+  if (attrs.type.IsValid()) {
+Type *enumerator_type = dwarf->ResolveTypeUID(attrs.type.Reference(), 
true);
+if (enumerator_type)
+  enumerator_clang_type = enumerator_type->GetFullCompilerType();
+  }
 
-if (!enumerator_clang_type) {
-  if (attrs.byte_size) {
-enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
-"", DW_ATE_signed, *attrs.byte_size * 8);
-  } else {
-enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
-  }
+  if (!enumerator_clang_type) {
+if (attrs.byte_size) {
+  enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
+  "", DW_ATE_signed, *attrs.byte_size * 8);
+} else {
+  enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
 }
-
-clang_type = m_ast.CreateEnumerationType(
-attrs.name.GetStringRef(),
-GetClangDeclContextContainingDIE(die, nullptr),
-GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
-attrs.is_scoped_enum);
-  } else {
-enumerator_clang_type = m_ast.GetEnumerationIntegerType(clang_type);
   }
 
+  CompilerType clang_type = m_ast.CreateEnumerationType(
+  attrs.name.GetStringRef(), GetClangDeclContextContainingDIE(die, 
nullptr),
+  GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
+  attrs.is_scoped_enum);
+
   LinkDeclContextToDIE(TypeSystemClang::GetDeclContextForType(clang_type), 
die);
 
   type_sp =
@@ -1781,65 +1771,59 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   assert(tag_decl_kind != -1);
   UNUSED_IF_ASSERT_DISABLED(tag_decl_kind);
   bool clang_type_was_created = false;
-  clang_type = CompilerType(
-  m_ast.weak_from_this(),
-  dwarf->GetForwardDeclDIEToCompilerType().lookup(die.GetDIE()));
-  if (!clang_type) {
-clang::DeclContext *decl_ctx =
-GetClangDeclContextContainingDIE(die, nullptr);
-
-PrepareContextToReceiveMembers(m_ast, GetClangASTImporter(), decl_ctx, die,
-   attrs.name.GetCString());
-
-if (attrs.accessibility == eAccessNone && decl_ctx) {
-  // Check the decl context that contains this class/struct/union. If
-  // it is a class we must give it an accessibility.
-  const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind();
-  if (DeclKindIsCXXClass(containing_decl_kind))
-attrs.accessibility = default_accessibility;
-}
-
-ClangASTMetadata metadata;
-metadata.SetUserID(die.GetID());
-metadata.SetIsDynamicCXXType(dwarf->ClassOrStructIsVirtual(die));
-
-TypeSystemClang::TemplateParameterInfos template_param_infos;
-if (ParseTemplateParameterInfos(die, template_param_infos)) {
-  clang::ClassTemplateDecl *class_template_decl =
-  m_ast.ParseClassTemplateDecl(
-  decl_ctx, G

[Lldb-commits] [lldb] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (PR #89427)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Zequan Wu (ZequanWu)


Changes

This removes `m_forward_decl_die_to_compiler_type` which is a map from `const 
DWARFDebugInfoEntry *` to `lldb::opaque_compiler_type_t`. This map is currently 
used in `DWARFASTParserClang::ParseEnum` and 
`DWARFASTParserClang::ParseStructureLikeDIE` to avoid creating duplicate 
CompilerType for the specific DIE. But before entering these two functions in 
`DWARFASTParserClang::ParseTypeFromDWARF`, we already checked with 
`SymbolFileDWARF::GetDIEToType()`  if we have a Type created from this DIE to 
avoid creating two CompilerTypes for the same DIE. So, this map is unnecessary 
and unseful.

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


4 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(+65-83) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (-9) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (-5) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (-2) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 54d06b1115a229..41d81fbcf1b087 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -854,36 +854,26 @@ TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext 
&sc,
DW_TAG_value_to_name(tag), type_name_cstr);
 
   CompilerType enumerator_clang_type;
-  CompilerType clang_type;
-  clang_type = CompilerType(
-  m_ast.weak_from_this(),
-  dwarf->GetForwardDeclDIEToCompilerType().lookup(die.GetDIE()));
-  if (!clang_type) {
-if (attrs.type.IsValid()) {
-  Type *enumerator_type =
-  dwarf->ResolveTypeUID(attrs.type.Reference(), true);
-  if (enumerator_type)
-enumerator_clang_type = enumerator_type->GetFullCompilerType();
-}
+  if (attrs.type.IsValid()) {
+Type *enumerator_type = dwarf->ResolveTypeUID(attrs.type.Reference(), 
true);
+if (enumerator_type)
+  enumerator_clang_type = enumerator_type->GetFullCompilerType();
+  }
 
-if (!enumerator_clang_type) {
-  if (attrs.byte_size) {
-enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
-"", DW_ATE_signed, *attrs.byte_size * 8);
-  } else {
-enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
-  }
+  if (!enumerator_clang_type) {
+if (attrs.byte_size) {
+  enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
+  "", DW_ATE_signed, *attrs.byte_size * 8);
+} else {
+  enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
 }
-
-clang_type = m_ast.CreateEnumerationType(
-attrs.name.GetStringRef(),
-GetClangDeclContextContainingDIE(die, nullptr),
-GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
-attrs.is_scoped_enum);
-  } else {
-enumerator_clang_type = m_ast.GetEnumerationIntegerType(clang_type);
   }
 
+  CompilerType clang_type = m_ast.CreateEnumerationType(
+  attrs.name.GetStringRef(), GetClangDeclContextContainingDIE(die, 
nullptr),
+  GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
+  attrs.is_scoped_enum);
+
   LinkDeclContextToDIE(TypeSystemClang::GetDeclContextForType(clang_type), 
die);
 
   type_sp =
@@ -1781,65 +1771,59 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   assert(tag_decl_kind != -1);
   UNUSED_IF_ASSERT_DISABLED(tag_decl_kind);
   bool clang_type_was_created = false;
-  clang_type = CompilerType(
-  m_ast.weak_from_this(),
-  dwarf->GetForwardDeclDIEToCompilerType().lookup(die.GetDIE()));
-  if (!clang_type) {
-clang::DeclContext *decl_ctx =
-GetClangDeclContextContainingDIE(die, nullptr);
-
-PrepareContextToReceiveMembers(m_ast, GetClangASTImporter(), decl_ctx, die,
-   attrs.name.GetCString());
-
-if (attrs.accessibility == eAccessNone && decl_ctx) {
-  // Check the decl context that contains this class/struct/union. If
-  // it is a class we must give it an accessibility.
-  const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind();
-  if (DeclKindIsCXXClass(containing_decl_kind))
-attrs.accessibility = default_accessibility;
-}
-
-ClangASTMetadata metadata;
-metadata.SetUserID(die.GetID());
-metadata.SetIsDynamicCXXType(dwarf->ClassOrStructIsVirtual(die));
-
-TypeSystemClang::TemplateParameterInfos template_param_infos;
-if (ParseTemplateParameterInfos(die, template_param_infos)) {
-  clang::ClassTemplateDecl *class_template_decl =
-  m_ast.ParseClassTemplateDecl(
-  decl_ctx, GetOwningClangModule(die), attrs.accessibility,
-  attrs.name.GetCString(), tag_decl_kind, template

[Lldb-commits] [lldb] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (PR #89427)

2024-04-19 Thread Zequan Wu via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Adrian Prantl via lldb-commits

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

This adds a hint to the missing symbols error message to make it easier to 
understand what this means to users.

>From d57f2adff84dc5148c417135aa4733e05476876c Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Fri, 19 Apr 2024 11:08:16 -0700
Subject: [PATCH] [lldb] Provide a better error message for missing symbols

This adds a hint to the missing symbols error message to make it
easier to understand what this means to users.
---
 lldb/source/Expression/IRExecutionUnit.cpp | 4 +++-
 lldb/test/API/lang/cpp/constructors/TestCppConstructors.py | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..8d4e5aaf9fe7ea 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-
+ss.PutCString(
+"\nHint: The expression tried to call a function missing from the "
+"target, perhaps because it was optimized out by the compiler.");
 error.SetErrorString(ss.GetString());
 
 return;
diff --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 6724bfc8ed78e0..d73b2af1ca077c 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,8 @@ def test_constructors(self):
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:"],
+substrs=["Couldn't look up symbols:",
+ "function missing"],
 )
 
 @skipIfWindows  # Can't find operator new.

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)


Changes

This adds a hint to the missing symbols error message to make it easier to 
understand what this means to users.

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


2 Files Affected:

- (modified) lldb/source/Expression/IRExecutionUnit.cpp (+3-1) 
- (modified) lldb/test/API/lang/cpp/constructors/TestCppConstructors.py (+2-1) 


``diff
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..8d4e5aaf9fe7ea 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-
+ss.PutCString(
+"\nHint: The expression tried to call a function missing from the "
+"target, perhaps because it was optimized out by the compiler.");
 error.SetErrorString(ss.GetString());
 
 return;
diff --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 6724bfc8ed78e0..d73b2af1ca077c 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,8 @@ def test_constructors(self):
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:"],
+substrs=["Couldn't look up symbols:",
+ "function missing"],
 )
 
 @skipIfWindows  # Can't find operator new.

``




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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 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 
4841d70a4b7d7cd8c492c16a9da339ec75bca135...d57f2adff84dc5148c417135aa4733e05476876c
 lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
``





View the diff from darker here.


``diff
--- TestCppConstructors.py  2024-04-19 18:22:28.00 +
+++ TestCppConstructors.py  2024-04-19 18:27:21.930974 +
@@ -45,12 +45,11 @@
 substrs=["Couldn't look up symbols:"],
 )
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:",
- "function missing"],
+substrs=["Couldn't look up symbols:", "function missing"],
 )
 
 @skipIfWindows  # Can't find operator new.
 @skipIfLinux  # Fails on some Linux systems with SIGABRT.
 def test_constructors_new(self):

``




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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Felipe de Azevedo Piovezan via lldb-commits

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

This LGTM!
I like the wording in the sense that it uses a slightly less "systemy" 
language, and so it becomes less cryptic to a wider audience.

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


[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)

2024-04-19 Thread via lldb-commits


@@ -649,16 +651,25 @@ MinidumpFileBuilder::AddMemoryList(const lldb::ProcessSP 
&process_sp,
   DataBufferHeap helper_data;
   std::vector mem_descriptors;
   for (const auto &core_range : core_ranges) {
-// Skip empty memory regions or any regions with no permissions.
-if (core_range.range.empty() || core_range.lldb_permissions == 0)
+// Skip empty memory regions.
+if (core_range.range.empty())
   continue;
 const addr_t addr = core_range.range.start();
 const addr_t size = core_range.range.size();
 auto data_up = std::make_unique(size, 0);
 const size_t bytes_read =
 process_sp->ReadMemory(addr, data_up->GetBytes(), size, error);
-if (bytes_read == 0)
+if (error.Fail()) {
+  Log *log = GetLog(LLDBLog::SystemRuntime);
+  LLDB_LOGF(log, "Failed to read memory region. Bytes read: %zu, error: 
%s",
+bytes_read, error.AsCString());
+  error.Clear();
+}
+
+if (bytes_read == 0) {

jeffreytan81 wrote:

If you undo the `{}` around single line block this should be good to go.

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


[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)

2024-04-19 Thread via lldb-commits

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

Looks good. Please undo the "{}" in the single line comment. 

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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

LGMT with the formatting fixed.

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Jonas Devlieghere via lldb-commits


@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-
+ss.PutCString(
+"\nHint: The expression tried to call a function missing from the "
+"target, perhaps because it was optimized out by the compiler.");

JDevlieghere wrote:

[bikeshedding] 
... a function that is not available in the target, perhaps because ...
[/bikeshedding]

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [easy] Fix spacing in help message of 'process save-core' command (PR #89445)

2024-04-19 Thread Michael Christensen via lldb-commits

https://github.com/mdko created https://github.com/llvm/llvm-project/pull/89445

Very minor change to help message on `process save-core`. Adds space between 
two sentences explaining the `-p` option: 

"Specify a plugin name to create the core file.This allows core files to be 
saved in different formats." 
-->
"Specify a plugin name to create the core file. This allows core files to be 
saved in different formats."

Before:
```
(lldb) help process save-core
Save the current process as a core file using an appropriate file type.

Syntax: process save-core [-s corefile-style -p plugin-name] FILE

Command Options Usage:
  process save-core [-p[]] [-s ] 

   -p[] ( --plugin-name=[] )
Specify a plugin name to create the core file.This allows core 
files to be saved in different formats.

   -s  ( --style  )
Request a specific style of corefile to be saved.
Values: full | modified-memory | stack

 This command takes options and free-form arguments.  If your arguments 
resemble option specifiers (i.e., they start with a -
 or --), you must use ' -- ' between the end of the command options and the 
beginning of the arguments.
```

After:
```
michristensen@devbig356 build/Debug » $HOME/llvm-sand/build/Debug/bin/lldb -x
(lldb) help process save-core
Save the current process as a core file using an appropriate file type.

Syntax: process save-core [-s corefile-style -p plugin-name] FILE

Command Options Usage:
  process save-core [-p[]] [-s ] 

   -p[] ( --plugin-name=[] )
Specify a plugin name to create the core file. This allows core 
files to be saved in different formats.

   -s  ( --style  )
Request a specific style of corefile to be saved.
Values: full | modified-memory | stack

 This command takes options and free-form arguments.  If your arguments 
resemble option specifiers (i.e., they start with a -
 or --), you must use ' -- ' between the end of the command options and the 
beginning of the arguments.
```

>From 38f81bc7c9581b2e5f8972b465c6b2461499437c Mon Sep 17 00:00:00 2001
From: Michael Christensen 
Date: Fri, 19 Apr 2024 11:54:45 -0700
Subject: [PATCH] fix spacing in help message of 'process save-core' command

---
 lldb/source/Commands/Options.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 62bbfdc117834f..00238d67d73215 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -784,7 +784,7 @@ let Command = "process save_core" in {
 EnumArg<"SaveCoreStyle">, Desc<"Request a specific style "
 "of corefile to be saved.">;
   def process_save_core_plugin_name : Option<"plugin-name", "p">,
-OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core 
file."
+OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core 
file. "
 "This allows core files to be saved in different formats.">;
 }
 

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


[Lldb-commits] [lldb] [easy] Fix spacing in help message of 'process save-core' command (PR #89445)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Christensen (mdko)


Changes

Very minor change to help message on `process save-core`. Adds space between 
two sentences explaining the `-p` option: 

"Specify a plugin name to create the core file.This allows core files to be 
saved in different formats." 
-->
"Specify a plugin name to create the core file. This allows core files to be 
saved in different formats."

Before:
```
(lldb) help process save-core
Save the current process as a core file using an appropriate file type.

Syntax: process save-core [-s corefile-style -p plugin-name] FILE

Command Options Usage:
  process save-core [-p[]] [-s ] 


   -p[] ( --plugin-name=[] )
Specify a plugin name to create the core file.This allows core 
files to be saved in different formats.

   -s  ( --style  )
Request a specific style of corefile to be saved.
Values: full | modified-memory | stack

 This command takes options and free-form arguments.  If your arguments 
resemble option specifiers (i.e., they start with a -
 or --), you must use ' -- ' between the end of the command options and the 
beginning of the arguments.
```

After:
```
michristensen@devbig356 build/Debug » 
$HOME/llvm-sand/build/Debug/bin/lldb -x
(lldb) help process save-core
Save the current process as a core file using an appropriate file type.

Syntax: process save-core [-s corefile-style -p plugin-name] FILE

Command Options Usage:
  process save-core [-p[]] [-s ] 


   -p[] ( --plugin-name=[] )
Specify a plugin name to create the core file. This allows core 
files to be saved in different formats.

   -s  ( --style  )
Request a specific style of corefile to be saved.
Values: full | modified-memory | stack

 This command takes options and free-form arguments.  If your arguments 
resemble option specifiers (i.e., they start with a -
 or --), you must use ' -- ' between the end of the command options and the 
beginning of the arguments.
```

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


1 Files Affected:

- (modified) lldb/source/Commands/Options.td (+1-1) 


``diff
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 62bbfdc117834f..00238d67d73215 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -784,7 +784,7 @@ let Command = "process save_core" in {
 EnumArg<"SaveCoreStyle">, Desc<"Request a specific style "
 "of corefile to be saved.">;
   def process_save_core_plugin_name : Option<"plugin-name", "p">,
-OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core 
file."
+OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core 
file. "
 "This allows core files to be saved in different formats.">;
 }
 

``




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


[Lldb-commits] [clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Nicolas van Kempen via lldb-commits

https://github.com/nicovank updated 
https://github.com/llvm/llvm-project/pull/89140

>From 2c82316a0f6641b93c666143211a87f06de8feab Mon Sep 17 00:00:00 2001
From: Nicolas van Kempen 
Date: Wed, 17 Apr 2024 14:27:42 -0400
Subject: [PATCH] Apply modernize-use-starts-ends-with on llvm-project

---
 clang-tools-extra/clang-doc/Representation.cpp   | 4 ++--
 lldb/unittests/Host/FileSystemTest.cpp   | 2 +-
 llvm/unittests/Support/VirtualFileSystemTest.cpp | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-doc/Representation.cpp 
b/clang-tools-extra/clang-doc/Representation.cpp
index 84233c36e15d98..2afff2929cf79c 100644
--- a/clang-tools-extra/clang-doc/Representation.cpp
+++ b/clang-tools-extra/clang-doc/Representation.cpp
@@ -380,8 +380,8 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext 
*ECtx,
   this->SourceRoot = std::string(SourceRootDir);
   if (!RepositoryUrl.empty()) {
 this->RepositoryUrl = std::string(RepositoryUrl);
-if (!RepositoryUrl.empty() && RepositoryUrl.find("http://";) != 0 &&
-RepositoryUrl.find("https://";) != 0)
+if (!RepositoryUrl.empty() && !RepositoryUrl.starts_with("http://";) &&
+!RepositoryUrl.starts_with("https://";))
   this->RepositoryUrl->insert(0, "https://";);
   }
 }
diff --git a/lldb/unittests/Host/FileSystemTest.cpp 
b/lldb/unittests/Host/FileSystemTest.cpp
index 3b5ee7c8bc2237..58887f6b2467e0 100644
--- a/lldb/unittests/Host/FileSystemTest.cpp
+++ b/lldb/unittests/Host/FileSystemTest.cpp
@@ -93,7 +93,7 @@ class DummyFileSystem : public vfs::FileSystem {
 std::map::iterator I;
 std::string Path;
 bool isInPath(StringRef S) {
-  if (Path.size() < S.size() && S.find(Path) == 0) {
+  if (Path.size() < S.size() && S.starts_with(Path)) {
 auto LastSep = S.find_last_of('/');
 if (LastSep == Path.size() || LastSep == Path.size() - 1)
   return true;
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp 
b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index e9b4ac3d92e1dd..e9fd9671ea6ab5 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -101,7 +101,7 @@ class DummyFileSystem : public vfs::FileSystem {
 std::map::iterator I;
 std::string Path;
 bool isInPath(StringRef S) {
-  if (Path.size() < S.size() && S.find(Path) == 0) {
+  if (Path.size() < S.size() && S.starts_with(Path)) {
 auto LastSep = S.find_last_of('/');
 if (LastSep == Path.size() || LastSep == Path.size() - 1)
   return true;

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


[Lldb-commits] [clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Nicolas van Kempen via lldb-commits

nicovank wrote:

Added one missed instance due to CMake configuration options.

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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Adrian Prantl via lldb-commits

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

>From 162907c6527464f828756b7152e2364ae3be88b5 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Fri, 19 Apr 2024 11:08:16 -0700
Subject: [PATCH] [lldb] Provide a better error message for missing symbols

This adds a hint to the missing symbols error message to make it
easier to understand what this means to users.
---
 lldb/source/Expression/IRExecutionUnit.cpp | 4 +++-
 lldb/test/API/lang/cpp/constructors/TestCppConstructors.py | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..07df8c52a2a4f0 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-
+ss.PutCString(
+"\nHint: The expression tried to call a function that is not present "
+"in the target, perhaps because it was optimized out by the 
compiler.");
 error.SetErrorString(ss.GetString());
 
 return;
diff --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 6724bfc8ed78e0..140877adba735a 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,7 @@ def test_constructors(self):
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:"],
+substrs=["Couldn't look up symbols:", "function missing"],
 )
 
 @skipIfWindows  # Can't find operator new.

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


[Lldb-commits] [lldb] [easy] Fix spacing in help message of 'process save-core' command (PR #89445)

2024-04-19 Thread Alex Langford via lldb-commits

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

LGTM. Thanks!

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


[Lldb-commits] [lldb] [lldb] Skip remote PutFile when MD5 hashes equal (PR #88812)

2024-04-19 Thread Anthony Ha via lldb-commits

Awfa wrote:

Thanks for taking a look at the build. I will do a new PR addressing the issues.

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


[Lldb-commits] [lldb] 08163cd - [lldb] Provide a better error message for missing symbols (#89433)

2024-04-19 Thread via lldb-commits

Author: Adrian Prantl
Date: 2024-04-19T13:14:55-07:00
New Revision: 08163cd9d82690e808c28515523b5fd0923d7b38

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

LOG: [lldb] Provide a better error message for missing symbols (#89433)

This adds a hint to the missing symbols error message to make it easier
to understand what this means to users.

Added: 


Modified: 
lldb/source/Expression/IRExecutionUnit.cpp
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..07df8c52a2a4f0 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-
+ss.PutCString(
+"\nHint: The expression tried to call a function that is not present "
+"in the target, perhaps because it was optimized out by the 
compiler.");
 error.SetErrorString(ss.GetString());
 
 return;

diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 6724bfc8ed78e0..140877adba735a 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,7 @@ def test_constructors(self):
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:"],
+substrs=["Couldn't look up symbols:", "function missing"],
 )
 
 @skipIfWindows  # Can't find operator new.



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


[Lldb-commits] [lldb] [lldb] Provide a better error message for missing symbols (PR #89433)

2024-04-19 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread Anthony Ha via lldb-commits


@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64

Awfa wrote:

By the way, I remember observing that the hash that comes out from 
`CalculateMD5` differed from the `md5sum` command before. Like entirely - not 
just the halves swapped.

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread Anthony Ha via lldb-commits

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


[Lldb-commits] [clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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

LLDB & VFS change LGTM.

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/89405

>From 31d688e70beec442cf731986ff8e4c8e9b5a9f0c Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 .../tools/lldb-dap/console/TestDAP_console.py | 47 +++
 lldb/tools/lldb-dap/lldb-dap.cpp  |  8 
 2 files changed, 55 insertions(+)

diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py 
b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
index ffa0dc943e0693..4be05b8607c3bf 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -4,10 +4,33 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_latest_pid(process_name):
+processes = []
+for proc in psutil.process_iter():
+try:
+if proc.name() == process_name:
+processes += [proc]
+except (psutil.NoSuchProcess, psutil.AccessDenied, 
psutil.ZombieProcess):
+pass
+if len(processes) == 0:
+print("No lldb-server process found", flush=True, file=sys.stderr)
+return None
+
+processes = sorted(processes, key=lambda x:x.create_time())
+return processes[-1].pid
+
+def killProcess(pid, process_name):
+process = psutil.Process(pid)
+process.terminate()
+try:
+process.wait(timeout=5)
+except psutil.TimeoutExpired:
+self.assertTrue(False, process_name + " process should have exited by 
now")
 
 class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
 def check_lldb_command(
@@ -104,3 +127,27 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = "lldb-server"
+pid = get_latest_pid(process_name)
+killProcess(pid, process_name)
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'"
+)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..124e5a087618a7 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,14 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char *const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(
+OutputType::Console,
+"Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+process.GetProcessID(), exit_status, exit_status,
+exit_description ? exit_description : "");
+
 // When restarting, we can get an "exited" event for the process we
 // just killed with the old PID, or even with no PID. In that case
 // we don't have to terminate the session.

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Miro Bucko via lldb-commits

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


[Lldb-commits] [clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Nicolas van Kempen via lldb-commits

nicovank wrote:

Maybe @kazutakahirata (or anyone else) can stamp the minor `clang-doc` change?

I don't have commit access, feel free to hit merge when everything is in order 
👍 .

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


[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)

2024-04-19 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/88564

>From 3a69226e9ca90bb7ae220b9c3a71a0c2371e52fc Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 12 Apr 2024 09:55:46 -0700
Subject: [PATCH] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam

Summary:
AddMemoryList() was returning the last error status returned by ReadMemory(). 
So if an invalid memory region was read last, the function would return an 
error. Also, one of the reasons why the invalid memory region was read was 
because the check for reading permission in AddRegion() was incorrect.

Test Plan:
./bin/llvm-lit -sv 
~/src/llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py

Reviewers:

Subscribers:

Tasks:

Tags:
---
 .../ObjectFile/Minidump/MinidumpFileBuilder.cpp   | 11 +--
 lldb/source/Target/Process.cpp|  7 +--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index cefd4cb22b6bae..601f11d51d4282 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Target/ThreadList.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
 #include "lldb/Utility/RegisterValue.h"
 
 #include "llvm/ADT/StringRef.h"
@@ -663,14 +664,20 @@ MinidumpFileBuilder::AddMemoryList(const lldb::ProcessSP 
&process_sp,
   DataBufferHeap helper_data;
   std::vector mem_descriptors;
   for (const auto &core_range : core_ranges) {
-// Skip empty memory regions or any regions with no permissions.
-if (core_range.range.empty() || core_range.lldb_permissions == 0)
+// Skip empty memory regions.
+if (core_range.range.empty())
   continue;
 const addr_t addr = core_range.range.start();
 const addr_t size = core_range.range.size();
 auto data_up = std::make_unique(size, 0);
 const size_t bytes_read =
 process_sp->ReadMemory(addr, data_up->GetBytes(), size, error);
+if (error.Fail()) {
+  Log *log = GetLog(LLDBLog::Object);
+  LLDB_LOGF(log, "Failed to read memory region. Bytes read: %zu, error: 
%s",
+bytes_read, error.AsCString());
+  error.Clear();
+}
 if (bytes_read == 0)
   continue;
 // We have a good memory region with valid bytes to store.
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f02ec37cb0f08f..606518ca541267 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -6325,8 +6325,11 @@ static bool AddDirtyPages(const MemoryRegionInfo ®ion,
 // ranges.
 static void AddRegion(const MemoryRegionInfo ®ion, bool try_dirty_pages,
   Process::CoreFileMemoryRanges &ranges) {
-  // Don't add empty ranges or ranges with no permissions.
-  if (region.GetRange().GetByteSize() == 0 || region.GetLLDBPermissions() == 0)
+  // Don't add empty ranges.
+  if (region.GetRange().GetByteSize() == 0)
+return;
+  // Don't add ranges with no read permissions.
+  if ((region.GetLLDBPermissions() & lldb::ePermissionsReadable) == 0)
 return;
   if (try_dirty_pages && AddDirtyPages(region, ranges))
 return;

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


[Lldb-commits] [clang-tools-extra] [lldb] [llvm] Apply modernize-use-starts-ends-with on llvm-project (PR #89140)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] 5232cec - Apply modernize-use-starts-ends-with on llvm-project (#89140)

2024-04-19 Thread via lldb-commits

Author: Nicolas van Kempen
Date: 2024-04-19T14:00:13-07:00
New Revision: 5232cec8f947ed8bff4ca57f990954228d58e66d

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

LOG: Apply modernize-use-starts-ends-with on llvm-project (#89140)

Run `modernize-use-starts-ends-with` on llvm-project. Two instances are
flagged, minor readability improvements, extremely minor performance
improvements.

```
python3 clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
-clang-tidy-binary="build/bin/clang-tidy" \
-clang-apply-replacements-binary="build/bin/clang-apply-replacements" \
-checks="-*,modernize-use-starts-ends-with" \
-header-filter=".*" \
-fix -format
```

I am working on some additions to this check, but they don't seem to
flag any additional cases anyway.

Added: 


Modified: 
clang-tools-extra/clang-doc/Representation.cpp
lldb/unittests/Host/FileSystemTest.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-doc/Representation.cpp 
b/clang-tools-extra/clang-doc/Representation.cpp
index 84233c36e15d98..2afff2929cf79c 100644
--- a/clang-tools-extra/clang-doc/Representation.cpp
+++ b/clang-tools-extra/clang-doc/Representation.cpp
@@ -380,8 +380,8 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext 
*ECtx,
   this->SourceRoot = std::string(SourceRootDir);
   if (!RepositoryUrl.empty()) {
 this->RepositoryUrl = std::string(RepositoryUrl);
-if (!RepositoryUrl.empty() && RepositoryUrl.find("http://";) != 0 &&
-RepositoryUrl.find("https://";) != 0)
+if (!RepositoryUrl.empty() && !RepositoryUrl.starts_with("http://";) &&
+!RepositoryUrl.starts_with("https://";))
   this->RepositoryUrl->insert(0, "https://";);
   }
 }

diff  --git a/lldb/unittests/Host/FileSystemTest.cpp 
b/lldb/unittests/Host/FileSystemTest.cpp
index 3b5ee7c8bc2237..58887f6b2467e0 100644
--- a/lldb/unittests/Host/FileSystemTest.cpp
+++ b/lldb/unittests/Host/FileSystemTest.cpp
@@ -93,7 +93,7 @@ class DummyFileSystem : public vfs::FileSystem {
 std::map::iterator I;
 std::string Path;
 bool isInPath(StringRef S) {
-  if (Path.size() < S.size() && S.find(Path) == 0) {
+  if (Path.size() < S.size() && S.starts_with(Path)) {
 auto LastSep = S.find_last_of('/');
 if (LastSep == Path.size() || LastSep == Path.size() - 1)
   return true;

diff  --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp 
b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index e9b4ac3d92e1dd..e9fd9671ea6ab5 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -101,7 +101,7 @@ class DummyFileSystem : public vfs::FileSystem {
 std::map::iterator I;
 std::string Path;
 bool isInPath(StringRef S) {
-  if (Path.size() < S.size() && S.find(Path) == 0) {
+  if (Path.size() < S.size() && S.starts_with(Path)) {
 auto LastSep = S.find_last_of('/');
 if (LastSep == Path.size() || LastSep == Path.size() - 1)
   return true;



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


[Lldb-commits] [lldb] [easy] Fix spacing in help message of 'process save-core' command (PR #89445)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo requested changes to this pull request.


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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-19 Thread Walter Erquinigo via lldb-commits


@@ -104,3 +127,27 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = "lldb-server"

walter-erquinigo wrote:

this is error prone because multiple lldb-servers might be running at the same 
time. You need the lldb-server or debugserver that is child of the current 
lldb-vscode process and not the most recent one

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


[Lldb-commits] [lldb] c8627e4 - Revert "[lldb] Provide a better error message for missing symbols (#89433)"

2024-04-19 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-04-19T16:37:09-07:00
New Revision: c8627e4e0c8ac453844638522b887ac7b7687672

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

LOG: Revert "[lldb] Provide a better error message for missing symbols (#89433)"

This reverts commit 08163cd9d82690e808c28515523b5fd0923d7b38.

I accidentally broke the test while addressing review feedback.

Added: 


Modified: 
lldb/source/Expression/IRExecutionUnit.cpp
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index 07df8c52a2a4f0..cb9bee8733e15d 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,9 +431,7 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-ss.PutCString(
-"\nHint: The expression tried to call a function that is not present "
-"in the target, perhaps because it was optimized out by the 
compiler.");
+
 error.SetErrorString(ss.GetString());
 
 return;

diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 140877adba735a..6724bfc8ed78e0 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,7 @@ def test_constructors(self):
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:", "function missing"],
+substrs=["Couldn't look up symbols:"],
 )
 
 @skipIfWindows  # Can't find operator new.



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


[Lldb-commits] [lldb] 6a35ee8 - [lldb] Provide a better error message for missing symbols (#89433)

2024-04-19 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-04-19T16:41:07-07:00
New Revision: 6a35ee8077647b32626c3c41f9d9da4dae6670fc

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

LOG: [lldb] Provide a better error message for missing symbols (#89433)

This adds a hint to the missing symbols error message to make it easier
to understand what this means to users.

[Reapplies an earlier patch with a test fix.]

Added: 


Modified: 
lldb/source/Expression/IRExecutionUnit.cpp
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..07df8c52a2a4f0 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, 
lldb::addr_t &func_addr,
 }
 
 m_failed_lookups.clear();
-
+ss.PutCString(
+"\nHint: The expression tried to call a function that is not present "
+"in the target, perhaps because it was optimized out by the 
compiler.");
 error.SetErrorString(ss.GetString());
 
 return;

diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 6724bfc8ed78e0..baf06e4c59fbba 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,7 @@ def test_constructors(self):
 self.expect(
 "expr ClassWithDeletedDefaultCtor().value",
 error=True,
-substrs=["Couldn't look up symbols:"],
+substrs=["Couldn't look up symbols:", "function", "optimized out"],
 )
 
 @skipIfWindows  # Can't find operator new.



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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread Will Hawkins via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread Will Hawkins via lldb-commits

https://github.com/hawkinsw commented:

I hate when I can only contribute nits, but I wanted to try to be helpful!

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

2024-04-19 Thread Will Hawkins via lldb-commits


@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64
+//  bits of the result, then the high 64 bits of the result. Both are hex

hawkinsw wrote:

```suggestion
//  bits of the result, and finally the high 64 bits of the result. Both are in 
hex format
```

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


[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread Troy Butler via lldb-commits

https://github.com/Troy-Butler created 
https://github.com/llvm/llvm-project/pull/89480

Addresses issue #85984

>From fba4b0556340a00c1e059a8abdba5fdd1b0e38ea Mon Sep 17 00:00:00 2001
From: Troy-Butler 
Date: Mon, 25 Mar 2024 13:28:45 -0400
Subject: [PATCH 1/4] [LLVM][LIB] Refactor Redundant Condition

Signed-off-by: Troy-Butler 
---
 llvm/lib/TextAPI/TextStub.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/TextAPI/TextStub.cpp b/llvm/lib/TextAPI/TextStub.cpp
index 0f742523f8207c..d903ba409360d6 100644
--- a/llvm/lib/TextAPI/TextStub.cpp
+++ b/llvm/lib/TextAPI/TextStub.cpp
@@ -276,7 +276,7 @@ namespace yaml {
 template <> struct MappingTraits {
   static void mapping(IO &IO, ExportSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);
@@ -298,7 +298,7 @@ template <> struct MappingTraits {
 template <> struct MappingTraits {
   static void mapping(IO &IO, UndefinedSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);

>From 780151b741f5a992ee253f74f96cefbb2a2df960 Mon Sep 17 00:00:00 2001
From: Troy-Butler 
Date: Mon, 25 Mar 2024 13:28:45 -0400
Subject: [PATCH 2/4] [LLVM][TextAPI] Refactor Redundant Condition

Signed-off-by: Troy-Butler 
---
 llvm/lib/TextAPI/TextStub.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/TextAPI/TextStub.cpp b/llvm/lib/TextAPI/TextStub.cpp
index 0f742523f8207c..d903ba409360d6 100644
--- a/llvm/lib/TextAPI/TextStub.cpp
+++ b/llvm/lib/TextAPI/TextStub.cpp
@@ -276,7 +276,7 @@ namespace yaml {
 template <> struct MappingTraits {
   static void mapping(IO &IO, ExportSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);
@@ -298,7 +298,7 @@ template <> struct MappingTraits {
 template <> struct MappingTraits {
   static void mapping(IO &IO, UndefinedSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);

>From 7315c8468ac411f73f1ba9c304aae7d6bdfa2132 Mon Sep 17 00:00:00 2001
From: Troy-Butler 
Date: Thu, 18 Apr 2024 15:47:14 -0400
Subject: [PATCH 3/4] Fix Definition Mismatches

Signed-off-by: Troy-Butler 
---
 .../include/clang/StaticAnalyzer/Core/PathSensitive/Store.h | 4 ++--
 llvm/lib/Transforms/InstCombine/InstCombineInternal.h   | 2 +-
 llvm/lib/Transforms/Vectorize/VPlan.h   | 4 ++--
 .../SparseTensor/Transforms/Utils/SparseTensorLevel.h   | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index fac0c04ae2caab..e60a49f68b7a0d 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -227,12 +227,12 @@ class StoreManager {
   ///   information will not be used.
   virtual StoreRef invalidateRegions(Store store,
   ArrayRef Values,
-  const Expr *E, unsigned Count,
+  const Expr *Ex, unsigned Count,
   const LocationContext *LCtx,
   const CallEvent *Call,
   InvalidatedSymbols &IS,
   RegionAndSymbolInvalidationTraits &ITraits,
-  InvalidatedRegions *InvalidatedTopLevel,
+  InvalidatedRegions *TopLevelRegions,
   InvalidatedRegions *Invalidated) = 0;
 
   /// enterStackFrame - Let the StoreManager to do something when execution
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h 
b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index b9ad3a74007929..90293feb9c1b82 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -433,7 +433,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   Value *foldAndOrOfICmpsOf

[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Troy Butler (Troy-Butler)


Changes

Addresses issue #85984

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


6 Files Affected:

- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h 
(+2-2) 
- (modified) lldb/source/Core/Debugger.cpp (-3) 
- (modified) llvm/lib/TextAPI/TextStub.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineInternal.h (+1-1) 
- (modified) llvm/lib/Transforms/Vectorize/VPlan.h (+2-2) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.h 
(+3-3) 


``diff
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index fac0c04ae2caab..e60a49f68b7a0d 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -227,12 +227,12 @@ class StoreManager {
   ///   information will not be used.
   virtual StoreRef invalidateRegions(Store store,
   ArrayRef Values,
-  const Expr *E, unsigned Count,
+  const Expr *Ex, unsigned Count,
   const LocationContext *LCtx,
   const CallEvent *Call,
   InvalidatedSymbols &IS,
   RegionAndSymbolInvalidationTraits &ITraits,
-  InvalidatedRegions *InvalidatedTopLevel,
+  InvalidatedRegions *TopLevelRegions,
   InvalidatedRegions *Invalidated) = 0;
 
   /// enterStackFrame - Let the StoreManager to do something when execution
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ebd112110e5f2d..19b3cf3bbf46b1 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1115,9 +1115,6 @@ void Debugger::RunIOHandlerSync(const IOHandlerSP 
&reader_sp) {
   IOHandlerSP top_reader_sp = reader_sp;
 
   while (top_reader_sp) {
-if (!top_reader_sp)
-  break;
-
 top_reader_sp->Run();
 
 // Don't unwind past the starting point.
diff --git a/llvm/lib/TextAPI/TextStub.cpp b/llvm/lib/TextAPI/TextStub.cpp
index 0f742523f8207c..d903ba409360d6 100644
--- a/llvm/lib/TextAPI/TextStub.cpp
+++ b/llvm/lib/TextAPI/TextStub.cpp
@@ -276,7 +276,7 @@ namespace yaml {
 template <> struct MappingTraits {
   static void mapping(IO &IO, ExportSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);
@@ -298,7 +298,7 @@ template <> struct MappingTraits {
 template <> struct MappingTraits {
   static void mapping(IO &IO, UndefinedSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h 
b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index b9ad3a74007929..90293feb9c1b82 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -433,7 +433,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   Value *foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS,
Instruction *CxtI, bool IsAnd,
bool IsLogical = false);
-  Value *matchSelectFromAndOr(Value *A, Value *B, Value *C, Value *D,
+  Value *matchSelectFromAndOr(Value *A, Value *C, Value *B, Value *D,
   bool InvertFalseVal = false);
   Value *getSelectCondition(Value *A, Value *B, bool ABIsTheSame);
 
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h 
b/llvm/lib/Transforms/Vectorize/VPlan.h
index 22173954f7cec0..bd327d5fb8b605 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3070,8 +3070,8 @@ class VPlan {
 private:
   /// Add to the given dominator tree the header block and every new basic 
block
   /// that was created between it and the latch block, inclusive.
-  static void updateDominatorTree(DominatorTree *DT, BasicBlock *LoopLatchBB,
-  BasicBlock *LoopPreHeaderBB,
+  static void updateDominatorTree(DominatorTree *DT, BasicBlock *LoopHeaderBB,
+  BasicBlock *LoopLatchBB,
   BasicBlock *LoopExitBB);
 };
 
diff --git a/mlir/lib/Dialect/Sparse

[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Troy Butler (Troy-Butler)


Changes

Addresses issue #85984

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


6 Files Affected:

- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h 
(+2-2) 
- (modified) lldb/source/Core/Debugger.cpp (-3) 
- (modified) llvm/lib/TextAPI/TextStub.cpp (+2-2) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineInternal.h (+1-1) 
- (modified) llvm/lib/Transforms/Vectorize/VPlan.h (+2-2) 
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorLevel.h 
(+3-3) 


``diff
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index fac0c04ae2caab..e60a49f68b7a0d 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -227,12 +227,12 @@ class StoreManager {
   ///   information will not be used.
   virtual StoreRef invalidateRegions(Store store,
   ArrayRef Values,
-  const Expr *E, unsigned Count,
+  const Expr *Ex, unsigned Count,
   const LocationContext *LCtx,
   const CallEvent *Call,
   InvalidatedSymbols &IS,
   RegionAndSymbolInvalidationTraits &ITraits,
-  InvalidatedRegions *InvalidatedTopLevel,
+  InvalidatedRegions *TopLevelRegions,
   InvalidatedRegions *Invalidated) = 0;
 
   /// enterStackFrame - Let the StoreManager to do something when execution
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ebd112110e5f2d..19b3cf3bbf46b1 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1115,9 +1115,6 @@ void Debugger::RunIOHandlerSync(const IOHandlerSP 
&reader_sp) {
   IOHandlerSP top_reader_sp = reader_sp;
 
   while (top_reader_sp) {
-if (!top_reader_sp)
-  break;
-
 top_reader_sp->Run();
 
 // Don't unwind past the starting point.
diff --git a/llvm/lib/TextAPI/TextStub.cpp b/llvm/lib/TextAPI/TextStub.cpp
index 0f742523f8207c..d903ba409360d6 100644
--- a/llvm/lib/TextAPI/TextStub.cpp
+++ b/llvm/lib/TextAPI/TextStub.cpp
@@ -276,7 +276,7 @@ namespace yaml {
 template <> struct MappingTraits {
   static void mapping(IO &IO, ExportSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);
@@ -298,7 +298,7 @@ template <> struct MappingTraits {
 template <> struct MappingTraits {
   static void mapping(IO &IO, UndefinedSection &Section) {
 const auto *Ctx = reinterpret_cast(IO.getContext());
-assert((!Ctx || (Ctx && Ctx->FileKind != FileType::Invalid)) &&
+assert((!Ctx || Ctx->FileKind != FileType::Invalid) &&
"File type is not set in YAML context");
 
 IO.mapRequired("archs", Section.Architectures);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h 
b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index b9ad3a74007929..90293feb9c1b82 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -433,7 +433,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   Value *foldAndOrOfICmpsOfAndWithPow2(ICmpInst *LHS, ICmpInst *RHS,
Instruction *CxtI, bool IsAnd,
bool IsLogical = false);
-  Value *matchSelectFromAndOr(Value *A, Value *B, Value *C, Value *D,
+  Value *matchSelectFromAndOr(Value *A, Value *C, Value *B, Value *D,
   bool InvertFalseVal = false);
   Value *getSelectCondition(Value *A, Value *B, bool ABIsTheSame);
 
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h 
b/llvm/lib/Transforms/Vectorize/VPlan.h
index 22173954f7cec0..bd327d5fb8b605 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3070,8 +3070,8 @@ class VPlan {
 private:
   /// Add to the given dominator tree the header block and every new basic 
block
   /// that was created between it and the latch block, inclusive.
-  static void updateDominatorTree(DominatorTree *DT, BasicBlock *LoopLatchBB,
-  BasicBlock *LoopPreHeaderBB,
+  static void updateDominatorTree(DominatorTree *DT, BasicBlock *LoopHeaderBB,
+  BasicBlock *LoopLatchBB,
   BasicBlock *LoopExitBB);
 };
 
diff --git a/mlir/lib/Dialect/Spars

[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread Cyndy Ishida via lldb-commits

cyndyishida wrote:

It appears your PR branch is based on a stale version of the target `llvm/main` 
branch, resulting in more commits than what this PR intended for. Please merge 
in the target branch and resolve any conflicts. 

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


[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread Jonas Devlieghere via lldb-commits

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

+1 on what Cyndy said. The lldb change itself looks fine. 

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


[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread Troy Butler via lldb-commits

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


[Lldb-commits] [clang] [lldb] [llvm] [mlir] [lldb][Core] Remove pointless condition (PR #89480)

2024-04-19 Thread Troy Butler via lldb-commits

Troy-Butler wrote:

I apologize - I'm not sure how this happened. I was careful to refresh my 
fork/clone before starting on this issue, but somehow not all of the files were 
updated, and now my PR requests are getting wires crossed. I think it would be 
safest for me to close this issue, delete my existing fork/clone, and start 
fresh.

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