[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-06 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

> https://green.lab.llvm.org/green/view/LLDB/ is currently giving me 
> ERR_CONNECTION_REFUSED.tores that.

Yeah, unfortunately I don't have an ETA for when this will be back online. It's 
probably not worth waiting on that. Changing the configuration of these bots is 
almost instant, so if they come back and it turns out this did cause an issue, 
I (or our build wrangler) can easily turn it back off just for green dragon 
while we investigate. 

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


[Lldb-commits] [lldb] [lldb] Don't report all progress event as completed. (PR #84281)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Currently, progress events reported by the ProgressManager and broadcast to 
eBroadcastBitProgressCategory always specify they're complete. The problem is 
that the ProgressManager reports kNonDeterministicTotal for both the total and 
the completed number of (sub)events. Because the values are the same, the event 
reports itself as complete.

This patch fixes the issue by reporting 0 as the completed value for the start 
event and kNonDeterministicTotal for the end event.

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


3 Files Affected:

- (modified) lldb/include/lldb/Core/Progress.h (+7-2) 
- (modified) lldb/source/Core/Progress.cpp (+10-8) 
- (modified) lldb/unittests/Core/ProgressReportTest.cpp (+2-2) 


``diff
diff --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index c6fc861fb71d86..c38f6dd0a140ed 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -148,9 +148,14 @@ class ProgressManager {
 
   static ProgressManager ();
 
-  static void ReportProgress(const Progress::ProgressData &);
-
 private:
+  enum class EventType {
+Begin,
+End,
+  };
+  static void ReportProgress(const Progress::ProgressData _data,
+ EventType type);
+
   llvm::StringMap>
   m_progress_category_map;
   std::mutex m_progress_map_mutex;
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 9dcd7cf75ae057..6f2f62c21a0c7e 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -97,7 +97,7 @@ void ProgressManager::Increment(const Progress::ProgressData 
_data) {
   // initial progress report.
   if (!m_progress_category_map.contains(progress_data.title)) {
 m_progress_category_map[progress_data.title].second = progress_data;
-ReportProgress(progress_data);
+ReportProgress(progress_data, EventType::Begin);
   }
   m_progress_category_map[progress_data.title].first++;
 }
@@ -110,7 +110,7 @@ void ProgressManager::Decrement(const 
Progress::ProgressData _data) {
 return;
 
   if (pos->second.first <= 1) {
-ReportProgress(pos->second.second);
+ReportProgress(pos->second.second, EventType::End);
 m_progress_category_map.erase(progress_data.title);
   } else {
 --pos->second.first;
@@ -118,12 +118,14 @@ void ProgressManager::Decrement(const 
Progress::ProgressData _data) {
 }
 
 void ProgressManager::ReportProgress(
-const Progress::ProgressData _data) {
-  // The category bit only keeps track of when progress report categories have
+const Progress::ProgressData _data, EventType type) {
+  // the category bit only keeps track of when progress report categories have
   // started and ended, so clear the details and reset other fields when
   // broadcasting to it since that bit doesn't need that information.
-  Debugger::ReportProgress(
-  progress_data.progress_id, progress_data.title, "",
-  Progress::kNonDeterministicTotal, Progress::kNonDeterministicTotal,
-  progress_data.debugger_id, Debugger::eBroadcastBitProgressCategory);
+  const uint64_t completed =
+  (type == EventType::Begin) ? 0 : Progress::kNonDeterministicTotal;
+  Debugger::ReportProgress(progress_data.progress_id, progress_data.title, "",
+   completed, Progress::kNonDeterministicTotal,
+   progress_data.debugger_id,
+   Debugger::eBroadcastBitProgressCategory);
 }
diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index 98cbc475ce2835..e0253cbc4ec59b 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -168,7 +168,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Progress report 1");
 
@@ -199,7 +199,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Overlapping report 1");
 

``




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


[Lldb-commits] [lldb] [lldb] Don't report all progress event as completed. (PR #84281)

2024-03-06 Thread Jonas Devlieghere via lldb-commits

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

Currently, progress events reported by the ProgressManager and broadcast to 
eBroadcastBitProgressCategory always specify they're complete. The problem is 
that the ProgressManager reports kNonDeterministicTotal for both the total and 
the completed number of (sub)events. Because the values are the same, the event 
reports itself as complete.

This patch fixes the issue by reporting 0 as the completed value for the start 
event and kNonDeterministicTotal for the end event.

>From 9211c334ab91ba424aa06460b3be9759e85db15c Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 6 Mar 2024 22:28:14 -0800
Subject: [PATCH] [lldb] Don't report all progress event as completed.

Currently, progress events reported by the ProgressManager and broadcast
to eBroadcastBitProgressCategory always specify they're complete. The
problem is that the ProgressManager reports kNonDeterministicTotal for
both the total and the completed number of (sub)events. Because the
values are the same, the event reports itself as complete.

This patch fixes the issue by reporting 0 as the completed value for the
start event and kNonDeterministicTotal for the end event.
---
 lldb/include/lldb/Core/Progress.h  |  9 +++--
 lldb/source/Core/Progress.cpp  | 18 ++
 lldb/unittests/Core/ProgressReportTest.cpp |  4 ++--
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index c6fc861fb71d86..c38f6dd0a140ed 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -148,9 +148,14 @@ class ProgressManager {
 
   static ProgressManager ();
 
-  static void ReportProgress(const Progress::ProgressData &);
-
 private:
+  enum class EventType {
+Begin,
+End,
+  };
+  static void ReportProgress(const Progress::ProgressData _data,
+ EventType type);
+
   llvm::StringMap>
   m_progress_category_map;
   std::mutex m_progress_map_mutex;
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index 9dcd7cf75ae057..6f2f62c21a0c7e 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -97,7 +97,7 @@ void ProgressManager::Increment(const Progress::ProgressData 
_data) {
   // initial progress report.
   if (!m_progress_category_map.contains(progress_data.title)) {
 m_progress_category_map[progress_data.title].second = progress_data;
-ReportProgress(progress_data);
+ReportProgress(progress_data, EventType::Begin);
   }
   m_progress_category_map[progress_data.title].first++;
 }
@@ -110,7 +110,7 @@ void ProgressManager::Decrement(const 
Progress::ProgressData _data) {
 return;
 
   if (pos->second.first <= 1) {
-ReportProgress(pos->second.second);
+ReportProgress(pos->second.second, EventType::End);
 m_progress_category_map.erase(progress_data.title);
   } else {
 --pos->second.first;
@@ -118,12 +118,14 @@ void ProgressManager::Decrement(const 
Progress::ProgressData _data) {
 }
 
 void ProgressManager::ReportProgress(
-const Progress::ProgressData _data) {
-  // The category bit only keeps track of when progress report categories have
+const Progress::ProgressData _data, EventType type) {
+  // the category bit only keeps track of when progress report categories have
   // started and ended, so clear the details and reset other fields when
   // broadcasting to it since that bit doesn't need that information.
-  Debugger::ReportProgress(
-  progress_data.progress_id, progress_data.title, "",
-  Progress::kNonDeterministicTotal, Progress::kNonDeterministicTotal,
-  progress_data.debugger_id, Debugger::eBroadcastBitProgressCategory);
+  const uint64_t completed =
+  (type == EventType::Begin) ? 0 : Progress::kNonDeterministicTotal;
+  Debugger::ReportProgress(progress_data.progress_id, progress_data.title, "",
+   completed, Progress::kNonDeterministicTotal,
+   progress_data.debugger_id,
+   Debugger::eBroadcastBitProgressCategory);
 }
diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index 98cbc475ce2835..e0253cbc4ec59b 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -168,7 +168,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  ASSERT_FALSE(data->GetCompleted());
   ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
   ASSERT_EQ(data->GetMessage(), "Progress report 1");
 
@@ -199,7 +199,7 @@ TEST_F(ProgressReportTest, TestProgressManager) {
 
   ASSERT_EQ(data->GetDetails(), "");
   ASSERT_FALSE(data->IsFinite());
-  ASSERT_TRUE(data->GetCompleted());
+  

[Lldb-commits] [lldb] [lldb] Do some gardening in ProgressReportTest (NFC) (PR #84278)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

 - Factor our common setup code.
 - Split the ProgressManager test into separate tests as they test separate 
things.
 - Fix usage of EXPECT (which continues on failure) and ASSERT (which halts on 
failure). We must use the latter when calling GetEvent as otherwise we'll try 
to dereference a null EventSP.

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


1 Files Affected:

- (modified) lldb/unittests/Core/ProgressReportTest.cpp (+96-103) 


``diff
diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index 98cbc475ce2835..1779d1e613b6f2 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -22,9 +22,29 @@
 using namespace lldb;
 using namespace lldb_private;
 
+static std::chrono::milliseconds TIMEOUT(100);
+
 class ProgressReportTest : public ::testing::Test {
-  SubsystemRAII subsystems;
+public:
+  ListenerSP CreateListenerFor(uint32_t bit) {
+// Set up the debugger, make sure that was done properly.
+ArchSpec arch("x86_64-apple-macosx-");
+Platform::SetHostPlatform(
+PlatformRemoteMacOSX::CreateInstance(true, ));
+
+m_debugger_sp = Debugger::CreateInstance();
+
+// Get the debugger's broadcaster.
+Broadcaster  = m_debugger_sp->GetBroadcaster();
+
+// Create a listener, make sure it can receive events and that it's
+// listening to the correct broadcast bit.
+m_listener_sp = Listener::MakeListener("progress-listener");
+m_listener_sp->StartListeningForEvents(, bit);
+return m_listener_sp;
+  }
 
+protected:
   // The debugger's initialization function can't be called with no arguments
   // so calling it using SubsystemRAII will cause the test build to fail as
   // SubsystemRAII will call Initialize with no arguments. As such we set it up
@@ -33,30 +53,14 @@ class ProgressReportTest : public ::testing::Test {
 std::call_once(TestUtilities::g_debugger_initialize_flag,
[]() { Debugger::Initialize(nullptr); });
   };
+
+  DebuggerSP m_debugger_sp;
+  ListenerSP m_listener_sp;
+  SubsystemRAII subsystems;
 };
 
 TEST_F(ProgressReportTest, TestReportCreation) {
-  std::chrono::milliseconds timeout(100);
-
-  // Set up the debugger, make sure that was done properly.
-  ArchSpec arch("x86_64-apple-macosx-");
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
-
-  DebuggerSP debugger_sp = Debugger::CreateInstance();
-  ASSERT_TRUE(debugger_sp);
-
-  // Get the debugger's broadcaster.
-  Broadcaster  = debugger_sp->GetBroadcaster();
-
-  // Create a listener, make sure it can receive events and that it's
-  // listening to the correct broadcast bit.
-  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
-
-  listener_sp->StartListeningForEvents(,
-   Debugger::eBroadcastBitProgress);
-  EXPECT_TRUE(
-  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
-
+  ListenerSP listener_sp = CreateListenerFor(Debugger::eBroadcastBitProgress);
   EventSP event_sp;
   const ProgressEventData *data;
 
@@ -73,82 +77,64 @@ TEST_F(ProgressReportTest, TestReportCreation) {
   // in this order:
   // Starting progress: 1, 2, 3
   // Ending progress: 3, 2, 1
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 1");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
+  EXPECT_EQ(data->GetDetails(), "Starting report 1");
+  EXPECT_FALSE(data->IsFinite());
+  EXPECT_FALSE(data->GetCompleted());
+  EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  EXPECT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
 
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 2");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2");
+  EXPECT_EQ(data->GetDetails(), "Starting report 2");
+  EXPECT_FALSE(data->IsFinite());
+  EXPECT_FALSE(data->GetCompleted());
+  EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  EXPECT_EQ(data->GetMessage(), "Progress report 2: Starting report 2");
 
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = 

[Lldb-commits] [lldb] [lldb] Do some gardening in ProgressReportTest (NFC) (PR #84278)

2024-03-06 Thread Jonas Devlieghere via lldb-commits

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

 - Factor our common setup code.
 - Split the ProgressManager test into separate tests as they test separate 
things.
 - Fix usage of EXPECT (which continues on failure) and ASSERT (which halts on 
failure). We must use the latter when calling GetEvent as otherwise we'll try 
to dereference a null EventSP.

>From a9eae8495f035d06cf810b78e5c7371cbe3c9bcc Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Wed, 6 Mar 2024 21:54:45 -0800
Subject: [PATCH] [lldb] Do some gardening in ProgressReportTest (NFC)

 - Factor our common setup code.
 - Split the ProgressManager test into separate tests as they test
   separate things.
 - Fix usage of EXPECT (which continues on failure) and ASSERT (which
   halts on failure). We must use the latter when calling GetEvent as
   otherwise we'll try to dereference a null EventSP.
---
 lldb/unittests/Core/ProgressReportTest.cpp | 199 ++---
 1 file changed, 96 insertions(+), 103 deletions(-)

diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
index 98cbc475ce2835..1779d1e613b6f2 100644
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -22,9 +22,29 @@
 using namespace lldb;
 using namespace lldb_private;
 
+static std::chrono::milliseconds TIMEOUT(100);
+
 class ProgressReportTest : public ::testing::Test {
-  SubsystemRAII subsystems;
+public:
+  ListenerSP CreateListenerFor(uint32_t bit) {
+// Set up the debugger, make sure that was done properly.
+ArchSpec arch("x86_64-apple-macosx-");
+Platform::SetHostPlatform(
+PlatformRemoteMacOSX::CreateInstance(true, ));
+
+m_debugger_sp = Debugger::CreateInstance();
+
+// Get the debugger's broadcaster.
+Broadcaster  = m_debugger_sp->GetBroadcaster();
+
+// Create a listener, make sure it can receive events and that it's
+// listening to the correct broadcast bit.
+m_listener_sp = Listener::MakeListener("progress-listener");
+m_listener_sp->StartListeningForEvents(, bit);
+return m_listener_sp;
+  }
 
+protected:
   // The debugger's initialization function can't be called with no arguments
   // so calling it using SubsystemRAII will cause the test build to fail as
   // SubsystemRAII will call Initialize with no arguments. As such we set it up
@@ -33,30 +53,14 @@ class ProgressReportTest : public ::testing::Test {
 std::call_once(TestUtilities::g_debugger_initialize_flag,
[]() { Debugger::Initialize(nullptr); });
   };
+
+  DebuggerSP m_debugger_sp;
+  ListenerSP m_listener_sp;
+  SubsystemRAII subsystems;
 };
 
 TEST_F(ProgressReportTest, TestReportCreation) {
-  std::chrono::milliseconds timeout(100);
-
-  // Set up the debugger, make sure that was done properly.
-  ArchSpec arch("x86_64-apple-macosx-");
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
-
-  DebuggerSP debugger_sp = Debugger::CreateInstance();
-  ASSERT_TRUE(debugger_sp);
-
-  // Get the debugger's broadcaster.
-  Broadcaster  = debugger_sp->GetBroadcaster();
-
-  // Create a listener, make sure it can receive events and that it's
-  // listening to the correct broadcast bit.
-  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
-
-  listener_sp->StartListeningForEvents(,
-   Debugger::eBroadcastBitProgress);
-  EXPECT_TRUE(
-  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
-
+  ListenerSP listener_sp = CreateListenerFor(Debugger::eBroadcastBitProgress);
   EventSP event_sp;
   const ProgressEventData *data;
 
@@ -73,82 +77,64 @@ TEST_F(ProgressReportTest, TestReportCreation) {
   // in this order:
   // Starting progress: 1, 2, 3
   // Ending progress: 3, 2, 1
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 1");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
+  EXPECT_EQ(data->GetDetails(), "Starting report 1");
+  EXPECT_FALSE(data->IsFinite());
+  EXPECT_FALSE(data->GetCompleted());
+  EXPECT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  EXPECT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
 
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  ASSERT_TRUE(listener_sp->GetEvent(event_sp, TIMEOUT));
   data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
 
-  ASSERT_EQ(data->GetDetails(), "Starting report 2");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  

[Lldb-commits] [lldb] [lldb] Log module build remarks to types log too (PR #84260)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] 4067115 - [lldb] Log module build remarks to types log too (#84260)

2024-03-06 Thread via lldb-commits

Author: Dave Lee
Date: 2024-03-06T21:12:10-08:00
New Revision: 40671156757cc3f2304085a6642a24efc8165df7

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

LOG: [lldb] Log module build remarks to types log too (#84260)

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index cc5250ca0f7883..2d778e410b0e73 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -183,7 +183,7 @@ void StoringDiagnosticConsumer::EndSourceFile() {
 
 bool StoringDiagnosticConsumer::HandleModuleRemark(
 const clang::Diagnostic ) {
-  Log *log = GetLog(LLDBLog::Expressions);
+  Log *log = GetLog(LLDBLog::Types | LLDBLog::Expressions);
   switch (info.getID()) {
   case clang::diag::remark_module_build: {
 const auto _name = info.getArgStdStr(0);



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


[Lldb-commits] [lldb] [lldb] Extract getter function for experimental target properties (NFC) (PR #83504)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] ca7492f - [lldb] Extract getter function for experimental target properties (NFC) (#83504)

2024-03-06 Thread via lldb-commits

Author: Dave Lee
Date: 2024-03-06T20:41:46-08:00
New Revision: ca7492fae42c5a21db96eccaca7a5e827ab1bf65

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

LOG: [lldb] Extract getter function for experimental target properties (NFC) 
(#83504)

In Swift's downstream lldb, there are a number of experimental properties. This 
change 
extracts a getter function containing the common logic for getting a boolean 
valued 
experimental property.

This also deletes `SetInjectLocalVariables` which isn't used anywhere.

Added: 


Modified: 
lldb/include/lldb/Target/Target.h
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 8f57358981d4d2..2c2e6b2831ccee 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -244,8 +244,6 @@ class TargetProperties : public Properties {
 
   bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
 
-  void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
-
   void SetRequireHardwareBreakpoints(bool b);
 
   bool GetRequireHardwareBreakpoints() const;
@@ -259,6 +257,10 @@ class TargetProperties : public Properties {
   bool GetDebugUtilityExpression() const;
 
 private:
+  std::optional
+  GetExperimentalPropertyValue(size_t prop_idx,
+   ExecutionContext *exe_ctx = nullptr) const;
+
   // Callbacks for m_launch_info.
   void Arg0ValueChangedCallback();
   void RunArgsValueChangedCallback();

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index e982a30a3ae4ff..09b0ac42631d1a 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -43,6 +43,7 @@
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Target/ABI.h"
+#include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/Process.h"
@@ -4227,28 +4228,21 @@ void TargetProperties::UpdateLaunchInfoFromProperties() 
{
   DisableSTDIOValueChangedCallback();
 }
 
-bool TargetProperties::GetInjectLocalVariables(
-ExecutionContext *exe_ctx) const {
+std::optional TargetProperties::GetExperimentalPropertyValue(
+size_t prop_idx, ExecutionContext *exe_ctx) const {
   const Property *exp_property =
   m_collection_sp->GetPropertyAtIndex(ePropertyExperimental, exe_ctx);
   OptionValueProperties *exp_values =
   exp_property->GetValue()->GetAsProperties();
   if (exp_values)
-return exp_values
-->GetPropertyAtIndexAs(ePropertyInjectLocalVars, exe_ctx)
-.value_or(true);
-  else
-return true;
+return exp_values->GetPropertyAtIndexAs(prop_idx, exe_ctx);
+  return std::nullopt;
 }
 
-void TargetProperties::SetInjectLocalVariables(ExecutionContext *exe_ctx,
-   bool b) {
-  const Property *exp_property =
-  m_collection_sp->GetPropertyAtIndex(ePropertyExperimental, exe_ctx);
-  OptionValueProperties *exp_values =
-  exp_property->GetValue()->GetAsProperties();
-  if (exp_values)
-exp_values->SetPropertyAtIndex(ePropertyInjectLocalVars, true, exe_ctx);
+bool TargetProperties::GetInjectLocalVariables(
+ExecutionContext *exe_ctx) const {
+  return GetExperimentalPropertyValue(ePropertyInjectLocalVars, exe_ctx)
+  .value_or(true);
 }
 
 ArchSpec TargetProperties::GetDefaultArchitecture() const {



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


[Lldb-commits] [lldb] [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (PR #84262)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] c7fbbec - [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (#84262)

2024-03-06 Thread via lldb-commits

Author: Dave Lee
Date: 2024-03-06T20:40:36-08:00
New Revision: c7fbbec86c483019e9340ee4573d6d8b4f878f72

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

LOG: [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (#84262)

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..cc5250ca0f7883 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -8,7 +8,6 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticFrontend.h"
-#include "clang/Basic/DiagnosticSerialization.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
@@ -19,20 +18,15 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Serialization/ASTReader.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Threading.h"
 
 #include "ClangHost.h"
 #include "ClangModulesDeclVendor.h"
-#include "ModuleDependencyCollector.h"
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/Progress.h"
-#include "lldb/Host/Host.h"
-#include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Target.h"
@@ -40,10 +34,8 @@
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
-#include "lldb/Utility/StreamString.h"
 
 #include 
-#include 
 
 using namespace lldb_private;
 



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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-06 Thread Alex Langford via lldb-commits

bulbazord wrote:

> To start with option #​1, I created #84246

Just took a look, thanks for taking care of that. I'll address your feedback 
(or just look at what you did in the other PR) and update this tomorrow. 

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-06 Thread Alex Langford via lldb-commits

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

Thanks for taking care of that!

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


[Lldb-commits] [lldb] [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (PR #84262)

2024-03-06 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-06 Thread Jordan Rupprecht via lldb-commits

rupprecht wrote:

btw, it would be nice if LLDB buildbots were clean before landing this. 
https://green.lab.llvm.org/green/view/LLDB/ is currently giving me 
ERR_CONNECTION_REFUSED. The others are failing but I'm hoping 
ec72909b62ce568ed27c6ad0581e50c0fdd70df4 restores that.

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


[Lldb-commits] [lldb] ec72909 - [lldb][test] iwyu for vfork test

2024-03-06 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2024-03-06T18:41:18-08:00
New Revision: ec72909b62ce568ed27c6ad0581e50c0fdd70df4

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

LOG: [lldb][test] iwyu for vfork test

Added: 


Modified: 
lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp

Removed: 




diff  --git a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp 
b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
index b0a4446ba01581..2f3a95dc5c6eef 100644
--- a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
+++ b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
@@ -1,4 +1,5 @@
 #include 
+#include 
 #include 
 #include 
 #include 



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


[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jordan Rupprecht (rupprecht)


Changes

This switches the default of `LLDB_TEST_USE_VENDOR_PACKAGES` from `ON` to `OFF` 
in preparation for eventually deleting it. All known LLDB buildbots have this 
package installed, so flipping the default will uncover any other users.

If this breaks anything, the preferred fix is to install `pexpect` on the host 
system. The second fix is to build with cmake option 
`-DLLDB_TEST_USE_VENDOR_PACKAGES=ON` as a temporary measure until `pexpect` can 
be installed. If neither of those work, reverting this patch is OK.

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


2 Files Affected:

- (modified) lldb/cmake/modules/LLDBConfig.cmake (+1-1) 
- (modified) lldb/test/CMakeLists.txt (+3-1) 


``diff
diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 93c8ffe4b7d8a0..5d62213c3f5838 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -68,7 +68,7 @@ option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when 
installing lldb."
 option(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
   "Fail to configure if certain requirements are not met for testing." OFF)
 option(LLDB_TEST_USE_VENDOR_PACKAGES
-  "Use packages from lldb/third_party/Python/module instead of system deps." 
ON)
+  "Use packages from lldb/third_party/Python/module instead of system deps." 
OFF)
 
 set(LLDB_GLOBAL_INIT_DIRECTORY "" CACHE STRING
   "Path to the global lldbinit directory. Relative paths are resolved relative 
to the
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 950643a5b8cc8e..0ef2eb1c42ce06 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -34,7 +34,9 @@ endif()
 # The "pexpect" package should come from the system environment, not from the
 # LLDB tree. However, we delay the deletion of it from the tree in case
 # users/buildbots don't have the package yet and need some time to install it.
-if (NOT LLDB_TEST_USE_VENDOR_PACKAGES)
+# Windows is configured to skip all pexpect tests, and guards all
+# "import pexpect" calls, so we do not need pexpect installed there.
+if (NOT LLDB_TEST_USE_VENDOR_PACKAGES AND NOT WIN32)
   unset(PY_pexpect_FOUND CACHE)
   lldb_find_python_module(pexpect)
   if (NOT PY_pexpect_FOUND)

``




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


[Lldb-commits] [lldb] [lldb][test] Enforce `pexpect` system availability by default (PR #84270)

2024-03-06 Thread Jordan Rupprecht via lldb-commits

https://github.com/rupprecht created 
https://github.com/llvm/llvm-project/pull/84270

This switches the default of `LLDB_TEST_USE_VENDOR_PACKAGES` from `ON` to `OFF` 
in preparation for eventually deleting it. All known LLDB buildbots have this 
package installed, so flipping the default will uncover any other users.

If this breaks anything, the preferred fix is to install `pexpect` on the host 
system. The second fix is to build with cmake option 
`-DLLDB_TEST_USE_VENDOR_PACKAGES=ON` as a temporary measure until `pexpect` can 
be installed. If neither of those work, reverting this patch is OK.

>From 3cc7dc86e6233bfd284e2b65b04a2be7a6fa46e1 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Wed, 6 Mar 2024 17:36:46 -0800
Subject: [PATCH] [lldb][test] Enforce `pexpect` system availability by default

This switches the default of LLDB_TEST_USE_VENDOR_PACKAGES from ON to OFF in 
preparation for eventually deleting it. All known LLDB buildbots have this 
package installed, so flipping the default will uncover any other users.

If this breaks anything, the preferred fix is to install `pexpect` on the host 
system. The second fix is to build with cmake option 
`-DLLDB_TEST_USE_VENDOR_PACKAGES=ON` as a temporary measure until `pexpect` can 
be installed. If neither of those work, reverting this patch is OK.
---
 lldb/cmake/modules/LLDBConfig.cmake | 2 +-
 lldb/test/CMakeLists.txt| 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 93c8ffe4b7d8a0..5d62213c3f5838 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -68,7 +68,7 @@ option(LLDB_SKIP_DSYM "Whether to skip generating a dSYM when 
installing lldb."
 option(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
   "Fail to configure if certain requirements are not met for testing." OFF)
 option(LLDB_TEST_USE_VENDOR_PACKAGES
-  "Use packages from lldb/third_party/Python/module instead of system deps." 
ON)
+  "Use packages from lldb/third_party/Python/module instead of system deps." 
OFF)
 
 set(LLDB_GLOBAL_INIT_DIRECTORY "" CACHE STRING
   "Path to the global lldbinit directory. Relative paths are resolved relative 
to the
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 950643a5b8cc8e..0ef2eb1c42ce06 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -34,7 +34,9 @@ endif()
 # The "pexpect" package should come from the system environment, not from the
 # LLDB tree. However, we delay the deletion of it from the tree in case
 # users/buildbots don't have the package yet and need some time to install it.
-if (NOT LLDB_TEST_USE_VENDOR_PACKAGES)
+# Windows is configured to skip all pexpect tests, and guards all
+# "import pexpect" calls, so we do not need pexpect installed there.
+if (NOT LLDB_TEST_USE_VENDOR_PACKAGES AND NOT WIN32)
   unset(PY_pexpect_FOUND CACHE)
   lldb_find_python_module(pexpect)
   if (NOT PY_pexpect_FOUND)

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread Adrian Prantl via lldb-commits


@@ -451,8 +451,13 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject 
) {
   if (valobj.GetSummaryFormat().get() != nullptr)
 return valobj.GetSummaryFormat()->IsOneLiner();
 
+  auto num_children = valobj.GetNumChildren();
+  if (!num_children) {
+llvm::consumeError(num_children.takeError());

adrian-prantl wrote:

Done!

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


[Lldb-commits] [lldb] [llvm] LLDB Debuginfod usage tests (with fixes) (PR #79181)

2024-03-06 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 
777ac46ddbc318b5d5820d278a2e4dc2213699d8...2c6afa88cf3a095bd404d28d43e4aae5d164177f
 lldb/test/API/debuginfod/Normal/TestDebuginfod.py 
lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py 
lldb/packages/Python/lldbsuite/test/decorators.py 
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
lldb/test/API/sanity/TestSettingSkipping.py 
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py 
lldb/test/Shell/helper/build.py lldb/test/Shell/lit.cfg.py
``





View the diff from darker here.


``diff
--- test/API/debuginfod/Normal/TestDebuginfod.py2024-03-07 
01:11:44.00 +
+++ test/API/debuginfod/Normal/TestDebuginfod.py2024-03-07 
01:14:26.293177 +
@@ -4,27 +4,30 @@
 
 import lldb
 import lldbsuite.test.lldbutil as lldbutil
 from lldbsuite.test.lldbtest import *
 
+
 def getUUID(aoutuuid):
 """
 Pull the 20 byte UUID out of the .note.gnu.build-id section that was dumped
 to a file already, as part of the build.
 """
 import struct
+
 with open(aoutuuid, "rb") as f:
 data = f.read(36)
 if len(data) != 36:
 return None
 header = struct.unpack_from("<4I", data)
 if len(header) != 4:
 return None
 # 4 element 'prefix', 20 bytes of uuid, 3 byte long string, 'GNU':
-if header[0] != 4 or header[1] != 20 or header[2] != 3 or header[3] != 
0x554e47:
+if header[0] != 4 or header[1] != 20 or header[2] != 3 or header[3] != 
0x554E47:
 return None
 return data[16:].hex()
+
 
 def config_fake_debuginfod_server(uuid, debuginfo, executable):
 """
 Create a file-system 'hosted' debuginfod server for the given UUID.
 Make the filesystem look like:
@@ -35,32 +38,34 @@
 Returns the /tmp/ path
 """
 import os
 import shutil
 import tempfile
+
 tmpdir = tempfile.mkdtemp()
 uuiddir = os.path.join(tmpdir, "buildid", uuid)
 os.makedirs(uuiddir)
 os.makedirs(os.path.join(tmpdir, "cache"))
 # Move the files to the correct location for debuginfod to find
 if debuginfo:
 pass
-#shutil.move(debuginfo, os.path.join(uuiddir, "debuginfo"))
+# shutil.move(debuginfo, os.path.join(uuiddir, "debuginfo"))
 
 if executable:
 pass
-#shutil.move(executable, os.path.join(uuiddir, "executable"))
+# shutil.move(executable, os.path.join(uuiddir, "executable"))
 
 return tmpdir
 
 
 # Need to test 5 different scenarios:
 # 1 - A stripped binary with it's corresponding unstripped binary:
 # 2 - A stripped binary with a corresponding --only-keep-debug symbols file
 # 3 - A split binary with it's corresponding DWP file
 # 4 - A stripped, split binary with an unstripped binary and a DWP file
 # 5 - A stripped, split binary with an --only-keep-debug symbols file and a 
DWP file
+
 
 class DebugInfodTests(TestBase):
 # No need to try every flavor of debug inf.
 NO_DEBUG_INFO_TESTCASE = True
 
@@ -76,13 +81,19 @@
 # Setup the fake DebugInfoD server.
 server_root = config_fake_debuginfod_server(self.uuid, self.dwp, 
self.debugbin)
 
 # Configure LLDB properly
 self.runCmd("settings set symbols.enable-external-lookup true")
-self.runCmd("settings set plugin.symbol-locator.debuginfod.cache-path 
%s/cache" % server_root)
+self.runCmd(
+"settings set plugin.symbol-locator.debuginfod.cache-path %s/cache"
+% server_root
+)
 self.runCmd("settings clear 
plugin.symbol-locator.debuginfod.server-urls")
-cmd = "settings insert-before 
plugin.symbol-locator.debuginfod.server-urls 0 file://%s" % server_root
+cmd = (
+"settings insert-before 
plugin.symbol-locator.debuginfod.server-urls 0 file://%s"
+% server_root
+)
 self.runCmd(cmd)
 print(cmd)
 # Check to see if the symbol file is properly loaded
 self.main_source_file = lldb.SBFileSpec("main.c")
 self.sample_test()
@@ -105,11 +116,14 @@
 addr = loc.GetAddress()
 self.assertTrue(addr and addr.IsValid(), "Loc address is valid")
 line_entry = addr.GetLineEntry()
 self.assertTrue(line_entry and line_entry.IsValid(), "Loc line entry 
is valid")
 self.assertEqual(line_entry.GetLine(), 18)
-self.assertEqual(loc.GetLineEntry().GetFileSpec().GetFilename(), 
self.main_source_file.GetFilename())
+self.assertEqual(
+loc.GetLineEntry().GetFileSpec().GetFilename(),
+self.main_source_file.GetFilename(),
+)
 
 def sample_test_no_launch(self):
 """Same as above but doesn't launch a process."""
 
 target = self.createTestTarget()
--- 

[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] Report back errors in GetNumChildren() (PR #84265)

2024-03-06 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 21be2fbd17f9ff6f3f04e0ababc91c9cdd5aed85 
cb496e138b46732de73d0e56b2bfc3f749355953 -- 
lldb/test/API/functionalities/valobj_errors/hidden.c 
lldb/test/API/functionalities/valobj_errors/main.c 
lldb/include/lldb/Core/ValueObject.h lldb/include/lldb/Core/ValueObjectCast.h 
lldb/include/lldb/Core/ValueObjectChild.h 
lldb/include/lldb/Core/ValueObjectConstResult.h 
lldb/include/lldb/Core/ValueObjectDynamicValue.h 
lldb/include/lldb/Core/ValueObjectMemory.h 
lldb/include/lldb/Core/ValueObjectRegister.h 
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h 
lldb/include/lldb/Core/ValueObjectVTable.h 
lldb/include/lldb/Core/ValueObjectVariable.h 
lldb/include/lldb/DataFormatters/TypeSynthetic.h 
lldb/include/lldb/DataFormatters/ValueObjectPrinter.h 
lldb/include/lldb/DataFormatters/VectorIterator.h 
lldb/include/lldb/Symbol/CompilerType.h lldb/include/lldb/Symbol/Type.h 
lldb/include/lldb/Symbol/TypeSystem.h 
lldb/include/lldb/Target/StackFrameRecognizer.h lldb/source/API/SBValue.cpp 
lldb/source/Core/FormatEntity.cpp lldb/source/Core/IOHandlerCursesGUI.cpp 
lldb/source/Core/ValueObject.cpp lldb/source/Core/ValueObjectCast.cpp 
lldb/source/Core/ValueObjectChild.cpp 
lldb/source/Core/ValueObjectConstResult.cpp 
lldb/source/Core/ValueObjectDynamicValue.cpp 
lldb/source/Core/ValueObjectMemory.cpp lldb/source/Core/ValueObjectRegister.cpp 
lldb/source/Core/ValueObjectSyntheticFilter.cpp 
lldb/source/Core/ValueObjectVTable.cpp lldb/source/Core/ValueObjectVariable.cpp 
lldb/source/DataFormatters/FormatManager.cpp 
lldb/source/DataFormatters/TypeSynthetic.cpp 
lldb/source/DataFormatters/ValueObjectPrinter.cpp 
lldb/source/DataFormatters/VectorType.cpp 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp 
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp 
lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp 
lldb/source/Plugins/Language/CPlusPlus/Coroutines.h 
lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp 
lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.h 
lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
lldb/source/Plugins/Language/ObjC/Cocoa.cpp 
lldb/source/Plugins/Language/ObjC/NSArray.cpp 
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp 
lldb/source/Plugins/Language/ObjC/NSError.cpp 
lldb/source/Plugins/Language/ObjC/NSException.cpp 
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp 
lldb/source/Plugins/Language/ObjC/NSSet.cpp 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp 
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/source/Symbol/Variable.cpp lldb/source/Target/StackFrame.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp 
b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index e253f6a23a..bbdc2a9981 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -773,8 +773,7 @@ bool ValueObjectPrinter::PrintChildrenOneLiner(bool 
hide_names) {
 m_stream->PutChar('(');
 
 bool did_print_children = false;
-for (uint32_t idx = 0; idx < num_children; ++
-   idx) {
+for (uint32_t idx = 0; idx < num_children; ++idx) {
   lldb::ValueObjectSP child_sp(synth_valobj.GetChildAtIndex(idx));
   if (child_sp)
 child_sp = child_sp->GetQualifiedRepresentationIfAvailable(
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp 
b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index 258c3debf1..749aa6f112 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -684,9 

[Lldb-commits] [lldb] Report back errors in GetNumChildren() (PR #84265)

2024-03-06 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 
21be2fbd17f9ff6f3f04e0ababc91c9cdd5aed85...cb496e138b46732de73d0e56b2bfc3f749355953
 lldb/test/API/functionalities/valobj_errors/TestValueObjectErrors.py
``





View the diff from darker here.


``diff
--- TestValueObjectErrors.py2024-03-07 00:21:27.00 +
+++ TestValueObjectErrors.py2024-03-07 00:27:15.402484 +
@@ -5,11 +5,9 @@
 
 
 class ValueObjectErrorsTestCase(TestBase):
 def test(self):
 """Test that the error message for a missing type
-   is visible when printing an object"""
+is visible when printing an object"""
 self.build()
-lldbutil.run_to_source_breakpoint(
-self, "break here", lldb.SBFileSpec('main.c'))
-self.expect('v -ptr-depth 1 x',
-substrs=[''])
+lldbutil.run_to_source_breakpoint(self, "break here", 
lldb.SBFileSpec("main.c"))
+self.expect("v -ptr-depth 1 x", substrs=[''])

``




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


[Lldb-commits] [lldb] Report back errors in GetNumChildren() (PR #84265)

2024-03-06 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

```
Ran command:
"v -ptr-depth 1 x"

Got output:
(Opaque *) x = 0x00018000 
```

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] 0497c77 - [lldb] Print mangled names with verbose break list (#84071)

2024-03-06 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2024-03-06T16:25:22-08:00
New Revision: 0497c77e9e02f0dcccd42a6afd65d0356a5dbb57

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

LOG: [lldb] Print mangled names with verbose break list (#84071)

When debugging LLDB itself, it can often be useful to know the mangled
name of the function where a breakpoint is set. Since the `--verbose`
setting of `break --list` is aimed at debugging LLDB, this patch makes
it so that the mangled name is also printed in that mode.

Note about testing: since mangling is not the same on Windows and Linux,
the test refrains from hardcoding mangled names.

Added: 


Modified: 
lldb/source/Breakpoint/BreakpointLocation.cpp

lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index f7b8ca1f5506f3..b48ec1398d63e8 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -524,6 +524,12 @@ void BreakpointLocation::GetDescription(Stream *s,
   s->EOL();
   s->Indent("function = ");
   s->PutCString(sc.function->GetName().AsCString(""));
+  if (ConstString mangled_name =
+  sc.function->GetMangled().GetMangledName()) {
+s->EOL();
+s->Indent("mangled function = ");
+s->PutCString(mangled_name.AsCString());
+  }
 }
 
 if (sc.line_entry.line > 0) {

diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
index 129290909029a1..5179ffe730b9a0 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
@@ -82,7 +82,7 @@ def breakpoint_options_language_test(self):
 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
 # This should create a breakpoint with 1 locations.
-lldbutil.run_break_set_by_symbol(
+bp_id = lldbutil.run_break_set_by_symbol(
 self,
 "ns::func",
 sym_exact=False,
@@ -90,6 +90,17 @@ def breakpoint_options_language_test(self):
 num_expected_locations=1,
 )
 
+location = 
self.target().FindBreakpointByID(bp_id).GetLocationAtIndex(0)
+function = location.GetAddress().GetFunction()
+self.expect(
+"breakpoint list -v",
+"Verbose breakpoint list contains mangled names",
+substrs=[
+"function = ns::func",
+f"mangled function = {function.GetMangledName()}",
+],
+)
+
 # This should create a breakpoint with 0 locations.
 lldbutil.run_break_set_by_symbol(
 self,



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


[Lldb-commits] [lldb] Report back errors in GetNumChildren() (PR #84265)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)


Changes

This is a proof-of-concept patch that illustrates how to use the
Expected return values to surface rich error messages all the way up
to the ValueObjectPrinter.

This is the final patch in the series that includes 
https://github.com/llvm/llvm-project/pull/83501 and 
https://github.com/llvm/llvm-project/pull/84219

---

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


76 Files Affected:

- (modified) lldb/include/lldb/Core/ValueObject.h (+6-5) 
- (modified) lldb/include/lldb/Core/ValueObjectCast.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectChild.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResult.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectDynamicValue.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectMemory.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectRegister.h (+2-2) 
- (modified) lldb/include/lldb/Core/ValueObjectSyntheticFilter.h (+2-2) 
- (modified) lldb/include/lldb/Core/ValueObjectVTable.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectVariable.h (+1-1) 
- (modified) lldb/include/lldb/DataFormatters/TypeSynthetic.h (+15-11) 
- (modified) lldb/include/lldb/DataFormatters/ValueObjectPrinter.h (+1-1) 
- (modified) lldb/include/lldb/DataFormatters/VectorIterator.h (+2-2) 
- (modified) lldb/include/lldb/Symbol/CompilerType.h (+3-2) 
- (modified) lldb/include/lldb/Symbol/Type.h (+1-1) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+4-3) 
- (modified) lldb/include/lldb/Target/StackFrameRecognizer.h (+2-1) 
- (modified) lldb/source/API/SBValue.cpp (+2-1) 
- (modified) lldb/source/Core/FormatEntity.cpp (+2-1) 
- (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+2-1) 
- (modified) lldb/source/Core/ValueObject.cpp (+21-10) 
- (modified) lldb/source/Core/ValueObjectCast.cpp (+4-2) 
- (modified) lldb/source/Core/ValueObjectChild.cpp (+4-2) 
- (modified) lldb/source/Core/ValueObjectConstResult.cpp (+5-2) 
- (modified) lldb/source/Core/ValueObjectDynamicValue.cpp (+5-2) 
- (modified) lldb/source/Core/ValueObjectMemory.cpp (+7-3) 
- (modified) lldb/source/Core/ValueObjectRegister.cpp (+9-4) 
- (modified) lldb/source/Core/ValueObjectSyntheticFilter.cpp (+22-15) 
- (modified) lldb/source/Core/ValueObjectVTable.cpp (+4-2) 
- (modified) lldb/source/Core/ValueObjectVariable.cpp (+7-3) 
- (modified) lldb/source/DataFormatters/FormatManager.cpp (+8-3) 
- (modified) lldb/source/DataFormatters/TypeSynthetic.cpp (+5-3) 
- (modified) lldb/source/DataFormatters/ValueObjectPrinter.cpp (+20-5) 
- (modified) lldb/source/DataFormatters/VectorType.cpp (+10-5) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp (+2-1) 
- (modified) 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp 
(+3-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp (+4-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.h (+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp (+10-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp (+13-13) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.h (+8-8) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
(+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (+10-10) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (+11-9) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp 
(+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp (+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
(+6-6) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp (+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp (+3-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp (+12-11) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp (+17-10) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (+8-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
(+5-4) 
- (modified) lldb/source/Plugins/Language/ObjC/Cocoa.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSArray.cpp (+25-23) 
- (modified) lldb/source/Plugins/Language/ObjC/NSDictionary.cpp (+54-44) 
- (modified) lldb/source/Plugins/Language/ObjC/NSError.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSException.cpp (+2-4) 
- (modified) 

[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-06 Thread Dave Lee via lldb-commits

https://github.com/kastiglione updated 
https://github.com/llvm/llvm-project/pull/84263

>From e5bed6b190687cc31ecb69da006bc93d9284994a Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 16:03:22 -0800
Subject: [PATCH 1/2] [lldb] Minor cleanup in StoringDiagnosticConsumer

---
 .../ExpressionParser/Clang/ClangModulesDeclVendor.cpp  | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..7fdaa2762be56d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -80,7 +80,6 @@ class StoringDiagnosticConsumer : public 
clang::DiagnosticConsumer {
   std::shared_ptr m_os;
   /// Output string filled by m_os. Will be reused for different diagnostics.
   std::string m_output;
-  Log *m_log;
   /// A Progress with explicitly managed lifetime.
   std::unique_ptr m_current_progress_up;
   std::vector m_module_build_stack;
@@ -142,12 +141,10 @@ class ClangModulesDeclVendorImpl : public 
ClangModulesDeclVendor {
 } // anonymous namespace
 
 StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
-  m_log = GetLog(LLDBLog::Expressions);
-
-  clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
+  clang::DiagnosticOptions *options = new clang::DiagnosticOptions();
   m_os = std::make_shared(m_output);
   m_diag_printer =
-  std::make_shared(*m_os, m_options);
+  std::make_shared(*m_os, options);
 }
 
 void StoringDiagnosticConsumer::HandleDiagnostic(

>From 13bfecf4740f7a3cf8cef98a91f4560fe6a59cfd Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 16:10:37 -0800
Subject: [PATCH 2/2] more cleanup

---
 .../Clang/ClangModulesDeclVendor.cpp | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 7fdaa2762be56d..2a992d6b36208d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -75,9 +75,11 @@ class StoringDiagnosticConsumer : public 
clang::DiagnosticConsumer {
   std::vector m_diagnostics;
   /// The DiagnosticPrinter used for creating the full diagnostic messages
   /// that are stored in m_diagnostics.
-  std::shared_ptr m_diag_printer;
+  std::unique_ptr m_diag_printer;
   /// Output stream of m_diag_printer.
-  std::shared_ptr m_os;
+  std::unique_ptr m_os;
+  /// Diagnostics options of m_diag_printer.
+  std::unique_ptr m_options;
   /// Output string filled by m_os. Will be reused for different diagnostics.
   std::string m_output;
   /// A Progress with explicitly managed lifetime.
@@ -141,10 +143,10 @@ class ClangModulesDeclVendorImpl : public 
ClangModulesDeclVendor {
 } // anonymous namespace
 
 StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
-  clang::DiagnosticOptions *options = new clang::DiagnosticOptions();
-  m_os = std::make_shared(m_output);
+  m_options = std::make_unique();
+  m_os = std::make_unique(m_output);
   m_diag_printer =
-  std::make_shared(*m_os, options);
+  std::make_unique(*m_os, m_options.get());
 }
 
 void StoringDiagnosticConsumer::HandleDiagnostic(

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


[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (+2-5) 


``diff
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..7fdaa2762be56d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -80,7 +80,6 @@ class StoringDiagnosticConsumer : public 
clang::DiagnosticConsumer {
   std::shared_ptr m_os;
   /// Output string filled by m_os. Will be reused for different diagnostics.
   std::string m_output;
-  Log *m_log;
   /// A Progress with explicitly managed lifetime.
   std::unique_ptr m_current_progress_up;
   std::vector m_module_build_stack;
@@ -142,12 +141,10 @@ class ClangModulesDeclVendorImpl : public 
ClangModulesDeclVendor {
 } // anonymous namespace
 
 StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
-  m_log = GetLog(LLDBLog::Expressions);
-
-  clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
+  clang::DiagnosticOptions *options = new clang::DiagnosticOptions();
   m_os = std::make_shared(m_output);
   m_diag_printer =
-  std::make_shared(*m_os, m_options);
+  std::make_shared(*m_os, options);
 }
 
 void StoringDiagnosticConsumer::HandleDiagnostic(

``




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


[Lldb-commits] [lldb] [lldb] Minor cleanup in StoringDiagnosticConsumer (PR #84263)

2024-03-06 Thread Dave Lee via lldb-commits

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

None

>From e5bed6b190687cc31ecb69da006bc93d9284994a Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 16:03:22 -0800
Subject: [PATCH] [lldb] Minor cleanup in StoringDiagnosticConsumer

---
 .../ExpressionParser/Clang/ClangModulesDeclVendor.cpp  | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..7fdaa2762be56d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -80,7 +80,6 @@ class StoringDiagnosticConsumer : public 
clang::DiagnosticConsumer {
   std::shared_ptr m_os;
   /// Output string filled by m_os. Will be reused for different diagnostics.
   std::string m_output;
-  Log *m_log;
   /// A Progress with explicitly managed lifetime.
   std::unique_ptr m_current_progress_up;
   std::vector m_module_build_stack;
@@ -142,12 +141,10 @@ class ClangModulesDeclVendorImpl : public 
ClangModulesDeclVendor {
 } // anonymous namespace
 
 StoringDiagnosticConsumer::StoringDiagnosticConsumer() {
-  m_log = GetLog(LLDBLog::Expressions);
-
-  clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions();
+  clang::DiagnosticOptions *options = new clang::DiagnosticOptions();
   m_os = std::make_shared(m_output);
   m_diag_printer =
-  std::make_shared(*m_os, m_options);
+  std::make_shared(*m_os, options);
 }
 
 void StoringDiagnosticConsumer::HandleDiagnostic(

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


[Lldb-commits] [lldb] [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (PR #84262)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (-8) 


``diff
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..cc5250ca0f7883 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -8,7 +8,6 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticFrontend.h"
-#include "clang/Basic/DiagnosticSerialization.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
@@ -19,20 +18,15 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Serialization/ASTReader.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Threading.h"
 
 #include "ClangHost.h"
 #include "ClangModulesDeclVendor.h"
-#include "ModuleDependencyCollector.h"
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/Progress.h"
-#include "lldb/Host/Host.h"
-#include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Target.h"
@@ -40,10 +34,8 @@
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
-#include "lldb/Utility/StreamString.h"
 
 #include 
-#include 
 
 using namespace lldb_private;
 

``




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


[Lldb-commits] [lldb] [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (PR #84262)

2024-03-06 Thread Dave Lee via lldb-commits

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

None

>From ba079bd1d130a460e481b6c10b33f1ddd58421a3 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 16:02:13 -0800
Subject: [PATCH] [lldb] Remove unused #includes in ClangModulesDeclVendor.cpp

---
 .../ExpressionParser/Clang/ClangModulesDeclVendor.cpp | 8 
 1 file changed, 8 deletions(-)

diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..cc5250ca0f7883 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -8,7 +8,6 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticFrontend.h"
-#include "clang/Basic/DiagnosticSerialization.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
@@ -19,20 +18,15 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Serialization/ASTReader.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Threading.h"
 
 #include "ClangHost.h"
 #include "ClangModulesDeclVendor.h"
-#include "ModuleDependencyCollector.h"
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/Progress.h"
-#include "lldb/Host/Host.h"
-#include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Target.h"
@@ -40,10 +34,8 @@
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
-#include "lldb/Utility/StreamString.h"
 
 #include 
-#include 
 
 using namespace lldb_private;
 

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


[Lldb-commits] [lldb] [lldb] Log module build remarks to types log too (PR #84260)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (+1-1) 


``diff
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..89e56213c1bfe0 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -191,7 +191,7 @@ void StoringDiagnosticConsumer::EndSourceFile() {
 
 bool StoringDiagnosticConsumer::HandleModuleRemark(
 const clang::Diagnostic ) {
-  Log *log = GetLog(LLDBLog::Expressions);
+  Log *log = GetLog(LLDBLog::Types | LLDBLog::Expressions);
   switch (info.getID()) {
   case clang::diag::remark_module_build: {
 const auto _name = info.getArgStdStr(0);

``




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


[Lldb-commits] [lldb] [lldb] Log module build remarks to types log too (PR #84260)

2024-03-06 Thread Dave Lee via lldb-commits

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

None

>From c828091ab173a2c23e10649ad7b131a02ae4e6c1 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 15:55:38 -0800
Subject: [PATCH] [lldb] Log module build remarks to types log too

---
 .../Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230c..89e56213c1bfe0 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -191,7 +191,7 @@ void StoringDiagnosticConsumer::EndSourceFile() {
 
 bool StoringDiagnosticConsumer::HandleModuleRemark(
 const clang::Diagnostic ) {
-  Log *log = GetLog(LLDBLog::Expressions);
+  Log *log = GetLog(LLDBLog::Types | LLDBLog::Expressions);
   switch (info.getID()) {
   case clang::diag::remark_module_build: {
 const auto _name = info.getArgStdStr(0);

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread via lldb-commits

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

Yes, this looks fine to me for adding the mangled name.

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-06 Thread Jonas Devlieghere via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-06 Thread Dave Lee via lldb-commits

kastiglione wrote:

To start with option #​1 I created 
https://github.com/llvm/llvm-project/pull/84246

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-06 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


3 Files Affected:

- (modified) lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test (+1-1) 
- (modified) lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test (+1-1) 
- (modified) lldb/test/Shell/lit.cfg.py (+12) 


``diff
diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 3df9906394f432..783bfd45c4669a 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 682b0e5332b1c5..a2b5ae8a9e3e5f 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index d75c1f532e147f..6d41dc7d8d7325 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -1,5 +1,6 @@
 # -*- Python -*-
 
+import json
 import os
 import platform
 import re
@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a TLS bug. We want
+# to skip TLS tests if they contain this bug.
+try:
+raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+if 1000 <= float(version) <= 1109:
+config.available_features.add("ld64-tls-bug")
+except:
+pass

``




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


[Lldb-commits] [lldb] [lldb] Disable shell tests affected by ld64 bug (PR #84246)

2024-03-06 Thread Dave Lee via lldb-commits

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

None

>From 1fb13a2d034dbea1d1ba2ef87354199a815f3788 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Wed, 6 Mar 2024 14:23:05 -0800
Subject: [PATCH] [lldb] Disable shell tests affected by ld64 bug

---
 lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test|  2 +-
 .../Shell/Unwind/thread-step-out-ret-addr-check.test |  2 +-
 lldb/test/Shell/lit.cfg.py   | 12 
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test 
b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 3df9906394f432..783bfd45c4669a 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test 
b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 682b0e5332b1c5..a2b5ae8a9e3e5f 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp 
%p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index d75c1f532e147f..6d41dc7d8d7325 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -1,5 +1,6 @@
 # -*- Python -*-
 
+import json
 import os
 import platform
 import re
@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
 config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a TLS bug. We want
+# to skip TLS tests if they contain this bug.
+try:
+raw_version_details = subprocess.check_output(("xcrun", "ld", 
"-version_details"))
+version_details = json.loads(raw_version_details)
+version = version_details.get("version", "0")
+if 1000 <= float(version) <= 1109:
+config.available_features.add("ld64-tls-bug")
+except:
+pass

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


[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

2024-03-06 Thread Dave Lee via lldb-commits

kastiglione wrote:

We're going to need this logic in a couple from shell tests too.

Should we:
1. Duplicate the logic into lit.cfg.py?
2. Import lldbplatformutil.py into lit.cfg.py? (are there any python 
structure/layout issues that would complicate this?)
3. Put the logic in an independent location and have both lit.cfg.py and 
lldbplatformutil.py import that?

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread Greg Clayton via lldb-commits

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

Looks good for just including the mangled name.

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


[Lldb-commits] [lldb] Don't require a UUID in a .dwp file. (PR #83935)

2024-03-06 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] f0eb0c5 - Don't require a UUID in a .dwp file. (#83935)

2024-03-06 Thread via lldb-commits

Author: Greg Clayton
Date: 2024-03-06T13:49:26-08:00
New Revision: f0eb0c5689b25153067e66647590a8300b997740

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

LOG: Don't require a UUID in a .dwp file. (#83935)

DWP files don't usually have a GNU build ID built into them. When
searching for a .dwp file, don't require a UUID to be in the .dwp file.
The debug info search information was checking for a UUID in the .dwp
file when debug info search paths were being used. This is now fixed by
not specifying the UUID in the ModuleSpec being used for the .dwp file
search.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 84ff4c2565a050..5f67658f86ea96 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4377,7 +4377,6 @@ const std::shared_ptr 
::GetDwpSymbolFile() {
 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
 ModuleSpec module_spec;
 module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec();
-module_spec.GetUUID() = m_objfile_sp->GetUUID();
 for (const auto  : symfiles.files()) {
   module_spec.GetSymbolFileSpec() =
   FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle());

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp
index 9a8149065b6e58..1d636ede41b56d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp
@@ -139,6 +139,20 @@
 // RUN:   -o "target variable a" \
 // RUN:   -b %t | FileCheck %s
 
+// Now move the .debug and .dwp file into another directory so that we can use
+// the target.debug-file-search-paths setting to search for the files.
+// RUN: mkdir -p %t-debug-info-dir
+// RUN: mv %t.dwp %t-debug-info-dir
+// RUN: mv %t.debug %t-debug-info-dir
+// RUN: %lldb \
+// RUN:   -O "log enable dwarf split" \
+// RUN:   -O "setting set target.debug-file-search-paths '%t-debug-info-dir'" \
+// RUN:   -o "target variable a" \
+// RUN:   -b %t | FileCheck %s
+// RUN:
+
+// Now move the .debug and .dwp file into another directory so that we can use
+// the target.debug-file-search-paths setting to search for the files.
 // CHECK: Searching for DWP using:
 // CHECK: Found DWP file:
 // CHECK: (A) a = (x = 47)



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


[Lldb-commits] [lldb] Fix vfork test strcmp buildbot failure (PR #84224)

2024-03-06 Thread Greg Clayton via lldb-commits

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


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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

@walter-erquinigo I was wondering if it would make sense to create a 
DropAndLogError() wrapper for all these places. The main problem would be that 
we end up calling these functions dozens of times over and over so we'd be 
spamming the logs quite a bit. But maybe doing a verbose log would be 
appropriate. I'll modify the patch accordingly.

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


[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread via lldb-commits

jeffreytan81 wrote:

The buildbot seems to complain about `strcmp` not available. Unfortunately I 
can't reproduce on my linux machine. 
Guess draft patch https://github.com/llvm/llvm-project/pull/84224 in case 
anyone has access to build machine can reproduce and verify this. 

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


[Lldb-commits] [lldb] Fix vfork test strcmp buildbot failure (PR #84224)

2024-03-06 Thread via lldb-commits

https://github.com/jeffreytan81 created 
https://github.com/llvm/llvm-project/pull/84224

The buildbot seems to complain about `strcmp` function not available in the 
vfork patch (https://github.com/llvm/llvm-project/pull/81564):
https://lab.llvm.org/buildbot/#/builders/68/builds/70093/steps/6/logs/stdio 

Unfortunately, I can't reproduce the failure on my linux machine so this is a 
guessing fix. If anyone has a way to reproduce and very this fix, please feel 
free to merge this change. 

>From 54334288018468c529a532e93d2f2bcc6bd2190f Mon Sep 17 00:00:00 2001
From: jeffreytan81 
Date: Wed, 6 Mar 2024 12:09:17 -0800
Subject: [PATCH] Fix vfork test strcmp buildbot failure

---
 lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp 
b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
index b0a4446ba01581..40cb63755ee8a5 100644
--- a/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
+++ b/lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp
@@ -1,6 +1,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread Walter Erquinigo via lldb-commits


@@ -1397,7 +1398,9 @@ ValueObjectSP GetValueForOffset(StackFrame , 
ValueObjectSP ,
 return parent;
   }
 
-  for (int ci = 0, ce = parent->GetNumChildren(); ci != ce; ++ci) {
+  for (int ci = 0, ce = llvm::expectedToStdOptional(parent->GetNumChildren())

walter-erquinigo wrote:

I'm afraid that calls to `expectedToStdOptional` will just silence important 
warnings.

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread Walter Erquinigo via lldb-commits


@@ -451,8 +451,13 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject 
) {
   if (valobj.GetSummaryFormat().get() != nullptr)
 return valobj.GetSummaryFormat()->IsOneLiner();
 
+  auto num_children = valobj.GetNumChildren();
+  if (!num_children) {
+llvm::consumeError(num_children.takeError());

walter-erquinigo wrote:

could you log this some channel instead of consuming the error? That would 
still be NFC and would fit well within this PR

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


[Lldb-commits] [lldb] [lldb] Address mask sbprocess apis and new mask invalid const (PR #83663)

2024-03-06 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

nb: this got a bot failure on the arm-linux-ubuntu bot,

```
mask = process.GetAddressMask(lldb.eAddressMaskTypeAny)
process.SetAddressMask(lldb.eAddressMaskTypeCode, mask | 0x3)
self.assertEqual(
0x02950001F694,
process.FixAddress(0x00265E950001F697, 
lldb.eAddressMaskTypeCode),
)

The API returned 0x02950001f694 instead of the expected
0x00265e950001f696.  The low bits differ because ABISysV_arm hardcodes
the Code address mask to clear the 0th bit, it doesn't use the
Process code mask.  I didn't debug why some of the high bytes were
dropped.  
```

I'm skipping TestAddressMasks for arch=arm now, but I don't even know if we 
should be able to set a mask which preserves the high 32-bits of an addr_t on a 
32-bit host; all masks have to mask off the high word of addr_t to be a valid 
addresss, at a minimum.  I don't have access to a 32-bit host that lldb runs on 
myself so my position is that I'll skip this API test entirely on 32-bit 
targets, I don't think the concepts make much sense there.

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -524,6 +524,9 @@ void BreakpointLocation::GetDescription(Stream *s,
   s->EOL();
   s->Indent("function = ");
   s->PutCString(sc.function->GetName().AsCString(""));
+  s->EOL();
+  s->Indent("mangled function = ");
+  
s->PutCString(sc.function->GetMangled().GetMangledName().AsCString(""));

felipepiovezan wrote:

Now that you mention it, I think we kind of _have_ to use `DumpStopContext`.  
As it stands, the verbose output is missing information that the non-verbose 
output has, which feels wrong.

But let's merge this one first, since doing the above requires changing 
existing pieces, and this PR is about adding a new piece.

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


[Lldb-commits] [lldb] 04bbbba - Skip TestAddressMasks API tests on 32-bit arm

2024-03-06 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-03-06T10:58:03-08:00
New Revision: 04a271ebe4c2421f34a4fbf34c328df9f111

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

LOG: Skip TestAddressMasks API tests on 32-bit arm

TestAddressMasks failed on the lldb-arm-buntu bot with the
Code address mask test,

mask = process.GetAddressMask(lldb.eAddressMaskTypeAny)
process.SetAddressMask(lldb.eAddressMaskTypeCode, mask | 0x3)
self.assertEqual(
0x02950001F694,
process.FixAddress(0x00265E950001F697, lldb.eAddressMaskTypeCode),
)

The API returned 0x02950001f694 instead of the expected
0x00265e950001f696.  The low bits differ because ABISysV_arm hardcodes
the Code address mask to clear the 0th bit, it doesn't use the
Process code mask.  I didn't debug why some of the high bytes were
dropped.  The address mask APIs are only important on 64-bit targets,
where many of the bits are not used for addressing and are used for
metadata instead, so I'm going to skip these tests on 32-bit arm
instead of debugging.

Added: 


Modified: 
lldb/test/API/python_api/process/address-masks/TestAddressMasks.py

Removed: 




diff  --git 
a/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py 
b/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py
index e0a570c15961c2..152776efc726f2 100644
--- a/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py
+++ b/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py
@@ -19,6 +19,7 @@ def reset_all_masks(self, process):
 self.runCmd("settings set target.process.virtual-addressable-bits 0")
 self.runCmd("settings set 
target.process.highmem-virtual-addressable-bits 0")
 
+@skipIf(archs=["arm"])  # 32-bit arm ABI hardcodes Code mask, is 32-bit
 def test_address_masks(self):
 self.build()
 (target, process, t, bp) = lldbutil.run_to_source_breakpoint(
@@ -79,6 +80,7 @@ def test_address_masks(self):
 # AArch64 can have 
diff erent address masks for high and low memory, when 
diff erent
 # page tables are set up.
 @skipIf(archs=no_match(["arm64", "arm64e", "aarch64"]))
+@skipIf(archs=["arm"])  # 32-bit arm ABI hardcodes Code mask, is 32-bit
 def test_address_masks_target_supports_highmem_tests(self):
 self.build()
 (target, process, t, bp) = lldbutil.run_to_source_breakpoint(
@@ -111,6 +113,7 @@ def test_address_masks_target_supports_highmem_tests(self):
 # On most targets where we have a single mask for all address range, 
confirm
 # that the high memory masks are ignored.
 @skipIf(archs=["arm64", "arm64e", "aarch64"])
+@skipIf(archs=["arm"])  # 32-bit arm ABI hardcodes Code mask, is 32-bit
 def test_address_masks_target_no_highmem(self):
 self.build()
 (target, process, t, bp) = lldbutil.run_to_source_breakpoint(



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


[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread via lldb-commits

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


[Lldb-commits] [lldb] 8bdddcf - Fix lldb crash while handling concurrent vfork() (#81564)

2024-03-06 Thread via lldb-commits

Author: jeffreytan81
Date: 2024-03-06T10:50:32-08:00
New Revision: 8bdddcf0bb5a40e6ce6cbf7fc6b7ce576e2b032d

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

LOG: Fix lldb crash while handling concurrent vfork() (#81564)

We got user reporting lldb crash while the debuggee is calling vfork()
concurrently from multiple threads.
The crash happens because the current implementation can only handle
single vfork, vforkdone protocol transaction.

This diff fixes the crash by lldb-server storing forked debuggee's  pair in jstopinfo which will be decoded by lldb client to create
StopInfoVFork for follow parent/child policy. Each StopInfoVFork will
later have a corresponding vforkdone packet. So the patch also changes
the `m_vfork_in_progress` to be reference counting based.

Two new test cases are added which crash/assert without the changes in
this patch.

-

Co-authored-by: jeffreytan81 

Added: 
lldb/test/API/functionalities/fork/concurrent_vfork/Makefile
lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py
lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp

Modified: 
lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp 
b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index b62e9f643fa792..26cb26daabf52c 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -456,6 +456,9 @@ void NativeThreadLinux::SetStoppedByFork(bool is_vfork, 
lldb::pid_t child_pid) {
   m_stop_info.signo = SIGTRAP;
   m_stop_info.details.fork.child_pid = child_pid;
   m_stop_info.details.fork.child_tid = child_pid;
+  m_stop_description = std::to_string(child_pid);
+  m_stop_description += " ";
+  m_stop_description += std::to_string(child_pid);
 }
 
 void NativeThreadLinux::SetStoppedByVForkDone() {

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 51ceb12f1a5709..5b9a9d71802f86 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -263,10 +263,9 @@ ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP 
target_sp,
   m_continue_C_tids(), m_continue_s_tids(), m_continue_S_tids(),
   m_max_memory_size(0), m_remote_stub_max_memory_size(0),
   m_addr_to_mmap_size(), m_thread_create_bp_sp(),
-  m_waiting_for_attach(false),
-  m_command_sp(), m_breakpoint_pc_offset(0),
+  m_waiting_for_attach(false), m_command_sp(), m_breakpoint_pc_offset(0),
   m_initial_tid(LLDB_INVALID_THREAD_ID), m_allow_flash_writes(false),
-  m_erased_flash_ranges(), m_vfork_in_progress(false) {
+  m_erased_flash_ranges(), m_vfork_in_progress_count(0) {
   m_async_broadcaster.SetEventName(eBroadcastBitAsyncThreadShouldExit,
"async thread should exit");
   m_async_broadcaster.SetEventName(eBroadcastBitAsyncContinue,
@@ -5293,8 +5292,10 @@ class CommandObjectProcessGDBRemoteSpeedTest : public 
CommandObjectParsed {
   (ProcessGDBRemote *)m_interpreter.GetExecutionContext()
   .GetProcessPtr();
   if (process) {
-StreamSP output_stream_sp(
-m_interpreter.GetDebugger().GetAsyncOutputStream());
+StreamSP output_stream_sp = result.GetImmediateOutputStream();
+if (!output_stream_sp)
+  output_stream_sp =
+  StreamSP(m_interpreter.GetDebugger().GetAsyncOutputStream());
 result.SetImmediateOutputStream(output_stream_sp);
 
 const uint32_t num_packets =
@@ -5634,8 +5635,11 @@ void ProcessGDBRemote::DidFork(lldb::pid_t child_pid, 
lldb::tid_t child_tid) {
 void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
   Log *log = GetLog(GDBRLog::Process);
 
-  assert(!m_vfork_in_progress);
-  m_vfork_in_progress = true;
+  LLDB_LOG(
+  log,
+  "ProcessGDBRemote::DidFork() called for child_pid: {0}, child_tid {1}",
+  child_pid, child_tid);
+  ++m_vfork_in_progress_count;
 
   // Disable all software breakpoints for the duration of vfork.
   if (m_gdb_comm.SupportsGDBStoppointPacket(eBreakpointSoftware))
@@ -5689,8 +5693,8 @@ void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, 
lldb::tid_t child_tid) {
 }
 
 void ProcessGDBRemote::DidVForkDone() {
-  assert(m_vfork_in_progress);
-  m_vfork_in_progress = false;
+  assert(m_vfork_in_progress_count > 0);
+  --m_vfork_in_progress_count;
 
   // Reenable all software breakpoints that were 

[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 21be2fbd17f9ff6f3f04e0ababc91c9cdd5aed85 
d3112e0cd5932e1e1413ed22f71adec70bc81bbf -- 
lldb/include/lldb/Core/ValueObject.h lldb/include/lldb/Core/ValueObjectCast.h 
lldb/include/lldb/Core/ValueObjectChild.h 
lldb/include/lldb/Core/ValueObjectConstResult.h 
lldb/include/lldb/Core/ValueObjectDynamicValue.h 
lldb/include/lldb/Core/ValueObjectMemory.h 
lldb/include/lldb/Core/ValueObjectRegister.h 
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h 
lldb/include/lldb/Core/ValueObjectVTable.h 
lldb/include/lldb/Core/ValueObjectVariable.h 
lldb/include/lldb/DataFormatters/TypeSynthetic.h 
lldb/include/lldb/DataFormatters/VectorIterator.h 
lldb/include/lldb/Symbol/CompilerType.h lldb/include/lldb/Symbol/Type.h 
lldb/include/lldb/Symbol/TypeSystem.h 
lldb/include/lldb/Target/StackFrameRecognizer.h lldb/source/API/SBValue.cpp 
lldb/source/Core/FormatEntity.cpp lldb/source/Core/IOHandlerCursesGUI.cpp 
lldb/source/Core/ValueObject.cpp lldb/source/Core/ValueObjectCast.cpp 
lldb/source/Core/ValueObjectChild.cpp 
lldb/source/Core/ValueObjectConstResult.cpp 
lldb/source/Core/ValueObjectDynamicValue.cpp 
lldb/source/Core/ValueObjectMemory.cpp lldb/source/Core/ValueObjectRegister.cpp 
lldb/source/Core/ValueObjectSyntheticFilter.cpp 
lldb/source/Core/ValueObjectVTable.cpp lldb/source/Core/ValueObjectVariable.cpp 
lldb/source/DataFormatters/FormatManager.cpp 
lldb/source/DataFormatters/TypeSynthetic.cpp 
lldb/source/DataFormatters/ValueObjectPrinter.cpp 
lldb/source/DataFormatters/VectorType.cpp 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp 
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp 
lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp 
lldb/source/Plugins/Language/CPlusPlus/Coroutines.h 
lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp 
lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.h 
lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp 
lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
lldb/source/Plugins/Language/ObjC/Cocoa.cpp 
lldb/source/Plugins/Language/ObjC/NSArray.cpp 
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp 
lldb/source/Plugins/Language/ObjC/NSError.cpp 
lldb/source/Plugins/Language/ObjC/NSException.cpp 
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp 
lldb/source/Plugins/Language/ObjC/NSSet.cpp 
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp 
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/source/Symbol/Variable.cpp lldb/source/Target/StackFrame.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp 
b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index 258c3debf1..749aa6f112 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -684,9 +684,8 @@ 
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd::
 }
 
 template 
-lldb::ValueObjectSP
-lldb_private::formatters::GenericNSArrayISyntheticFrontEnd::
-  GetChildAtIndex(uint32_t idx) {
+lldb::ValueObjectSP lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<
+D32, D64, Inline>::GetChildAtIndex(uint32_t idx) {
   if (idx >= llvm::expectedToStdOptional(CalculateNumChildren()).value_or(0))
 return lldb::ValueObjectSP();
   lldb::addr_t object_at_idx;
diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp 
b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
index 726063c54d..69eb253505 100644
--- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -262,9 +262,9 @@ namespace Foundation1100 {
 NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
  

[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (PR #84219)

2024-03-06 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] Change GetNumChildren()/CalculateNumChilrem() methods return llvm::Expected (PR #84219)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)


Changes

Change GetNumChildren()/CalculateNumChilrem() methods return llvm::Expected

This is an NFC change that does not yet add any error handling or change any 
code to return any errors.

This is the second big change in the patch series started with 
https://github.com/llvm/llvm-project/pull/83501

A follow-up PR will wire up error handling.

---

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


71 Files Affected:

- (modified) lldb/include/lldb/Core/ValueObject.h (+6-5) 
- (modified) lldb/include/lldb/Core/ValueObjectCast.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectChild.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectConstResult.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectDynamicValue.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectMemory.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectRegister.h (+2-2) 
- (modified) lldb/include/lldb/Core/ValueObjectSyntheticFilter.h (+2-2) 
- (modified) lldb/include/lldb/Core/ValueObjectVTable.h (+1-1) 
- (modified) lldb/include/lldb/Core/ValueObjectVariable.h (+1-1) 
- (modified) lldb/include/lldb/DataFormatters/TypeSynthetic.h (+15-11) 
- (modified) lldb/include/lldb/DataFormatters/VectorIterator.h (+2-2) 
- (modified) lldb/include/lldb/Symbol/CompilerType.h (+3-2) 
- (modified) lldb/include/lldb/Symbol/Type.h (+1-1) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+4-3) 
- (modified) lldb/include/lldb/Target/StackFrameRecognizer.h (+2-1) 
- (modified) lldb/source/API/SBValue.cpp (+2-1) 
- (modified) lldb/source/Core/FormatEntity.cpp (+2-1) 
- (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+2-1) 
- (modified) lldb/source/Core/ValueObject.cpp (+21-10) 
- (modified) lldb/source/Core/ValueObjectCast.cpp (+4-2) 
- (modified) lldb/source/Core/ValueObjectChild.cpp (+4-2) 
- (modified) lldb/source/Core/ValueObjectConstResult.cpp (+5-2) 
- (modified) lldb/source/Core/ValueObjectDynamicValue.cpp (+5-2) 
- (modified) lldb/source/Core/ValueObjectMemory.cpp (+7-3) 
- (modified) lldb/source/Core/ValueObjectRegister.cpp (+9-4) 
- (modified) lldb/source/Core/ValueObjectSyntheticFilter.cpp (+22-15) 
- (modified) lldb/source/Core/ValueObjectVTable.cpp (+4-2) 
- (modified) lldb/source/Core/ValueObjectVariable.cpp (+5-2) 
- (modified) lldb/source/DataFormatters/FormatManager.cpp (+8-3) 
- (modified) lldb/source/DataFormatters/TypeSynthetic.cpp (+5-3) 
- (modified) lldb/source/DataFormatters/ValueObjectPrinter.cpp (+2-1) 
- (modified) lldb/source/DataFormatters/VectorType.cpp (+10-5) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp (+2-1) 
- (modified) 
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp 
(+3-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp (+4-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.h (+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp (+10-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp (+13-13) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.h (+8-8) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
(+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (+10-10) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (+11-9) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp 
(+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp (+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
(+6-6) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp (+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp (+3-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp (+12-11) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp (+17-10) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (+8-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
(+5-4) 
- (modified) lldb/source/Plugins/Language/ObjC/Cocoa.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSArray.cpp (+25-23) 
- (modified) lldb/source/Plugins/Language/ObjC/NSDictionary.cpp (+52-42) 
- (modified) lldb/source/Plugins/Language/ObjC/NSError.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSException.cpp (+2-4) 
- (modified) lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp 

[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread via lldb-commits

https://github.com/jeffreytan81 updated 
https://github.com/llvm/llvm-project/pull/81564

>From d65900f5e6169062fc0988b57fb5be2474789025 Mon Sep 17 00:00:00 2001
From: jeffreytan81 
Date: Mon, 12 Feb 2024 18:08:23 -0800
Subject: [PATCH 1/8] Fix lldb crash while handling concurrent vfork()

---
 .../Process/Linux/NativeThreadLinux.cpp   | 12 -
 .../Process/gdb-remote/ProcessGDBRemote.cpp   | 21 ++---
 .../Process/gdb-remote/ProcessGDBRemote.h |  3 +-
 .../fork/concurrent_vfork/Makefile|  4 ++
 .../concurrent_vfork/TestConcurrentVFork.py   | 31 +
 .../fork/concurrent_vfork/main.cpp| 46 +++
 6 files changed, 108 insertions(+), 9 deletions(-)
 create mode 100644 lldb/test/API/functionalities/fork/concurrent_vfork/Makefile
 create mode 100644 
lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py
 create mode 100644 lldb/test/API/functionalities/fork/concurrent_vfork/main.cpp

diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp 
b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index b62e9f643fa792..cf8a1e7d34392a 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -120,7 +120,7 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo 
_info,
   case eStateCrashed:
   case eStateExited:
   case eStateSuspended:
-  case eStateUnloaded:
+  case eStateUnloaded: {
 if (log)
   LogThreadStopInfo(*log, m_stop_info, "m_stop_info in thread:");
 stop_info = m_stop_info;
@@ -128,7 +128,17 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo 
_info,
 if (log)
   LogThreadStopInfo(*log, stop_info, "returned stop_info:");
 
+// Include child process PID/TID for forks.
+// Client expects " " format.
+if (stop_info.reason == eStopReasonFork ||
+stop_info.reason == eStopReasonVFork) {
+  description = std::to_string(stop_info.details.fork.child_pid);
+  description += " ";
+  description += std::to_string(stop_info.details.fork.child_tid);
+}
+
 return true;
+  }
 
   case eStateInvalid:
   case eStateConnected:
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 629b191f3117aa..8ab2257e0a79b9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -266,7 +266,7 @@ ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp,
   m_waiting_for_attach(false),
   m_command_sp(), m_breakpoint_pc_offset(0),
   m_initial_tid(LLDB_INVALID_THREAD_ID), m_allow_flash_writes(false),
-  m_erased_flash_ranges(), m_vfork_in_progress(false) {
+  m_erased_flash_ranges(), m_vfork_in_progress(0) {
   m_async_broadcaster.SetEventName(eBroadcastBitAsyncThreadShouldExit,
"async thread should exit");
   m_async_broadcaster.SetEventName(eBroadcastBitAsyncContinue,
@@ -5615,8 +5615,12 @@ void ProcessGDBRemote::DidFork(lldb::pid_t child_pid, 
lldb::tid_t child_tid) {
 void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
   Log *log = GetLog(GDBRLog::Process);
 
-  assert(!m_vfork_in_progress);
-  m_vfork_in_progress = true;
+  LLDB_LOG(
+  log,
+  "ProcessGDBRemote::DidFork() called for child_pid: {0}, child_tid {1}",
+  child_pid, child_tid);
+  assert(m_vfork_in_progress >= 0);
+  ++m_vfork_in_progress;
 
   // Disable all software breakpoints for the duration of vfork.
   if (m_gdb_comm.SupportsGDBStoppointPacket(eBreakpointSoftware))
@@ -5670,8 +5674,8 @@ void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, 
lldb::tid_t child_tid) {
 }
 
 void ProcessGDBRemote::DidVForkDone() {
-  assert(m_vfork_in_progress);
-  m_vfork_in_progress = false;
+  --m_vfork_in_progress;
+  assert(m_vfork_in_progress >= 0);
 
   // Reenable all software breakpoints that were enabled before vfork.
   if (m_gdb_comm.SupportsGDBStoppointPacket(eBreakpointSoftware))
@@ -5681,7 +5685,10 @@ void ProcessGDBRemote::DidVForkDone() {
 void ProcessGDBRemote::DidExec() {
   // If we are following children, vfork is finished by exec (rather than
   // vforkdone that is submitted for parent).
-  if (GetFollowForkMode() == eFollowChild)
-m_vfork_in_progress = false;
+  if (GetFollowForkMode() == eFollowChild) {
+if (m_vfork_in_progress > 0)
+  --m_vfork_in_progress;
+assert(m_vfork_in_progress >= 0);
+  }
   Process::DidExec();
 }
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index c1ea1cc7905587..29ed770c1275ea 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -301,7 +301,8 @@ class ProcessGDBRemote : public Process,
   using FlashRange = FlashRangeVector::Entry;
   

[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread Greg Clayton via lldb-commits


@@ -0,0 +1,116 @@
+"""
+Make sure that the concurrent vfork() from multiple threads works correctly.
+"""
+
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+
+class TestConcurrentVFork(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def get_pid_from_variable(self, target):
+return target.FindFirstGlobalVariable("g_pid").GetValueAsUnsigned()

clayborg wrote:

only one caller to this, just inline the code as suggested below.

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


[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread Greg Clayton via lldb-commits


@@ -0,0 +1,116 @@
+"""
+Make sure that the concurrent vfork() from multiple threads works correctly.
+"""
+
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+
+class TestConcurrentVFork(TestBase):
+NO_DEBUG_INFO_TESTCASE = True
+
+def get_pid_from_variable(self, target):
+return target.FindFirstGlobalVariable("g_pid").GetValueAsUnsigned()
+
+def build_run_to_breakpoint(self, use_fork, call_exec):
+self.build()
+
+args = []
+if use_fork:
+args.append("--fork")
+if call_exec:
+args.append("--exec")
+launch_info = lldb.SBLaunchInfo(args)
+launch_info.SetWorkingDirectory(self.getBuildDir())
+
+return lldbutil.run_to_source_breakpoint(
+self, "// break here", lldb.SBFileSpec("main.cpp")
+)
+
+def follow_parent_helper(self, use_fork, call_exec):
+(target, process, thread, bkpt) = self.build_run_to_breakpoint(
+use_fork, call_exec
+)
+
+parent_pid = self.get_pid_from_variable(target)

clayborg wrote:

Only one caller to this function, inline the code:
```
parent_pid = target.FindFirstGlobalVariable("g_pid").GetValueAsUnsigned()
```

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


[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread Greg Clayton via lldb-commits

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

One little nit you can fix as suggested in the inline comments.

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


[Lldb-commits] [lldb] Fix lldb crash while handling concurrent vfork() (PR #81564)

2024-03-06 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Address mask sbprocess apis and new mask invalid const (PR #83663)

2024-03-06 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] aeaa11a - [lldb] Address mask sbprocess apis and new mask invalid const (#83663)

2024-03-06 Thread via lldb-commits

Author: Jason Molenda
Date: 2024-03-06T10:06:56-08:00
New Revision: aeaa11aeac0aedf32cafec6532d303fea595c5fc

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

LOG: [lldb] Address mask sbprocess apis and new mask invalid const (#83663)

[lldb] Add SBProcess methods for get/set/use address masks (#83095)

I'm reviving a patch from phabracator, https://reviews.llvm.org/D155905
which was approved but I wasn't thrilled with all the API I was adding
to SBProcess for all of the address mask types / memory regions. In this
update, I added enums to control type address mask type (code, data,
any) and address space specifiers (low, high, all) with defaulted
arguments for the most common case.  I originally landed this via
https://github.com/llvm/llvm-project/pull/83095 but it failed on CIs
outside of arm64 Darwin so I had to debug it on more environments
and update the patch.

This patch is also fixing a bug in the "addressable bits to address
mask" calculation I added in AddressableBits::SetProcessMasks. If lldb
were told that 64 bits are valid for addressing, this method would
overflow the calculation and set an invalid mask. Added tests to check
this specific bug while I was adding these APIs.

This patch changes the value of "no mask set" from 0 to
LLDB_INVALID_ADDRESS_MASK, which is UINT64_MAX. A mask of all 1's
means "no bits are used for addressing" which is an impossible mask,
whereas a mask of 0 means "all bits are used for addressing" which
is possible.

I added a base class implementation of ABI::FixCodeAddress and
ABI::FixDataAddress that will apply the Process mask values if they
are set to a value other than LLDB_INVALID_ADDRESS_MASK.

I updated all the callers/users of the Mask methods which were
handling a value of 0 to mean invalid mask to use
LLDB_INVALID_ADDRESS_MASK.

I added code to the all AArch64 ABI Fix* methods to apply the
Highmem masks if they have been set.  These will not be set on a
Linux environment, but in TestAddressMasks.py I test the highmem
masks feature for any AArch64 target, so all AArch64 ABI  plugins 
must handle it.

rdar://123530562

Added: 
lldb/test/API/python_api/process/address-masks/Makefile
lldb/test/API/python_api/process/address-masks/TestAddressMasks.py
lldb/test/API/python_api/process/address-masks/main.c

Modified: 
lldb/include/lldb/API/SBProcess.h
lldb/include/lldb/Target/ABI.h
lldb/include/lldb/Target/Process.h
lldb/include/lldb/Utility/AddressableBits.h
lldb/include/lldb/lldb-defines.h
lldb/include/lldb/lldb-enumerations.h
lldb/source/API/SBProcess.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Target/ABI.cpp
lldb/source/Target/Process.cpp
lldb/source/Utility/AddressableBits.cpp

Removed: 




diff  --git a/lldb/include/lldb/API/SBProcess.h 
b/lldb/include/lldb/API/SBProcess.h
index 4f92a41f3028a2..7da3335a7234b7 100644
--- a/lldb/include/lldb/API/SBProcess.h
+++ b/lldb/include/lldb/API/SBProcess.h
@@ -407,6 +407,120 @@ class LLDB_API SBProcess {
   /// the process isn't loaded from a core file.
   lldb::SBFileSpec GetCoreFile();
 
+  /// \{
+  /// \group Mask Address Methods
+  ///
+  /// \a type
+  /// All of the methods in this group take \a type argument
+  /// which is an AddressMaskType enum value.
+  /// There can be 
diff erent address masks for code addresses and
+  /// data addresses, this argument can select which to get/set,
+  /// or to use when clearing non-addressable bits from an address.
+  /// This choice of mask can be important for example on AArch32
+  /// systems. Where instructions where instructions start on even addresses,
+  /// the 0th bit may be used to indicate that a function is thumb code.  On
+  /// such a target, the eAddressMaskTypeCode may clear the 0th bit from an
+  /// address to get the actual address Whereas eAddressMaskTypeData would not.
+  ///
+  /// \a addr_range
+  /// Many of the methods in this group take an \a addr_range argument
+  /// which is an AddressMaskRange enum value.
+  /// Needing to specify the address range is highly unusual, and the
+  /// default argument can be used in nearly all circumstances.
+  /// On some architectures (e.g., AArch64), it is possible to have
+  /// 
diff erent page table setups for low and high memory, so 
diff erent
+  /// numbers of bits relevant to addressing. It is possible to have
+  /// a program running in one half of memory and accessing the other
+  /// as heap, so we 

[Lldb-commits] [lldb] [lldb] Address mask sbprocess apis and new mask invalid const (PR #83663)

2024-03-06 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

> Still not sure this is the ideal API but we can't know that until someone 
> (aka you :) ) has used it for a bit, so let's get this in.

Thanks for all the help in finishing this one.  I think this approach with 
enums to select the different types/ranges, with defaulted arguments so the 
most frequent use case is easy, is not bad.  My original patch had a lot of 
different methods for the different operations and that was a lot less clear 
for script writers I think.

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread Greg Clayton via lldb-commits


@@ -524,6 +524,9 @@ void BreakpointLocation::GetDescription(Stream *s,
   s->EOL();
   s->Indent("function = ");
   s->PutCString(sc.function->GetName().AsCString(""));
+  s->EOL();
+  s->Indent("mangled function = ");
+  
s->PutCString(sc.function->GetMangled().GetMangledName().AsCString(""));

clayborg wrote:

It does look like `SymbolContext::DumpStopContext` does what we want. Will the 
output fit well into the "breakpoint list --verbose" output? Or will it look 
too different?

I would be fine to just print the inline function name if the output is too 
different. 

FYI: Any `lldb_private::Block` may or may not have inlined function info. You 
can always call:
```
Block *inlined_block = block->GetContainingInlinedBlock();
```
If `block` is an inlined function it will return `block`, else it will get the 
parent block and see if any parent blocks contain inline function info. If it 
returns NULL, then `block` isn't a or contained in an inline block. 

Getting an inline call stack from this information is tricky and is done in 
`SymbolContext::DumpStopContext()` correctly.

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Print mangled names with verbose break list (PR #84071)

2024-03-06 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -524,6 +524,9 @@ void BreakpointLocation::GetDescription(Stream *s,
   s->EOL();
   s->Indent("function = ");
   s->PutCString(sc.function->GetName().AsCString(""));
+  s->EOL();
+  s->Indent("mangled function = ");
+  
s->PutCString(sc.function->GetMangled().GetMangledName().AsCString(""));

felipepiovezan wrote:

We might be able to reuse `bool SymbolContext::DumpStopContext`, this is what 
is the regular `break list` uses

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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP value (PR #84147)

2024-03-06 Thread David Spickett via lldb-commits

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

>From a251b494614a0700f424c2bedebcabd2e053a653 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Wed, 6 Mar 2024 09:08:25 +
Subject: [PATCH 1/2] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP2 value

While adding register fields I realised that the AUXV values
for Linux and FreeBSD disagree here.

So I've added a FreeBSD specific HWCAP2 value that I can
use from FreeBSD specific code.

The alternative is translating GetAuxValue calls depending
on platform, which requires that we know what we are at all
times.

Another way would be to convert the entries' values when
we construct the AuxVector but the platform specific call
that reads the data just returns a raw array. So adding
another layer here is more disruption.
---
 lldb/source/Plugins/Process/Utility/AuxVector.h | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.h 
b/lldb/source/Plugins/Process/Utility/AuxVector.h
index 3b0f55d35e5d11..237c120a426941 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -20,9 +20,13 @@ class AuxVector {
   AuxVector(const lldb_private::DataExtractor );
 
   /// Constants describing the type of entry.
-  /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
+  /// On Linux and FreeBSD, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
   /// information. Added AUXV prefix to avoid potential conflicts with system-
-  /// defined macros
+  /// defined macros. For FreeBSD, the numbers can be found in 
sys/elf_common.h.
+  ///
+  /// Linux and FreeBSD values diverge, so the FreeBSD classes will convert
+  /// some entries to the Linux AT_ value so that LLDB only has to use
+  /// the constants listed here when asking the AuxVector for a value.
   enum EntryType {
 AUXV_AT_NULL = 0,  ///< End of auxv.
 AUXV_AT_IGNORE = 1,///< Ignore entry.
@@ -39,6 +43,11 @@ class AuxVector {
 AUXV_AT_EUID = 12, ///< Effective UID.
 AUXV_AT_GID = 13,  ///< GID.
 AUXV_AT_EGID = 14, ///< Effective GID.
+
+// At this point Linux and FreeBSD diverge and many of the following values
+// are Linux specific. If you use them make sure you are in Linux specific
+// code or they have the same value on other platforms.
+
 AUXV_AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
 AUXV_AT_PLATFORM = 15, ///< String identifying platform.
 AUXV_AT_HWCAP =
@@ -60,6 +69,10 @@ class AuxVector {
 AUXV_AT_L1D_CACHESHAPE = 35,
 AUXV_AT_L2_CACHESHAPE = 36,
 AUXV_AT_L3_CACHESHAPE = 37,
+
+// Platform specific values which may overlap the Linux values.
+
+AUXV_FREEBSD_AT_HWCAP = 25, ///< FreeBSD specific AT_HWCAP value.
   };
 
   std::optional GetAuxValue(enum EntryType entry_type) const;

>From 74f9b8cd1fd68298e1b03f749041256639ce1fef Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Wed, 6 Mar 2024 13:49:17 +
Subject: [PATCH 2/2] Remove comment that referred to previous attempt.

---
 lldb/source/Plugins/Process/Utility/AuxVector.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.h 
b/lldb/source/Plugins/Process/Utility/AuxVector.h
index 237c120a426941..4175cb73b23432 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -23,10 +23,6 @@ class AuxVector {
   /// On Linux and FreeBSD, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
   /// information. Added AUXV prefix to avoid potential conflicts with system-
   /// defined macros. For FreeBSD, the numbers can be found in 
sys/elf_common.h.
-  ///
-  /// Linux and FreeBSD values diverge, so the FreeBSD classes will convert
-  /// some entries to the Linux AT_ value so that LLDB only has to use
-  /// the constants listed here when asking the AuxVector for a value.
   enum EntryType {
 AUXV_AT_NULL = 0,  ///< End of auxv.
 AUXV_AT_IGNORE = 1,///< Ignore entry.

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


[Lldb-commits] [lldb] [lldb] Save the edited line before clearing it in Editline::PrintAsync (PR #84154)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: karzan (karzanWang)


Changes

If the `m_editor_status` is `EditorStatus::Editing`, PrintAsync clears the 
currently edited line. In some situations, the edited line is not saved. After 
the stream flushes, PrintAsync tries to display the unsaved line, causing the 
loss of the edited line.

The issue arose while I was debugging REPRLRun in 
[Fuzzilli](https://github.com/googleprojectzero/fuzzilli). I started LLDB and 
attempted to set a breakpoint in libreprl-posix.c. I entered `breakpoint set -f 
lib` and used the "tab" key for command completion. After completion, the 
edited line was flushed, leaving a blank line.

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


1 Files Affected:

- (modified) lldb/source/Host/common/Editline.cpp (+1) 


``diff
diff --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index e66271e8a6ee99..ed61aecc23b9b0 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -1597,6 +1597,7 @@ bool Editline::GetLines(int first_line_number, StringList 
,
 void Editline::PrintAsync(Stream *stream, const char *s, size_t len) {
   std::lock_guard guard(m_output_mutex);
   if (m_editor_status == EditorStatus::Editing) {
+SaveEditedLine();
 MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart);
 fprintf(m_output_file, ANSI_CLEAR_BELOW);
   }

``




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


[Lldb-commits] [lldb] [lldb] Save the edited line before clearing it in Editline::PrintAsync (PR #84154)

2024-03-06 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/84154
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Save the edited line before clearing it in Editline::PrintAsync (PR #84154)

2024-03-06 Thread via lldb-commits

https://github.com/karzanWang created 
https://github.com/llvm/llvm-project/pull/84154

If the `m_editor_status` is `EditorStatus::Editing`, PrintAsync clears the 
currently edited line. In some situations, the edited line is not saved. After 
the stream flushes, PrintAsync tries to display the unsaved line, causing the 
loss of the edited line.

The issue arose while I was debugging REPRLRun in 
[Fuzzilli](https://github.com/googleprojectzero/fuzzilli). I started LLDB and 
attempted to set a breakpoint in libreprl-posix.c. I entered `breakpoint set -f 
lib` and used the "tab" key for command completion. After completion, the 
edited line was flushed, leaving a blank line.

>From 84634135c0c0b15026568b988632c3e12c96105e Mon Sep 17 00:00:00 2001
From: wanghaiwei 
Date: Wed, 6 Mar 2024 19:17:14 +0800
Subject: [PATCH] [lldb] Save the edited line before clearing it in
 Editline::PrintAsync If the `m_editor_status` is `EditorStatus::Editing`,
 PrintAsync clears the currently edited line. In some situations, the edited
 line is not saved. After the stream flushes, PrintAsync tries to display the
 unsaved line, causing the loss of the edited line.

---
 lldb/source/Host/common/Editline.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index e66271e8a6ee99..ed61aecc23b9b0 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -1597,6 +1597,7 @@ bool Editline::GetLines(int first_line_number, StringList 
,
 void Editline::PrintAsync(Stream *stream, const char *s, size_t len) {
   std::lock_guard guard(m_output_mutex);
   if (m_editor_status == EditorStatus::Editing) {
+SaveEditedLine();
 MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart);
 fprintf(m_output_file, ANSI_CLEAR_BELOW);
   }

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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP value (PR #84147)

2024-03-06 Thread David Spickett via lldb-commits


@@ -39,6 +43,11 @@ class AuxVector {
 AUXV_AT_EUID = 12, ///< Effective UID.
 AUXV_AT_GID = 13,  ///< GID.
 AUXV_AT_EGID = 14, ///< Effective GID.
+
+// At this point Linux and FreeBSD diverge and many of the following values
+// are Linux specific. If you use them make sure you are in Linux specific
+// code or they have the same value on other platforms.

DavidSpickett wrote:

And if anyone knows the appropriate way to write this as a doxygen comment, 
that would be a great help.

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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP value (PR #84147)

2024-03-06 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 982e9022ca4abaad58c693d2b0aba0e908ee2d39 
a251b494614a0700f424c2bedebcabd2e053a653 -- 
lldb/source/Plugins/Process/Utility/AuxVector.h
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.h 
b/lldb/source/Plugins/Process/Utility/AuxVector.h
index 237c120a42..9e489b05ab 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -28,21 +28,21 @@ public:
   /// some entries to the Linux AT_ value so that LLDB only has to use
   /// the constants listed here when asking the AuxVector for a value.
   enum EntryType {
-AUXV_AT_NULL = 0,  ///< End of auxv.
-AUXV_AT_IGNORE = 1,///< Ignore entry.
-AUXV_AT_EXECFD = 2,///< File descriptor of program.
-AUXV_AT_PHDR = 3,  ///< Program headers.
-AUXV_AT_PHENT = 4, ///< Size of program header.
-AUXV_AT_PHNUM = 5, ///< Number of program headers.
-AUXV_AT_PAGESZ = 6,///< Page size.
-AUXV_AT_BASE = 7,  ///< Interpreter base address.
-AUXV_AT_FLAGS = 8, ///< Flags.
-AUXV_AT_ENTRY = 9, ///< Program entry point.
-AUXV_AT_NOTELF = 10,   ///< Set if program is not an ELF.
-AUXV_AT_UID = 11,  ///< UID.
-AUXV_AT_EUID = 12, ///< Effective UID.
-AUXV_AT_GID = 13,  ///< GID.
-AUXV_AT_EGID = 14, ///< Effective GID.
+AUXV_AT_NULL = 0,///< End of auxv.
+AUXV_AT_IGNORE = 1,  ///< Ignore entry.
+AUXV_AT_EXECFD = 2,  ///< File descriptor of program.
+AUXV_AT_PHDR = 3,///< Program headers.
+AUXV_AT_PHENT = 4,   ///< Size of program header.
+AUXV_AT_PHNUM = 5,   ///< Number of program headers.
+AUXV_AT_PAGESZ = 6,  ///< Page size.
+AUXV_AT_BASE = 7,///< Interpreter base address.
+AUXV_AT_FLAGS = 8,   ///< Flags.
+AUXV_AT_ENTRY = 9,   ///< Program entry point.
+AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF.
+AUXV_AT_UID = 11,///< UID.
+AUXV_AT_EUID = 12,   ///< Effective UID.
+AUXV_AT_GID = 13,///< GID.
+AUXV_AT_EGID = 14,   ///< Effective GID.
 
 // At this point Linux and FreeBSD diverge and many of the following values
 // are Linux specific. If you use them make sure you are in Linux specific

``




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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP value (PR #84147)

2024-03-06 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP value (PR #84147)

2024-03-06 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP2 value (PR #84147)

2024-03-06 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Some notes:
1. This looks odd in isolation but I need to correct this to enable register 
fields on FreeBSD, which will be the next PR.
2. clang-format is going to complain about the enum, I will fix push a commit 
to fix that after this one, so that this commit stays readable.

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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP2 value (PR #84147)

2024-03-06 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

While adding register fields I realised that the AUXV values for Linux and 
FreeBSD disagree here.

So I've added a FreeBSD specific HWCAP2 value that I can use from FreeBSD 
specific code.

The alternative is translating GetAuxValue calls depending on platform, which 
requires that we know what we are at all times.

Another way would be to convert the entries' values when we construct the 
AuxVector but the platform specific call that reads the data just returns a raw 
array. So adding another layer here is more disruption.

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


1 Files Affected:

- (modified) lldb/source/Plugins/Process/Utility/AuxVector.h (+15-2) 


``diff
diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.h 
b/lldb/source/Plugins/Process/Utility/AuxVector.h
index 3b0f55d35e5d11..237c120a426941 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -20,9 +20,13 @@ class AuxVector {
   AuxVector(const lldb_private::DataExtractor );
 
   /// Constants describing the type of entry.
-  /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
+  /// On Linux and FreeBSD, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
   /// information. Added AUXV prefix to avoid potential conflicts with system-
-  /// defined macros
+  /// defined macros. For FreeBSD, the numbers can be found in 
sys/elf_common.h.
+  ///
+  /// Linux and FreeBSD values diverge, so the FreeBSD classes will convert
+  /// some entries to the Linux AT_ value so that LLDB only has to use
+  /// the constants listed here when asking the AuxVector for a value.
   enum EntryType {
 AUXV_AT_NULL = 0,  ///< End of auxv.
 AUXV_AT_IGNORE = 1,///< Ignore entry.
@@ -39,6 +43,11 @@ class AuxVector {
 AUXV_AT_EUID = 12, ///< Effective UID.
 AUXV_AT_GID = 13,  ///< GID.
 AUXV_AT_EGID = 14, ///< Effective GID.
+
+// At this point Linux and FreeBSD diverge and many of the following values
+// are Linux specific. If you use them make sure you are in Linux specific
+// code or they have the same value on other platforms.
+
 AUXV_AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
 AUXV_AT_PLATFORM = 15, ///< String identifying platform.
 AUXV_AT_HWCAP =
@@ -60,6 +69,10 @@ class AuxVector {
 AUXV_AT_L1D_CACHESHAPE = 35,
 AUXV_AT_L2_CACHESHAPE = 36,
 AUXV_AT_L3_CACHESHAPE = 37,
+
+// Platform specific values which may overlap the Linux values.
+
+AUXV_FREEBSD_AT_HWCAP = 25, ///< FreeBSD specific AT_HWCAP value.
   };
 
   std::optional GetAuxValue(enum EntryType entry_type) const;

``




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


[Lldb-commits] [lldb] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP2 value (PR #84147)

2024-03-06 Thread David Spickett via lldb-commits

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

While adding register fields I realised that the AUXV values for Linux and 
FreeBSD disagree here.

So I've added a FreeBSD specific HWCAP2 value that I can use from FreeBSD 
specific code.

The alternative is translating GetAuxValue calls depending on platform, which 
requires that we know what we are at all times.

Another way would be to convert the entries' values when we construct the 
AuxVector but the platform specific call that reads the data just returns a raw 
array. So adding another layer here is more disruption.

>From a251b494614a0700f424c2bedebcabd2e053a653 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Wed, 6 Mar 2024 09:08:25 +
Subject: [PATCH] [lldb][FreeBSD] Add FreeBSD specific AT_HWCAP2 value

While adding register fields I realised that the AUXV values
for Linux and FreeBSD disagree here.

So I've added a FreeBSD specific HWCAP2 value that I can
use from FreeBSD specific code.

The alternative is translating GetAuxValue calls depending
on platform, which requires that we know what we are at all
times.

Another way would be to convert the entries' values when
we construct the AuxVector but the platform specific call
that reads the data just returns a raw array. So adding
another layer here is more disruption.
---
 lldb/source/Plugins/Process/Utility/AuxVector.h | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.h 
b/lldb/source/Plugins/Process/Utility/AuxVector.h
index 3b0f55d35e5d11..237c120a426941 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.h
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.h
@@ -20,9 +20,13 @@ class AuxVector {
   AuxVector(const lldb_private::DataExtractor );
 
   /// Constants describing the type of entry.
-  /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
+  /// On Linux and FreeBSD, running "LD_SHOW_AUXV=1 ./executable" will spew AUX
   /// information. Added AUXV prefix to avoid potential conflicts with system-
-  /// defined macros
+  /// defined macros. For FreeBSD, the numbers can be found in 
sys/elf_common.h.
+  ///
+  /// Linux and FreeBSD values diverge, so the FreeBSD classes will convert
+  /// some entries to the Linux AT_ value so that LLDB only has to use
+  /// the constants listed here when asking the AuxVector for a value.
   enum EntryType {
 AUXV_AT_NULL = 0,  ///< End of auxv.
 AUXV_AT_IGNORE = 1,///< Ignore entry.
@@ -39,6 +43,11 @@ class AuxVector {
 AUXV_AT_EUID = 12, ///< Effective UID.
 AUXV_AT_GID = 13,  ///< GID.
 AUXV_AT_EGID = 14, ///< Effective GID.
+
+// At this point Linux and FreeBSD diverge and many of the following values
+// are Linux specific. If you use them make sure you are in Linux specific
+// code or they have the same value on other platforms.
+
 AUXV_AT_CLKTCK = 17,   ///< Clock frequency (e.g. times(2)).
 AUXV_AT_PLATFORM = 15, ///< String identifying platform.
 AUXV_AT_HWCAP =
@@ -60,6 +69,10 @@ class AuxVector {
 AUXV_AT_L1D_CACHESHAPE = 35,
 AUXV_AT_L2_CACHESHAPE = 36,
 AUXV_AT_L3_CACHESHAPE = 37,
+
+// Platform specific values which may overlap the Linux values.
+
+AUXV_FREEBSD_AT_HWCAP = 25, ///< FreeBSD specific AT_HWCAP value.
   };
 
   std::optional GetAuxValue(enum EntryType entry_type) const;

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


[Lldb-commits] [lldb] [lldb] Address mask sbprocess apis and new mask invalid const (PR #83663)

2024-03-06 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] Address mask sbprocess apis and new mask invalid const (PR #83663)

2024-03-06 Thread David Spickett via lldb-commits

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

Still not sure this is the ideal  API but we can't know that until someone (aka 
you :) ) has used it for a bit, so let's get this in.

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