[Lldb-commits] [lldb] 0f08db6 - [lldb] Make logging machinery type-safe

2022-01-25 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-25T12:13:49+01:00
New Revision: 0f08db66db93b42ff26caca2159bd548436184ae

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

LOG: [lldb] Make logging machinery type-safe

This patch makes use of c++ type checking and scoped enums to make
logging statements shorter and harder to misuse.

Defines like LIBLLDB_LOG_PROCESS are replaces with LLDBLog::Process.
Because it now carries type information we do not need to worry about
matching a specific enum value with the right getter function -- the
compiler will now do that for us.

The main entry point for the logging machinery becomes the GetLog
(template) function, which will obtain the correct Log object based on
the enum type. It achieves this through another template function
(LogChannelFor), which must be specialized for each type, and should
return the appropriate channel object.

This patch also removes the ability to log a message if multiple
categories are enabled simultaneously as it was unused and confusing.

This patch does not actually remove any of the existing interfaces. The
defines and log retrieval functions are left around as wrappers around
the new interfaces. They will be removed in follow-up patch.

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

Added: 


Modified: 
lldb/include/lldb/Interpreter/ScriptedInterface.h
lldb/include/lldb/Utility/Log.h
lldb/include/lldb/Utility/Logging.h
lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
lldb/source/Utility/Log.cpp
lldb/source/Utility/Logging.cpp
lldb/tools/lldb-server/lldb-gdbserver.cpp
lldb/unittests/Utility/LogTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/ScriptedInterface.h 
b/lldb/include/lldb/Interpreter/ScriptedInterface.h
index 9eb11832003e6..9de5e60cfea32 100644
--- a/lldb/include/lldb/Interpreter/ScriptedInterface.h
+++ b/lldb/include/lldb/Interpreter/ScriptedInterface.h
@@ -33,7 +33,7 @@ class ScriptedInterface {
   template 
   static Ret ErrorWithMessage(llvm::StringRef caller_name,
   llvm::StringRef error_msg, Status &error,
-  uint32_t log_caterogy = LIBLLDB_LOG_PROCESS) {
+  LLDBLog log_caterogy = LLDBLog::Process) {
 LLDB_LOGF(GetLogIfAllCategoriesSet(log_caterogy), "%s ERROR = %s",
   caller_name.data(), error_msg.data());
 error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") +

diff  --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h
index 2684783939bd8..09fd2cb3a7e60 100644
--- a/lldb/include/lldb/Utility/Log.h
+++ b/lldb/include/lldb/Utility/Log.h
@@ -10,7 +10,6 @@
 #define LLDB_UTILITY_LOG_H
 
 #include "lldb/Utility/Flags.h"
-#include "lldb/Utility/Logging.h"
 #include "lldb/lldb-defines.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -48,11 +47,31 @@ namespace lldb_private {
 
 class Log final {
 public:
+  /// The underlying type of all log channel enums. Declare them as:
+  /// enum class MyLog : MaskType {
+  ///   Channel0 = Log::ChannelFlag<0>,
+  ///   Channel1 = Log::ChannelFlag<1>,
+  ///   ...,
+  ///   LLVM_MARK_AS_BITMASK_ENUM(LastChannel),
+  /// };
+  using MaskType = uint64_t;
+
+  template 
+  static constexpr MaskType ChannelFlag = MaskType(1) << Bit;
+
   // Description of a log channel category.
   struct Category {
 llvm::StringLiteral name;
 llvm::StringLiteral description;
-uint32_t flag;
+MaskType flag;
+
+template 
+constexpr Category(llvm::StringLiteral name,
+   llvm::StringLiteral description, Cat mask)
+: name(name), description(description), flag(MaskType(mask)) {
+  static_assert(
+  std::is_same>::value, "");
+}
   };
 
   // This class describes a log channel. It also encapsulates the behavior
@@ -63,18 +82,22 @@ class Log final {
 
   public:
 const llvm::ArrayRef categories;
-const uint32_t default_flags;
+const MaskType default_flags;
 
+template 
 constexpr Channel(llvm::ArrayRef categories,
-  uint32_t default_flags)
+  Cat default_flags)
 : log_ptr(nullptr), categories(categories),
-  default_flags(default_flags) {}
+  defa

[Lldb-commits] [lldb] ce69035 - [lldb/test] Use abspath when searching for lldb.exe

2022-01-25 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-25T12:13:49+01:00
New Revision: ce6903595b7161f881b62834c55b3099853cabd5

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

LOG: [lldb/test] Use abspath when searching for lldb.exe

realpath is too aggressive and does not produce the desired effect if
ones build folder is a symlink farm.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/dotest.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index 0815188d6cde8..ce01146055b2c 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -357,7 +357,7 @@ def parseOptionsAndInitTestdirs():
 
 if args.executable:
 # lldb executable is passed explicitly
-lldbtest_config.lldbExec = os.path.realpath(args.executable)
+lldbtest_config.lldbExec = os.path.abspath(args.executable)
 if not is_exe(lldbtest_config.lldbExec):
 lldbtest_config.lldbExec = which(args.executable)
 if not is_exe(lldbtest_config.lldbExec):



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


[Lldb-commits] [PATCH] D117490: [lldb] Make logging machinery type-safe

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f08db66db93: [lldb] Make logging machinery type-safe 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D117490?vs=402636&id=402824#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117490

Files:
  lldb/include/lldb/Interpreter/ScriptedInterface.h
  lldb/include/lldb/Utility/Log.h
  lldb/include/lldb/Utility/Logging.h
  lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
  lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
  lldb/source/Utility/Log.cpp
  lldb/source/Utility/Logging.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/unittests/Utility/LogTest.cpp

Index: lldb/unittests/Utility/LogTest.cpp
===
--- lldb/unittests/Utility/LogTest.cpp
+++ lldb/unittests/Utility/LogTest.cpp
@@ -18,13 +18,24 @@
 using namespace lldb;
 using namespace lldb_private;
 
-enum { FOO = 1, BAR = 2 };
+enum class TestChannel : Log::MaskType {
+  FOO = Log::ChannelFlag<0>,
+  BAR = Log::ChannelFlag<1>,
+  LLVM_MARK_AS_BITMASK_ENUM(BAR),
+};
+
+LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
+
 static constexpr Log::Category test_categories[] = {
-{{"foo"}, {"log foo"}, FOO}, {{"bar"}, {"log bar"}, BAR},
+{{"foo"}, {"log foo"}, TestChannel::FOO},
+{{"bar"}, {"log bar"}, TestChannel::BAR},
 };
-static constexpr uint32_t default_flags = FOO;
 
-static Log::Channel test_channel(test_categories, default_flags);
+static Log::Channel test_channel(test_categories, TestChannel::FOO);
+
+namespace lldb_private {
+template <> Log::Channel &LogChannelFor() { return test_channel; }
+} // namespace lldb_private
 
 // Wrap enable, disable and list functions to make them easier to test.
 static bool EnableChannel(std::shared_ptr stream_sp,
@@ -93,7 +104,7 @@
   std::string error;
   ASSERT_TRUE(EnableChannel(m_stream_sp, 0, "chan", {}, error));
 
-  m_log = test_channel.GetLogIfAll(FOO);
+  m_log = GetLog(TestChannel::FOO);
   ASSERT_NE(nullptr, m_log);
 }
 
@@ -124,18 +135,18 @@
 TEST(LogTest, Unregister) {
   llvm::llvm_shutdown_obj obj;
   Log::Register("chan", test_channel);
-  EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
+  EXPECT_EQ(nullptr, GetLog(TestChannel::FOO));
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
   EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {"foo"}, llvm::nulls()));
-  EXPECT_NE(nullptr, test_channel.GetLogIfAny(FOO));
+  EXPECT_NE(nullptr, GetLog(TestChannel::FOO));
   Log::Unregister("chan");
-  EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
+  EXPECT_EQ(nullptr, GetLog(TestChannel::FOO));
 }
 
 TEST_F(LogChannelTest, Enable) {
-  EXPECT_EQ(nullptr, test_channel.GetLogIfAll(FOO));
+  EXPECT_EQ(nullptr, GetLog(TestChannel::FOO));
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
@@ -144,20 +155,22 @@
   EXPECT_EQ("Invalid log channel 'chanchan'.\n", error);
 
   EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {}, error));
-  EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO));
-  EXPECT_EQ(nullptr, test_channel.GetLogIfAll(BAR));
+  EXPECT_NE(nullptr, GetLog(TestChannel::FOO));
+  EXPECT_EQ(nullptr, GetLog(TestChannel::BAR));
 
   EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"bar"}, error));
-  EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
+  EXPECT_NE(nullptr, test_channel.GetLogIfAll(
+ Log::MaskType(TestChannel::FOO | TestChannel::BAR)));
 
   EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"baz"}, error));
   EXPECT_NE(std::string::npos, error.find("unrecognized log category 'baz'"))
   << "error: " << error;
