1 //===-- ProcessKDPLog.h -----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_ProcessKDPLog_h_
11 #define liblldb_ProcessKDPLog_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 
17 // Project includes
18 #include "lldb/Core/Log.h"
19 
20 #define KDP_LOG_VERBOSE (1u << 0)
21 #define KDP_LOG_PROCESS (1u << 1)
22 #define KDP_LOG_THREAD (1u << 2)
23 #define KDP_LOG_PACKETS (1u << 3)
24 #define KDP_LOG_MEMORY (1u << 4) // Log memory reads/writes calls
25 #define KDP_LOG_MEMORY_DATA_SHORT                                              \
26   (1u << 5) // Log short memory reads/writes bytes
27 #define KDP_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes
28 #define KDP_LOG_BREAKPOINTS (1u << 7)
29 #define KDP_LOG_WATCHPOINTS (1u << 8)
30 #define KDP_LOG_STEP (1u << 9)
31 #define KDP_LOG_COMM (1u << 10)
32 #define KDP_LOG_ASYNC (1u << 11)
33 #define KDP_LOG_ALL (UINT32_MAX)
34 #define KDP_LOG_DEFAULT KDP_LOG_PACKETS
35 
36 class ProcessKDPLog {
37 public:
38   static lldb_private::Log *GetLogIfAllCategoriesSet(uint32_t mask = 0);
39 
40   static void DisableLog(const char **categories,
41                          lldb_private::Stream *feedback_strm);
42 
43   static lldb_private::Log *EnableLog(lldb::StreamSP &log_stream_sp,
44                                       uint32_t log_options,
45                                       const char **categories,
46                                       lldb_private::Stream *feedback_strm);
47 
48   static void ListLogCategories(lldb_private::Stream *strm);
49 
50   static void LogIf(uint32_t mask, const char *format, ...);
51 };
52 
53 #endif // liblldb_ProcessKDPLog_h_
54