[Lldb-commits] [lldb] [lldb] Use CFPropertyListCreateData in debug server (NFC) (PR #112262)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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

CFPropertyListCreateXMLData has been deprecated since macOS 10.10. Use 
CFPropertyListCreateData instead.

>From 9048d3a65e9478d5b25338bef656f69c2fc65969 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 14 Oct 2024 14:16:58 -0700
Subject: [PATCH] [lldb] Replace CFPropertyListCreateXMLData with
 CFPropertyListCreateData (NFC)

CFPropertyListCreateXMLData has been deprecated since macOS 10.10. Use
CFPropertyListCreateData instead.
---
 lldb/cmake/modules/LLDBConfig.cmake   | 2 --
 lldb/source/Host/CMakeLists.txt   | 3 +++
 lldb/source/Host/macosx/objcxx/CMakeLists.txt | 4 +++-
 lldb/tools/debugserver/source/RNBServices.cpp | 4 ++--
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index a60921990cf775..93ccd9c479c2b8 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -188,7 +188,6 @@ 
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
   # Disable GCC warnings
-  append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS)
   append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
   append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
 
@@ -198,7 +197,6 @@ endif()
 
 # Disable Clang warnings
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  append("-Wno-deprecated-register" CMAKE_CXX_FLAGS)
   append("-Wno-vla-extension" CMAKE_CXX_FLAGS)
 endif()
 
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index c2e091ee8555b7..04090349cdd20c 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -177,3 +177,6 @@ add_lldb_library(lldbHost NO_PLUGIN_DEPENDENCIES
 Support
   )
 
+if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  target_compile_options(lldbHost PRIVATE "-Wno-deprecated-declarations")
+endif()
diff --git a/lldb/source/Host/macosx/objcxx/CMakeLists.txt 
b/lldb/source/Host/macosx/objcxx/CMakeLists.txt
index 273999f24380e5..1e693bed12ce15 100644
--- a/lldb/source/Host/macosx/objcxx/CMakeLists.txt
+++ b/lldb/source/Host/macosx/objcxx/CMakeLists.txt
@@ -16,4 +16,6 @@ add_lldb_library(lldbHostMacOSXObjCXX NO_PLUGIN_DEPENDENCIES
 TargetParser
   )
 