-  EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO | BAR));
+  EXPECT_NE(nullptr, test_channel.GetLogIfAll(
+ Log::MaskType(TestChannel::FOO | TestChannel::BAR)));
 }
 
 TEST_F(LogChannelTest, EnableOptions) {
-  EXPECT_EQ(nullptr, test_channel.GetLogIfAll(FOO));
+  EXPECT_EQ(nullptr, GetLog(TestChannel::FOO));
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
@@ -165,32 +178,33 @@
   EXPECT_TRUE(
   EnableChannel(stream_sp, LLDB_LOG_OPTION_VERBOSE, "chan", {}, error));
 
-  Log *log = test_channel.GetLogIfAll(FOO);
+  Log *log = GetLog(TestChannel::FOO);
   ASSERT_NE(nullptr, log);
   EXPE

[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Seems reasonable to me. Jim, do you have any thoughts on this?




Comment at: 
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py:494
+
+def test_siginfo_linux(self):
+class MyResponder(MockGDBServerResponder):

I'd probably factor the out the common parts into a helper fn, as these two 
tests only differ in constants.


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

https://reviews.llvm.org/D118055

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


[Lldb-commits] [PATCH] D117490: [lldb] Make logging machinery type-safe

2022-01-25 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

Looks like this doesn't build on Mac: http://45.33.8.238/macm1/26315/step_4.txt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117490

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


[Lldb-commits] [PATCH] D117490: [lldb] Make logging machinery type-safe

2022-01-25 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

And e


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117490

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


[Lldb-commits] [PATCH] D117490: [lldb] Make logging machinery type-safe

2022-01-25 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

And even less on windows: http://45.33.8.238/win/53319/step_4.txt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117490

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thanks for tracking this down. I'm looking forward to seeing how the kernel 
issue gets resolved.

> In D117928#3266895 , @labath wrote:
>
>> If you want, I can try to create a patch for this, though it might take me a 
>> couple of days to get around to it.
>
> I'm probably not getting the full picture but my idea on this is: if we 
> propose this change due to this specific kernel regression is not worth it, 
> although we should consider it if there is any other benefit on using 
> `PTRACE_POKEUSER`.

PTRACE_POKE/PEEKUSER might be theoretically faster for some use cases, as it 
can access only some bytes instead of the whole XSAVE block, but we're nowhere 
near doing those kinds of optimizations.

As for being worth it, we have added workarounds for kernel bugs in the past 
(try grepping for SingleStepWorkaround), so this wouldn't be the first one and, 
if done right, it also shouldn't be particularly burdensome.

I'd say it all comes down to how much you care about this particular 
configuration having a clean test run. My position is that I'd rather have a 
workaround in place than to have to figure out how to skip this test for this 
exact setup.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D117490: [lldb] Make logging machinery type-safe

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I'm sorry. I should have that fixed right very quickly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117490

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


[Lldb-commits] [lldb] 345d85e - [lldb] Fix mac build for D117490

2022-01-25 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-25T13:42:24+01:00
New Revision: 345d85e1240801999ed321eb13a39048a9aa1a06

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

LOG: [lldb] Fix mac build for D117490

This is exactly that kind of a API misuse that the patch was meant to
detect.

Added: 


Modified: 
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index abb3b30e175a4..75271ca6abf49 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -484,10 +484,8 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
   ConstString file_spec_extension = file_spec.GetFileNameExtension();
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  Log *log_verbose(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM | 
LLDB_LOG_OPTION_VERBOSE));
 
-  LLDB_LOGF(log_verbose, "PlatformDarwinKernel examining '%s'",
-file_spec.GetPath().c_str());
+  LLDB_LOGV(log, "PlatformDarwinKernel examining '{0}'", file_spec);
 
   PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
 
@@ -567,9 +565,8 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
   if (recurse && file_spec_extension != g_dsym_suffix &&
   file_spec_extension != g_kext_suffix &&
   file_spec_extension != g_bundle_suffix) {
-LLDB_LOGF(log_verbose,
-  "PlatformDarwinKernel descending into directory '%s'",
-  file_spec.GetPath().c_str());
+LLDB_LOGV(log, "PlatformDarwinKernel descending into directory '{0}'",
+  file_spec);
 return FileSystem::eEnumerateDirectoryResultEnter;
   } else {
 return FileSystem::eEnumerateDirectoryResultNext;



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


[Lldb-commits] [lldb] 6b67e89 - [lldb] Fix windows build for D117490

2022-01-25 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-25T13:51:53+01:00
New Revision: 6b67e89b45c1e84a5ddac23f8c9c8c3961577bda

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

LOG: [lldb] Fix windows build for D117490

I forgot to update ProcessWindowsLog to the new API.

Added: 


Modified: 
lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp 
b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
index 6f5e020e812b6..0d7649a98e8c3 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
@@ -11,17 +11,21 @@
 using namespace lldb_private;
 
 static constexpr Log::Category g_categories[] = {
-{{"break"}, {"log breakpoints"}, WINDOWS_LOG_BREAKPOINTS},
-{{"event"}, {"log low level debugger events"}, WINDOWS_LOG_EVENT},
-{{"exception"}, {"log exception information"}, WINDOWS_LOG_EXCEPTION},
-{{"memory"}, {"log memory reads and writes"}, WINDOWS_LOG_MEMORY},
-{{"process"}, {"log process events and activities"}, WINDOWS_LOG_PROCESS},
-{{"registers"}, {"log register read/writes"}, WINDOWS_LOG_REGISTERS},
-{{"step"}, {"log step related activities"}, WINDOWS_LOG_STEP},
-{{"thread"}, {"log thread events and activities"}, WINDOWS_LOG_THREAD},
+{{"break"}, {"log breakpoints"}, WindowsLog::Breakpoints},
+{{"event"}, {"log low level debugger events"}, WindowsLog::Event},
+{{"exception"}, {"log exception information"}, WindowsLog::Exception},
+{{"memory"}, {"log memory reads and writes"}, WindowsLog::Memory},
+{{"process"}, {"log process events and activities"}, WindowsLog::Process},
+{{"registers"}, {"log register read/writes"}, WindowsLog::Registers},
+{{"step"}, {"log step related activities"}, WindowsLog::Step},
+{{"thread"}, {"log thread events and activities"}, WindowsLog::Thread},
 };
 
-Log::Channel ProcessWindowsLog::g_channel(g_categories, WINDOWS_LOG_PROCESS);
+static Log::Channel g_channel(g_categories, WindowsLog::Process);
+
+template <> Log::Channel &lldb_private::LogChannelFor() {
+  return g_channel;
+}
 
 void ProcessWindowsLog::Initialize() {
   static llvm::once_flag g_once_flag;

diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h 
b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
index 66ba245c9fa88..68a9d767c227d 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
@@ -11,25 +11,38 @@
 
 #include "lldb/Utility/Log.h"
 
-#define WINDOWS_LOG_PROCESS (1u << 1) // Log process operations
-#define WINDOWS_LOG_EXCEPTION (1u << 1)   // Log exceptions
-#define WINDOWS_LOG_THREAD (1u << 2)  // Log thread operations
-#define WINDOWS_LOG_MEMORY (1u << 3)  // Log memory reads/writes calls
-#define WINDOWS_LOG_BREAKPOINTS (1u << 4) // Log breakpoint operations
-#define WINDOWS_LOG_STEP (1u << 5)// Log step operations
-#define WINDOWS_LOG_REGISTERS (1u << 6)   // Log register operations
-#define WINDOWS_LOG_EVENT (1u << 7)   // Low level debug events
-
 namespace lldb_private {
-class ProcessWindowsLog {
-  static Log::Channel g_channel;
 
+enum class WindowsLog : Log::MaskType {
+  Breakpoints = Log::ChannelFlag<0>, // Log breakpoint operations
+  Event = Log::ChannelFlag<1>,   // Low level debug events
+  Exception = Log::ChannelFlag<2>,   // Log exceptions
+  Memory = Log::ChannelFlag<3>,  // Log memory reads/writes calls
+  Process = Log::ChannelFlag<4>, // Log process operations
+  Registers = Log::ChannelFlag<5>,   // Log register operations
+  Step = Log::ChannelFlag<6>,// Log step operations
+  Thread = Log::ChannelFlag<7>,  // Log thread operations
+  LLVM_MARK_AS_BITMASK_ENUM(Thread)
+};
+
+#define WINDOWS_LOG_PROCESS ::lldb_private::WindowsLog::Process
+#define WINDOWS_LOG_EXCEPTION ::lldb_private::WindowsLog::Exception
+#define WINDOWS_LOG_THREAD ::lldb_private::WindowsLog::Thread
+#define WINDOWS_LOG_MEMORY ::lldb_private::WindowsLog::Memory
+#define WINDOWS_LOG_BREAKPOINTS ::lldb_private::WindowsLog::Breakpoints
+#define WINDOWS_LOG_STEP ::lldb_private::WindowsLog::Step
+#define WINDOWS_LOG_REGISTERS ::lldb_private::WindowsLog::Registers
+#define WINDOWS_LOG_EVENT ::lldb_private::WindowsLog::Event
+
+class ProcessWindowsLog {
 public:
   static void Initialize();
   static void Terminate();
 
-  static Log *GetLogIfAny(uint32_t mask) { return g_channel.GetLogIfAny(mask); 
}
+  static Log *GetLogIfAny(WindowsLog mask) { return GetLog(mask); }
 };
+
+template <> Log::Channel &Lo

[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a reviewer: bulbazord.
labath added a comment.

Adding Alex for the plugin dependency aspect. I don't think this dep is wrong 
(it's pretty hard to pretend we don't at least have a C language), but he may 
want to say something about this.

The patch itself is somewhat repetitive, but otherwise seems ok.

I am a bit curious about the `__lldb` prefix. I'm wondering if there's a way to 
avoid having it, while still maintaining isolation from any type with the same 
name coming from the debug info. I'm thinking about putting it in some kind of 
an anonymous namespace or something... Does anyone know if that works?




Comment at: lldb/source/API/SBPlatform.cpp:672
+
+  assert(target_sp);
+  return SBType();

??



Comment at: lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp:324
+
+  // TODO: do we actually care about sparc here? lldb doesn't seem to have
+  // any sparc support

we don't



Comment at: lldb/unittests/Platform/PlatformSiginfoTest.cpp:83
+  void InitializeSiginfo(const std::string &triple) {
+ArchSpec arch(triple.c_str());
+

drop c_str()



Comment at: lldb/unittests/Platform/PlatformSiginfoTest.cpp:109
+
+siginfo_type = platform_sp->GetSiginfoType(*target_sp);
+  }

Other platform APIs seem to take an ArchSpec or even a Triple, so doing that 
would be more consistent *and* make your job here easier.


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [PATCH] D112824: [lldb][AArch64] Add MakeTaggedRanges to MemoryTagManager

2022-01-25 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 402898.
DavidSpickett added a comment.

Since output of GetMemoryRegions will be sorted and not overlap,
switch the checks to asserts and don't sort the input regions.

Updated the testing to reflect that and added some comment
diagrams showing what regions are used for the later tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112824

Files:
  lldb/include/lldb/Target/MemoryTagManager.h
  lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp
  lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h
  lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp

Index: lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
===
--- lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
+++ lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
@@ -165,6 +165,14 @@
   llvm::FailedWithMessage(
   "End address (0x0) must be greater than the start address (0x1)"));
 
+  // The inversion check ignores tags in the addresses (MTE tags start at bit
+  // 56).
+  ASSERT_THAT_EXPECTED(
+  manager.MakeTaggedRange((lldb::addr_t)1 << 56,
+  ((lldb::addr_t)2 << 56) + 0x10, memory_regions),
+  llvm::FailedWithMessage(
+  "Address range 0x0:0x10 is not in a memory tagged region"));
+
   // Adding a single region to cover the whole range
   memory_regions.push_back(MakeRegionInfo(0, 0x1000, true));
 
@@ -247,6 +255,122 @@
   ASSERT_EQ(*got, expected_range);
 }
 
+TEST(MemoryTagManagerAArch64MTETest, MakeTaggedRanges) {
+  MemoryTagManagerAArch64MTE manager;
+  MemoryRegionInfos memory_regions;
+
+  // Note that MakeTaggedRanges takes start/end address.
+  // Whereas TagRanges and regions take start address and size.
+
+  // Range must not be inverted
+  ASSERT_THAT_EXPECTED(
+  manager.MakeTaggedRanges(1, 0, memory_regions),
+  llvm::FailedWithMessage(
+  "End address (0x0) must be greater than the start address (0x1)"));
+
+  // We remove tags before doing the inversion check, so this is not an error.
+  // Also no regions means no tagged regions returned.
+  // (bit 56 is where MTE tags begin)
+  llvm::Expected> got =
+  manager.MakeTaggedRanges((lldb::addr_t)2 << 56,
+   ((lldb::addr_t)1 << 56) + 0x10, memory_regions);
+  ASSERT_THAT_EXPECTED(got, llvm::Succeeded());
+  ASSERT_EQ(*got, std::vector{});
+
+  // Cover whole range, untagged. No ranges returned.
+  memory_regions.push_back(MakeRegionInfo(0, 0x20, false));
+  got = manager.MakeTaggedRanges(0, 0x20, memory_regions);
+  ASSERT_THAT_EXPECTED(got, llvm::Succeeded());
+  ASSERT_EQ(*got, std::vector{});
+
+  // Make the region tagged and it'll be the one range returned.
+  memory_regions.back().SetMemoryTagged(MemoryRegionInfo::eYes);
+  got = manager.MakeTaggedRanges(0, 0x20, memory_regions);
+  ASSERT_THAT_EXPECTED(got, llvm::Succeeded());
+  ASSERT_EQ(*got, std::vector{
+  MemoryTagManager::TagRange(0, 0x20)});
+
+  // This region will be trimmed if it's larger than the whole range.
+  memory_regions.clear();
+  memory_regions.push_back(MakeRegionInfo(0, 0x40, true));
+  got = manager.MakeTaggedRanges(0x10, 0x30, memory_regions);
+  ASSERT_THAT_EXPECTED(got, llvm::Succeeded());
+  ASSERT_EQ(*got, std::vector{
+  MemoryTagManager::TagRange(0x10, 0x20)});
+
+  memory_regions.clear();
+
+  // For the following tests we keep the input regions
+  // in ascending order as MakeTaggedRanges expects.
+
+  // Only start of range is tagged, only that is returned.
+  // Start the region just before the requested range to check
+  // we limit the result to the requested range.
+  memory_regions.push_back(MakeRegionInfo(0, 0x20, true));
+  got = manager.MakeTaggedRanges(0x10, 0x100, memory_regions);
+  ASSERT_THAT_EXPECTED(got, llvm::Succeeded());
+  ASSERT_EQ(*got, std::vector{
+  MemoryTagManager::TagRange(0x10, 0x10)});
+
+  // Add a tagged region at the end, now we get both
+  // and the middle is untagged.
+  // 
+  // <...>
+  // 
+  // The range added here is deliberately over the end of the
+  // requested range to show that we trim the end.
+  memory_regions.push_back(MakeRegionInfo(0xE0, 0x40, true));
+  got = manager.MakeTaggedRanges(0x10, 0x110, memory_regions);
+  ASSERT_THAT_EXPECTED(got, llvm::Succeeded());
+
+  std::vector expected{
+  MemoryTagManager::TagRange(0x10, 0x10),
+  MemoryTagManager::TagRange(0xE0, 0x30)};
+  ASSERT_EQ(*got, expected);
+
+  // Now add a middle tagged region.
+  // 
+  // <...>
+  // 
+  // <...>
+  // 
+  memory_regions.insert(std::next(memory_regions.begin()),
+MakeRegionInfo(0x90, 0x20, true));
+
+  // As the given regions are in ascending order, the resulting
+  // tagged ranges are

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 399020.
Ericson2314 added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
   else(

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 399883.
Ericson2314 added a comment.

Rebase after landing the polly change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CM

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 399096.
Ericson2314 added a comment.

Retrigger CI now that deps are fixed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMA

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 398857.
Ericson2314 added a comment.

Fix conflicts, one more thing for openmp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "$

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 marked 10 inline comments as done.
Ericson2314 added a comment.

The approval on this patch is quite old, but nothing much interesting has 
happened in it since then --- if anything, it has gotten more trivial as I 
created patches "under" it and landed them which cleared the way for this.

The build failure in the libc++ "modular build" I also see in other CI runs, 
e.g. 
https://buildkite.com/llvm-project/libcxx-ci/builds/7855#b40f8ad6-dc6a-4589-81d7-a459dae8b7e7,
 so I it appears unrelated.

I double checked and old lingering conversations (pre approval) can be marked 
resolved.




Comment at: clang-tools-extra/clang-doc/tool/CMakeLists.txt:26
 install(FILES ../assets/index.js
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)

Ericson2314 wrote:
> Ericson2314 wrote:
> > compnerd wrote:
> > > Why are these quoted but other uses not?
> > I confess I have no clue when quoting is required or advisable with CMake. 
> > I started out converting things by hand and then did some auto-conversions, 
> > this must have been one of the by-hand ones.
> > 
> > Happy to normalize either way, just tell me which one.
> I looked it up, 
> https://stackoverflow.com/questions/35847655/when-should-i-quote-cmake-variables
>  says I'm slightly better off quoting all of these so I did.
Since then I landed D115566, which made the quoting consistent prior to this. 
This adds quotes defensively around variable expansions, and just needs to 
where the path expression didn't involve variables before.



Comment at: clang/cmake/modules/AddClang.cmake:127
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

compnerd wrote:
> Ericson2314 wrote:
> > compnerd wrote:
> > > Ericson2314 wrote:
> > > > compnerd wrote:
> > > > > For the initial change, Id leave this off.  `CMAKE_INSTALL_LIBDIR` 
> > > > > sometimes already deals with the bit suffix, so you can end up with 
> > > > > two instances of `32` or `64`.  I think that cleaning that up 
> > > > > separately, while focusing on the details of cleaning up how to 
> > > > > handle `LLVM_LIBDIR_SUFFIX` is the right thing to do.  The same 
> > > > > applies to the rest of the patch.
> > > > https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/GNUInstallDirs.cmake#L257
> > > >  Hmm I see what you mean. So you are saying `s/${ 
> > > > CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${ CMAKE_INSTALL_LIBDIR}/` 
> > > > everywhere?
> > > Yes, that is what I was referring to.  I'm suggesting that you do *not* 
> > > make that change instead.  That needs a much more involved change to 
> > > clean up the use of `${LLVM_LIBDIR_SUFFIX}`.  I think that this change is 
> > > already extremely large as is, and folding more into it is not going to 
> > > help.
> > So you are saying II should back all of these out into 
> > `lib${LLVM_LIBDIR_SUFFIX}` as they were before, for now?
> > 
> > Yes I don't want to make this bigger either, and would rather be on the 
> > hook for follow-up work than have this one be too massive to get over the 
> > finish line.
> Yes.
`CMAKE_INSTALL_LIBDIR` is no longer introduced in this patch; this has been the 
case since before the approval.



Comment at: libcxx/CMakeLists.txt:32
+
+include(GNUInstallDirs)
 

Ericson2314 wrote:
> compnerd wrote:
> > Ericson2314 wrote:
> > > compnerd wrote:
> > > > Does this need to come here?  Why not push this to after the if block 
> > > > completes?  The same applies through out the rest of the patch.
> > > It might be fine here. But I was worried that in some of these cases code 
> > > included in those blocks might refer to the `GNUInstallDirs` variables.
> > > 
> > > Originally I had `GNUInstallDirs` only included in the conditional block 
> > > after `project(...)`, but then the combined build test failed because 
> > > nothing including `GnuInstallDirs` in that case. If there is an 
> > > "entrypoint" CMakeLists boilerplate that combined builds should always 
> > > use, I think the best thing would be to change it back and then 
> > > additionally put `GNUInstallDirs` there.
> > Unified builds always use `llvm/CMakeLists.txt`.  However, both should 
> > continue to work, and so you will need to add this in the subprojects as 
> > well.
> Huh. That one always had the unconditional `include(GNUInstalDirs)`, so not 
> sure why the CI build was failing before.
`include(GNUInstallDirs)` is no longer in funny locations like this.



Comment at: polly/cmake/CMakeLists.txt:82-96
+set(POLLY_INSTALL_PREFIX "")
 set(POLLY_CONFIG_LLVM_CMAKE_DIR 
"${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR 
"${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS 
"${PO

[Lldb-commits] [PATCH] D117382: [NFC] Cleanup log channel stuff to all be consistent and use 64 bit log channel mask.

2022-01-25 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: jingham, labath, JDevlieghere, wallace.
Herald added subscribers: atanasyan, jrtc27, kbarton, sbc100, mgorny, nemanjai, 
sdardis, emaste.
Herald added a reviewer: shafik.
Herald added a reviewer: shafik.
clayborg requested review of this revision.
Herald added subscribers: lldb-commits, MaskRay, aheejin.
Herald added a project: LLDB.

Long ago we first stated with only one log channel: the LLDB log channel. Then 
we slowly added more log channels and all those new log channels used the 
lldb_private::Log class and all call sites would access methods in each log 
class except the LLDB log channel.

After this change:

- Log.h contains the Log class definition and no longer inlcudes the old 
"Logging.h" file which contained the LLDB log channel bits and functions
- the log mask is now expanded to 64 bits which allows for more categories 
within a log channel (we were out of available category bits in the LLDB log 
channel)
- Logging.h has been renamed to LLDBLog.h
- Logging.cpp has been renamed to LLDBLog.cpp
- all call sites that were using the old top level functions 
GetLogIfAllCategoriesSet and GetLogIfAnyCategoriesSet now call 
LLDBLog::GetLogIfAllCategoriesSet and 
LLDBLog::GetLogIfAnyCategoryIsSetrespectively.

This cleans up our logging implementation and caught a few cases where we were 
getting the wrong log from the wrong channel (ThreadGDBRemote for instance) and 
makes it harder to use the wrong log. This also allows us to add more log 
channels to LLDB's main logging categories now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117382

Files:
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/include/lldb/Interpreter/ScriptedInterface.h
  lldb/include/lldb/Utility/LLDBLog.h
  lldb/include/lldb/Utility/Log.h
  lldb/include/lldb/Utility/Logging.h
  lldb/include/lldb/Utility/ReproducerInstrumentation.h
  lldb/source/API/SBBreakpointOptionCommon.cpp
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBFrame.cpp
  lldb/source/API/SBStream.cpp
  lldb/source/API/SBTarget.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointName.cpp
  lldb/source/Breakpoint/BreakpointResolver.cpp
  lldb/source/Breakpoint/BreakpointResolverAddress.cpp
  lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
  lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Breakpoint/BreakpointResolverScripted.cpp
  lldb/source/Breakpoint/Watchpoint.cpp
  lldb/source/Commands/CommandObjectLog.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/AddressResolverFileLine.cpp
  lldb/source/Core/Communication.cpp
  lldb/source/Core/DataFileCache.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/RichManglingContext.cpp
  lldb/source/Core/StreamFile.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectDynamicValue.cpp
  lldb/source/Core/ValueObjectRegister.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/source/DataFormatters/TypeCategoryMap.cpp
  lldb/source/DataFormatters/VectorType.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Expression/DiagnosticManager.cpp
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Expression/IRInterpreter.cpp
  lldb/source/Expression/IRMemoryMap.cpp
  lldb/source/Expression/LLVMUserExpression.cpp
  lldb/source/Expression/Materializer.cpp
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Host/common/Host.cpp
  lldb/source/Host/common/HostInfoBase.cpp
  lldb/source/Host/common/HostNativeThreadBase.cpp
  lldb/source/Host/common/MonitoringProcessLauncher.cpp
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Host/common/NativeRegisterContext.cpp
  lldb/source/Host/common/NativeWatchpointList.cpp
  lldb/source/Host/common/ProcessLaunchInfo.cpp
  lldb/source/Host/common/Socket.cpp
  lldb/source/Host/common/TCPSocket.cpp
  lldb/source/Host/common/ThreadLauncher.cpp
  lldb/source/Host/common/UDPSocket.cpp
  lldb/source/Host/freebsd/Host.cpp
  lldb/source/Host/linux/Host.cpp
  lldb/source/Host/linux/HostInfoLinux.cpp
  lldb/source/Host/linux/Support.cpp
  lldb/source/Host/macosx/objcxx/Host.mm
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
  lldb/source/Host/netbsd/HostNetBSD.cpp
  lldb/source/Host/openbsd/Host.cpp
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/source/Host/posix/HostInfoPosix.cpp
  lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
  lldb/source/Host/windows/ConnectionGen

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 marked 3 inline comments as done.
Ericson2314 added inline comments.



Comment at: polly/cmake/CMakeLists.txt:85
+set(POLLY_CONFIG_CMAKE_DIR 
"${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+set(POLLY_CONFIG_LIBRARY_DIRS 
"${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
 if (POLLY_BUNDLED_ISL)

lebedev.ri wrote:
> This looks suspect
I am not sure how to find the date on this comment but I quite sure it dates 
back to an earlier change on this line. This just combines the two parts of the 
path with a `/` which is what we want and what it did before.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Ericson2314 marked an inline comment as done.
Closed by commit rGefeb50197091: [cmake] Use `GNUInstallDirs` to support custom 
installation dirs. (authored by Ericson2314).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 forea

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread Vitaly Buka via Phabricator via lldb-commits
vitalybuka added a comment.

It breaks multiple bots.
https://lab.llvm.org/buildbot/#/builders/37/builds/9960
https://lab.llvm.org/buildbot/#/builders/77/builds/13245
https://lab.llvm.org/buildbot/#/builders/169/builds/5409
https://lab.llvm.org/buildbot/#/builders/105/builds/19941

Can you please fix or revert it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D117382: [NFC] Cleanup log channel stuff to all be consistent and use 64 bit log channel mask.

2022-01-25 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Nice improvement!




Comment at: lldb/include/lldb/Utility/LLDBLog.h:1
+//===-- Logging.h ---*- C++ 
-*-===//
+//

LLDBLog.h



Comment at: lldb/include/lldb/Utility/LLDBLog.h:58
+public:
+  static void Initialize();
+

Even if it's a NOOP, should we add a `Terminate` for consistency? 



Comment at: lldb/source/Core/ValueObject.cpp:45-46
 #include "lldb/Utility/Flags.h"
-#include "lldb/Utility/Log.h"
-#include "lldb/Utility/Logging.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Scalar.h"

Dupe


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117382

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


[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 reopened this revision.
Ericson2314 added a comment.
This revision is now accepted and ready to land.

Will try to break up the pathc further for better troubleshooting, but keeping 
this open to track progress.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added a comment.

Sorry about that.

I think the issue was just one more `include(GNUInstallDirs)` for compiler-rt 
for the standalone build, but I am going to bed so just reverted for now to try 
again later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4a678f807200: [cmake] Use `GNUInstallDirs` to support custom 
installation dirs. (authored by Ericson2314).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 400253.
Ericson2314 added a comment.

Try again, with more `include(GNUInstallDirs)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-nvlink-wrapper/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/libompd/src/CMakeLists.txt
  openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -90,10 +92,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Keep this in sync with llvm/cmake/CMakeLists.txt!
 
+include(ExtendPath)
 include(FindPrefixFromConfig)
 
 set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
@@ -83,17 +84,18 @@
 # Generate PollyConfig.cmake for the install tree.
 unset(POLLY_EXPORTS)
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
-"\${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"\${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -110,12 +112,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUT

[Lldb-commits] [PATCH] D100810: [llvm] Use `GNUInstallDirs` to support custom installation dirs

2022-01-25 Thread Alexander Richardson via Phabricator via lldb-commits
arichardson added inline comments.



Comment at: llvm/CMakeLists.txt:5
 
+include(GNUInstallDirs)
+

This seems to be causing the following warning for me:

```
CMake Warning (dev) at 
/opt/clion-2021.2/bin/cmake/linux/share/cmake-3.20/Modules/GNUInstallDirs.cmake:236
 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

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


[Lldb-commits] [PATCH] D117382: [NFC] Cleanup log channel stuff to all be consistent and use 64 bit log channel mask.

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

It is definitely an improvement, but I can't help but wonder, since we're going 
to be touching every GetLog line with this, if we couldn't go even further.

The various LLDB_LOG have helped a lot, but one of the things that still 
bothers me is the verbosity of the GetLog statements. 
`GetLogIfAllCategoriesSet(LIBLLDB_LOG_WHATEVER)` is long enough as it is, and 
this prepends `LLDBLog::` on top of that.

Here's a straw-man proposal to make that shorter (and safer). Instead of 
macros, we use (scoped) enums for denoting log categories. enums are not a 
preprocessor construct, so we can keep the identifiers relatively short. E.g. 
`LLDBLog::API` instead of `LLDB_LOG_API`. They also have types, which means we 
can use the compiler to check that the values are used appropriately. And 
thanks to that, we also don't need to have a long name for the log getter 
function. The logging could be as simple as

  Log *log = LogIfAny(LLDBLog::API); // Uses template magic to find the 
appropriate log class based on the type

If the name sounds too cryptic, we can also choose something longer like 
`GetLogIfAnySet` or variation thereof.

If you (all) think something like that would be useful, but don't have the time 
to do that, I can try to whip something up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117382

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


[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 reopened this revision.
Ericson2314 added a comment.
This revision is now accepted and ready to land.

Found two more `include(GNUInstallDirs)` I should include which will hopefully 
fix the build.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D100810: [llvm] Use `GNUInstallDirs` to support custom installation dirs

2022-01-25 Thread Alexander Richardson via Phabricator via lldb-commits
arichardson added inline comments.



Comment at: llvm/CMakeLists.txt:5
 
+include(GNUInstallDirs)
+

arichardson wrote:
> This seems to be causing the following warning for me:
> 
> ```
> CMake Warning (dev) at 
> /opt/clion-2021.2/bin/cmake/linux/share/cmake-3.20/Modules/GNUInstallDirs.cmake:236
>  (message):
>   Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
>   target architecture is known.  Please enable at least one language before
>   including GNUInstallDirs.
> ```
Moving it below `project(LLVM` should fix that, but I'm not sure if there is a 
reason that it's up here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

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


[Lldb-commits] [PATCH] D117382: [NFC] Cleanup log channel stuff to all be consistent and use 64 bit log channel mask.

2022-01-25 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

D117490  is pretty much what I had in mind. 
It needs a bit of a cleanup, and doesn't actually change any interface (that'd 
be better done as a separate patch anyway), but all the major functionality is 
already there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117382

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


[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added a comment.

OK I split out D117417 , D117418 
, D117419 , 
and D117420 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread Alexander Richardson via Phabricator via lldb-commits
arichardson added a comment.

I can't see anywhere where the GNUInstallDirs variables are used before 
project(), so can't we just move the includes further down?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread Alexander Richardson via Phabricator via lldb-commits
arichardson added a comment.

I believe `LLVM_LIBDIR_SUFFIX` was added as a workaround for not being able to 
use GNUInstallDirs (which will automatically detect the right suffixed e.g. for 
SuSE) in rG46fed3b475ddd92d02d9b72d0d77c5a939f132d1 
. Would it 
be possible to move the include() below the `project()/enable_language()` calls 
so that CMake can detect the expected libdir suffix and then use something like 
the following:

  # If LLVM_LIBDIR_SUFFIX is defined, we use that to override the libdir, 
otherwise GNUInstallDirs defaults should be correct.
  if(DEFINED LLVM_LIBDIR_SUFFIX)
message(DEPRECATION "LLVM_LIBDIR_SUFFIX is deprecated, set 
CMAKE_INSTALL_LIBDIR to lib${LLVM_LIBDIR_SUFFIX} instead")
set(CMAKE_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX})
  endif()
  include(GNUInstallDirs)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 401103.
Ericson2314 added a comment.
Herald added subscribers: Sanitizers, JDevlieghere.
Herald added a project: Sanitizers.

Don't forget compiler-rt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

Files:
  compiler-rt/cmake/base-config-ix.cmake
  flang/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  llvm/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,10 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # Check if this is a in tree build.
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,6 +2,10 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # Add path for custom modules.
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # If we are not building as a part of LLVM, build LLD as an
Index: libunwind/CMakeLists.txt
===
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -8,6 +8,10 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
Index: libcxxabi/CMakeLists.txt
===
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -10,6 +10,10 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -10,6 +10,10 @@
 #===
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
Index: flang/CMakeLists.txt
===
--- flang/CMakeLists.txt
+++ flang/CMakeLists.txt
@@ -7,6 +7,10 @@
 set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Index: compiler-rt/cmake/base-config-ix.cmake
===
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -5,9 +5,14 @@
 
 include(CheckIncludeFile)
 include(CheckCXXSourceCompiles)
-include(GNUInstallDirs)
 include(ExtendPath)
 
+if(NOT DEFINED CMAKE_I

[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 401296.
Ericson2314 added a comment.
Herald added subscribers: sdasgup3, wenzhicui, wrengr, Chia-hungDuan, dcaballe, 
cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, 
Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, 
arpith-jacob, nicolasvasilache, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a reviewer: sscalpone.
Herald added a project: MLIR.

Just move them


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

Files:
  flang/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/tools/debugserver/CMakeLists.txt
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,8 +7,6 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -18,6 +16,9 @@
 
 project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES CXX)
 
+# Must go below project(..)
+include(GNUInstallDirs)
+
 set(PSTL_PARALLEL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial', 'omp', and 'tbb'. The default is 'serial'.")
 set(PSTL_HIDE_FROM_ABI_PER_TU OFF CACHE BOOL "Whether to constrain ABI-unstable symbols to each translation unit (basically, mark them with C's static keyword).")
 set(_PSTL_HIDE_FROM_ABI_PER_TU ${PSTL_HIDE_FROM_ABI_PER_TU}) # For __pstl_config_site
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,10 +1,14 @@
-include(GNUInstallDirs)
-
 # Check if this is a in tree build.
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
   cmake_minimum_required(VERSION 3.13.4)
+  set(POLLY_STANDALONE_BUILD TRUE)
+endif()
+
+# Must go below project(..)
+include(GNUInstallDirs)
 
+if(POLLY_STANDALONE_BUILD)
   # Where is LLVM installed?
   find_package(LLVM CONFIG REQUIRED)
   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,10 +1,15 @@
 # MLIR project.
 
-include(GNUInstallDirs)
-
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(mlir)
+  set(MLIR_STANDALONE_BUILD TRUE)
+endif()
+
+# Must go below project(..)
+include(GNUInstallDirs)
+
+if(MLIR_STANDALONE_BUILD)
   cmake_minimum_required(VERSION 3.13.4)
 
   find_package(LLVM CONFIG REQUIRED)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,8 +2,6 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 # CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
 # New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
 if(POLICY CMP0116)
@@ -47,6 +45,9 @@
   VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}
   LANGUAGES C CXX ASM)
 
+# Must go after project(..)
+include(GNUInstallDirs)
+
 set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
Index: lldb/tools/debugserver/CMakeLists.txt
===
--- lldb/tools/debugserver/CMakeLists.txt
+++ lldb/tools/debugserver/CMakeLists.txt
@@ -2,7 +2,12 @@
 
 project(Debugserver LANGUAGES C CXX ASM-ATT)
 
+# Must go below project(..)
+include(GNUInstallDirs)
+
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  set(LLDB_BUILT_STANDALONE TRUE)
+
   set(CMAKE_MODULE_PATH
 ${CMAKE_MODULE_PATH}
 "${CMAKE_SOURCE_DIR}/../../cmake"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -108,5 +108,3 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
-
-set(LLDB_BUILT_STANDALONE 1)
Index: lldb/CMakeLists.txt
==

[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 created this revision.
Ericson2314 added reviewers: arichardson, compnerd, phosek, beanz.
Herald added subscribers: libcxx-commits, mgorny.
Herald added a reviewer: bollu.
Herald added a reviewer: ldionne.
Herald added projects: libunwind, Flang.
Herald added a reviewer: libunwind.
Ericson2314 requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, jdoerfert.
Herald added projects: LLDB, libc++, libc++abi, LLVM.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

We had two related problems with `GNUInstallDirs`:

1. It might default to `lib64`, clashing with LLVM's own `*_LIBDIR_SUFFIX`. I 
haven't used `CMAKE_INSTALL_LIBDIR` so far for this very reason.

2. Its defaulting logic must go after `project(..)` to work correctly, but 
`project(..)` is often in a standalone condition making this awkward, since the 
rest of the condition code may also need GNUInstallDirs.

A simple solution is to just default `CMAKE_INSTALL_LIBDIR` ourselves,
which avoids both issues.

I did this with a little copy-pasted code, but we could factor it out in
`/cmake` instead. I didn't do that yet because it would mean moving the
module path manipulations instead. But if that is desired, I will do it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117639

Files:
  flang/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  llvm/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,10 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # Check if this is a in tree build.
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,6 +2,10 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # Add path for custom modules.
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 # If we are not building as a part of LLVM, build LLD as an
Index: libunwind/CMakeLists.txt
===
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -8,6 +8,10 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
Index: libcxxabi/CMakeLists.txt
===
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -10,6 +10,10 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM does those separately.
+  set(CMAKE_INSTALL_LIBDIR lib)
+endif()
 include(GNUInstallDirs)
 
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -10,6 +10,10 @@
 #===
 cmake_minimum_required(VERSION 3.13.4)
 
+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
+  # No suffixes by default: LLVM doe

[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added a comment.

In D117639#3254065 , @arichardson 
wrote:

> I believe `LLVM_LIBDIR_SUFFIX` was added as a workaround for not being able 
> to use GNUInstallDirs (which will automatically detect the right suffixed 
> e.g. for SuSE) in rG46fed3b475ddd92d02d9b72d0d77c5a939f132d1 
> . Would 
> it be possible to move the include() below the `project()/enable_language()` 
> calls so that CMake can detect the expected libdir suffix and then use 
> something like the following:
>
>   # If LLVM_LIBDIR_SUFFIX is defined, we use that to override the libdir, 
> otherwise GNUInstallDirs defaults should be correct.
>   if(DEFINED LLVM_LIBDIR_SUFFIX)
> message(DEPRECATION "LLVM_LIBDIR_SUFFIX is deprecated, set 
> CMAKE_INSTALL_LIBDIR to lib${LLVM_LIBDIR_SUFFIX} instead")
> set(CMAKE_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX})
>   endif()
>   include(GNUInstallDirs)

I would love to do this, but I was unsure whether that was acceptable.

It gets even more complicated downstream when other `*_LIBDIR_SUFFIX` variable 
are defaulted from `LLVM_LIBDIR_SUFFIX`. Can we deprecate that too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Avoid warning or extra suffix for CMAKE_INSTALL_LIBDIR

2022-01-25 Thread Alexander Richardson via Phabricator via lldb-commits
arichardson added a comment.

I see AddLLVM already includes GNUInstallDirs, can we add the 
LLVM_LIBDIR_SUFFIX check to that file and avoid including GNUInstallDirs 
explicitly in all the projects? The standalone builds will pull in 
GNUInstallDirs via AddLLVM, and the non-standalone builds should already have 
the variables defined?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Make include(GNUInstallDirs) always below project(..)

2022-01-25 Thread Chris Bieneman via Phabricator via lldb-commits
beanz accepted this revision.
beanz added a comment.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Make include(GNUInstallDirs) always below project(..)

2022-01-25 Thread Alexander Richardson via Phabricator via lldb-commits
arichardson accepted this revision.
arichardson added a comment.

This LGTM, but please wait for someone else to review before committing it.




Comment at: lldb/CMakeLists.txt:21
+if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 

Could keep this in the first if then you won't have to duplicate setting 
LLDB_BUILT_STANDALONE?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Make include(GNUInstallDirs) always below project(..)

2022-01-25 Thread Petr Hosek via Phabricator via lldb-commits
phosek accepted this revision.
phosek added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

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


[Lldb-commits] [PATCH] D117639: [cmake] Make include(GNUInstallDirs) always below project(..)

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 401402.
Ericson2314 edited the summary of this revision.
Ericson2314 added a comment.

Rebase after D117617  landed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

Files:
  flang/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/tools/debugserver/CMakeLists.txt
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,8 +7,6 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -18,6 +16,9 @@
 
 project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES CXX)
 
+# Must go below project(..)
+include(GNUInstallDirs)
+
 set(PSTL_PARALLEL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial', 'omp', and 'tbb'. The default is 'serial'.")
 set(PSTL_HIDE_FROM_ABI_PER_TU OFF CACHE BOOL "Whether to constrain ABI-unstable symbols to each translation unit (basically, mark them with C's static keyword).")
 set(_PSTL_HIDE_FROM_ABI_PER_TU ${PSTL_HIDE_FROM_ABI_PER_TU}) # For __pstl_config_site
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,10 +1,14 @@
-include(GNUInstallDirs)
-
 # Check if this is a in tree build.
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
   cmake_minimum_required(VERSION 3.13.4)
+  set(POLLY_STANDALONE_BUILD TRUE)
+endif()
+
+# Must go below project(..)
+include(GNUInstallDirs)
 
+if(POLLY_STANDALONE_BUILD)
   # Where is LLVM installed?
   find_package(LLVM CONFIG REQUIRED)
   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,10 +1,15 @@
 # MLIR project.
 
-include(GNUInstallDirs)
-
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(mlir)
+  set(MLIR_STANDALONE_BUILD TRUE)
+endif()
+
+# Must go below project(..)
+include(GNUInstallDirs)
+
+if(MLIR_STANDALONE_BUILD)
   cmake_minimum_required(VERSION 3.13.4)
 
   find_package(LLVM CONFIG REQUIRED)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,8 +2,6 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 # CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
 # New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
 if(POLICY CMP0116)
@@ -47,6 +45,9 @@
   VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}
   LANGUAGES C CXX ASM)
 
+# Must go after project(..)
+include(GNUInstallDirs)
+
 set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
Index: lldb/tools/debugserver/CMakeLists.txt
===
--- lldb/tools/debugserver/CMakeLists.txt
+++ lldb/tools/debugserver/CMakeLists.txt
@@ -2,7 +2,12 @@
 
 project(Debugserver LANGUAGES C CXX ASM-ATT)
 
+# Must go below project(..)
+include(GNUInstallDirs)
+
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  set(LLDB_BUILT_STANDALONE TRUE)
+
   set(CMAKE_MODULE_PATH
 ${CMAKE_MODULE_PATH}
 "${CMAKE_SOURCE_DIR}/../../cmake"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -108,5 +108,3 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
-
-set(LLDB_BUILT_STANDALONE 1)
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,7 +1,5 @@
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 # Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
@@ -13,6 +11,1

[Lldb-commits] [PATCH] D117639: [cmake] Make include(GNUInstallDirs) always below project(..)

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf31ff1b29bc: [cmake] Make include(GNUInstallDirs) always 
below project(..) (authored by Ericson2314).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117639

Files:
  flang/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/tools/debugserver/CMakeLists.txt
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt
  polly/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,8 +7,6 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -18,6 +16,9 @@
 
 project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES CXX)
 
+# Must go below project(..)
+include(GNUInstallDirs)
+
 set(PSTL_PARALLEL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial', 'omp', and 'tbb'. The default is 'serial'.")
 set(PSTL_HIDE_FROM_ABI_PER_TU OFF CACHE BOOL "Whether to constrain ABI-unstable symbols to each translation unit (basically, mark them with C's static keyword).")
 set(_PSTL_HIDE_FROM_ABI_PER_TU ${PSTL_HIDE_FROM_ABI_PER_TU}) # For __pstl_config_site
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,10 +1,14 @@
-include(GNUInstallDirs)
-
 # Check if this is a in tree build.
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
   cmake_minimum_required(VERSION 3.13.4)
+  set(POLLY_STANDALONE_BUILD TRUE)
+endif()
+
+# Must go below project(..)
+include(GNUInstallDirs)
 
+if(POLLY_STANDALONE_BUILD)
   # Where is LLVM installed?
   find_package(LLVM CONFIG REQUIRED)
   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,10 +1,15 @@
 # MLIR project.
 
-include(GNUInstallDirs)
-
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(mlir)
+  set(MLIR_STANDALONE_BUILD TRUE)
+endif()
+
+# Must go below project(..)
+include(GNUInstallDirs)
+
+if(MLIR_STANDALONE_BUILD)
   cmake_minimum_required(VERSION 3.13.4)
 
   find_package(LLVM CONFIG REQUIRED)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -2,8 +2,6 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 # CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
 # New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
 if(POLICY CMP0116)
@@ -47,6 +45,9 @@
   VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}
   LANGUAGES C CXX ASM)
 
+# Must go after project(..)
+include(GNUInstallDirs)
+
 set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
Index: lldb/tools/debugserver/CMakeLists.txt
===
--- lldb/tools/debugserver/CMakeLists.txt
+++ lldb/tools/debugserver/CMakeLists.txt
@@ -2,7 +2,12 @@
 
 project(Debugserver LANGUAGES C CXX ASM-ATT)
 
+# Must go below project(..)
+include(GNUInstallDirs)
+
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  set(LLDB_BUILT_STANDALONE TRUE)
+
   set(CMAKE_MODULE_PATH
 ${CMAKE_MODULE_PATH}
 "${CMAKE_SOURCE_DIR}/../../cmake"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -108,5 +108,3 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
-
-set(LLDB_BUILT_STANDALONE 1)
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,7 +1,5 @@
 cmake_minimum_required(VERSION 3.13.4)
 
-include(GNUInstallDirs)
-
 # Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
@@ -13,6 +

[Lldb-commits] [PATCH] D99484: [cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 402234.
Ericson2314 added a comment.

Trim down, now that many parts have been landed already


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-tidy)
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -113,7 +113,7 @@
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY .
-DESTINATION include/clang-tidy
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/clang-tidy"
 COMPONENT clang-tidy-headers
 FILES_MATCHING
 PATTERN "*.h"
Index: clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
@@ -21,8 +21,8 @@
   )
 
 install(PROGRAMS clang-include-fixer.el
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
 install(PROGRAMS clang-include-fixer.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
Index: 
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
@@ -20,5 +20,5 @@
   )
 
 install(PROGRAMS run-find-all-symbols.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT find-all-symbols)
Index: clang-tools-extra/clang-doc/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -19,9 +19,9 @@
   )
 
 install(FILES ../assets/clang-doc-default-stylesheet.css
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
 
 install(FILES ../assets/index.js
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
Index: clang-tools-extra/CMakeLists.txt
===
--- clang-tools-extra/CMakeLists.txt
+++ clang-tools-extra/CMakeLists.txt
@@ -1,4 +1,5 @@
 include(CMakeDependentOption)
+include(GNUInstallDirs)
 
 option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
   "Include static analyzer checks in clang-tidy" ON)


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-tidy)
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===

[Lldb-commits] [PATCH] D99484: [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added a comment.

Alright, this is the last bit (except for D101070 
 which evidently caused the issues), looking 
good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[Lldb-commits] [PATCH] D99484: [clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.

2022-01-25 Thread John Ericson via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c16647c3676: [clang-tools-extra][cmake] Use 
`GNUInstallDirs` to support custom installation… (authored by Ericson2314).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/CMakeLists.txt
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-tidy)
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -113,7 +113,7 @@
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY .
-DESTINATION include/clang-tidy
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/clang-tidy"
 COMPONENT clang-tidy-headers
 FILES_MATCHING
 PATTERN "*.h"
Index: clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
@@ -21,8 +21,8 @@
   )
 
 install(PROGRAMS clang-include-fixer.el
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
 install(PROGRAMS clang-include-fixer.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-include-fixer)
Index: 
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
+++ clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
@@ -20,5 +20,5 @@
   )
 
 install(PROGRAMS run-find-all-symbols.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT find-all-symbols)
Index: clang-tools-extra/clang-doc/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -19,9 +19,9 @@
   )
 
 install(FILES ../assets/clang-doc-default-stylesheet.css
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
 
 install(FILES ../assets/index.js
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
Index: clang-tools-extra/CMakeLists.txt
===
--- clang-tools-extra/CMakeLists.txt
+++ clang-tools-extra/CMakeLists.txt
@@ -1,4 +1,5 @@
 include(CMakeDependentOption)
+include(GNUInstallDirs)
 
 option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
   "Include static analyzer checks in clang-tidy" ON)


Index: clang-tools-extra/modularize/CMakeLists.txt
===
--- clang-tools-extra/modularize/CMakeLists.txt
+++ clang-tools-extra/modularize/CMakeLists.txt
@@ -23,5 +23,5 @@
   )
 
 install(TARGETS modularize
-RUNTIME DESTINATION bin
+RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 COMPONENT clang-extras)
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -52,9 +52,9 @@
 
 
 install(PROGRAMS clang-tidy-diff.py
-  DESTINATION share/clang
+  DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-tidy)
 install(PROGRAMS run-clang-tidy.py
-  DESTINATION bin
+  DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-tidy
   RENAME run-clang-ti

[Lldb-commits] [PATCH] D117382: [NFC] Cleanup log channel stuff to all be consistent and use 64 bit log channel mask.

2022-01-25 Thread Greg Clayton via Phabricator via lldb-commits
clayborg abandoned this revision.
clayborg added a comment.

Abandoning after discussing on the mailing list in lieu of Pavel's patch: 
https://reviews.llvm.org/D117490


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117382

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


[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 402927.
mgorny marked an inline comment as done.
mgorny added a comment.

Add a common test function. Document the raw data. Include trapno check on 
FreeBSD.

That said, it just occurred to me that I need to add some packet indicating the 
architecture.


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

https://reviews.llvm.org/D118055

Files:
  lldb/bindings/interface/SBThread.i
  lldb/include/lldb/API/SBThread.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/API/SBThread.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py

Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
===
--- lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -490,3 +490,77 @@
  lldb.eStopReasonSignal)
 self.assertEqual(process.threads[0].GetStopDescription(100),
  'signal SIGUSR1')
+
+def do_siginfo_test(self, platform, raw_data, expected):
+class MyResponder(MockGDBServerResponder):
+def qSupported(self, client_supported):
+return "PacketSize=3fff;QStartNoAckMode+;qXfer:siginfo:read+"
+
+def qXferRead(self, obj, annex, offset, length):
+if obj == "siginfo":
+return raw_data, False
+else:
+return None, False
+
+def haltReason(self):
+return "T02"
+
+def cont(self):
+return self.haltReason()
+
+self.server.responder = MyResponder()
+
+self.runCmd("platform select " + platform)
+target = self.createTarget("a.yaml")
+process = self.connect(target)
+
+error = lldb.SBError()
+siginfo = process.threads[0].GetSiginfo(error)
+self.assertTrue(siginfo, error)
+
+for key, value in expected.items():
+self.assertEqual(siginfo.GetValueForExpressionPath("." + key)
+ .GetValueAsUnsigned(),
+ value)
+
+
+def test_siginfo_linux(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # __pad0   si_pid  si_uid
+"\x00\x00\x00\x00\xbf\xf7\x0b\x00\xe8\x03\x00\x00"
+  # si_status
+"\x0c\x00\x00\x00" + "\x00" * 100)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 784319,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", data, expected)
+
+def test_siginfo_freebsd(self):
+data = (
+  # si_signo si_errnosi_code
+"\x0b\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+  # si_addr
+"\x76\x98\xba\xdc\xfe\x00\x00\x00"
+  # si_statussi_trapno
+"\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 36)
+
+expected = {
+"si_signo": 11,  # SIGSEGV
+"si_errno": 0,
+"si_code": 1,  # SEGV_MAPERR
+"si_addr": 0xfedcba9876,
+"_reason._fault._trapno": 12,
+}
+self.do_siginfo_test("remote-freebsd", data, expected)
Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
@@ -90,6 +90,9 @@
 
   StructuredData::ObjectSP FetchThreadExtendedInfo() override;
 
+  llvm::Expected>
+  GetSiginfo(size_t max_size) const override;
+
 protected:
   friend class ProcessGDBRemote;
 
Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -346,3 +346,23 @@
 ->CalculateThreadStopInfo(this);
   return false;
 }
+
+llvm::Expected>
+ThreadGDBRemote::Ge

[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 402933.
mgorny added a comment.

I've forgotten that the architecture is inferred from target here. Added i386 
test for completeness.


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

https://reviews.llvm.org/D118055

Files:
  lldb/bindings/interface/SBThread.i
  lldb/include/lldb/API/SBThread.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/API/SBThread.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py

Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
===
--- lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -490,3 +490,99 @@
  lldb.eStopReasonSignal)
 self.assertEqual(process.threads[0].GetStopDescription(100),
  'signal SIGUSR1')
+
+def do_siginfo_test(self, platform, target_yaml, raw_data, expected):
+class MyResponder(MockGDBServerResponder):
+def qSupported(self, client_supported):
+return "PacketSize=3fff;QStartNoAckMode+;qXfer:siginfo:read+"
+
+def qXferRead(self, obj, annex, offset, length):
+if obj == "siginfo":
+return raw_data, False
+else:
+return None, False
+
+def haltReason(self):
+return "T02"
+
+def cont(self):
+return self.haltReason()
+
+self.server.responder = MyResponder()
+
+self.runCmd("platform select " + platform)
+target = self.createTarget(target_yaml)
+process = self.connect(target)
+
+error = lldb.SBError()
+siginfo = process.threads[0].GetSiginfo(error)
+self.assertTrue(siginfo, error)
+
+for key, value in expected.items():
+self.assertEqual(siginfo.GetValueForExpressionPath("." + key)
+ .GetValueAsUnsigned(),
+ value)
+
+
+def test_siginfo_linux_amd64(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # __pad0   si_pid  si_uid
+"\x00\x00\x00\x00\xbf\xf7\x0b\x00\xe8\x03\x00\x00"
+  # si_status
+"\x0c\x00\x00\x00" + "\x00" * 100)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 784319,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", "basic_eh_frame.yaml",
+ data, expected)
+
+def test_siginfo_linux_i386(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x49\x43\x07\x00\xe8\x03\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 104)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 475977,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", "basic_eh_frame-i386.yaml",
+ data, expected)
+
+def test_siginfo_freebsd_amd64(self):
+data = (
+  # si_signo si_errnosi_code
+"\x0b\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+  # si_addr
+"\x76\x98\xba\xdc\xfe\x00\x00\x00"
+  # si_statussi_trapno
+"\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 36)
+
+expected = {
+"si_signo": 11,  # SIGSEGV
+"si_errno": 0,
+"si_code": 1,  # SEGV_MAPERR
+"si_addr": 0xfedcba9876,
+"_reason._fault._trapno": 12,
+}
+self.do_siginfo_test("remote-freebsd", "basic_eh_frame.yaml",
+ data, expected)
Index: lldb/source/Plugins/Process/gdb-remote/ThreadGD

[Lldb-commits] [lldb] d7e183b - [lldb] Use new dyld SPIs to query the shared cache local symbols

2022-01-25 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-01-25T09:36:48-08:00
New Revision: d7e183b225ecddeef2a28a59c1addb8e1825ffc6

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

LOG: [lldb] Use new dyld SPIs to query the shared cache local symbols

rdar://85492172

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 20383d9646fdc..2e712cded5308 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6,8 +6,13 @@
 //
 
//===--===//
 
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/StringRef.h"
 
+#include 
+#include 
+#include 
+
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm64.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
@@ -155,28 +160,6 @@ struct lldb_copy_dyld_cache_header_v1 {
 // and later
 };
 
-struct lldb_copy_dyld_cache_mapping_info {
-  uint64_t address;
-  uint64_t size;
-  uint64_t fileOffset;
-  uint32_t maxProt;
-  uint32_t initProt;
-};
-
-struct lldb_copy_dyld_cache_local_symbols_info {
-  uint32_t nlistOffset;
-  uint32_t nlistCount;
-  uint32_t stringsOffset;
-  uint32_t stringsSize;
-  uint32_t entriesOffset;
-  uint32_t entriesCount;
-};
-struct lldb_copy_dyld_cache_local_symbols_entry {
-  uint32_t dylibOffset;
-  uint32_t nlistStartIndex;
-  uint32_t nlistCount;
-};
-
 static void PrintRegisterValue(RegisterContext *reg_ctx, const char *name,
const char *alt_name, size_t reg_byte_size,
Stream &data) {
@@ -2257,6 +2240,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
   llvm::StringRef g_objc_v2_prefix_class("_OBJC_CLASS_$_");
   llvm::StringRef g_objc_v2_prefix_metaclass("_OBJC_METACLASS_$_");
   llvm::StringRef g_objc_v2_prefix_ivar("_OBJC_IVAR_$_");
+  UUID image_uuid;
 
   for (i = 0; i < m_header.ncmds; ++i) {
 const lldb::offset_t cmd_offset = offset;
@@ -2324,6 +2308,14 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
sizeof(function_starts_load_command));
   break;
 
+case LC_UUID: {
+  const uint8_t *uuid_bytes = m_data.PeekData(offset, 16);
+
+  if (uuid_bytes)
+image_uuid = UUID::fromOptionalData(uuid_bytes, 16);
+  break;
+}
+
 default:
   break;
 }
@@ -2615,8 +2607,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
  ? eh_frame_section_sp->GetID()
  : static_cast(NO_SECT);
 
-  lldb::offset_t nlist_data_offset = 0;
-
   uint32_t N_SO_index = UINT32_MAX;
 
   MachSymtabSectionInfo section_info(section_list);
@@ -2682,26 +2672,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 // Next we need to determine the correct path for the dyld shared cache.
 
 ArchSpec header_arch = GetArchitecture();
-char dsc_path[PATH_MAX];
-char dsc_path_development[PATH_MAX];
-
-snprintf(
-dsc_path, sizeof(dsc_path), "%s%s%s",
-"/System/Library/Caches/com.apple.dyld/", /* 
IPHONE_DYLD_SHARED_CACHE_DIR
-   */
-"dyld_shared_cache_", /* DYLD_SHARED_CACHE_BASE_NAME */
-header_arch.GetArchitectureName());
-
-snprintf(
-dsc_path_development, sizeof(dsc_path), "%s%s%s%s",
-"/System/Library/Caches/com.apple.dyld/", /* 
IPHONE_DYLD_SHARED_CACHE_DIR
-   */
-"dyld_shared_cache_", /* DYLD_SHARED_CACHE_BASE_NAME */
-header_arch.GetArchitectureName(), ".development");
-
-FileSpec dsc_nondevelopment_filespec(dsc_path);
-FileSpec dsc_development_filespec(dsc_path_development);
-FileSpec dsc_filespec;
 
 UUID dsc_uuid;
 UUID process_shared_cache_uuid;
@@ -2712,155 +2682,99 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 process_shared_cache_uuid);
 }
 
-// First see if we can find an exact match for the inferior process
-// shared cache UUID in the development or non-development shared caches
-// on disk.
-if (process_shared_cache_uuid.IsValid()) {
-  if (FileSystem::Instance().Exists(dsc_development_filespec)) {
-UUID dsc_development_uuid = GetSharedCacheUUID(
-dsc_development_filespec, byte_order, addr_byte_size);
-if (dsc_development_uuid.IsValid() &&
-dsc_development_uuid == process_shared_cache_uuid) {
-

[Lldb-commits] [lldb] c2cd7cc - [lldb] Only include mach headers on Darwin

2022-01-25 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-01-25T09:58:47-08:00
New Revision: c2cd7cc63c5084cea943a7cfa7e1d7e5c62a34b2

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

LOG: [lldb] Only include mach headers on Darwin

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 2e712cded530..36ef7b520897 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -9,10 +9,6 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/StringRef.h"
 
-#include 
-#include 
-#include 
-
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_arm64.h"
 #include "Plugins/Process/Utility/RegisterContextDarwin_i386.h"
@@ -60,6 +56,9 @@
 #include 
 // GetLLDBSharedCacheUUID() needs to call dlsym()
 #include 
+#include 
+#include 
+#include 
 #endif
 
 #ifndef __APPLE__



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


[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The GetSiginfoType API seems awkward to me.  It requires I get the data itself 
from some other source and then cast it to this type myself.  I'm assuming in 
the fullness of time, there will be a GetSiginfoData call, and then I have to 
put the two together?  The only reason I can see to have separate "GetType" and 
"GetData" calls is if there's some useful way to get the data blob that doesn't 
go through lldb.

After all, if we had:

SBValue SBThread::GetSiginfoValue();

API you can still get the type and data back out of the SBValue if you needed 
them.   But I am pretty sure most uses will be to query the values of its child 
members, which makes the value returning API more convenient.

At the lldb_private layer, it's fine to separate the two, but when you go to 
present this to the outside world through commands or API's we try to keep the 
API set more compact.


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D117707#3269214 , @labath wrote:

> Adding Alex for the plugin dependency aspect. I don't think this dep is wrong 
> (it's pretty hard to pretend we don't at least have a C language), but he may 
> want to say something about this.

I think we need to have a way to express types that the basic system uses so we 
can present them in a structured way to users.  Formally, you could express 
this by saying that we need a "platform language" reflecting how that platform 
vends it's API's at the lowest level.  This would have been Pascal for classic 
MacOS way back in the day, and maybe Lisp for Lisp machines.  But IRL all the 
platforms we are likely to deal with express their lowest level system API's in 
C, so it seems okay to have that be an implicit assumption till we come across 
a system that we want to support and for which C isn't one of the low level 
system languages.

> The patch itself is somewhat repetitive, but otherwise seems ok.
>
> I am a bit curious about the `__lldb` prefix. I'm wondering if there's a way 
> to avoid having it, while still maintaining isolation from any type with the 
> same name coming from the debug info. I'm thinking about putting it in some 
> kind of an anonymous namespace or something... Does anyone know if that works?

This will be the actual type of an SBValue, as is the case in other instances 
where we've made up types, so users will see this type if they look closely.  
So it should be clear from the name that this is just an artificial type lldb 
made up.  `__lldb_whatever` expresses that pretty clearly, but I'm worried some 
reasonable looking name in an anonymous namespace would send users off on a 
wild goose chase.


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked 4 inline comments as done.
mgorny added inline comments.



Comment at: lldb/source/API/SBPlatform.cpp:672
+
+  assert(target_sp);
+  return SBType();

labath wrote:
> ??
Sorry, debug leftover ;-).


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 402979.
mgorny marked an inline comment as done.
mgorny added a comment.

Implemented the requested changes.


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

https://reviews.llvm.org/D117707

Files:
  lldb/bindings/interface/SBPlatform.i
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBType.h
  lldb/include/lldb/Target/Platform.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
  lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
  lldb/source/Plugins/Platform/Linux/PlatformLinux.h
  lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
  lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
  lldb/source/Target/Platform.cpp
  lldb/unittests/Platform/CMakeLists.txt
  lldb/unittests/Platform/PlatformSiginfoTest.cpp
  lldb/unittests/Platform/tools/generate_siginfo.c

Index: lldb/unittests/Platform/tools/generate_siginfo.c
===
--- /dev/null
+++ lldb/unittests/Platform/tools/generate_siginfo.c
@@ -0,0 +1,112 @@
+//===-- generate_siginfo_linux.c --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include 
+#include 
+#include 
+
+siginfo_t siginfo;
+
+#define P(member)  \
+  printf("   {\"%s\", %zd, %zd},\n", #member,   \
+ offsetof(siginfo_t, member), sizeof(siginfo.member));
+
+// undef annoying "POSIX friendliness" macros
+#undef si_pid
+#undef si_uid
+#undef si_overrun
+#undef si_status
+#undef si_utime
+#undef si_stime
+#undef si_addr
+#undef si_addr_lsb
+#undef si_band
+#undef si_fd
+
+int main() {
+  printf("  ExpectFields(siginfo_type,\n");
+  printf("   {\n");
+
+#if !defined(__NetBSD__)
+  P(si_signo);
+  P(si_errno);
+  P(si_code);
+
+#if defined(__GLIBC__)
+  P(_sifields._kill.si_pid);
+  P(_sifields._kill.si_uid);
+  P(_sifields._timer.si_tid);
+  P(_sifields._timer.si_overrun);
+  P(_sifields._timer.si_sigval);
+  P(_sifields._rt.si_pid);
+  P(_sifields._rt.si_uid);
+  P(_sifields._rt.si_sigval);
+  P(_sifields._sigchld.si_pid);
+  P(_sifields._sigchld.si_uid);
+  P(_sifields._sigchld.si_status);
+  P(_sifields._sigchld.si_utime);
+  P(_sifields._sigchld.si_stime);
+  P(_sifields._sigfault.si_addr);
+  P(_sifields._sigfault.si_addr_lsb);
+  P(_sifields._sigfault._bounds._addr_bnd._lower);
+  P(_sifields._sigfault._bounds._addr_bnd._upper);
+  P(_sifields._sigfault._bounds._pkey);
+  P(_sifields._sigpoll.si_band);
+  P(_sifields._sigpoll.si_fd);
+  P(_sifields._sigsys._call_addr);
+  P(_sifields._sigsys._syscall);
+  P(_sifields._sigsys._arch);
+#endif // defined(__GLIBC__)
+
+#if defined(__FreeBSD__)
+  // these are top-level fields on FreeBSD
+  P(si_pid);
+  P(si_uid);
+  P(si_status);
+  P(si_addr);
+  P(si_value);
+  P(_reason._fault._trapno);
+  P(_reason._timer._timerid);
+  P(_reason._timer._overrun);
+  P(_reason._mesgq._mqd);
+  P(_reason._poll._band);
+#endif // defined(__FreeBSD__)
+
+#else // defined(__NetBSD__)
+
+  P(_info._signo);
+  P(_info._code);
+  P(_info._errno);
+  P(_info._reason._rt._pid);
+  P(_info._reason._rt._uid);
+  P(_info._reason._rt._value);
+  P(_info._reason._child._pid);
+  P(_info._reason._child._uid);
+  P(_info._reason._child._status);
+  P(_info._reason._child._utime);
+  P(_info._reason._child._stime);
+  P(_info._reason._fault._addr);
+  P(_info._reason._fault._trap);
+  P(_info._reason._fault._trap2);
+  P(_info._reason._fault._trap3);
+  P(_info._reason._poll._band);
+  P(_info._reason._poll._fd);
+  P(_info._reason._syscall._sysnum);
+  P(_info._reason._syscall._retval);
+  P(_info._reason._syscall._error);
+  P(_info._reason._syscall._args);
+  P(_info._reason._ptrace_state._pe_report_event);
+  P(_info._reason._ptrace_state._option._pe_other_pid);
+  P(_info._reason._ptrace_state._option._pe_lwp);
+
+#endif // defined(__NetBSD__)
+
+  printf("   });\n");
+
+  return 0;
+}
Index: lldb/unittests/Platform/PlatformSiginfoTest.cpp
===
--- /dev/null
+++ lldb/unittests/Platform/PlatformSiginfoTest.cpp
@@ -0,0 +1,311 @@
+//===-- PlatformSiginfoTest.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 "gtest/gtest.h"
+
+#include 
+#include 
+
+#include "Plugins/Platform/

[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Hmm, I think I've exposed it via SBPlatform because originally I planned on 
writing the tests in Python. However, it ended up being tested through 
unittests after all, so I think I can remove that part. Lemme try.


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [lldb] 2a1b7aa - [lldb] Fix ProcessKDPLog for the logging refactor

2022-01-25 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-25T20:51:19+01:00
New Revision: 2a1b7aa016c0f4b5598806205bdfbab1ea2d92c4

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

LOG: [lldb] Fix ProcessKDPLog for the logging refactor

Added: 


Modified: 
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp 
b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
index 3b5f1157d5446..f741126f965bb 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
@@ -11,24 +11,28 @@
 using namespace lldb_private;
 
 static constexpr Log::Category g_categories[] = {
-{{"async"}, {"log asynchronous activity"}, KDP_LOG_ASYNC},
-{{"break"}, {"log breakpoints"}, KDP_LOG_BREAKPOINTS},
-{{"comm"}, {"log communication activity"}, KDP_LOG_COMM},
+{{"async"}, {"log asynchronous activity"}, KDPLog::Async},
+{{"break"}, {"log breakpoints"}, KDPLog::Breakpoints},
+{{"comm"}, {"log communication activity"}, KDPLog::Comm},
 {{"data-long"},
  {"log memory bytes for memory reads and writes for all transactions"},
- KDP_LOG_MEMORY_DATA_LONG},
+ KDPLog::MemoryDataLong},
 {{"data-short"},
  {"log memory bytes for memory reads and writes for short transactions "
   "only"},
- KDP_LOG_MEMORY_DATA_SHORT},
-{{"memory"}, {"log memory reads and writes"}, KDP_LOG_MEMORY},
-{{"packets"}, {"log gdb remote packets"}, KDP_LOG_PACKETS},
-{{"process"}, {"log process events and activities"}, KDP_LOG_PROCESS},
-{{"step"}, {"log step related activities"}, KDP_LOG_STEP},
-{{"thread"}, {"log thread events and activities"}, KDP_LOG_THREAD},
-{{"watch"}, {"log watchpoint related activities"}, KDP_LOG_WATCHPOINTS},
+ KDPLog::MemoryDataShort},
+{{"memory"}, {"log memory reads and writes"}, KDPLog::Memory},
+{{"packets"}, {"log gdb remote packets"}, KDPLog::Packets},
+{{"process"}, {"log process events and activities"}, KDPLog::Process},
+{{"step"}, {"log step related activities"}, KDPLog::Step},
+{{"thread"}, {"log thread events and activities"}, KDPLog::Thread},
+{{"watch"}, {"log watchpoint related activities"}, KDPLog::Watchpoints},
 };
 
-Log::Channel ProcessKDPLog::g_channel(g_categories, KDP_LOG_DEFAULT);
+static Log::Channel g_channel(g_categories, KDPLog::Packets);
+
+template <> Log::Channel &lldb_private::LogChannelFor() {
+  return g_channel;
+}
 
 void ProcessKDPLog::Initialize() { Log::Register("kdp-remote", g_channel); }

diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h 
b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h
index 91b1b6e49b7af..f47a9f5dd0876 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h
@@ -11,32 +11,44 @@
 
 #include "lldb/Utility/Log.h"
 
-#define KDP_LOG_PROCESS (1u << 1)
-#define KDP_LOG_THREAD (1u << 2)
-#define KDP_LOG_PACKETS (1u << 3)
-#define KDP_LOG_MEMORY (1u << 4) // Log memory reads/writes calls
-#define KDP_LOG_MEMORY_DATA_SHORT  
\
-  (1u << 5) // Log short memory reads/writes bytes
-#define KDP_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes
-#define KDP_LOG_BREAKPOINTS (1u << 7)
-#define KDP_LOG_WATCHPOINTS (1u << 8)
-#define KDP_LOG_STEP (1u << 9)
-#define KDP_LOG_COMM (1u << 10)
-#define KDP_LOG_ASYNC (1u << 11)
-#define KDP_LOG_ALL (UINT32_MAX)
-#define KDP_LOG_DEFAULT KDP_LOG_PACKETS
 
 namespace lldb_private {
-class ProcessKDPLog {
-  static Log::Channel g_channel;
 
+enum class KDPLog : Log::MaskType {
+  Async = Log::ChannelFlag<0>,
+  Breakpoints = Log::ChannelFlag<1>,
+  Comm = Log::ChannelFlag<2>,
+  MemoryDataLong = Log::ChannelFlag<3>,  // Log all memory reads/writes bytes
+  MemoryDataShort = Log::ChannelFlag<4>, // Log short memory reads/writes bytes
+  Memory = Log::ChannelFlag<5>,  // Log memory reads/writes calls
+  Packets = Log::ChannelFlag<6>,
+  Process = Log::ChannelFlag<7>,
+  Step = Log::ChannelFlag<8>,
+  Thread = Log::ChannelFlag<9>,
+  Watchpoints = Log::ChannelFlag<10>,
+  LLVM_MARK_AS_BITMASK_ENUM(Watchpoints)
+};
+#define KDP_LOG_PROCESS ::lldb_private::KDPLog::Process
+#define KDP_LOG_THREAD ::lldb_private::KDPLog::Thread
+#define KDP_LOG_PACKETS ::lldb_private::KDPLog::Packets
+#define KDP_LOG_MEMORY ::lldb_private::KDPLog::Memory
+#define KDP_LOG_MEMORY_DATA_SHORT ::lldb_private::KDPLog::MemoryDataShort
+#define KDP_LOG_MEMORY_DATA_LONG ::lldb_private::KDPLog::MemoryDataLong
+#define KDP_LOG_BREAKPOINTS ::lldb_private::KDPLog::Breakpoi

[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 402991.
mgorny added a comment.

Remove the unnecessary API part.


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

https://reviews.llvm.org/D117707

Files:
  lldb/include/lldb/Target/Platform.h
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
  lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
  lldb/source/Plugins/Platform/Linux/PlatformLinux.h
  lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
  lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
  lldb/source/Target/Platform.cpp
  lldb/unittests/Platform/CMakeLists.txt
  lldb/unittests/Platform/PlatformSiginfoTest.cpp
  lldb/unittests/Platform/tools/generate_siginfo.c

Index: lldb/unittests/Platform/tools/generate_siginfo.c
===
--- /dev/null
+++ lldb/unittests/Platform/tools/generate_siginfo.c
@@ -0,0 +1,112 @@
+//===-- generate_siginfo_linux.c --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include 
+#include 
+#include 
+
+siginfo_t siginfo;
+
+#define P(member)  \
+  printf("   {\"%s\", %zd, %zd},\n", #member,   \
+ offsetof(siginfo_t, member), sizeof(siginfo.member));
+
+// undef annoying "POSIX friendliness" macros
+#undef si_pid
+#undef si_uid
+#undef si_overrun
+#undef si_status
+#undef si_utime
+#undef si_stime
+#undef si_addr
+#undef si_addr_lsb
+#undef si_band
+#undef si_fd
+
+int main() {
+  printf("  ExpectFields(siginfo_type,\n");
+  printf("   {\n");
+
+#if !defined(__NetBSD__)
+  P(si_signo);
+  P(si_errno);
+  P(si_code);
+
+#if defined(__GLIBC__)
+  P(_sifields._kill.si_pid);
+  P(_sifields._kill.si_uid);
+  P(_sifields._timer.si_tid);
+  P(_sifields._timer.si_overrun);
+  P(_sifields._timer.si_sigval);
+  P(_sifields._rt.si_pid);
+  P(_sifields._rt.si_uid);
+  P(_sifields._rt.si_sigval);
+  P(_sifields._sigchld.si_pid);
+  P(_sifields._sigchld.si_uid);
+  P(_sifields._sigchld.si_status);
+  P(_sifields._sigchld.si_utime);
+  P(_sifields._sigchld.si_stime);
+  P(_sifields._sigfault.si_addr);
+  P(_sifields._sigfault.si_addr_lsb);
+  P(_sifields._sigfault._bounds._addr_bnd._lower);
+  P(_sifields._sigfault._bounds._addr_bnd._upper);
+  P(_sifields._sigfault._bounds._pkey);
+  P(_sifields._sigpoll.si_band);
+  P(_sifields._sigpoll.si_fd);
+  P(_sifields._sigsys._call_addr);
+  P(_sifields._sigsys._syscall);
+  P(_sifields._sigsys._arch);
+#endif // defined(__GLIBC__)
+
+#if defined(__FreeBSD__)
+  // these are top-level fields on FreeBSD
+  P(si_pid);
+  P(si_uid);
+  P(si_status);
+  P(si_addr);
+  P(si_value);
+  P(_reason._fault._trapno);
+  P(_reason._timer._timerid);
+  P(_reason._timer._overrun);
+  P(_reason._mesgq._mqd);
+  P(_reason._poll._band);
+#endif // defined(__FreeBSD__)
+
+#else // defined(__NetBSD__)
+
+  P(_info._signo);
+  P(_info._code);
+  P(_info._errno);
+  P(_info._reason._rt._pid);
+  P(_info._reason._rt._uid);
+  P(_info._reason._rt._value);
+  P(_info._reason._child._pid);
+  P(_info._reason._child._uid);
+  P(_info._reason._child._status);
+  P(_info._reason._child._utime);
+  P(_info._reason._child._stime);
+  P(_info._reason._fault._addr);
+  P(_info._reason._fault._trap);
+  P(_info._reason._fault._trap2);
+  P(_info._reason._fault._trap3);
+  P(_info._reason._poll._band);
+  P(_info._reason._poll._fd);
+  P(_info._reason._syscall._sysnum);
+  P(_info._reason._syscall._retval);
+  P(_info._reason._syscall._error);
+  P(_info._reason._syscall._args);
+  P(_info._reason._ptrace_state._pe_report_event);
+  P(_info._reason._ptrace_state._option._pe_other_pid);
+  P(_info._reason._ptrace_state._option._pe_lwp);
+
+#endif // defined(__NetBSD__)
+
+  printf("   });\n");
+
+  return 0;
+}
Index: lldb/unittests/Platform/PlatformSiginfoTest.cpp
===
--- /dev/null
+++ lldb/unittests/Platform/PlatformSiginfoTest.cpp
@@ -0,0 +1,311 @@
+//===-- PlatformSiginfoTest.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 "gtest/gtest.h"
+
+#include 
+#include 
+
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"

[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-25 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 402992.
mgorny added a comment.

Update following changes in `GetSiginfoType()` — notably stop relying on the 
`SBPlatform` API and update for new prototype.


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

https://reviews.llvm.org/D118055

Files:
  lldb/bindings/interface/SBThread.i
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBTarget.h
  lldb/include/lldb/API/SBThread.h
  lldb/include/lldb/API/SBType.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/API/SBThread.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py

Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
===
--- lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -490,3 +490,99 @@
  lldb.eStopReasonSignal)
 self.assertEqual(process.threads[0].GetStopDescription(100),
  'signal SIGUSR1')
+
+def do_siginfo_test(self, platform, target_yaml, raw_data, expected):
+class MyResponder(MockGDBServerResponder):
+def qSupported(self, client_supported):
+return "PacketSize=3fff;QStartNoAckMode+;qXfer:siginfo:read+"
+
+def qXferRead(self, obj, annex, offset, length):
+if obj == "siginfo":
+return raw_data, False
+else:
+return None, False
+
+def haltReason(self):
+return "T02"
+
+def cont(self):
+return self.haltReason()
+
+self.server.responder = MyResponder()
+
+self.runCmd("platform select " + platform)
+target = self.createTarget(target_yaml)
+process = self.connect(target)
+
+error = lldb.SBError()
+siginfo = process.threads[0].GetSiginfo(error)
+self.assertTrue(siginfo, error)
+
+for key, value in expected.items():
+self.assertEqual(siginfo.GetValueForExpressionPath("." + key)
+ .GetValueAsUnsigned(),
+ value)
+
+
+def test_siginfo_linux_amd64(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # __pad0   si_pid  si_uid
+"\x00\x00\x00\x00\xbf\xf7\x0b\x00\xe8\x03\x00\x00"
+  # si_status
+"\x0c\x00\x00\x00" + "\x00" * 100)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 784319,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", "basic_eh_frame.yaml",
+ data, expected)
+
+def test_siginfo_linux_i386(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x49\x43\x07\x00\xe8\x03\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 104)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 475977,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", "basic_eh_frame-i386.yaml",
+ data, expected)
+
+def test_siginfo_freebsd_amd64(self):
+data = (
+  # si_signo si_errnosi_code
+"\x0b\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+  # si_addr
+"\x76\x98\xba\xdc\xfe\x00\x00\x00"
+  # si_statussi_trapno
+"\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 36)
+
+expected = {
+"si_signo": 11,  # SIGSEGV
+"si_errno": 0,
+"si_code": 1,  # SEGV_MAPERR
+"si_addr": 0xfedcba9876,
+"_reason._fault._trapno": 12,
+}
+self.do_siginfo_test("remote-freeb

[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D117707#3270323 , @mgorny wrote:

> Remove the unnecessary API part.

In the end, you will want some SB API exposing this information so users can do 
something with it.  I think returning the SBValue for the Thread is the right 
way to go.  But presumably you will do that once you are actually fetching 
values.


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-25 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

This looks fine to me.


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

https://reviews.llvm.org/D117707

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


[Lldb-commits] [PATCH] D117928: [lldb] Disable tests for x86 that uses write command on XMM registers

2022-01-25 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added a comment.

In D117928#3264795 , @labath wrote:

> If this is a problem with PTRACE_SETREGSET(NT_FPREGSET), then we might be 
> able to work around it by using PTRACE_POKEUSER instead. But it'd definitely 
> be good to confirm this, so that we can report the bug to kernel devs.

Oleg Nesterov  is the kernel maintainer for PTRACE; it seems 
there's no mailing list for PTRACE AFAICT.

> I submitted a patch to the kernel mailing list. See the kernel bug tracker 
> for discussion.

link: 
https://lore.kernel.org/lkml/20220125022015.874422-1-cont...@lsferreira.net/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117928

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


[Lldb-commits] [PATCH] D112824: [lldb][AArch64] Add MakeTaggedRanges to MemoryTagManager

2022-01-25 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid accepted this revision.
omjavaid added a comment.
This revision is now accepted and ready to land.

LGTM Thanks! for your patience


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112824

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


[Lldb-commits] [PATCH] D107140: [lldb] Add option to show memory tags in memory read output

2022-01-25 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid accepted this revision.
omjavaid added a comment.
This revision is now accepted and ready to land.

looks good thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107140

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


[Lldb-commits] [PATCH] D81499: [Debugger] Use FileSystem instead of calling llvm::sys::fs::openFileForWrite directly.

2022-01-25 Thread Yevgeny Rouban via Phabricator via lldb-commits
yrouban added a comment.

Sorry, I have a typo in diff number. My commit relates to 
https://reviews.llvm.org/D81449.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81499

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