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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 25 04:53:22 PST 2022


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<WindowsLog>() {
+  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 &LogChannelFor<WindowsLog>();
 }
 
 #endif // liblldb_ProcessWindowsLog_h_


        


More information about the lldb-commits mailing list