-target_compile_options(lldbHostMacOSXObjCXX PRIVATE -fno-objc-exceptions)
+target_compile_options(lldbHostMacOSXObjCXX PRIVATE
+  -fno-objc-exceptions
+  -Wno-deprecated-declarations)
diff --git a/lldb/tools/debugserver/source/RNBServices.cpp 
b/lldb/tools/debugserver/source/RNBServices.cpp
index 6e4b55e3e6466d..bb57fb5ea027eb 100644
--- a/lldb/tools/debugserver/source/RNBServices.cpp
+++ b/lldb/tools/debugserver/source/RNBServices.cpp
@@ -208,8 +208,8 @@ int ListApplications(std::string &plist, bool 
opt_runningApps,
   GetProcesses(plistMutableArray.get(), all_users);
 #endif
 
-  CFReleaser plistData(
-  ::CFPropertyListCreateXMLData(alloc, plistMutableArray.get()));
+  CFReleaser plistData(::CFPropertyListCreateData(
+  alloc, plistMutableArray.get(), kCFPropertyListXMLFormat_v1_0, 0, NULL));
 
   // write plist to service port
   if (plistData.get() != NULL) {

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


[Lldb-commits] [lldb] [lldb] Use CFPropertyListCreateData in debugserver (NFC) (PR #112262)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Jonas Devlieghere via lldb-commits


@@ -642,26 +652,86 @@ ModuleSP DynamicLoaderDarwin::GetDYLDModule() {
 
 void DynamicLoaderDarwin::ClearDYLDModule() { m_dyld_module_wp.reset(); }
 
+template 
+static std::vector parallel_map(
+llvm::ThreadPoolInterface &threadPool, InputIterator first,
+InputIterator last,
+llvm::function_ref::value_type &)>
+transform) {
+  const auto size = std::distance(first, last);
+  std::vector results(size);
+  if (size > 0) {
+llvm::ThreadPoolTaskGroup taskGroup(threadPool);
+auto it = first;
+for (ssize_t i = 0; i < size; ++i, ++it) {
+  taskGroup.async([&, i, it]() { results[i] = transform(*it); });
+}
+taskGroup.wait();
+  }
+  return results;
+}

JDevlieghere wrote:

Do we really need these `map` helpers? I would imagine you could achieve the 
same thing with something like this:

```
TaskGroup task_group(...);
for (...)
  if (is_parallel)
task_group.async(lambda, args);
  else 
lambda(args);
task_group.wait();
```

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


[Lldb-commits] [lldb] [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (PR #112260)

2024-10-14 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Adrian Prantl via lldb-commits

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

>From 23e1eeafd84d0f14803da52f89723a3ae257dbb8 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Fri, 11 Oct 2024 19:27:37 -0700
Subject: [PATCH] [lldb] Expose structured command diagnostics via the SBAPI.

This allows IDEs to render LLDB expression diagnostics to their liking
without relying on characterprecise ASCII art from LLDB. It is exposed
as a versioned SBStructuredData object, since it is expected that this
may need to be tweaked based on actual usage.
---
 lldb/include/lldb/API/SBCommandReturnObject.h |  1 +
 lldb/include/lldb/API/SBStructuredData.h  |  2 +
 .../lldb/Interpreter/CommandReturnObject.h| 13 ++-
 lldb/source/API/SBCommandReturnObject.cpp | 11 +++
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 .../Commands/CommandObjectExpression.cpp  | 42 +++---
 .../source/Interpreter/CommandInterpreter.cpp | 23 +++--
 .../Interpreter/CommandReturnObject.cpp   | 84 +++
 .../diagnostics/TestExprDiagnostics.py| 81 --
 .../Shell/Commands/Inputs/multiline-expr.txt  |  6 ++
 .../Commands/command-expr-diagnostics.test| 32 +++
 11 files changed, 190 insertions(+), 107 deletions(-)
 create mode 100644 lldb/test/Shell/Commands/Inputs/multiline-expr.txt
 create mode 100644 lldb/test/Shell/Commands/command-expr-diagnostics.test

diff --git a/lldb/include/lldb/API/SBCommandReturnObject.h 
b/lldb/include/lldb/API/SBCommandReturnObject.h
index f96384a4710b16..e8e20a3f3016b8 100644
--- a/lldb/include/lldb/API/SBCommandReturnObject.h
+++ b/lldb/include/lldb/API/SBCommandReturnObject.h
@@ -45,6 +45,7 @@ class LLDB_API SBCommandReturnObject {
   const char *GetOutput();
 
   const char *GetError();
+  SBStructuredData GetErrorData();
 
 #ifndef SWIG
   LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)",
diff --git a/lldb/include/lldb/API/SBStructuredData.h 
b/lldb/include/lldb/API/SBStructuredData.h
index fc6e1ec95c7b86..ccdd12cab94b2f 100644
--- a/lldb/include/lldb/API/SBStructuredData.h
+++ b/lldb/include/lldb/API/SBStructuredData.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_API_SBSTRUCTUREDDATA_H
 #define LLDB_API_SBSTRUCTUREDDATA_H
 
+#include "lldb/API/SBCommandReturnObject.h"
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBModule.h"
 #include "lldb/API/SBScriptObject.h"
@@ -110,6 +111,7 @@ class SBStructuredData {
 
 protected:
   friend class SBAttachInfo;
+  friend class SBCommandReturnObject;
   friend class SBLaunchInfo;
   friend class SBDebugger;
   friend class SBTarget;
diff --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h 
b/lldb/include/lldb/Interpreter/CommandReturnObject.h
index eda841869ba432..a491a6c1535b11 100644
--- a/lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -13,6 +13,7 @@
 #include "lldb/Utility/DiagnosticsRendering.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StreamTee.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/StringRef.h"
@@ -31,7 +32,7 @@ class CommandReturnObject {
   ~CommandReturnObject() = default;
 
   /// Format any inline diagnostics with an indentation of \c indent.
-  llvm::StringRef GetInlineDiagnosticString(unsigned indent);
+  std::string GetInlineDiagnosticString(unsigned indent);
 
   llvm::StringRef GetOutputString() {
 lldb::StreamSP 
stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
@@ -40,7 +41,13 @@ class CommandReturnObject {
 return llvm::StringRef();
   }
 
-  llvm::StringRef GetErrorString();
+  /// Return the errors as a string.
+  ///
+  /// If \c with_diagnostics is true, all diagnostics are also
+  /// rendered into the string. Otherwise the expectation is that they
+  /// are fetched with \ref GetInlineDiagnosticString().
+  std::string GetErrorString(bool with_diagnostics = true);
+  StructuredData::ObjectSP GetErrorData();
 
   Stream &GetOutputStream() {
 // Make sure we at least have our normal string stream output stream
@@ -168,7 +175,6 @@ class CommandReturnObject {
   StreamTee m_out_stream;
   StreamTee m_err_stream;
   std::vector m_diagnostics;
-  StreamString m_diag_stream;
   std::optional m_diagnostic_indent;
 
   lldb::ReturnStatus m_status = lldb::eReturnStatusStarted;
@@ -178,6 +184,7 @@ class CommandReturnObject {
 
   /// If true, then the input handle from the debugger will be hooked up.
   bool m_interactive = true;
+  bool m_colors;
 };
 
 } // namespace lldb_private
diff --git a/lldb/source/API/SBCommandReturnObject.cpp 
b/lldb/source/API/SBCommandReturnObject.cpp
index a94eff75ffcb9e..9df8aa48b99366 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -11,6 +11,8 @@
 #include "lldb/API/SBError.h"
 #include "lldb/API/SBFile.h"
 #include "lldb/API/SBStream.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/Core/Struct

[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] 9eddc8b - [lldb] Expose structured command diagnostics via the SBAPI. (#112109)

2024-10-14 Thread via lldb-commits

Author: Adrian Prantl
Date: 2024-10-14T16:29:26-07:00
New Revision: 9eddc8b9bf4e4e0b01e2ecc90a71c4b3b4e9c8af

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

LOG: [lldb] Expose structured command diagnostics via the SBAPI. (#112109)

This allows IDEs to render LLDB expression diagnostics to their liking
without relying on characterprecise ASCII art from LLDB. It is exposed
as a versioned SBStructuredData object, since it is expected that this
may need to be tweaked based on actual usage.

Added: 
lldb/test/Shell/Commands/Inputs/multiline-expr.txt
lldb/test/Shell/Commands/command-expr-diagnostics.test

Modified: 
lldb/include/lldb/API/SBCommandReturnObject.h
lldb/include/lldb/API/SBStructuredData.h
lldb/include/lldb/Interpreter/CommandReturnObject.h
lldb/source/API/SBCommandReturnObject.cpp
lldb/source/Commands/CommandObjectDWIMPrint.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py

Removed: 




diff  --git a/lldb/include/lldb/API/SBCommandReturnObject.h 
b/lldb/include/lldb/API/SBCommandReturnObject.h
index f96384a4710b16..e8e20a3f3016b8 100644
--- a/lldb/include/lldb/API/SBCommandReturnObject.h
+++ b/lldb/include/lldb/API/SBCommandReturnObject.h
@@ -45,6 +45,7 @@ class LLDB_API SBCommandReturnObject {
   const char *GetOutput();
 
   const char *GetError();
+  SBStructuredData GetErrorData();
 
 #ifndef SWIG
   LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)",

diff  --git a/lldb/include/lldb/API/SBStructuredData.h 
b/lldb/include/lldb/API/SBStructuredData.h
index fc6e1ec95c7b86..ccdd12cab94b2f 100644
--- a/lldb/include/lldb/API/SBStructuredData.h
+++ b/lldb/include/lldb/API/SBStructuredData.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_API_SBSTRUCTUREDDATA_H
 #define LLDB_API_SBSTRUCTUREDDATA_H
 
+#include "lldb/API/SBCommandReturnObject.h"
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBModule.h"
 #include "lldb/API/SBScriptObject.h"
@@ -110,6 +111,7 @@ class SBStructuredData {
 
 protected:
   friend class SBAttachInfo;
+  friend class SBCommandReturnObject;
   friend class SBLaunchInfo;
   friend class SBDebugger;
   friend class SBTarget;

diff  --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h 
b/lldb/include/lldb/Interpreter/CommandReturnObject.h
index eda841869ba432..a491a6c1535b11 100644
--- a/lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -13,6 +13,7 @@
 #include "lldb/Utility/DiagnosticsRendering.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StreamTee.h"
+#include "lldb/Utility/StructuredData.h"
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/StringRef.h"
@@ -31,7 +32,7 @@ class CommandReturnObject {
   ~CommandReturnObject() = default;
 
   /// Format any inline diagnostics with an indentation of \c indent.
-  llvm::StringRef GetInlineDiagnosticString(unsigned indent);
+  std::string GetInlineDiagnosticString(unsigned indent);
 
   llvm::StringRef GetOutputString() {
 lldb::StreamSP 
stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
@@ -40,7 +41,13 @@ class CommandReturnObject {
 return llvm::StringRef();
   }
 
-  llvm::StringRef GetErrorString();
+  /// Return the errors as a string.
+  ///
+  /// If \c with_diagnostics is true, all diagnostics are also
+  /// rendered into the string. Otherwise the expectation is that they
+  /// are fetched with \ref GetInlineDiagnosticString().
+  std::string GetErrorString(bool with_diagnostics = true);
+  StructuredData::ObjectSP GetErrorData();
 
   Stream &GetOutputStream() {
 // Make sure we at least have our normal string stream output stream
@@ -168,7 +175,6 @@ class CommandReturnObject {
   StreamTee m_out_stream;
   StreamTee m_err_stream;
   std::vector m_diagnostics;
-  StreamString m_diag_stream;
   std::optional m_diagnostic_indent;
 
   lldb::ReturnStatus m_status = lldb::eReturnStatusStarted;
@@ -178,6 +184,7 @@ class CommandReturnObject {
 
   /// If true, then the input handle from the debugger will be hooked up.
   bool m_interactive = true;
+  bool m_colors;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/source/API/SBCommandReturnObject.cpp 
b/lldb/source/API/SBCommandReturnObject.cpp
index a94eff75ffcb9e..9df8aa48b99366 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -11,6 +11,8 @@
 #include "lldb/API/SBError.h"
 #include "lldb/API/SBFile.h"
 #include "lldb/API/SBStream.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/Core/StructuredDataImpl.h"
 #include "lldb/Interpreter/CommandReturnObject.h"

[Lldb-commits] [lldb] [lldb][test] Remove objcopy detection from API tests' CMakeLists.txt (PR #111977)

2024-10-14 Thread Vladimir Vereschaka via lldb-commits

vvereschaka wrote:

@dzhidzhoev is sick. I'll merge this MR for him.

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


[Lldb-commits] [lldb] 1cb8314 - [lldb][test] Remove objcopy detection from API tests' CMakeLists.txt (#111977)

2024-10-14 Thread via lldb-commits

Author: Vladislav Dzhidzhoev
Date: 2024-10-14T17:35:55-07:00
New Revision: 1cb83147801a4b4bac193e1aa94a05853ab09c68

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

LOG: [lldb][test] Remove objcopy detection from API tests' CMakeLists.txt 
(#111977)

This commit essentially reverts https://reviews.llvm.org/D30453.

In #109961, objcopy util search code was added to dotest.py. dotest.py
should use llvm-X by default if no path to a utility X is provided
externally.

However, it doesn't work out for llvm-objcopy, since objcopy path is
always overridden with the lines being removed here. It causes a problem
with cross-platform testing when objcopy used by cmake doesn't support
targets/executable file formats other than native.

I suppose these lines are unnecessary after #109961, so they can be
safely removed.

Added: 


Modified: 
lldb/test/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 896ce2c8c27724..2548cab5cfb5b8 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -96,14 +96,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
   endif()
 endif()
 
-if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
-  list(APPEND LLDB_TEST_COMMON_ARGS_VAR
---env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
-else()
-  list(APPEND LLDB_TEST_COMMON_ARGS_VAR
---env 
OBJCOPY=${LLVM_TOOLS_BINARY_DIR}/llvm-objcopy${CMAKE_EXECUTABLE_SUFFIX})
-endif()
-
 if (NOT "${LLDB_LIT_TOOLS_DIR}" STREQUAL "")
   if (NOT EXISTS "${LLDB_LIT_TOOLS_DIR}")
 message(WARNING "LLDB_LIT_TOOLS_DIR ${LLDB_LIT_TOOLS_DIR} does not exist.")



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


[Lldb-commits] [lldb] [lldb][test] Remove objcopy detection from API tests' CMakeLists.txt (PR #111977)

2024-10-14 Thread Vladimir Vereschaka via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Use CFPropertyListCreateData in debugserver (NFC) (PR #112262)

2024-10-14 Thread Jason Molenda via lldb-commits

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

LGTM, honestly i'm not sure we even use `ListApplications` in debugserver any 
longer, but this looks correct.

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

@DmT021 I will, can you edit the Description in this PR for the commit message 
that will be recorded?

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


[Lldb-commits] [lldb] 9cc6e6f - [lldb] Use CFPropertyListCreateData in debugserver (NFC) (#112262)

2024-10-14 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-14T14:30:32-07:00
New Revision: 9cc6e6f71c117c3c47f3eee253c8a429118c11e5

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

LOG: [lldb] Use CFPropertyListCreateData in debugserver (NFC) (#112262)

CFPropertyListCreateXMLData has been deprecated since macOS 10.10. Use
CFPropertyListCreateData instead.

Added: 


Modified: 
lldb/tools/debugserver/source/RNBServices.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBServices.cpp 
b/lldb/tools/debugserver/source/RNBServices.cpp
index 6e4b55e3e6466d..bb57fb5ea027eb 100644
--- a/lldb/tools/debugserver/source/RNBServices.cpp
+++ b/lldb/tools/debugserver/source/RNBServices.cpp
@@ -208,8 +208,8 @@ int ListApplications(std::string &plist, bool 
opt_runningApps,
   GetProcesses(plistMutableArray.get(), all_users);
 #endif
 
-  CFReleaser plistData(
-  ::CFPropertyListCreateXMLData(alloc, plistMutableArray.get()));
+  CFReleaser plistData(::CFPropertyListCreateData(
+  alloc, plistMutableArray.get(), kCFPropertyListXMLFormat_v1_0, 0, NULL));
 
   // write plist to service port
   if (plistData.get() != NULL) {



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


[Lldb-commits] [lldb] [lldb] Use CFPropertyListCreateData in debugserver (NFC) (PR #112262)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Jonas Devlieghere via lldb-commits


@@ -642,26 +652,86 @@ ModuleSP DynamicLoaderDarwin::GetDYLDModule() {
 
 void DynamicLoaderDarwin::ClearDYLDModule() { m_dyld_module_wp.reset(); }
 
+template 
+static std::vector parallel_map(
+llvm::ThreadPoolInterface &threadPool, InputIterator first,
+InputIterator last,
+llvm::function_ref::value_type &)>
+transform) {
+  const auto size = std::distance(first, last);
+  std::vector results(size);
+  if (size > 0) {
+llvm::ThreadPoolTaskGroup taskGroup(threadPool);
+auto it = first;
+for (ssize_t i = 0; i < size; ++i, ++it) {
+  taskGroup.async([&, i, it]() { results[i] = transform(*it); });
+}
+taskGroup.wait();
+  }
+  return results;
+}

JDevlieghere wrote:

I personally think the new code, even with the little bit of code duplication, 
reads a lot easier than the templated signature of the `(parallel_)map` 
functions. I personally wouldn't bother with the `size > 0` check (I expect 
that creating an empty task group and waiting on an empty task group is 
essentially free). Anyway, I don't feel super strongly about it, so go with 
whatever you think is best. 

FWIW I don't expect us to ever migrate this code to `std::transform` because we 
definitely want to limit the parallelism by using the debugger's thread pool. 

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Dmitrii Galimzianov via lldb-commits

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Dmitrii Galimzianov via lldb-commits

DmT021 wrote:

@jasonmolenda All the tests are green but I don't have the merge button. Can 
you merge it, please?

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


[Lldb-commits] [lldb] [lldb] Escape ? for zsh (PR #112107)

2024-10-14 Thread Keith Smiley via lldb-commits

keith wrote:

Oh yea great point. I guess another way to put that is if I copy the exact same 
invocation and run it directly it works, so that differing is unexpected. 

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Vy Nguyen via lldb-commits

oontvoo wrote:

Can I merge this? Or would anyone else like to have another look/comments? 
Thanks!

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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Liu An via lldb-commits

https://github.com/lawn123 created 
https://github.com/llvm/llvm-project/pull/112296

When using the lldb command 'target create -- core' on the LoongArch64 
architecture, this part of the code is required.

>From ba485de763a08f6ff3c7468c1a1bfbbfb25ac48f Mon Sep 17 00:00:00 2001
From: Liu An 
Date: Tue, 15 Oct 2024 10:31:35 +0800
Subject: [PATCH] [LoongArch64]: Add support for LoongArch64 in elf-core for
 lldb

---
 .../Plugins/Process/elf-core/CMakeLists.txt   |  1 +
 .../RegisterContextPOSIXCore_loongarch64.cpp  | 87 +++
 .../RegisterContextPOSIXCore_loongarch64.h| 62 +
 .../Process/elf-core/ThreadElfCore.cpp|  6 ++
 4 files changed, 156 insertions(+)
 create mode 100644 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
 create mode 100644 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h

diff --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt 
b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
index 72925c835b5c89..7473fa8d41ccb3 100644
--- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
@@ -10,6 +10,7 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN
   RegisterContextPOSIXCore_s390x.cpp
   RegisterContextPOSIXCore_x86_64.cpp
   RegisterContextPOSIXCore_riscv64.cpp
+  RegisterContextPOSIXCore_loongarch64.cpp
   RegisterUtilities.cpp
 
   LINK_LIBS
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
new file mode 100644
index 00..af192ecbe01e1b
--- /dev/null
+++ 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
@@ -0,0 +1,87 @@
+//===-- RegisterContextPOSIXCore_loongarch64.cpp
+//--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RegisterContextPOSIXCore_loongarch64.h"
+
+#include "lldb/Utility/DataBufferHeap.h"
+
+using namespace lldb_private;
+
+std::unique_ptr
+RegisterContextCorePOSIX_loongarch64::Create(Thread &thread,
+ const ArchSpec &arch,
+ const DataExtractor &gpregset,
+ llvm::ArrayRef notes) {
+  return std::unique_ptr(
+  new RegisterContextCorePOSIX_loongarch64(
+  thread,
+  std::make_unique(arch, Flags()),
+  gpregset, notes));
+}
+
+RegisterContextCorePOSIX_loongarch64::RegisterContextCorePOSIX_loongarch64(
+Thread &thread,
+std::unique_ptr register_info,
+const DataExtractor &gpregset, llvm::ArrayRef notes)
+: RegisterContextPOSIX_loongarch64(thread, std::move(register_info)) {
+
+  m_gpr_buffer = std::make_shared(gpregset.GetDataStart(),
+  gpregset.GetByteSize());
+  m_gpr.SetData(m_gpr_buffer);
+  m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  ArchSpec arch = m_register_info_up->GetTargetArchitecture();
+  DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
+  m_fpr_buffer = std::make_shared(fpregset.GetDataStart(),
+  fpregset.GetByteSize());
+  m_fpr.SetData(m_fpr_buffer);
+  m_fpr.SetByteOrder(fpregset.GetByteOrder());
+}
+
+RegisterContextCorePOSIX_loongarch64::~RegisterContextCorePOSIX_loongarch64() =
+default;
+
+bool RegisterContextCorePOSIX_loongarch64::ReadGPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::ReadFPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::WriteGPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteFPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::ReadRegister(
+const RegisterInfo *reg_info, RegisterValue &value) {
+  const uint8_t *src = nullptr;
+  lldb::offset_t offset = reg_info->byte_offset;
+
+  if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+src = m_gpr.GetDataStart();
+  } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+src = m_fpr.GetDataStart();
+offset -= GetGPRSize();
+  } else {
+return false;
+  }
+
+  Status error;
+  value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
+  lldb::eByteOrderLittle, error);
+  return error.Success();
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteRegister(
+const RegisterInfo *reg_info, const RegisterValue &value) {
+  return false;
+}
diff --git 
a/lldb/source/Plugins/Process/elf-c

[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Liu An (lawn123)


Changes

When using the lldb command 'target create -- core' on the LoongArch64 
architecture, this part of the code is required.

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


4 Files Affected:

- (modified) lldb/source/Plugins/Process/elf-core/CMakeLists.txt (+1) 
- (added) 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp 
(+87) 
- (added) 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h 
(+62) 
- (modified) lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp (+6) 


``diff
diff --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt 
b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
index 72925c835b5c89..7473fa8d41ccb3 100644
--- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
@@ -10,6 +10,7 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN
   RegisterContextPOSIXCore_s390x.cpp
   RegisterContextPOSIXCore_x86_64.cpp
   RegisterContextPOSIXCore_riscv64.cpp
+  RegisterContextPOSIXCore_loongarch64.cpp
   RegisterUtilities.cpp
 
   LINK_LIBS
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
new file mode 100644
index 00..af192ecbe01e1b
--- /dev/null
+++ 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
@@ -0,0 +1,87 @@
+//===-- RegisterContextPOSIXCore_loongarch64.cpp
+//--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RegisterContextPOSIXCore_loongarch64.h"
+
+#include "lldb/Utility/DataBufferHeap.h"
+
+using namespace lldb_private;
+
+std::unique_ptr
+RegisterContextCorePOSIX_loongarch64::Create(Thread &thread,
+ const ArchSpec &arch,
+ const DataExtractor &gpregset,
+ llvm::ArrayRef notes) {
+  return std::unique_ptr(
+  new RegisterContextCorePOSIX_loongarch64(
+  thread,
+  std::make_unique(arch, Flags()),
+  gpregset, notes));
+}
+
+RegisterContextCorePOSIX_loongarch64::RegisterContextCorePOSIX_loongarch64(
+Thread &thread,
+std::unique_ptr register_info,
+const DataExtractor &gpregset, llvm::ArrayRef notes)
+: RegisterContextPOSIX_loongarch64(thread, std::move(register_info)) {
+
+  m_gpr_buffer = std::make_shared(gpregset.GetDataStart(),
+  gpregset.GetByteSize());
+  m_gpr.SetData(m_gpr_buffer);
+  m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  ArchSpec arch = m_register_info_up->GetTargetArchitecture();
+  DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
+  m_fpr_buffer = std::make_shared(fpregset.GetDataStart(),
+  fpregset.GetByteSize());
+  m_fpr.SetData(m_fpr_buffer);
+  m_fpr.SetByteOrder(fpregset.GetByteOrder());
+}
+
+RegisterContextCorePOSIX_loongarch64::~RegisterContextCorePOSIX_loongarch64() =
+default;
+
+bool RegisterContextCorePOSIX_loongarch64::ReadGPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::ReadFPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::WriteGPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteFPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::ReadRegister(
+const RegisterInfo *reg_info, RegisterValue &value) {
+  const uint8_t *src = nullptr;
+  lldb::offset_t offset = reg_info->byte_offset;
+
+  if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+src = m_gpr.GetDataStart();
+  } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+src = m_fpr.GetDataStart();
+offset -= GetGPRSize();
+  } else {
+return false;
+  }
+
+  Status error;
+  value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
+  lldb::eByteOrderLittle, error);
+  return error.Success();
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteRegister(
+const RegisterInfo *reg_info, const RegisterValue &value) {
+  return false;
+}
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h
new file mode 100644
index 00..44ee44badc5961
--- /dev/null
+++ 
b/lldb/source/Plugins/Process/elf-core/RegisterConte

[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Liu An via lldb-commits

lawn123 wrote:

@shushanhf

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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Qiao Pengcheng via lldb-commits

shushanhf wrote:

> @shushanhf

@SixWeining 

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


[Lldb-commits] [clang] [lldb] [llvm] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-10-14 Thread David Green via lldb-commits


@@ -1159,7 +1159,9 @@ class ARMOperand : public MCParsedAsmOperand {
 if (!isImm()) return false;
 const MCConstantExpr *CE = dyn_cast(getImm());
 if (!CE) return false;

davemgreen wrote:

Can this check that CE->getActiveBits() > 32?

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


[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #112315)

2024-10-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


1 Files Affected:

- (modified) lldb/source/Commands/CommandObjectMultiword.cpp (+1-10) 


``diff
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp 
b/lldb/source/Commands/CommandObjectMultiword.cpp
index 4efa5652a71703..8e9f91c64140ea 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -84,16 +84,7 @@ bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef 
name,
 lldbassert((&GetCommandInterpreter() == 
&cmd_obj_sp->GetCommandInterpreter()) &&
"tried to add a CommandObject from a different interpreter");
 
-  CommandMap::iterator pos;
-  bool success = true;
-
-  pos = m_subcommand_dict.find(std::string(name));
-  if (pos == m_subcommand_dict.end()) {
-m_subcommand_dict[std::string(name)] = cmd_obj_sp;
-  } else
-success = false;
-
-  return success;
+  return m_subcommand_dict.try_emplace(std::string(name), cmd_obj_sp).second;
 }
 
 llvm::Error CommandObjectMultiword::LoadUserSubcommand(

``




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


[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #112315)

2024-10-14 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/112315

None

>From 70d0a4b3ce6445dd182225df09aecf450b4073ec Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Mon, 14 Oct 2024 23:11:09 -0700
Subject: [PATCH] [lldb] Avoid repeated map lookups (NFC)

---
 lldb/source/Commands/CommandObjectMultiword.cpp | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp 
b/lldb/source/Commands/CommandObjectMultiword.cpp
index 4efa5652a71703..8e9f91c64140ea 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -84,16 +84,7 @@ bool CommandObjectMultiword::LoadSubCommand(llvm::StringRef 
name,
 lldbassert((&GetCommandInterpreter() == 
&cmd_obj_sp->GetCommandInterpreter()) &&
"tried to add a CommandObject from a different interpreter");
 
-  CommandMap::iterator pos;
-  bool success = true;
-
-  pos = m_subcommand_dict.find(std::string(name));
-  if (pos == m_subcommand_dict.end()) {
-m_subcommand_dict[std::string(name)] = cmd_obj_sp;
-  } else
-success = false;
-
-  return success;
+  return m_subcommand_dict.try_emplace(std::string(name), cmd_obj_sp).second;
 }
 
 llvm::Error CommandObjectMultiword::LoadUserSubcommand(

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


[Lldb-commits] [lldb] [lldb] Use CFPropertyListCreateData in debugserver (NFC) (PR #112262)

2024-10-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

CFPropertyListCreateXMLData has been deprecated since macOS 10.10. Use 
CFPropertyListCreateData instead.

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


4 Files Affected:

- (modified) lldb/cmake/modules/LLDBConfig.cmake (-2) 
- (modified) lldb/source/Host/CMakeLists.txt (+3) 
- (modified) lldb/source/Host/macosx/objcxx/CMakeLists.txt (+3-1) 
- (modified) lldb/tools/debugserver/source/RNBServices.cpp (+2-2) 


``diff
diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index a60921990cf775..93ccd9c479c2b8 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -188,7 +188,6 @@ 
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
   # Disable GCC warnings
-  append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS)
   append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
   append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
 
@@ -198,7 +197,6 @@ endif()
 
 # Disable Clang warnings
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  append("-Wno-deprecated-register" CMAKE_CXX_FLAGS)
   append("-Wno-vla-extension" CMAKE_CXX_FLAGS)
 endif()
 
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index c2e091ee8555b7..04090349cdd20c 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -177,3 +177,6 @@ add_lldb_library(lldbHost NO_PLUGIN_DEPENDENCIES
 Support
   )
 
+if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  target_compile_options(lldbHost PRIVATE "-Wno-deprecated-declarations")
+endif()
diff --git a/lldb/source/Host/macosx/objcxx/CMakeLists.txt 
b/lldb/source/Host/macosx/objcxx/CMakeLists.txt
index 273999f24380e5..1e693bed12ce15 100644
--- a/lldb/source/Host/macosx/objcxx/CMakeLists.txt
+++ b/lldb/source/Host/macosx/objcxx/CMakeLists.txt
@@ -16,4 +16,6 @@ add_lldb_library(lldbHostMacOSXObjCXX NO_PLUGIN_DEPENDENCIES
 TargetParser
   )
 
-target_compile_options(lldbHostMacOSXObjCXX PRIVATE -fno-objc-exceptions)
+target_compile_options(lldbHostMacOSXObjCXX PRIVATE
+  -fno-objc-exceptions
+  -Wno-deprecated-declarations)
diff --git a/lldb/tools/debugserver/source/RNBServices.cpp 
b/lldb/tools/debugserver/source/RNBServices.cpp
index 6e4b55e3e6466d..bb57fb5ea027eb 100644
--- a/lldb/tools/debugserver/source/RNBServices.cpp
+++ b/lldb/tools/debugserver/source/RNBServices.cpp
@@ -208,8 +208,8 @@ int ListApplications(std::string &plist, bool 
opt_runningApps,
   GetProcesses(plistMutableArray.get(), all_users);
 #endif
 
-  CFReleaser plistData(
-  ::CFPropertyListCreateXMLData(alloc, plistMutableArray.get()));
+  CFReleaser plistData(::CFPropertyListCreateData(
+  alloc, plistMutableArray.get(), kCFPropertyListXMLFormat_v1_0, 0, NULL));
 
   // write plist to service port
   if (plistData.get() != NULL) {

``




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


[Lldb-commits] [lldb] [lldb] Use CFPropertyListCreateData in debugserver (NFC) (PR #112262)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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

>From 325d131bd24947a9be1f50a22ca9600c19c8dc84 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 14 Oct 2024 14:19:24 -0700
Subject: [PATCH] [lldb] Use CFPropertyListCreateData in debugserver (NFC)

CFPropertyListCreateXMLData has been deprecated since macOS 10.10. Use
CFPropertyListCreateData instead.
---
 lldb/tools/debugserver/source/RNBServices.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/tools/debugserver/source/RNBServices.cpp 
b/lldb/tools/debugserver/source/RNBServices.cpp
index 6e4b55e3e6466d..bb57fb5ea027eb 100644
--- a/lldb/tools/debugserver/source/RNBServices.cpp
+++ b/lldb/tools/debugserver/source/RNBServices.cpp
@@ -208,8 +208,8 @@ int ListApplications(std::string &plist, bool 
opt_runningApps,
   GetProcesses(plistMutableArray.get(), all_users);
 #endif
 
-  CFReleaser plistData(
-  ::CFPropertyListCreateXMLData(alloc, plistMutableArray.get()));
+  CFReleaser plistData(::CFPropertyListCreateData(
+  alloc, plistMutableArray.get(), kCFPropertyListXMLFormat_v1_0, 0, NULL));
 
   // write plist to service port
   if (plistData.get() != NULL) {

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


[Lldb-commits] [lldb] [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (PR #112260)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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

Remove support for ASL (Apple System Log) which has been deprecated since macOS 
10.12. Fixes the following warnings:

  warning: 'asl_new' is deprecated: first deprecated in macOS 10.12 - os_log(3) 
has replaced asl(3)
  warning: 'asl_set' is deprecated: first deprecated in macOS 10.12 - os_log(3) 
has replaced asl(3)
  warning: 'asl_vlog' is deprecated: first deprecated in macOS 10.12 - 
os_log(3) has replaced asl(3)

>From 2505d355116b8f35e9a377440cfb139d654ef892 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 14 Oct 2024 13:56:40 -0700
Subject: [PATCH] [lldb] Remove ASL (Apple System Log) support from debugserver
 (NFC)

Remove support for ASL (Apple System Log) which has been deprecated
since macOS 10.12. Fixes the following warnings:

  warning: 'asl_new' is deprecated: first deprecated in macOS 10.12 - os_log(3) 
has replaced asl(3)
  warning: 'asl_set' is deprecated: first deprecated in macOS 10.12 - os_log(3) 
has replaced asl(3)
  warning: 'asl_vlog' is deprecated: first deprecated in macOS 10.12 - 
os_log(3) has replaced asl(3)
---
 lldb/tools/debugserver/source/debugserver.cpp | 39 +--
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/lldb/tools/debugserver/source/debugserver.cpp 
b/lldb/tools/debugserver/source/debugserver.cpp
index cfc9646ed2d081..f41a9e00ec9481 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -759,35 +759,6 @@ static int ConnectRemote(RNBRemote *remote, const char 
*host, int port,
   return 1;
 }
 
-// ASL Logging callback that can be registered with DNBLogSetLogCallback
-void ASLLogCallback(void *baton, uint32_t flags, const char *format,
-va_list args) {
-  if (format == NULL)
-return;
-  static aslmsg g_aslmsg = NULL;
-  if (g_aslmsg == NULL) {
-g_aslmsg = ::asl_new(ASL_TYPE_MSG);
-char asl_key_sender[PATH_MAX];
-snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.%s-%s",
- DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR);
-::asl_set(g_aslmsg, ASL_KEY_SENDER, asl_key_sender);
-  }
-
-  int asl_level;
-  if (flags & DNBLOG_FLAG_FATAL)
-asl_level = ASL_LEVEL_CRIT;
-  else if (flags & DNBLOG_FLAG_ERROR)
-asl_level = ASL_LEVEL_ERR;
-  else if (flags & DNBLOG_FLAG_WARNING)
-asl_level = ASL_LEVEL_WARNING;
-  else if (flags & DNBLOG_FLAG_VERBOSE)
-asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_INFO;
-  else
-asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_DEBUG;
-
-  ::asl_vlog(NULL, g_aslmsg, asl_level, format, args);
-}
-
 // FILE based Logging callback that can be registered with
 // DNBLogSetLogCallback
 void FileLogCallback(void *baton, uint32_t flags, const char *format,
@@ -948,16 +919,8 @@ int main(int argc, char *argv[]) {
   // Set up DNB logging by default. If the user passes different log flags or a
   // log file, these settings will be modified after processing the command 
line
   // arguments.
-  auto log_callback = OsLogger::GetLogFunction();
-  if (log_callback) {
-// if os_log() support is available, log through that.
+  if (auto log_callback = OsLogger::GetLogFunction())
 DNBLogSetLogCallback(log_callback, nullptr);
-DNBLog("debugserver will use os_log for internal logging.");
-  } else {
-// Fall back to ASL support.
-DNBLogSetLogCallback(ASLLogCallback, nullptr);
-DNBLog("debugserver will use ASL for internal logging.");
-  }
   DNBLogSetLogMask(/*log_flags*/ 0);
 
   g_remoteSP = std::make_shared();

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


[Lldb-commits] [lldb] [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (PR #112260)

2024-10-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Remove support for ASL (Apple System Log) which has been deprecated since macOS 
10.12. Fixes the following warnings:

  warning: 'asl_new' is deprecated: first deprecated in macOS 10.12 - os_log(3) 
has replaced asl(3)
  warning: 'asl_set' is deprecated: first deprecated in macOS 10.12 - os_log(3) 
has replaced asl(3)
  warning: 'asl_vlog' is deprecated: first deprecated in macOS 10.12 - 
os_log(3) has replaced asl(3)

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


1 Files Affected:

- (modified) lldb/tools/debugserver/source/debugserver.cpp (+1-38) 


``diff
diff --git a/lldb/tools/debugserver/source/debugserver.cpp 
b/lldb/tools/debugserver/source/debugserver.cpp
index cfc9646ed2d081..f41a9e00ec9481 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -759,35 +759,6 @@ static int ConnectRemote(RNBRemote *remote, const char 
*host, int port,
   return 1;
 }
 
-// ASL Logging callback that can be registered with DNBLogSetLogCallback
-void ASLLogCallback(void *baton, uint32_t flags, const char *format,
-va_list args) {
-  if (format == NULL)
-return;
-  static aslmsg g_aslmsg = NULL;
-  if (g_aslmsg == NULL) {
-g_aslmsg = ::asl_new(ASL_TYPE_MSG);
-char asl_key_sender[PATH_MAX];
-snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.%s-%s",
- DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR);
-::asl_set(g_aslmsg, ASL_KEY_SENDER, asl_key_sender);
-  }
-
-  int asl_level;
-  if (flags & DNBLOG_FLAG_FATAL)
-asl_level = ASL_LEVEL_CRIT;
-  else if (flags & DNBLOG_FLAG_ERROR)
-asl_level = ASL_LEVEL_ERR;
-  else if (flags & DNBLOG_FLAG_WARNING)
-asl_level = ASL_LEVEL_WARNING;
-  else if (flags & DNBLOG_FLAG_VERBOSE)
-asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_INFO;
-  else
-asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_DEBUG;
-
-  ::asl_vlog(NULL, g_aslmsg, asl_level, format, args);
-}
-
 // FILE based Logging callback that can be registered with
 // DNBLogSetLogCallback
 void FileLogCallback(void *baton, uint32_t flags, const char *format,
@@ -948,16 +919,8 @@ int main(int argc, char *argv[]) {
   // Set up DNB logging by default. If the user passes different log flags or a
   // log file, these settings will be modified after processing the command 
line
   // arguments.
-  auto log_callback = OsLogger::GetLogFunction();
-  if (log_callback) {
-// if os_log() support is available, log through that.
+  if (auto log_callback = OsLogger::GetLogFunction())
 DNBLogSetLogCallback(log_callback, nullptr);
-DNBLog("debugserver will use os_log for internal logging.");
-  } else {
-// Fall back to ASL support.
-DNBLogSetLogCallback(ASLLogCallback, nullptr);
-DNBLog("debugserver will use ASL for internal logging.");
-  }
   DNBLogSetLogMask(/*log_flags*/ 0);
 
   g_remoteSP = std::make_shared();

``




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


[Lldb-commits] [lldb] [lldb] Avoid repeated hash lookups (NFC) (PR #112301)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Lu Weining via lldb-commits


@@ -0,0 +1,62 @@
+//===-- RegisterContextPOSIXCore_loongarch64.h --*- C++
+//-*-===//

SixWeining wrote:

ditto

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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Lu Weining via lldb-commits


@@ -0,0 +1,87 @@
+//===-- RegisterContextPOSIXCore_loongarch64.cpp
+//--===//

SixWeining wrote:

format

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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Lu Weining via lldb-commits

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


[Lldb-commits] [lldb] [LoongArch64]: Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-14 Thread Lu Weining via lldb-commits

https://github.com/SixWeining commented:

@wangleiat may take a look.

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


[Lldb-commits] [lldb] [lldb] Improve unwinding for discontinuous functions (PR #111409)

2024-10-14 Thread Shubham Sandeep Rastogi via lldb-commits

rastogishubham wrote:

Hi this patch broke Unwind/trap_frame_sym_ctx.test in greendragon, you can see 
the link to the failing build here: 
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/6724/consoleFull#-1880437047d6fdb6cb-f376-4f2e-8bce-d31c7304698b

I will be reverting this change to make sure green dragon is up and running 
again

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


[Lldb-commits] [lldb] [LLDB][SBSaveCore] Add Extension to Save a thread and N pointers deep (PR #111601)

2024-10-14 Thread Jacob Lalonde via lldb-commits

https://github.com/Jlalond updated 
https://github.com/llvm/llvm-project/pull/111601

>From 2d693e8208ea99fc57b1137668ee0e12777ab767 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Tue, 8 Oct 2024 15:52:45 -0700
Subject: [PATCH 1/7] Create new extension for save core to save a thread and N
 pointers deep

---
 .../interface/SBSaveCoreOptionsExtensions.i   | 31 +++
 lldb/bindings/interfaces.swig |  1 +
 .../TestProcessSaveCoreMinidump.py| 22 +
 3 files changed, 54 insertions(+)
 create mode 100644 lldb/bindings/interface/SBSaveCoreOptionsExtensions.i

diff --git a/lldb/bindings/interface/SBSaveCoreOptionsExtensions.i 
b/lldb/bindings/interface/SBSaveCoreOptionsExtensions.i
new file mode 100644
index 00..668efbf0f932f1
--- /dev/null
+++ b/lldb/bindings/interface/SBSaveCoreOptionsExtensions.i
@@ -0,0 +1,31 @@
+#extend lldb::SBSaveCoreOptions {
+#ifdef SWIGPYTHON
+%pythoncode% {
+'''Add a thread to the SaveCoreOptions thread list, and follow it's 
children N pointers deep, adding each memory region to the SaveCoreOptions 
Memory region list.'''
+def save_thread_with_heaps(self, thread, num_heaps_deep = 3):
+self.AddThread(thread)
+frame = thread.GetFrameAtIndex(0)
+process = thread.GetProcess()
+queue = []
+for var in frame.locals:
+if var.TypeIsPointerType():
+queue.append(var.Dereference())
+
+while (num_heaps_deep > 0 and len(queue) > 0):
+queue_size = len(queue)
+for i in range(0, queue_size):
+var = queue.pop(0)
+memory_region = lldb.SBMemoryRegionInfo()
+process.GetMemoryRegionInfo(var.GetAddress().GetOffset(), 
memory_region)
+self.AddMemoryRegionToSave(memory_region)
+/* 
+We only check for direct pointer children T*, should 
probably scan 
+internal to the children themselves. 
+*/
+for x in var.children:
+if x.TypeIsPointerType():
+queue.append(x.Dereference())
+
+num_heaps_deep -= 1
+}
+#endif SWIGPYTHON
diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig
index 8a6fed95f0b729..8a82ba28d3f2ae 100644
--- a/lldb/bindings/interfaces.swig
+++ b/lldb/bindings/interfaces.swig
@@ -26,6 +26,7 @@
 %include "./interface/SBCommunicationDocstrings.i"
 %include "./interface/SBCompileUnitDocstrings.i"
 %include "./interface/SBSaveCoreOptionsDocstrings.i"
+#include "./interface/SBSaveCoreOptionsExtensions.i"
 %include "./interface/SBDataDocstrings.i"
 %include "./interface/SBDebuggerDocstrings.i"
 %include "./interface/SBDeclarationDocstrings.i"
diff --git 
a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
 
b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
index 03cc415924e0bb..cb5d625f4bffa4 100644
--- 
a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ 
b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
@@ -3,6 +3,7 @@
 """
 
 import os
+
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -470,6 +471,27 @@ def save_core_with_region(self, process, region_index):
 if os.path.isfile(custom_file):
 os.unlink(custom_file)
 
+def save_core_one_thread_one_heap(self, process, region_index):
+try:
+custom_file = self.getBuildArtifact("core.one_thread_one_heap.dmp")
+options = lldb.SBSaveCoreOptions()
+options.SetOutputFile(lldb.SBFileSpec(custom_file))
+options.SetPluginName("minidump")
+options.SetStyle(lldb.eSaveCoreCustomOnly)
+thread = process.GetThreadAtIndex(0)
+options.save_thread_with_heaps(thread)
+
+error = process.SaveCore(options)
+self.assertTrue(error.Success())
+core_target = self.dbg.CreateTarget(None)
+core_proc = core_target.LoadCore(custom_file)
+# proc/pid maps prevent us from checking the number of regions, but
+# this is mostly a smoke test for the extension.
+self.assertEqual(core_proc.GetNumThreads(), 1)
+finally:
+if os.path.isfile(custom_file):
+os.unlink(custom_file)
+
 @skipUnlessArch("x86_64")
 @skipUnlessPlatform(["linux"])
 def test_save_minidump_custom_save_style_duplicated_regions(self):

>From dcfa2b25ad8f6961f4da431b863a4f5caefe3ec8 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde 
Date: Tue, 8 Oct 2024 15:53:19 -0700
Subject: [PATCH 2/7] Reword the variable

---
 lldb/bindings/interface/SBSaveCoreOptionsExtensions.i | 6 +++---
 1

[Lldb-commits] [lldb] d8de239 - Revert "[lldb] Improve unwinding for discontinuous functions (#111409)"

2024-10-14 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2024-10-14T15:27:05-07:00
New Revision: d8de2391eb014fb3f750f4c38abc101edc1e2cc2

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

LOG: Revert "[lldb] Improve unwinding for discontinuous functions (#111409)"

This reverts commit a89e01634fe2e6ce0b967ead24280b6693b523dc.

This is being reverted because it broke the test:

Unwind/trap_frame_sym_ctx.test

/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test:21:10:
 error: CHECK: expected string not found in input
 CHECK: frame #2: {{.*}}`main

Added: 


Modified: 
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Symbol/UnwindTable.cpp

Removed: 
lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
lldb/test/Shell/Unwind/Inputs/linux-x86_64.yaml
lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test
lldb/test/Shell/Unwind/basic-block-sections-with-dwarf.test



diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 9a4a17eaa124ce..e950fb346c253b 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3583,12 +3583,10 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
   addr_t start_addr = range.GetBaseAddress().GetLoadAddress(target);
   if (abi)
 start_addr = abi->FixCodeAddress(start_addr);
-  range.GetBaseAddress().SetLoadAddress(start_addr, target);
 
   FuncUnwindersSP func_unwinders_sp(
   sc.module_sp->GetUnwindTable()
-  
.GetUncachedFuncUnwindersContainingAddress(range.GetBaseAddress(),
- sc));
+  .GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
   if (!func_unwinders_sp)
 continue;
 

diff  --git a/lldb/source/Symbol/UnwindTable.cpp 
b/lldb/source/Symbol/UnwindTable.cpp
index 42ab7ba95b9e6c..da88b0c9c4ea19 100644
--- a/lldb/source/Symbol/UnwindTable.cpp
+++ b/lldb/source/Symbol/UnwindTable.cpp
@@ -99,6 +99,12 @@ UnwindTable::GetAddressRange(const Address &addr, const 
SymbolContext &sc) {
   m_object_file_unwind_up->GetAddressRange(addr, range))
 return range;
 
+  // Check the symbol context
+  if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
+ false, range) &&
+  range.GetBaseAddress().IsValid())
+return range;
+
   // Does the eh_frame unwind info has a function bounds for this addr?
   if (m_eh_frame_up && m_eh_frame_up->GetAddressRange(addr, range))
 return range;
@@ -107,12 +113,6 @@ UnwindTable::GetAddressRange(const Address &addr, const 
SymbolContext &sc) {
   if (m_debug_frame_up && m_debug_frame_up->GetAddressRange(addr, range))
 return range;
 
-  // Check the symbol context
-  if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
- false, range) &&
-  range.GetBaseAddress().IsValid())
-return range;
-
   return std::nullopt;
 }
 

diff  --git a/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s 
b/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
deleted file mode 100644
index c405e51c227cb6..00
--- a/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
+++ /dev/null
@@ -1,256 +0,0 @@
-# An example of a function which has been split into two parts. Roughly
-# corresponds to this C code.
-# int baz() { return 47; }
-# int bar() { return foo(0); }
-# int foo(int flag) { return flag ? bar() : baz(); }
-# int main() { return foo(1); }
-# The function bar has been placed "in the middle" of foo.
-
-.text
-
-.type   baz,@function
-baz:
-.cfi_startproc
-movl$47, %eax
-retq
-.cfi_endproc
-.Lbaz_end:
-.size   baz, .Lbaz_end-baz
-
-.type   foo,@function
-foo:
-.cfi_startproc
-pushq   %rbp
-.cfi_def_cfa_offset 16
-.cfi_offset %rbp, -16
-movq%rsp, %rbp
-.cfi_def_cfa_register %rbp
-subq$16, %rsp
-movl%edi, -8(%rbp)
-cmpl$0, -8(%rbp)
-je  foo.__part.2
-jmp foo.__part.1
-.cfi_endproc
-.Lfoo_end:
-.size   foo, .Lfoo_end-foo
-
-foo.__part.1:
-.cfi_startproc
-.cfi_def_cfa %rbp, 16
-.cfi_offset %rbp, -16
-callq   bar
-movl%eax, -4(%rbp)
-jmp foo.__part.3
-.Lfoo.__part.1_end:
-.size   foo.__part.1, .Lfoo.__part.1_end-foo.__part.1
-.cfi_endproc
-
-bar:
-.cfi_startproc
-# NB: Decrease the stack pointer to make the unwind info for this function
-# 
diff erent from the surroun

[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Dmitrii Galimzianov via lldb-commits


@@ -642,26 +652,86 @@ ModuleSP DynamicLoaderDarwin::GetDYLDModule() {
 
 void DynamicLoaderDarwin::ClearDYLDModule() { m_dyld_module_wp.reset(); }
 
+template 
+static std::vector parallel_map(
+llvm::ThreadPoolInterface &threadPool, InputIterator first,
+InputIterator last,
+llvm::function_ref::value_type &)>
+transform) {
+  const auto size = std::distance(first, last);
+  std::vector results(size);
+  if (size > 0) {
+llvm::ThreadPoolTaskGroup taskGroup(threadPool);
+auto it = first;
+for (ssize_t i = 0; i < size; ++i, ++it) {
+  taskGroup.async([&, i, it]() { results[i] = transform(*it); });
+}
+taskGroup.wait();
+  }
+  return results;
+}

DmT021 wrote:

We can but it may not be better. The implementations of map and parallel_map 
aren't important from the business logic perspective. The only important thing 
about PreloadModulesFromImageInfos is checking the setting. 
Also, the code will be a bit more complicated than shown in the snippet you 
provided:
- we are creating a task group and waiting for it even when we are going to 
load the modules sequentially.
- we are checking the setting on each iteration of the loop.

This is probably almost free (I'm not sure if that's the case for 
`task_group.wait()` though) but it's still a bit of an eyesore.

But a version of this without these two disadvantages will have a repeating for 
loop. Something like
```
std::vector>
DynamicLoaderDarwin::PreloadModulesFromImageInfos(
const ImageInfo::collection &image_infos) {
  const auto size = image_infos.size();
  std::vector> images(
  size);
  auto lambda = [&](size_t i, ImageInfo::collection::const_iterator it) {
const auto &image_info = *it;
images[i] = std::make_pair(
image_info, FindTargetModuleForImageInfo(image_info, true, nullptr));
  };
  auto it = image_infos.begin();
  bool is_parallel_load =
  DynamicLoaderDarwinProperties::GetGlobal().GetEnableParallelImageLoad();
  if (is_parallel_load) {
if (size > 0) {
  llvm::ThreadPoolTaskGroup taskGroup(Debugger::GetThreadPool());
  for (size_t i = 0; i < size; ++i, ++it) {
taskGroup.async(lambda, i, it);
  }
  taskGroup.wait();
}
  } else {
for (size_t i = 0; i < size; ++i, ++it) {
  lambda(i, it);
}
  }
  return images;
}
```

So now we have a bigger room for error in future refactoring here and the 
important part (checking the setting) is less visible in the code as well.

Also, consider how would this code look like if had `std::transform` with 
`ExecutionPolicy` available. I think it'd look about the same as the current 
implementation with `map` and `parallel_map`.

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


[Lldb-commits] [lldb] [lldb] Log errors to the system log if they would otherwise get dropped (PR #111911)

2024-10-14 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

> @adrian-prantl do you want the system log to include the dropped errors in 
> `Status`. If so we'll need to promote that to use `LLDB_LOG_ERROR` instead.

No, I expect that to be too much traffic in the beginning at least.

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


[Lldb-commits] [lldb] [lldb] Narrow scope of -Wno-deprecated-declarations (NFC) (PR #112276)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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

Currently all of LLDB is being compiled with -Wno-deprecated-declarations. 
That's not desirable, especially as part of the LLVM monorepo, as we miss 
deprecation warnings from LLVM and clang.

According to the git history, this was first introduced to suppress warnings 
related to auto_ptr. Since then, other things have been deprecated and gone 
unnoticed. This patch limits the flag to Host.mm which uses a handful of 
LSApplication headers that have no replacement.

rdar://112040718

>From d594127ce03f0b6e89529c95ae60fcdce8197bdf Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 14 Oct 2024 14:47:22 -0700
Subject: [PATCH] [lldb] Narrow scope of -Wno-deprecated-declarations (NFC)

Currently all of LLDB is being compiled with -Wno-deprecated-declarations.
That's not desirable, especially as part of the LLVM monorepo, as we
miss deprecation warnings from LLVM and clang.

According to the git history, this was first introduced to suppress
warnings related to auto_ptr. Since then, other things have been
deprecated and gone unnoticed. This patch limits the flag to Host.mm
which uses a handful of LSApplication headers that have no replacement.

rdar://112040718
---
 lldb/cmake/modules/LLDBConfig.cmake   | 2 --
 lldb/source/Host/macosx/objcxx/CMakeLists.txt | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index a60921990cf775..93ccd9c479c2b8 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -188,7 +188,6 @@ 
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
   # Disable GCC warnings
-  append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS)
   append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
   append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
 
@@ -198,7 +197,6 @@ endif()
 
 # Disable Clang warnings
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  append("-Wno-deprecated-register" CMAKE_CXX_FLAGS)
   append("-Wno-vla-extension" CMAKE_CXX_FLAGS)
 endif()
 
diff --git a/lldb/source/Host/macosx/objcxx/CMakeLists.txt 
b/lldb/source/Host/macosx/objcxx/CMakeLists.txt
index 273999f24380e5..1e693bed12ce15 100644
--- a/lldb/source/Host/macosx/objcxx/CMakeLists.txt
+++ b/lldb/source/Host/macosx/objcxx/CMakeLists.txt
@@ -16,4 +16,6 @@ add_lldb_library(lldbHostMacOSXObjCXX NO_PLUGIN_DEPENDENCIES
 TargetParser
   )
 
-target_compile_options(lldbHostMacOSXObjCXX PRIVATE -fno-objc-exceptions)
+target_compile_options(lldbHostMacOSXObjCXX PRIVATE
+  -fno-objc-exceptions
+  -Wno-deprecated-declarations)

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


[Lldb-commits] [lldb] [lldb] Narrow scope of -Wno-deprecated-declarations (NFC) (PR #112276)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Depends on:

 - https://github.com/llvm/llvm-project/pull/112260
 - https://github.com/llvm/llvm-project/pull/112262

Remaining issues:

- IRDynamicChecks.cpp:333:72: warning: 'InsertPosition' is deprecated: Use 
BasicBlock::iterators for insertion instead [-Wdeprecated-declarations]
- Editline.h:370:8: warning: 'wstring_convert>' is 
deprecated [-Wdeprecated-declarations]
- Editline.h:370:29: warning: 'codecvt_utf8' is deprecated 
[-Wdeprecated-declarations]

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


[Lldb-commits] [lldb] [lldb][test] Fix TestStdCXXDisassembly test for case when tests are linked with libc++ statically (PR #98694)

2024-10-14 Thread Dmitry Vasilyev via lldb-commits

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

Thanks

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


[Lldb-commits] [lldb] 6539481 - [lldb] Account for DWARF 5 sections in TestCTF.py

2024-10-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-14T16:57:33-07:00
New Revision: 6539481c8e7a840a41f6835426ddfbcdc234c831

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

LOG: [lldb] Account for DWARF 5 sections in TestCTF.py

Update the TestCTF Makefile to remove the DWARF 5 sections.

Added: 


Modified: 
lldb/test/API/macosx/ctf/Makefile

Removed: 




diff  --git a/lldb/test/API/macosx/ctf/Makefile 
b/lldb/test/API/macosx/ctf/Makefile
index 0857e234837e54..eeef9351e3ef13 100644
--- a/lldb/test/API/macosx/ctf/Makefile
+++ b/lldb/test/API/macosx/ctf/Makefile
@@ -17,15 +17,19 @@ a.ctf: a.out.dSYM
-o a.ctf \
a.out.dSYM/Contents/Resources/DWARF/a.out
$(OBJCOPY) \
-   -R __DWARF,__debug_line \
-   -R __DWARF,__debug_aranges \
-   -R __DWARF,__debug_info \
-   -R __DWARF,__debug_abbrev \
-   -R __DWARF,__debug_str \
-R __DWARF,__apple_names \
-R __DWARF,__apple_namespac \
-   -R __DWARF,__apple_types \
-R __DWARF,__apple_objc \
+   -R __DWARF,__apple_types \
+   -R __DWARF,__debug_abbrev \
+   -R __DWARF,__debug_addr \
+   -R __DWARF,__debug_aranges \
+   -R __DWARF,__debug_info \
+   -R __DWARF,__debug_line \
+   -R __DWARF,__debug_line_str \
+   -R __DWARF,__debug_names \
+   -R __DWARF,__debug_str \
+   -R __DWARF,__debug_str_offs \
a.ctf a.ctf
rm -rf a.out.dSYM
rm -rf test.o



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


[Lldb-commits] [lldb] [LLDB][SBSaveCore] Add Extension to Save a thread and N pointers deep (PR #111601)

2024-10-14 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

This does require us to walk the stack backwards instead of just taking the 
`0th` frame

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (PR #112260)

2024-10-14 Thread Jason Molenda via lldb-commits

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

LGTM.

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


[Lldb-commits] [lldb] 8225938 - [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (#112260)

2024-10-14 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-14T17:06:02-07:00
New Revision: 8225938a73406f26e599c7a55fa019422fe18369

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

LOG: [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) 
(#112260)

Remove support for ASL (Apple System Log) which has been deprecated
since macOS 10.12. Fixes the following warnings:

warning: 'asl_new' is deprecated: first deprecated in macOS 10.12 -
os_log(3) has replaced asl(3)
warning: 'asl_set' is deprecated: first deprecated in macOS 10.12 -
os_log(3) has replaced asl(3)
warning: 'asl_vlog' is deprecated: first deprecated in macOS 10.12 -
os_log(3) has replaced asl(3)

Added: 


Modified: 
lldb/tools/debugserver/source/debugserver.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/debugserver.cpp 
b/lldb/tools/debugserver/source/debugserver.cpp
index cfc9646ed2d081..f41a9e00ec9481 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -759,35 +759,6 @@ static int ConnectRemote(RNBRemote *remote, const char 
*host, int port,
   return 1;
 }
 
-// ASL Logging callback that can be registered with DNBLogSetLogCallback
-void ASLLogCallback(void *baton, uint32_t flags, const char *format,
-va_list args) {
-  if (format == NULL)
-return;
-  static aslmsg g_aslmsg = NULL;
-  if (g_aslmsg == NULL) {
-g_aslmsg = ::asl_new(ASL_TYPE_MSG);
-char asl_key_sender[PATH_MAX];
-snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.%s-%s",
- DEBUGSERVER_PROGRAM_NAME, DEBUGSERVER_VERSION_STR);
-::asl_set(g_aslmsg, ASL_KEY_SENDER, asl_key_sender);
-  }
-
-  int asl_level;
-  if (flags & DNBLOG_FLAG_FATAL)
-asl_level = ASL_LEVEL_CRIT;
-  else if (flags & DNBLOG_FLAG_ERROR)
-asl_level = ASL_LEVEL_ERR;
-  else if (flags & DNBLOG_FLAG_WARNING)
-asl_level = ASL_LEVEL_WARNING;
-  else if (flags & DNBLOG_FLAG_VERBOSE)
-asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_INFO;
-  else
-asl_level = ASL_LEVEL_WARNING; // ASL_LEVEL_DEBUG;
-
-  ::asl_vlog(NULL, g_aslmsg, asl_level, format, args);
-}
-
 // FILE based Logging callback that can be registered with
 // DNBLogSetLogCallback
 void FileLogCallback(void *baton, uint32_t flags, const char *format,
@@ -948,16 +919,8 @@ int main(int argc, char *argv[]) {
   // Set up DNB logging by default. If the user passes 
diff erent log flags or a
   // log file, these settings will be modified after processing the command 
line
   // arguments.
-  auto log_callback = OsLogger::GetLogFunction();
-  if (log_callback) {
-// if os_log() support is available, log through that.
+  if (auto log_callback = OsLogger::GetLogFunction())
 DNBLogSetLogCallback(log_callback, nullptr);
-DNBLog("debugserver will use os_log for internal logging.");
-  } else {
-// Fall back to ASL support.
-DNBLogSetLogCallback(ASLLogCallback, nullptr);
-DNBLog("debugserver will use ASL for internal logging.");
-  }
   DNBLogSetLogMask(/*log_flags*/ 0);
 
   g_remoteSP = std::make_shared();



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


[Lldb-commits] [lldb] [lldb] Remove ASL (Apple System Log) support from debugserver (NFC) (PR #112260)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Make the system log a NOOP on Windows (PR #112052)

2024-10-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I wonder if this is going to fix 
https://lab.llvm.org/buildbot/#/builders/141/builds/3100, so I am testing it 
right now.

```
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe  
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Settings/Inputs/EchoCommandsQuiet.out
 
:5:1: note: 'next' match was here
# | done
# | ^
# | :1:6: note: previous match ended here
# | start
# |  ^
# | :2:1: note: non-matching line after previous match is here
# | lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 
73e74e496ec32a13a5ae71df71364065f7be3cca)
# | ^
# | 
# | Input file: 
# | Check file: 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Settings/Inputs/EchoCommandsQuiet.out
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# | 1: start 
# | 2: lldb version 20.0.0git (https://github.com/llvm/llvm-project.git 
revision 73e74e496ec32a13a5ae71df71364065f7be3cca) 
# | 3:  clang revision 73e74e496ec32a13a5ae71df71364065f7be3cca 
# | 4:  llvm revision 73e74e496ec32a13a5ae71df71364065f7be3cca 
# | 5: done 
# | next:4 !~~~  error: match on wrong line
# | >>
# `-
# error: command failed with exit status: 1
```


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


[Lldb-commits] [lldb] d4ea086 - [lldb] Replace Code Owners with Maintainers (#111686)

2024-10-14 Thread via lldb-commits

Author: David Spickett
Date: 2024-10-14T09:09:48+01:00
New Revision: d4ea08687f2de1a5e0b70f37f522dcb798f650fe

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

LOG: [lldb] Replace Code Owners with Maintainers (#111686)

To align with the new policy:
https://llvm.org/docs/DeveloperPolicy.html#maintainers

I've assumed that Jonas will be the "Lead Maintainer" as he was the
default Code Owner.

I know the past Code Owners weren't "Maintainers" but it's the same
energy so I've changed it there too.

See also: https://github.com/llvm/llvm-project/pull/107384 /
https://discourse.llvm.org/t/rfc-proposing-changes-to-the-community-code-ownership-policy/80714

Added: 
lldb/Maintainers.rst

Modified: 


Removed: 
lldb/CodeOwners.rst



diff  --git a/lldb/CodeOwners.rst b/lldb/Maintainers.rst
similarity index 91%
rename from lldb/CodeOwners.rst
rename to lldb/Maintainers.rst
index 3c10c2a28da9e7..e83591d5f162b4 100644
--- a/lldb/CodeOwners.rst
+++ b/lldb/Maintainers.rst
@@ -1,27 +1,31 @@
 
-LLDB Code Owners
+LLDB Maintainers
 
 
-This file is a list of the `code owners 
`_ for LLDB.
+This file is a list of the `maintainers 
`_ for LLDB.
 
 .. contents::
:depth: 2
:local:
 
-Current Code Owners
+Current Maintainers
 ===
-The following people are the active code owners for the project. Please reach
+The following people are the active maintainers for the project. Please reach
 out to them for code reviews, questions about their area of expertise, or other
 assistance.
 
-All parts of LLDB not covered by someone else
---
+Lead Maintainer
+---
+
+Responsible for project as a whole, and for any areas not covered by a specific
+maintainer.
+
 | Jonas Devlieghere
 | jonas\@devlieghere.com (email), jdevlieghere (GitHub), jdevlieghere 
(Discourse), jdevlieghere (Discord)
 
 Components
 --
-These code owners are responsible for particular high-level components within
+These maintainers are responsible for particular high-level components within
 LLDB.
 
 ABI
@@ -242,10 +246,10 @@ lldb-dap
 | Walter Erquinigo
 | a20012251\@gmail.com (email), walter-erquinigo (GitHub), wallace 
(Discourse), werquinigo (Discord)
 
-Former Code Owners
+Former Maintainers
 ==
-The following people have graciously spent time performing code ownership
-responsibilities but are no longer active in that role. Thank you for all your
+The following people have graciously spent time performing maintainership
+duties but are no longer active in that role. Thank you for all your
 help with the success of the project!
 
 | Kamil Rytarowski (kamil\@netbsd.org)



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


[Lldb-commits] [lldb] [lldb] Replace Code Owners with Maintainers (PR #111686)

2024-10-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Pavel Labath via lldb-commits


@@ -194,28 +194,54 @@ void CommandObjectMultiword::Execute(const char 
*args_string,
 
   std::string error_msg;
   const size_t num_subcmd_matches = matches.GetSize();
-  if (num_subcmd_matches > 0)
+  if (num_subcmd_matches > 0) {
 error_msg.assign("ambiguous command ");
-  else
-error_msg.assign("invalid command ");
-
-  error_msg.append("'");
-  error_msg.append(std::string(GetCommandName()));
-  error_msg.append(" ");
-  error_msg.append(std::string(sub_command));
-  error_msg.append("'.");
+error_msg.append("'");
+error_msg.append(std::string(GetCommandName()));
+error_msg.append(" ");
+error_msg.append(std::string(sub_command));
+error_msg.append("'.");
 
-  if (num_subcmd_matches > 0) {
 error_msg.append(" Possible completions:");
 for (const std::string &match : matches) {
   error_msg.append("\n\t");
   error_msg.append(match);
 }
+  } else {
+// Try to offer some alternatives to help correct the command.
+error_msg.assign(
+llvm::Twine("'" + sub_command + "' is not a valid subcommand of \"" +
+GetCommandName() + "\"." + GetSubcommandsHintText() +
+" Use \"help " + GetCommandName() + "\" to find out more.")
+.str());
   }
   error_msg.append("\n");
   result.AppendRawError(error_msg.c_str());
 }
 
+std::string CommandObjectMultiword::GetSubcommandsHintText() {
+  if (m_subcommand_dict.empty())
+return "";
+  const size_t maxCount = 5;
+  size_t i = 0;
+  std::string buffer = " Valid subcommand";
+  buffer.append(m_subcommand_dict.size() > 1 ? "s are:" : "is");

labath wrote:

You're missing a space before "is". The output will also be garbled for the 
case of zero subcommands (I think such a thing can happen if the user registers 
a custom multiword command (`SBCommandInterpreter::AddMultiwordCommand`), but 
does not add any subcommands to it).

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Pavel Labath via lldb-commits

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


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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Pavel Labath via lldb-commits


@@ -70,6 +70,8 @@ class CommandObjectMultiword : public CommandObject {
 return m_subcommand_dict;
   }
 
+  std::string GetTopSubcommands(int count);

labath wrote:

Yeah, I was basically thinking just some predetermined order (our estimate of a 
command usage). I don't want to derail this patch with it though, I just found 
the remark humorous and couldn't resist the temptation.

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,8 @@
+# UNSUPPORTED: system-windows
+#
+# RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
+# RUN: not %lldb -b -o 'breakpoint foo' %t.out -o exit 2>&1 | FileCheck %s 
--check-prefix BP-MSG
+# RUN: not %lldb -b -o 'watchpoint set foo' %t.out -o exit 2>&1 | FileCheck %s 
--check-prefix WP-MSG
+# CHECK: at main.c:2:21
+# BP-MSG: 'foo' is not a valid subcommand of "breakpoint". Valid subcommands 
are: clear, command, delete, disable, enable, and others. Use "help breakpoint" 
to find out more.

labath wrote:

> 'foo' is not a valid subcommand of "breakpoint"
It would be nice if we could be consistent about the kind of quotes we use at 
least within a single sentence.

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


[Lldb-commits] [lldb] [lldb] Escape ? for zsh (PR #112107)

2024-10-14 Thread Pavel Labath via lldb-commits

labath wrote:

So... `?` is a glob character (in just about any shell), just like `*`. And 
lldb-argdumper is only reason for existence is to expand globs, so escaping it 
sounds wrong. I think the main difference here is that zsh complains loudly 
about a failed glob expansion, where as bash just leaves it alone (although 
this can be controlled with some settings). However, this behavior is not 
specific to `?` -- you can get the same thing with `*` as well:
```
$ zsh -c 'echo bin/lld?'
bin/lldb
$ zsh -c 'echo bin/lld?'
bin/lldb
$ zsh -c 'echo bin/lld*'
bin/lld bin/lld-link bin/lldb bin/lldb-argdumper bin/lldb-dap bin/lldb-dotest 
bin/lldb-instr bin/lldb-python bin/lldb-repro bin/lldb-server bin/lldb-tblgen 
bin/lldb-test
$ zsh -c 'echo bin/not-lld?'
zsh:1: no matches found: bin/not-lld?
$ zsh -c 'echo bin/not-lld*'
zsh:1: no matches found: bin/not-lld*
$ bash -c 'echo bin/lld?'
bin/lldb
$ bash -c 'echo bin/lld*'
bin/lld bin/lld-link bin/lldb bin/lldb-argdumper bin/lldb-dap bin/lldb-dotest 
bin/lldb-instr bin/lldb-python bin/lldb-repro bin/lldb-server bin/lldb-tblgen 
bin/lldb-test
$ bash -c 'echo bin/not-lld*'
bin/not-lld*
$ bash -c 'echo bin/not-lld?'
bin/not-lld?
```

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


[Lldb-commits] [lldb] [lldb] Make the system log a NOOP on Windows (PR #112052)

2024-10-14 Thread Pavel Labath via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][test] Fixed the test `no_unique_address-with-bitfields` (PR #111902)

2024-10-14 Thread Pavel Labath via lldb-commits

labath wrote:

I would recommend that -- then you wouldn't need to worry about how to spell 
[[no_unique_address]] on windows.

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


[Lldb-commits] [lldb] [lldb][test] Remove objcopy detection from API tests' CMakeLists.txt (PR #111977)

2024-10-14 Thread Pavel Labath via lldb-commits

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

LGTM. LLDB's build/test setup is a lot different that what it was when I wrote 
that patch.

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


[Lldb-commits] [lldb] [lldb] Fix finding make tool for tests (PR #111980)

2024-10-14 Thread Pavel Labath via lldb-commits

labath wrote:

lldb-dotest is a separate tool, which is usually only invoked manually when 
debugging a specific test (and not invoked by `make check-lldb` like the bots 
do). This fact that its args need to stay in sync is annoying an a relatively 
common problem. I feel that there must be a way to have a single source of 
truth for the testing args, but I haven't found the time to figure one out yet 
(patches welcome).

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Vy Nguyen via lldb-commits


@@ -0,0 +1,8 @@
+# UNSUPPORTED: system-windows
+#
+# RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
+# RUN: not %lldb -b -o 'breakpoint foo' %t.out -o exit 2>&1 | FileCheck %s 
--check-prefix BP-MSG
+# RUN: not %lldb -b -o 'watchpoint set foo' %t.out -o exit 2>&1 | FileCheck %s 
--check-prefix WP-MSG
+# CHECK: at main.c:2:21
+# BP-MSG: 'foo' is not a valid subcommand of "breakpoint". Valid subcommands 
are: clear, command, delete, disable, enable, and others. Use "help breakpoint" 
to find out more.

oontvoo wrote:

done

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Vy Nguyen via lldb-commits


@@ -194,28 +194,54 @@ void CommandObjectMultiword::Execute(const char 
*args_string,
 
   std::string error_msg;
   const size_t num_subcmd_matches = matches.GetSize();
-  if (num_subcmd_matches > 0)
+  if (num_subcmd_matches > 0) {
 error_msg.assign("ambiguous command ");
-  else
-error_msg.assign("invalid command ");
-
-  error_msg.append("'");
-  error_msg.append(std::string(GetCommandName()));
-  error_msg.append(" ");
-  error_msg.append(std::string(sub_command));
-  error_msg.append("'.");
+error_msg.append("'");
+error_msg.append(std::string(GetCommandName()));
+error_msg.append(" ");
+error_msg.append(std::string(sub_command));
+error_msg.append("'.");
 
-  if (num_subcmd_matches > 0) {
 error_msg.append(" Possible completions:");
 for (const std::string &match : matches) {
   error_msg.append("\n\t");
   error_msg.append(match);
 }
+  } else {
+// Try to offer some alternatives to help correct the command.
+error_msg.assign(
+llvm::Twine("'" + sub_command + "' is not a valid subcommand of \"" +
+GetCommandName() + "\"." + GetSubcommandsHintText() +
+" Use \"help " + GetCommandName() + "\" to find out more.")
+.str());
   }
   error_msg.append("\n");
   result.AppendRawError(error_msg.c_str());
 }
 
+std::string CommandObjectMultiword::GetSubcommandsHintText() {
+  if (m_subcommand_dict.empty())
+return "";
+  const size_t maxCount = 5;
+  size_t i = 0;
+  std::string buffer = " Valid subcommand";
+  buffer.append(m_subcommand_dict.size() > 1 ? "s are:" : "is");

oontvoo wrote:

> You're missing a space before "is"
Done.

> The output will also be garbled for the case of zero subcommands
Which output? the error msg as a whole or just this function's output?

unless i'm missing something, if there are zero subcommands, the function would 
have returned "" on line 223, which means the error message would have been 
something like `"foo" is not a valid subcommand of "breakpoint". Use "help 
breakpoint" to find out more.` (ie., there will be no suggestions on 
subcommands).



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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread Vy Nguyen via lldb-commits

https://github.com/oontvoo updated 
https://github.com/llvm/llvm-project/pull/111891

>From 4493bf07c8b18dac39a2a421f97fa34cd15a6031 Mon Sep 17 00:00:00 2001
From: Vy Nguyen 
Date: Thu, 10 Oct 2024 14:48:08 -0400
Subject: [PATCH 1/4] [LLDB]Provide clearer error message for invalid commands.

Sometimes users (esp. gdb-longtime users) accidentally use GDB syntax, such as 
`breakpoint foo`, and they would get an error message from LLDB saying simply 
`Invalid command "breakpoint foo"`, which is not very helpful.
This change provides additional suggestions to help correcting the mistake.
---
 .../lldb/Interpreter/CommandObjectMultiword.h |  2 +
 .../Commands/CommandObjectMultiword.cpp   | 42 ++-
 .../Commands/command-breakpoint-col.test  |  2 +
 3 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h 
b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
index bceb7f0e51edb6..cee118c3f454b5 100644
--- a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
+++ b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -70,6 +70,8 @@ class CommandObjectMultiword : public CommandObject {
 return m_subcommand_dict;
   }
 
+  std::string GetTopSubcommands(int count);
+
   CommandObject::CommandMap m_subcommand_dict;
   bool m_can_be_removed;
 };
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp 
b/lldb/source/Commands/CommandObjectMultiword.cpp
index 4efa5652a71703..f7bb58187895b4 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -194,28 +194,50 @@ void CommandObjectMultiword::Execute(const char 
*args_string,
 
   std::string error_msg;
   const size_t num_subcmd_matches = matches.GetSize();
-  if (num_subcmd_matches > 0)
+  if (num_subcmd_matches > 0) {
 error_msg.assign("ambiguous command ");
-  else
-error_msg.assign("invalid command ");
-
-  error_msg.append("'");
-  error_msg.append(std::string(GetCommandName()));
-  error_msg.append(" ");
-  error_msg.append(std::string(sub_command));
-  error_msg.append("'.");
+error_msg.append("'");
+error_msg.append(std::string(GetCommandName()));
+error_msg.append(" ");
+error_msg.append(std::string(sub_command));
+error_msg.append("'.");
 
-  if (num_subcmd_matches > 0) {
 error_msg.append(" Possible completions:");
 for (const std::string &match : matches) {
   error_msg.append("\n\t");
   error_msg.append(match);
 }
+  } else {
+// Rather than simply complaining about the invalid (sub) command,
+// try to offer some alternatives.
+// This is especially useful for cases where the user types something
+// seamingly trivial, such as `breakpoint foo`.
+error_msg.assign(
+llvm::Twine("'" + sub_command + "' is not a valid subcommand of \"" +
+GetCommandName() + "\". Valid subcommands are " +
+GetTopSubcommands(/*count=*/5) + ". Use \"help " +
+GetCommandName() + "\" to find out more.")
+.str());
   }
   error_msg.append("\n");
   result.AppendRawError(error_msg.c_str());
 }
 
+std::string CommandObjectMultiword::GetTopSubcommands(int count) {
+  if (m_subcommand_dict.empty())
+return "";
+  std::string buffer = "{";
+  CommandMap::iterator pos;
+  for (pos = m_subcommand_dict.begin();
+   pos != m_subcommand_dict.end() && count > 0; ++pos, --count) {
+buffer.append("'");
+buffer.append(pos->first);
+buffer.append("',");
+  }
+  buffer.append("...}");
+  return buffer;
+}
+
 void CommandObjectMultiword::GenerateHelpText(Stream &output_stream) {
   // First time through here, generate the help text for the object and push it
   // to the return result object as well
diff --git a/lldb/test/Shell/Commands/command-breakpoint-col.test 
b/lldb/test/Shell/Commands/command-breakpoint-col.test
index 65c1e220794303..fecb773d2b4c66 100644
--- a/lldb/test/Shell/Commands/command-breakpoint-col.test
+++ b/lldb/test/Shell/Commands/command-breakpoint-col.test
@@ -3,8 +3,10 @@
 # RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
 # RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 
21' %t.out | FileCheck %s --check-prefix HELP --check-prefix CHECK
 # RUN: %lldb -b -o 'help _regexp-break' -o 'b main.c:2:21' %t.out | FileCheck 
%s --check-prefix HELP-REGEX --check-prefix CHECK
+# RUN: not %lldb -b -o 'breakpoint foo' %t.out -o exit 2>&1 | FileCheck %s 
--check-prefix ERROR-MSG
 # HELP: -u  ( --column  )
 # HELP: Specifies the column number on which to set this breakpoint.
 # HELP-REGEX: _regexp-break ::
 # HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c
 # CHECK: at main.c:2:21
+# ERROR-MSG: 'foo' is not a valid subcommand of "breakpoint". Valid 
subcommands are {'clear','command','delete','disable','enable',...}. Use "help 
breakpoint" to find out more.

>From 8dfb266f7eed943f7d9c4bd00e09ef86ae1c5d6e Mon

[Lldb-commits] [lldb] [lldb] Log errors to the system log if they would otherwise get dropped (PR #111911)

2024-10-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> Log errors to the system log if they would otherwise get dropped

Dropped because of what exactly, because the user did not enable a channel that 
would include them? How does one enable collection of these with the current 
lldb?

> @DavidSpickett, do you have any thoughts on this? :)

> For example, on linux, these system logs are normally only readable by root, 
> so a normal user wouldn't even be able to see what is being logged

So if we wanted to implement "here is a log you should send to an lldb 
developer if they ask for it", then we'd need to log to somewhere else anyway.

Certainly if someone is shipping lldb within an organisation they could 
implement that, but I'm not convinced it's required for Linux right now. And at 
that point why log to the Darwin system log not some other file? At least it 
would have a consistent name across platforms then.

It sounds like these messages are currently dropped so we could just change 
Darwin to push to the system log and leave the rest as is and it wouldn't be a 
regression. Is that correct? That's a way forward at least.

(idk if you are aiming to enable this on all platforms for the Swift project's 
benefit)

I'm also curious how useful the system log is if it contains other output. 
Maybe that's the reason it's useful, if it can tell you about system events 
that caused the problem, but having random services' output in there seems A: 
annoying and B: something a issue reporter might be wary of sharing.

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Jason Molenda via lldb-commits

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

Most of the review and discussion happened in the "non-preload" version of the 
PR ( https://github.com/llvm/llvm-project/pull/110439 ), but I agree with 
Dmitrii that this is the best approach to merge, this is approved.  Very nice 
job spotting a prime opportunity for multithreading, thanks for doing the work 
to implement it.  I think for native macOS debugging (with all binaries in the 
same shared cache as lldb's) we're seeing some less than optimal results so 
we've got a bottleneck that I'll try to look into, I suspect maybe related to 
how we find binaries in our shared cache.  This is still a speedup or 
not-slower result in every use case I tried.

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel (PR #110439)

2024-10-14 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

Sounds good, I agree.  I marked 
https://github.com/llvm/llvm-project/pull/110646 as approved, please merge at 
your convenience.  Thanks again for spotting this opportunity for 
multithreading and seeing it through!

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


[Lldb-commits] [lldb] [LLDB]Provide clearer error message for invalid commands. (PR #111891)

2024-10-14 Thread via lldb-commits


@@ -70,6 +70,8 @@ class CommandObjectMultiword : public CommandObject {
 return m_subcommand_dict;
   }
 
+  std::string GetTopSubcommands(int count);

jimingham wrote:

Sure, that's fine too.

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Dmitrii Galimzianov via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Rename CommandReturnObject::Get.*Data -> Get.*String (PR #112062)

2024-10-14 Thread via lldb-commits

https://github.com/jimingham commented:

LGTM

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


[Lldb-commits] [lldb] [lldb] Rename CommandReturnObject::Get.*Data -> Get.*String (PR #112062)

2024-10-14 Thread via lldb-commits

jimingham wrote:

The best I can reconstruct, these were GetData because of the StreamString API 
name.  That's not a good reason, and after all they do return strings, so this 
makes sense.

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread Dmitrii Galimzianov via lldb-commits

https://github.com/DmT021 updated 
https://github.com/llvm/llvm-project/pull/110646

>From 64a4d69d1bb3f32c4b303d6f45b45cdf513183c2 Mon Sep 17 00:00:00 2001
From: Dmitrii Galimzianov 
Date: Sun, 29 Sep 2024 22:24:19 +0200
Subject: [PATCH 1/2] DynamicLoaderDarwin load images in parallel

---
 .../DynamicLoader/MacOSX-DYLD/CMakeLists.txt  | 13 
 .../MacOSX-DYLD/DynamicLoaderDarwin.cpp   | 71 +--
 .../MacOSX-DYLD/DynamicLoaderDarwin.h |  4 +-
 .../DynamicLoaderDarwinProperties.cpp | 53 ++
 .../DynamicLoaderDarwinProperties.h   | 34 +
 .../DynamicLoaderDarwinProperties.td  |  8 +++
 .../MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp   |  8 ++-
 .../MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h |  2 +
 8 files changed, 185 insertions(+), 8 deletions(-)
 create mode 100644 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.cpp
 create mode 100644 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.h
 create mode 100644 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.td

diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
index 7308374c8bfba6..77a560541fcb1f 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
@@ -1,7 +1,16 @@
+lldb_tablegen(DynamicLoaderDarwinProperties.inc -gen-lldb-property-defs
+  SOURCE DynamicLoaderDarwinProperties.td
+  TARGET LLDBPluginDynamicLoaderDarwinPropertiesGen)
+
+lldb_tablegen(DynamicLoaderDarwinPropertiesEnum.inc 
-gen-lldb-property-enum-defs
+  SOURCE DynamicLoaderDarwinProperties.td
+  TARGET LLDBPluginDynamicLoaderDarwinPropertiesEnumGen)
+
 add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN
   DynamicLoaderMacOSXDYLD.cpp
   DynamicLoaderMacOS.cpp
   DynamicLoaderDarwin.cpp
+  DynamicLoaderDarwinProperties.cpp
 
   LINK_LIBS
 lldbBreakpoint
@@ -16,3 +25,7 @@ add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN
 Support
 TargetParser
   )
+
+add_dependencies(lldbPluginDynamicLoaderMacOSXDYLD
+  LLDBPluginDynamicLoaderDarwinPropertiesGen
+  LLDBPluginDynamicLoaderDarwinPropertiesEnumGen)
diff --git 
a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 30242038a5f66f..3d57a10a196c11 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -8,6 +8,7 @@
 
 #include "DynamicLoaderDarwin.h"
 
+#include "DynamicLoaderDarwinProperties.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
@@ -31,6 +32,7 @@
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/State.h"
+#include "llvm/Support/ThreadPool.h"
 
 #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
@@ -77,6 +79,17 @@ void DynamicLoaderDarwin::DidLaunch() {
   SetNotificationBreakpoint();
 }
 
+void DynamicLoaderDarwin::CreateSettings(lldb_private::Debugger &debugger) {
+  if (!PluginManager::GetSettingForDynamicLoaderPlugin(
+  debugger, DynamicLoaderDarwinProperties::GetSettingName())) {
+const bool is_global_setting = true;
+PluginManager::CreateSettingForDynamicLoaderPlugin(
+debugger,
+DynamicLoaderDarwinProperties::GetGlobal().GetValueProperties(),
+"Properties for the DynamicLoaderDarwin plug-in.", is_global_setting);
+  }
+}
+
 // Clear out the state of this class.
 void DynamicLoaderDarwin::Clear(bool clear_process) {
   std::lock_guard guard(m_mutex);
@@ -88,7 +101,7 @@ void DynamicLoaderDarwin::Clear(bool clear_process) {
 }
 
 ModuleSP DynamicLoaderDarwin::FindTargetModuleForImageInfo(
-ImageInfo &image_info, bool can_create, bool *did_create_ptr) {
+const ImageInfo &image_info, bool can_create, bool *did_create_ptr) {
   if (did_create_ptr)
 *did_create_ptr = false;
 
@@ -642,6 +655,41 @@ ModuleSP DynamicLoaderDarwin::GetDYLDModule() {
 
 void DynamicLoaderDarwin::ClearDYLDModule() { m_dyld_module_wp.reset(); }
 
+template 
+static std::vector parallel_map(
+llvm::ThreadPoolInterface &threadPool, InputIterator first,
+InputIterator last,
+llvm::function_ref::value_type &)>
+transform) {
+  const auto size = std::distance(first, last);
+  std::vector results(size);
+  if (size > 0) {
+llvm::ThreadPoolTaskGroup taskGroup(threadPool);
+auto it = first;
+for (ssize_t i = 0; i < size; ++i, ++it) {
+  taskGroup.async([&, i, it]() { results[i] = transform(*it); });
+}
+taskGroup.wait();
+  }
+  return results;
+}
+
+template 
+static std::vector
+map(InputIterator first, InputIterator last,
+llvm::function_ref::value_ty

[Lldb-commits] [lldb] [lldb] Escape ? for zsh (PR #112107)

2024-10-14 Thread Keith Smiley via lldb-commits

keith wrote:

hmm good point. I wonder if the fix here should be around surfacing the error 
to users then, so they know they have to escape it depending on their use case

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


[Lldb-commits] [lldb] [lldb] Log errors to the system log if they would otherwise get dropped (PR #111911)

2024-10-14 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Let me try to provide a bit more context. Darwin has the concept of a 
[sysdiagnose](https://it-training.apple.com/tutorials/support/sup075/). It's 
essentially an archive with diagnostic files, including crashlogs and a dump of 
the last few minutes of the system log. On our platform, the majority of bug 
reports (feedback reports/radars) are accompanied by a sysdiagnose. We already 
rely heavily on them for crashes (crashlogs for `lldb` and `debugserver`) and 
logging in `debugserver` (which logs to the system log). I want to start using 
this for logging from `lldb` as well. 

As I mentioned in #108495, Swift was already doing something similar, and we've 
found this to be extremely useful. To give a concrete example, the Swift fork 
starts by logging the used lldb version to the system log. We've found that 
this was a lot  more reliable than trusting the version reported by the user, 
if they mention a version in their bug report at all. When there's a 
sysdiagnose attached, we don't have to send the bug back, asking for more 
information. My goal for the always-on log channel (which logs to the system 
log) is to log high-value/low-bandwidth information. 

Separately, we had a few instances recently where we received bug reports that 
were hard to investigate and where we discovered that deep down we had created 
a meaningful Error (which would've told us the problem right away) but got 
dropped somewhere or at least not shown to the user. @adrian-prantl has put up 
several patches to propagate those errors. The goal of this patch is to catch 
those errors so we can quickly spot them in the sysdiagnose. To be clear, the 
goal is not to rely on that, but to save us from having to spend two days 
debugging LLDB when we could've spotted the issue from a dropped error right 
away, and use that time instead to improve LLDB and propagate the error to the 
user. 

Although this is all motivated by sysdiagnoses, I didn't want to do something 
too bespoke for our platform and want to be able to reuse the existing logging 
infrastructure. I figured this might be useful on Linux as well, but as I'm 
hearing more about how the system log is used there, I think it's much less 
appealing. I'm starting to wonder if we should just make the system log a NOOP 
on Linux too like we did on Windows and make the system log in LLDB and


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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Alex Langford via lldb-commits


@@ -123,30 +123,79 @@ void CommandReturnObject::SetError(llvm::Error error) {
   }
 }
 
-llvm::StringRef
-CommandReturnObject::GetInlineDiagnosticString(unsigned indent) {
-  RenderDiagnosticDetails(m_diag_stream, indent, true, m_diagnostics);
+std::string CommandReturnObject::GetInlineDiagnosticString(unsigned indent) {
+  StreamString diag_stream(m_colors);
+  RenderDiagnosticDetails(diag_stream, indent, true, m_diagnostics);
   // Duplex the diagnostics to the secondary stream (but not inlined).
-  if (auto stream_sp = m_err_stream.GetStreamAtIndex(eStreamStringIndex))
+  if (auto stream_sp = m_err_stream.GetStreamAtIndex(eImmediateStreamIndex))
 RenderDiagnosticDetails(*stream_sp, std::nullopt, false, m_diagnostics);
 
-  // Clear them so GetErrorData() doesn't render them again.
-  m_diagnostics.clear();
-  return m_diag_stream.GetString();
+  return diag_stream.GetString().str();
 }
 
-llvm::StringRef CommandReturnObject::GetErrorString() {
-  // Diagnostics haven't been fetched; render them now (not inlined).
-  if (!m_diagnostics.empty()) {
-RenderDiagnosticDetails(GetErrorStream(), std::nullopt, false,
-m_diagnostics);
-m_diagnostics.clear();
-  }
+std::string CommandReturnObject::GetErrorString(bool with_diagnostics) {
+  StreamString stream(m_colors);
+  if (with_diagnostics)
+RenderDiagnosticDetails(stream, std::nullopt, false, m_diagnostics);
 
   lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
   if (stream_sp)
-return std::static_pointer_cast(stream_sp)->GetString();
-  return llvm::StringRef();
+stream << std::static_pointer_cast(stream_sp)->GetString();
+  return stream.GetString().str();
+}
+
+StructuredData::ObjectSP CommandReturnObject::GetErrorData() {
+  auto make_array = []() { return std::make_unique(); };
+  auto make_bool = [](bool b) {
+return std::make_unique(b);
+  };
+  auto make_dict = []() {
+return std::make_unique();
+  };
+  auto make_int = [](unsigned i) {
+return std::make_unique(i);
+  };
+  auto make_string = [](llvm::StringRef s) {
+return std::make_unique(s);
+  };
+  auto dict_up = make_dict();
+  dict_up->AddItem("version", make_int(1));
+  auto array_up = make_array();
+  for (const DiagnosticDetail &diag : m_diagnostics) {
+auto detail_up = make_dict();
+if (auto &sloc = diag.source_location) {
+  auto sloc_up = make_dict();
+  sloc_up->AddItem("file", make_string(sloc->file.GetPath()));
+  sloc_up->AddItem("line", make_int(sloc->line));
+  sloc_up->AddItem("length", make_int(sloc->length));
+  sloc_up->AddItem("hidden", make_bool(sloc->hidden));
+  sloc_up->AddItem("in_user_input", make_bool(sloc->in_user_input));
+  detail_up->AddItem("source_location", std::move(sloc_up));
+}
+llvm::StringRef severity = "unknown";
+switch (diag.severity) {
+case lldb::eSeverityError:
+  severity = "error";
+  break;
+case lldb::eSeverityWarning:
+  severity = "warning";
+  break;
+case lldb::eSeverityInfo:
+  severity = "note";

bulbazord wrote:

Why is the severity for "Info" written as "note"? Is there precedent here that 
I'm unaware of?

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Alex Langford via lldb-commits


@@ -3187,11 +3185,12 @@ void 
CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
io_handler.GetFlags().Test(eHandleCommandFlagPrintResult)) ||
   io_handler.GetFlags().Test(eHandleCommandFlagPrintErrors)) {
 // Display any inline diagnostics first.
-if (!result.GetImmediateErrorStream() &&
-GetDebugger().GetShowInlineDiagnostics()) {
+bool inline_diagnostics = !result.GetImmediateErrorStream() &&

bulbazord wrote:

nit: `const` this?

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Alex Langford via lldb-commits


@@ -2636,20 +2636,18 @@ void CommandInterpreter::HandleCommands(const 
StringList &commands,
 }
 
 if (!success || !tmp_result.Succeeded()) {
-  llvm::StringRef error_msg = tmp_result.GetErrorString();
+  std::string error_msg = tmp_result.GetErrorString();
   if (error_msg.empty())
 error_msg = ".\n";
   if (options.GetStopOnError()) {
-result.AppendErrorWithFormat(
-"Aborting reading of commands after command #%" PRIu64
-": '%s' failed with %s",
-(uint64_t)idx, cmd, error_msg.str().c_str());
+result.AppendErrorWithFormatv("Aborting reading of commands after "
+  "command #{0}: '{1}' failed with {2}",
+  (uint64_t)idx, cmd, error_msg);
 m_debugger.SetAsyncExecution(old_async_execution);
 return;
   } else if (options.GetPrintResults()) {
-result.AppendMessageWithFormat(
-"Command #%" PRIu64 " '%s' failed with %s", (uint64_t)idx + 1, cmd,
-error_msg.str().c_str());
+result.AppendMessageWithFormatv("Command #{0} '{1}' failed with {1}",

bulbazord wrote:

The format string is incorrect. You have `{1}` twice when the second one should 
be `{2}`

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


[Lldb-commits] [lldb] [llvm] [lldb] Move SBLanguages.h out of API tree (PR #111929)

2024-10-14 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben updated 
https://github.com/llvm/llvm-project/pull/111929

>From 5744d94fa7aaa8e8a800f929dfaf6baeb5670e03 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Mon, 14 Oct 2024 10:41:36 -0700
Subject: [PATCH] [lldb] Move SBLanguages.h out of API tree

This patch moves `SBLanguages.h` out of the API tree. This file gets
generated at build time using DWARF table-gen file and contains an
enumeration of the DWARF supported source language names and there
respective code/identifier.

Since this is an enum, this shouldn't be part of the API tree but rather
it should be included in the `lldb-enumeration` header.

Also, that enum was used in internal methods in `lldb_private` by
down-casting the enum value type to an `uint16_t`.
This patch changes that by making those internal methods use the enum
type.

This should address the feedbacks from #111907.

Signed-off-by: Med Ismail Bennani 
---
 lldb/bindings/CMakeLists.txt  |  2 +-
 lldb/bindings/headers.swig|  1 -
 lldb/bindings/interfaces.swig |  1 -
 lldb/cmake/modules/LLDBFramework.cmake|  2 +-
 lldb/include/lldb/API/LLDB.h  |  1 -
 lldb/include/lldb/API/SBDefines.h |  2 ++
 lldb/include/lldb/API/SBExpressionOptions.h   |  1 -
 lldb/include/lldb/Target/Target.h |  2 +-
 lldb/include/lldb/lldb-enumerations.h |  2 ++
 lldb/include/lldb/lldb-private-types.h| 11 +-
 lldb/scripts/generate-sbapi-dwarf-enum.py | 10 +-
 lldb/source/API/CMakeLists.txt| 20 +--
 lldb/source/API/SBFrame.cpp   |  6 +++---
 .../Clang/ClangUserExpression.cpp | 13 
 lldb/source/Target/Language.cpp   | 19 ++
 .../lldb/include/lldb/{API => }/BUILD.gn  |  4 ++--
 .../llvm-project-overlay/lldb/BUILD.bazel |  2 +-
 17 files changed, 54 insertions(+), 45 deletions(-)
 rename llvm/utils/gn/secondary/lldb/include/lldb/{API => }/BUILD.gn (72%)

diff --git a/lldb/bindings/CMakeLists.txt b/lldb/bindings/CMakeLists.txt
index bec694e43bd7be..befc5c9e9afc15 100644
--- a/lldb/bindings/CMakeLists.txt
+++ b/lldb/bindings/CMakeLists.txt
@@ -3,7 +3,7 @@ file(GLOB_RECURSE SWIG_SOURCES *.swig)
 file(GLOB SWIG_HEADERS
   ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
   ${LLDB_SOURCE_DIR}/include/lldb/*.h
-  ${LLDB_BINARY_DIR}/include/lldb/API/SBLanguages.h
+  ${LLDB_BINARY_DIR}/include/lldb/SourceLanguageNames.h
 )
 file(GLOB SWIG_PRIVATE_HEADERS
   ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h
diff --git a/lldb/bindings/headers.swig b/lldb/bindings/headers.swig
index c0dde905f986bd..2420ea4aab843a 100644
--- a/lldb/bindings/headers.swig
+++ b/lldb/bindings/headers.swig
@@ -39,7 +39,6 @@
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBInstruction.h"
 #include "lldb/API/SBInstructionList.h"
-#include "lldb/API/SBLanguages.h"
 #include "lldb/API/SBLanguageRuntime.h"
 #include "lldb/API/SBLaunchInfo.h"
 #include "lldb/API/SBLineEntry.h"
diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig
index 8a6fed95f0b729..e48e875367f7c4 100644
--- a/lldb/bindings/interfaces.swig
+++ b/lldb/bindings/interfaces.swig
@@ -120,7 +120,6 @@
 %include "lldb/API/SBHostOS.h"
 %include "lldb/API/SBInstruction.h"
 %include "lldb/API/SBInstructionList.h"
-%include "lldb/API/SBLanguages.h"
 %include "lldb/API/SBLanguageRuntime.h"
 %include "lldb/API/SBLaunchInfo.h"
 %include "lldb/API/SBLineEntry.h"
diff --git a/lldb/cmake/modules/LLDBFramework.cmake 
b/lldb/cmake/modules/LLDBFramework.cmake
index 471aeaaad3c0d3..0daff8b3e07e2b 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -71,7 +71,7 @@ endif()
 # At configuration time, collect headers for the framework bundle and copy them
 # into a staging directory. Later we can copy over the entire folder.
 file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
-set(generated_public_headers ${LLDB_OBJ_DIR}/include/lldb/API/SBLanguages.h)
+set(generated_public_headers 
${LLDB_OBJ_DIR}/include/lldb/SourceLanguageNames.h)
 file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
 file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
 list(REMOVE_ITEM root_public_headers ${root_private_headers})
diff --git a/lldb/include/lldb/API/LLDB.h b/lldb/include/lldb/API/LLDB.h
index 40368e036e0e40..8884b21a40120f 100644
--- a/lldb/include/lldb/API/LLDB.h
+++ b/lldb/include/lldb/API/LLDB.h
@@ -42,7 +42,6 @@
 #include "lldb/API/SBInstruction.h"
 #include "lldb/API/SBInstructionList.h"
 #include "lldb/API/SBLanguageRuntime.h"
-#include "lldb/API/SBLanguages.h"
 #include "lldb/API/SBLaunchInfo.h"
 #include "lldb/API/SBLineEntry.h"
 #include "lldb/API/SBListener.h"
diff --git a/lldb/include/lldb/API/SBDefines.h 
b/lldb/include/lldb/API/SBDefines.h
index 159a9ba799b181..3951fc17c40057 100644
--- a/lldb/include/lldb/API/SBDef

[Lldb-commits] [lldb] [llvm] [lldb] Move SBLanguages.h out of API tree (PR #111929)

2024-10-14 Thread Alex Langford via lldb-commits


@@ -136,6 +136,8 @@ class LLDB_API SBWatchpoint;
 class LLDB_API SBWatchpointOptions;
 class LLDB_API SBUnixSignals;
 
+typedef SourceLanguageName SBSourceLanguageName;

bulbazord wrote:

I'm not sure a typedef is enough here. It ends up being little more than 
syntactic sugar, the final symbol will still contain `SourceLanguageName` 
instead of `SBSourceLanguageName`. To verify this, you can perform a build with 
this patch and search for `SBExpressionOptions::SetLanguage` and make sure it 
still retains the `SBSourceLanguageName` symbol.

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


[Lldb-commits] [clang] [lldb] [llvm] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-10-14 Thread Yingwei Zheng via lldb-commits

https://github.com/dtcxzyw commented:

Middle-end/CodeGen/RISC-V changes LGTM.

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


[Lldb-commits] [lldb] [lldb] Make the system log a NOOP on Windows (PR #112052)

2024-10-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Merging to fix our Windows bot.

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


[Lldb-commits] [lldb] 3dedcab - [lldb] Make the system log a NOOP on Windows (#112052)

2024-10-14 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-14T15:02:02+01:00
New Revision: 3dedcab6d9b660a690d8fe5ddad3d43276a82708

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

LOG: [lldb] Make the system log a NOOP on Windows (#112052)

Windows doesn't have a built-in system log. Previously we got away with
writing to stdout and stderr because it was used only sporadically. As
we're trying to make the system log more useful on the other platforms,
the increased use become a concern. Make it a NOOP until someone figures
out a reasonable alternative.

Added: 


Modified: 
lldb/source/Host/common/Host.cpp

Removed: 




diff  --git a/lldb/source/Host/common/Host.cpp 
b/lldb/source/Host/common/Host.cpp
index abca6068d3604a..6857a29b039902 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -111,17 +111,7 @@ void Host::SystemLog(Severity severity, llvm::StringRef 
message) {
   syslog(level, "%s", message.data());
 }
 #else
-void Host::SystemLog(Severity severity, llvm::StringRef message) {
-  switch (severity) {
-  case lldb::eSeverityInfo:
-  case lldb::eSeverityWarning:
-llvm::outs() << message;
-break;
-  case lldb::eSeverityError:
-llvm::errs() << message;
-break;
-  }
-}
+void Host::SystemLog(Severity severity, llvm::StringRef message) {}
 #endif
 #endif
 



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


[Lldb-commits] [clang] [lldb] [llvm] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-10-14 Thread Nikita Popov via lldb-commits

https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/80309

>From ab1d3f23ee1a8402403a61038effb9bb15c91a13 Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Thu, 19 Sep 2024 17:27:13 +0200
Subject: [PATCH] apint only

---
 clang/lib/AST/ByteCode/IntegralAP.h   |  6 ++--
 clang/lib/CodeGen/CGVTT.cpp   |  5 +--
 clang/lib/CodeGen/ItaniumCXXABI.cpp   |  5 +--
 clang/lib/Parse/ParseInit.cpp |  4 ++-
 clang/lib/Sema/SemaExpr.cpp   |  7 ++--
 clang/lib/Sema/SemaOpenMP.cpp |  4 ++-
 lldb/source/Expression/DWARFExpression.cpp|  7 ++--
 llvm/include/llvm/ADT/APFixedPoint.h  |  4 ++-
 llvm/lib/Analysis/ConstantFolding.cpp |  3 +-
 llvm/lib/Analysis/Loads.cpp   |  6 ++--
 llvm/lib/Analysis/MemoryBuiltins.cpp  |  2 ++
 llvm/lib/Analysis/ScalarEvolution.cpp |  2 +-
 llvm/lib/Bitcode/Reader/BitcodeReader.cpp |  3 +-
 .../lib/CodeGen/SelectionDAG/SelectionDAG.cpp |  5 ++-
 .../SelectionDAG/SelectionDAGBuilder.cpp  |  3 +-
 .../CodeGen/SelectionDAG/SelectionDAGISel.cpp |  8 +++--
 .../CodeGen/SelectionDAG/TargetLowering.cpp   |  8 +++--
 llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp  |  2 +-
 llvm/lib/IR/Constants.cpp |  4 ++-
 .../Target/AArch64/AArch64ISelLowering.cpp| 32 +--
 llvm/lib/Target/AMDGPU/SIInstrInfo.cpp|  3 +-
 .../Target/AMDGPU/SIShrinkInstructions.cpp|  4 +--
 .../lib/Target/ARM/AsmParser/ARMAsmParser.cpp |  4 ++-
 .../Hexagon/HexagonConstPropagation.cpp   |  3 +-
 llvm/lib/Target/Hexagon/HexagonGenExtract.cpp |  2 +-
 llvm/lib/Target/RISCV/RISCVISelLowering.cpp   |  4 ++-
 llvm/lib/Target/X86/X86ISelLowering.cpp   |  6 ++--
 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp |  3 +-
 llvm/lib/Transforms/Utils/SimplifyCFG.cpp |  2 +-
 llvm/unittests/ADT/APFixedPointTest.cpp   |  9 +++---
 30 files changed, 99 insertions(+), 61 deletions(-)

diff --git a/clang/lib/AST/ByteCode/IntegralAP.h 
b/clang/lib/AST/ByteCode/IntegralAP.h
index a4d656433344b7..6ab3d09ec85d5b 100644
--- a/clang/lib/AST/ByteCode/IntegralAP.h
+++ b/clang/lib/AST/ByteCode/IntegralAP.h
@@ -61,7 +61,7 @@ template  class IntegralAP final {
 
   IntegralAP(APInt V) : V(V) {}
   /// Arbitrary value for uninitialized variables.
-  IntegralAP() : IntegralAP(-1, 3) {}
+  IntegralAP() : IntegralAP(Signed ? -1 : 7, 3) {}
 
   IntegralAP operator-() const { return IntegralAP(-V); }
   IntegralAP operator-(const IntegralAP &Other) const {
@@ -112,7 +112,9 @@ template  class IntegralAP final {
 
   template 
   static IntegralAP from(Integral I, unsigned BitWidth) {
-APInt Copy = APInt(BitWidth, static_cast(I), InputSigned);
+// TODO: Avoid implicit trunc?
+APInt Copy = APInt(BitWidth, static_cast(I), InputSigned,
+   /*implicitTrunc=*/true);
 
 return IntegralAP(Copy);
   }
diff --git a/clang/lib/CodeGen/CGVTT.cpp b/clang/lib/CodeGen/CGVTT.cpp
index 20bd2c2fc2c642..989a07d09d50ee 100644
--- a/clang/lib/CodeGen/CGVTT.cpp
+++ b/clang/lib/CodeGen/CGVTT.cpp
@@ -85,8 +85,9 @@ CodeGenVTables::EmitVTTDefinition(llvm::GlobalVariable *VTT,
  cast(VTable->getValueType())
  ->getElementType(AddressPoint.VTableIndex));
  unsigned Offset = ComponentSize * AddressPoint.AddressPointIndex;
- llvm::ConstantRange InRange(llvm::APInt(32, -Offset, true),
- llvm::APInt(32, VTableSize - Offset, true));
+ llvm::ConstantRange InRange(
+ llvm::APInt(32, (int)-Offset, true),
+ llvm::APInt(32, (int)(VTableSize - Offset), true));
  llvm::Constant *Init = llvm::ConstantExpr::getGetElementPtr(
  VTable->getValueType(), VTable, Idxs, /*InBounds=*/true, InRange);
 
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp 
b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 75dab596e1b2c4..5bb0765cb0249c 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -2099,8 +2099,9 @@ ItaniumCXXABI::getVTableAddressPoint(BaseSubobject Base,
   unsigned VTableSize =
   ComponentSize * Layout.getVTableSize(AddressPoint.VTableIndex);
   unsigned Offset = ComponentSize * AddressPoint.AddressPointIndex;
-  llvm::ConstantRange InRange(llvm::APInt(32, -Offset, true),
-  llvm::APInt(32, VTableSize - Offset, true));
+  llvm::ConstantRange InRange(
+  llvm::APInt(32, (int)-Offset, true),
+  llvm::APInt(32, (int)(VTableSize - Offset), true));
   return llvm::ConstantExpr::getGetElementPtr(
   VTable->getValueType(), VTable, Indices, /*InBounds=*/true, InRange);
 }
diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp
index 0a9a359cdaf979..e7c8d79ac3 100644
--- a/clang/lib/Parse/ParseInit.cpp
+++ b/clang/lib/Parse/ParseInit.cpp
@@ -437,7 +437,9 @@ ExprResult Parser::createEmbedExpr() {
   SourceLocation StartLoc = ConsumeAnnotationToken();
   if (Data->BinaryData.s

[Lldb-commits] [clang] [lldb] [llvm] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-10-14 Thread Nikita Popov via lldb-commits

nikic wrote:

Ping. The PR no longer contains MLIR changes now.

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


[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)

2024-10-14 Thread Pavel Labath via lldb-commits

labath wrote:

> Should it work?

It should, and I suspect (I haven't seen the error msg, do you have a link?) 
that the problem isn't in this part of the code. If I had to guess, I'd say 
that this is failing because macos generates slightly different packet 
sequences, and the test is not expecting those.

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


[Lldb-commits] [clang] [lldb] [llvm] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-10-14 Thread Yingwei Zheng via lldb-commits

dtcxzyw wrote:

`APInt::getAllOnes` will assert if `BitWidth == 0`.
```
[--] 6 tests from APFloatTest
[ RUN  ] APFloatTest.MinimumNumber
[   OK ] APFloatTest.MinimumNumber (0 ms)
[ RUN  ] APFloatTest.Float8E8M0FNUValues
ADTTests: 
/home/dtcxzyw/WorkSpace/Projects/compilers/llvm-project/llvm/include/llvm/ADT/APInt.h:116:
 llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `val == 0 && 
"Value must be zero for 0-bit APInt"' failed.
 #0 0x77e15c32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0x215c32)
 #1 0x77e12aff llvm::sys::RunSignalHandlers() 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0x212aff)
 #2 0x77e12c45 SignalHandler(int) Signals.cpp:0:0
 #3 0x77442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x774969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x774969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x774969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x77442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x774287f3 abort ./stdlib/abort.c:81:7
 #9 0x7742871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x77439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x77c97cb6 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0x97cb6)
#12 0x77c98b83 llvm::detail::IEEEFloat::makeNaN(bool, bool, llvm::APInt 
const*) 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0x98b83)
#13 0x77c9e019 
llvm::detail::IEEEFloat::convertFromStringSpecials(llvm::StringRef) 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0x9e019)
#14 0x77caef9d 
llvm::detail::IEEEFloat::convertFromString(llvm::StringRef, llvm::RoundingMode) 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0xaef9d)
#15 0x77caf4f6 llvm::APFloat::APFloat(llvm::fltSemantics const&, 
llvm::StringRef) 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libLLVMSupport.so.20.0git+0xaf4f6)
#16 0x5585e240 (anonymous 
namespace)::APFloatTest_Float8E8M0FNUValues_Test::TestBody() APFloatTest.cpp:0:0
#17 0x77f6e9d1 void 
testing::internal::HandleExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libllvm_gtest.so.20.0git+0x569d1)
#18 0x77f6ef2a testing::Test::Run() (.part.0) gtest-all.cc:0:0
#19 0x77f6fc02 testing::TestInfo::Run() 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libllvm_gtest.so.20.0git+0x57c02)
#20 0x77f721e9 testing::TestSuite::Run() (.part.0) gtest-all.cc:0:0
#21 0x77f7c18b testing::internal::UnitTestImpl::RunAllTests() 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libllvm_gtest.so.20.0git+0x6418b)
#22 0x77f6e441 testing::UnitTest::Run() 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libllvm_gtest.so.20.0git+0x56441)
#23 0x77fb71cc main 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/lib/libllvm_gtest_main.so.20.0git+0x11cc)
#24 0x77429d90 __libc_start_call_main 
./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#25 0x77429e40 call_init ./csu/../csu/libc-start.c:128:20
#26 0x77429e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#27 0x557b7075 _start 
(/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/unittests/ADT/./ADTTests+0x263075)
```
Would be better to handle this corner case in `IEEEFloat::makeNaN`:
https://github.com/llvm/llvm-project/blob/81fee740d073640c79c0d45a8e8e804c1c5fea40/llvm/lib/Support/APFloat.cpp#L966


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


[Lldb-commits] [lldb] a89e016 - [lldb] Improve unwinding for discontinuous functions (#111409)

2024-10-14 Thread via lldb-commits

Author: Pavel Labath
Date: 2024-10-14T18:56:37+02:00
New Revision: a89e01634fe2e6ce0b967ead24280b6693b523dc

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

LOG: [lldb] Improve unwinding for discontinuous functions (#111409)

Currently, our unwinder assumes that the functions are continuous (or at
least, that there are no functions which are "in the middle" of other
functions). Neither of these assumptions is true for functions optimized
by tools like propeller and (probably) bolt.

While there are many things that go wrong for these functions, the
biggest damage is caused by the unwind plan caching code, which
currently takes the maximalist extent of the function and assumes that
the unwind plan we get for that is going to be valid for all code inside
that range. If a part of the function has been moved into a "cold"
section, then the range of the function can be many megabytes, meaning
that any function within that range will probably fail to unwind.

We end up with this maximalist range because the unwinder asks for the
Function object for its range. This is only one of the strategies for
determining the range, but it is the first one -- and also the most
incorrect one. The second choice would is asking the eh_frame section
for the range of the function, and this one returns something reasonable
here (the address range of the current function fragment) -- which it
does because each fragment gets its own eh_frame entry (it has to,
because they have to be continuous).

With this in mind, this patch moves the eh_frame (and debug_frame) to
the front of the queue. I think that preferring this range makes sense
because eh_frame is one of the unwind plans that we return, and some
others (augmented eh_frame) are based on it. In theory this could break
some functions, where the debug info and eh_frame disagree on the extent
of the function (and eh_frame is the one who's wrong), but I don't know
of any such scenarios.

Added: 
lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
lldb/test/Shell/Unwind/Inputs/linux-x86_64.yaml
lldb/test/Shell/Unwind/basic-block-sections-with-dwarf-static.test
lldb/test/Shell/Unwind/basic-block-sections-with-dwarf.test

Modified: 
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Symbol/UnwindTable.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index e950fb346c253b..9a4a17eaa124ce 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3583,10 +3583,12 @@ class CommandObjectTargetModulesShowUnwind : public 
CommandObjectParsed {
   addr_t start_addr = range.GetBaseAddress().GetLoadAddress(target);
   if (abi)
 start_addr = abi->FixCodeAddress(start_addr);
+  range.GetBaseAddress().SetLoadAddress(start_addr, target);
 
   FuncUnwindersSP func_unwinders_sp(
   sc.module_sp->GetUnwindTable()
-  .GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
+  
.GetUncachedFuncUnwindersContainingAddress(range.GetBaseAddress(),
+ sc));
   if (!func_unwinders_sp)
 continue;
 

diff  --git a/lldb/source/Symbol/UnwindTable.cpp 
b/lldb/source/Symbol/UnwindTable.cpp
index da88b0c9c4ea19..42ab7ba95b9e6c 100644
--- a/lldb/source/Symbol/UnwindTable.cpp
+++ b/lldb/source/Symbol/UnwindTable.cpp
@@ -99,12 +99,6 @@ UnwindTable::GetAddressRange(const Address &addr, const 
SymbolContext &sc) {
   m_object_file_unwind_up->GetAddressRange(addr, range))
 return range;
 
-  // Check the symbol context
-  if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
- false, range) &&
-  range.GetBaseAddress().IsValid())
-return range;
-
   // Does the eh_frame unwind info has a function bounds for this addr?
   if (m_eh_frame_up && m_eh_frame_up->GetAddressRange(addr, range))
 return range;
@@ -113,6 +107,12 @@ UnwindTable::GetAddressRange(const Address &addr, const 
SymbolContext &sc) {
   if (m_debug_frame_up && m_debug_frame_up->GetAddressRange(addr, range))
 return range;
 
+  // Check the symbol context
+  if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
+ false, range) &&
+  range.GetBaseAddress().IsValid())
+return range;
+
   return std::nullopt;
 }
 

diff  --git a/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s 
b/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
new file mode 100644
index 00..c405e51c227cb6
--- /dev/null
+++ b/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
@@ -0,0 +1,256 @@
+# An example of

[Lldb-commits] [lldb] [lldb] Improve unwinding for discontinuous functions (PR #111409)

2024-10-14 Thread Pavel Labath via lldb-commits

labath wrote:

Yeah, I plan to look into Function::GetAddressRange and see how we can make it 
do something reasonable for these kinds of functions (probably by having it 
return a list of ranges). That will likely involve looking at the users of that 
API as well, although I'm less than enthusiastic about making this work with 
the instruction scanner -- the reason for that (at least for our use case) I 
don't see much use for it. We already have tools (like profilers) which rely on 
the correctness of unwind info (even in the async case), so I don't think we 
gain much by using it. Clang already produces correct eh_frame for these 
discontinuous functions (for x86 at least, we're in the process of fixing 
aarch64), and hand-written functions are not likely to be split, and even if 
they are, unless the user writes correct debug info for them, we won't be able 
to detect that they are split. At that point the user might as well write the 
eh_frame section as well...

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


[Lldb-commits] [lldb] [lldb] Improve unwinding for discontinuous functions (PR #111409)

2024-10-14 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] DynamicLoaderDarwin load images in parallel with preload (PR #110646)

2024-10-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitrii Galimzianov (DmT021)


Changes

This is another approach to the goal described in [this 
PR](https://github.com/llvm/llvm-project/pull/110439). This PR is provided just 
for convenience.

---

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


9 Files Affected:

- (modified) lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt (+13) 
- (modified) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+100-30) 
- (modified) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h (+17-6) 
- (added) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.cpp 
(+53) 
- (added) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.h 
(+34) 
- (added) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.td 
(+8) 
- (modified) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp (+6-4) 
- (modified) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
(+10-3) 
- (modified) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h (+2) 


``diff
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
index 7308374c8bfba6..77a560541fcb1f 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
@@ -1,7 +1,16 @@
+lldb_tablegen(DynamicLoaderDarwinProperties.inc -gen-lldb-property-defs
+  SOURCE DynamicLoaderDarwinProperties.td
+  TARGET LLDBPluginDynamicLoaderDarwinPropertiesGen)
+
+lldb_tablegen(DynamicLoaderDarwinPropertiesEnum.inc 
-gen-lldb-property-enum-defs
+  SOURCE DynamicLoaderDarwinProperties.td
+  TARGET LLDBPluginDynamicLoaderDarwinPropertiesEnumGen)
+
 add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN
   DynamicLoaderMacOSXDYLD.cpp
   DynamicLoaderMacOS.cpp
   DynamicLoaderDarwin.cpp
+  DynamicLoaderDarwinProperties.cpp
 
   LINK_LIBS
 lldbBreakpoint
@@ -16,3 +25,7 @@ add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN
 Support
 TargetParser
   )
+
+add_dependencies(lldbPluginDynamicLoaderMacOSXDYLD
+  LLDBPluginDynamicLoaderDarwinPropertiesGen
+  LLDBPluginDynamicLoaderDarwinPropertiesEnumGen)
diff --git 
a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 30242038a5f66f..c6a59d9e87a46b 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -8,6 +8,7 @@
 
 #include "DynamicLoaderDarwin.h"
 
+#include "DynamicLoaderDarwinProperties.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
@@ -31,6 +32,7 @@
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/State.h"
+#include "llvm/Support/ThreadPool.h"
 
 #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
@@ -77,6 +79,17 @@ void DynamicLoaderDarwin::DidLaunch() {
   SetNotificationBreakpoint();
 }
 
+void DynamicLoaderDarwin::CreateSettings(lldb_private::Debugger &debugger) {
+  if (!PluginManager::GetSettingForDynamicLoaderPlugin(
+  debugger, DynamicLoaderDarwinProperties::GetSettingName())) {
+const bool is_global_setting = true;
+PluginManager::CreateSettingForDynamicLoaderPlugin(
+debugger,
+DynamicLoaderDarwinProperties::GetGlobal().GetValueProperties(),
+"Properties for the DynamicLoaderDarwin plug-in.", is_global_setting);
+  }
+}
+
 // Clear out the state of this class.
 void DynamicLoaderDarwin::Clear(bool clear_process) {
   std::lock_guard guard(m_mutex);
@@ -88,7 +101,7 @@ void DynamicLoaderDarwin::Clear(bool clear_process) {
 }
 
 ModuleSP DynamicLoaderDarwin::FindTargetModuleForImageInfo(
-ImageInfo &image_info, bool can_create, bool *did_create_ptr) {
+const ImageInfo &image_info, bool can_create, bool *did_create_ptr) {
   if (did_create_ptr)
 *did_create_ptr = false;
 
@@ -517,8 +530,8 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo(
   return true;
 }
 
-void DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos(
-ImageInfo::collection &image_infos) {
+void DynamicLoaderDarwin::UpdateSpecialBinariesFromPreloadedModules(
+std::vector> &images) {
   uint32_t exe_idx = UINT32_MAX;
   uint32_t dyld_idx = UINT32_MAX;
   Target &target = m_process->GetTarget();
@@ -526,35 +539,34 @@ void 
DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos(
   ConstString g_dyld_sim_filename("dyld_sim");
 
   ArchSpec target_arch = target.GetArchitecture();
-  const size_t image_infos_size = image_infos.size();
-  for (

[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Med Ismail Bennani via lldb-commits

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

LGTM with comments.

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Med Ismail Bennani via lldb-commits


@@ -45,13 +45,14 @@ class LLDB_API SBCommandReturnObject {
   const char *GetOutput();
 
   const char *GetError();
+  SBStructuredData GetErrorData();
 
 #ifndef SWIG
   LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)",
 "PutOutput(SBFile)")
   size_t PutOutput(FILE *fh);
 #endif
-
+\

medismailben wrote:

Typo ?

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Med Ismail Bennani via lldb-commits




medismailben wrote:

ditto (line returns)

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Med Ismail Bennani via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Med Ismail Bennani via lldb-commits


@@ -485,35 +485,8 @@ bool 
CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
 
 result.SetStatus(eReturnStatusSuccessFinishResult);
   } else {
-// Retrieve the diagnostics.
-std::vector details;
-llvm::consumeError(llvm::handleErrors(
-result_valobj_sp->GetError().ToError(),
-[&](DiagnosticError &error) { details = error.GetDetails(); }));
-// Find the position of the expression in the command.
-std::optional expr_pos;
-size_t nchar = m_original_command.find(expr);
-if (nchar != std::string::npos)
-  expr_pos = nchar + GetDebugger().GetPrompt().size();
-
-if (!details.empty()) {
-  bool show_inline =
-  GetDebugger().GetShowInlineDiagnostics() && !expr.contains('\n');
-  RenderDiagnosticDetails(error_stream, expr_pos, show_inline, 
details);
-} else {
-  const char *error_cstr = result_valobj_sp->GetError().AsCString();
-  llvm::StringRef error(error_cstr);
-  if (!error.empty()) {
-if (!error.starts_with("error:"))
-  error_stream << "error: ";
-error_stream << error;
-if (!error.ends_with('\n'))
-  error_stream.EOL();
-  } else {
-error_stream << "error: unknown error\n";
-  }
-}
 result.SetStatus(eReturnStatusFailed);
+result.SetError(result_valobj_sp->GetError().ToError());

medismailben wrote:

Nice!

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


[Lldb-commits] [lldb] [lldb] Expose structured command diagnostics via the SBAPI. (PR #112109)

2024-10-14 Thread Med Ismail Bennani via lldb-commits


@@ -184,53 +184,26 @@ def test_source_locations_from_objc_modules(self):
 # the first argument are probably stable enough that this test can 
check for them.
 self.assertIn("void NSLog(NSString *format", 
value.GetError().GetCString())
 
-def test_command_expr_formatting(self):
+def test_command_expr_sbdata(self):
 """Test that the source and caret positions LLDB prints are correct"""
 self.build()
 
 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
 self, "// Break here", self.main_source_spec
 )
-frame = thread.GetFrameAtIndex(0)
-self.expect("settings set show-inline-diagnostics true")
-
-def check(input_ref):
-self.expect(input_ref[0], error=True, substrs=input_ref[1:])
-
-check(
-[
-"expression -- a+b",
-"  ^ ^",
-"  | error: use of undeclared identifier 'b'",
-"  error: use of undeclared identifier 'a'",
-]
-)
-
-check(
-[
-"expr -- a",
-"^",
-"error: use of undeclared identifier 'a'",
-]
-)
-check(
-[
-"expr -i 0 -o 0 -- a",
-"  ^",
-"  error: use of undeclared identifier 'a'",
-]
-)
-
-self.expect(
-"expression --top-level -- template T FOO(T x) { 
return x/2;}"
-)
-check(
-[
-'expression -- FOO("")',
-"  ^",
-"  note: in instantiation of function template 
specialization 'FOO' requested here",
-"error: https://github.com/llvm/llvm-project/pull/112109
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Make the system log a NOOP on Windows (PR #112052)

2024-10-14 Thread David Spickett via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Make the system log a NOOP on Windows (PR #112052)

2024-10-14 Thread David Spickett via lldb-commits

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


[Lldb-commits] [clang] [lldb] [llvm] [APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (PR #80309)

2024-10-14 Thread Simon Pilgrim via lldb-commits


@@ -171,7 +171,7 @@ bool HexagonGenExtract::convert(Instruction *In) {
 // this value.
 if (!LogicalSR && (SR > SL))
   return false;
-APInt A = APInt(BW, ~0ULL).lshr(SR).shl(SL);
+APInt A = APInt(BW, ~0ULL, true).lshr(SR).shl(SL);

RKSimon wrote:

can we not use APInt::getBitsSet here?

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


  1   2   >