1 //===-- ProcessWindowsLog.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ProcessWindowsLog_h_
11 #define liblldb_ProcessWindowsLog_h_
13 #include "lldb/Core/Log.h"
15 #define WINDOWS_LOG_VERBOSE (1u << 0)
16 #define WINDOWS_LOG_PROCESS (1u << 1) // Log process operations
17 #define WINDOWS_LOG_EXCEPTION (1u << 1) // Log exceptions
18 #define WINDOWS_LOG_THREAD (1u << 2) // Log thread operations
19 #define WINDOWS_LOG_MEMORY (1u << 3) // Log memory reads/writes calls
20 #define WINDOWS_LOG_BREAKPOINTS (1u << 4) // Log breakpoint operations
21 #define WINDOWS_LOG_STEP (1u << 5) // Log step operations
22 #define WINDOWS_LOG_REGISTERS (1u << 6) // Log register operations
23 #define WINDOWS_LOG_EVENT (1u << 7) // Low level debug events
24 #define WINDOWS_LOG_ALL (UINT32_MAX)
32 class ProcessWindowsLog
34 static const char *m_pluginname;
37 // ---------------------------------------------------------------------
38 // Public Static Methods
39 // ---------------------------------------------------------------------
47 RegisterPluginName(const char *pluginName)
49 m_pluginname = pluginName;
53 RegisterPluginName(lldb_private::ConstString pluginName)
55 m_pluginname = pluginName.GetCString();
59 TestLogFlags(uint32_t mask, LogMaskReq req);
61 static lldb_private::Log *
65 DisableLog(const char **args, lldb_private::Stream *feedback_strm);
67 static lldb_private::Log *
68 EnableLog(lldb::StreamSP &log_stream_sp, uint32_t log_options,
69 const char **args, lldb_private::Stream *feedback_strm);
72 ListLogCategories(lldb_private::Stream *strm);
75 #define WINLOGF_IF(Flags, Req, Method, ...) \
77 if (ProcessWindowsLog::TestLogFlags(Flags, Req)) \
79 Log *log = ProcessWindowsLog::GetLog(); \
81 log->Method(__VA_ARGS__); \
85 #define WINLOG_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Printf, __VA_ARGS__)
86 #define WINLOG_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Printf, __VA_ARGS__)
87 #define WINLOGV_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Verbose, __VA_ARGS__)
88 #define WINLOGV_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Verbose, __VA_ARGS__)
89 #define WINLOGD_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Debug, __VA_ARGS__)
90 #define WINLOGD_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Debug, __VA_ARGS__)
91 #define WINERR_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Error, __VA_ARGS__)
92 #define WINERR_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Error, __VA_ARGS__)
93 #define WINWARN_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Warning, __VA_ARGS__)
94 #define WINWARN_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Warning, __VA_ARGS__)
96 #endif // liblldb_ProcessWindowsLog_h_