xref: /llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (revision e8a7b9841c583059115f5136fae3c85880773513)
1 //===-- ProcessGDBRemoteLog.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_ProcessGDBRemoteLog_h_
11 #define liblldb_ProcessGDBRemoteLog_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 GDBR_LOG_PROCESS (1u << 1)
21 #define GDBR_LOG_THREAD (1u << 2)
22 #define GDBR_LOG_PACKETS (1u << 3)
23 #define GDBR_LOG_MEMORY (1u << 4) // Log memory reads/writes calls
24 #define GDBR_LOG_MEMORY_DATA_SHORT                                             \
25   (1u << 5) // Log short memory reads/writes bytes
26 #define GDBR_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes
27 #define GDBR_LOG_BREAKPOINTS (1u << 7)
28 #define GDBR_LOG_WATCHPOINTS (1u << 8)
29 #define GDBR_LOG_STEP (1u << 9)
30 #define GDBR_LOG_COMM (1u << 10)
31 #define GDBR_LOG_ASYNC (1u << 11)
32 #define GDBR_LOG_ALL (UINT32_MAX)
33 #define GDBR_LOG_DEFAULT GDBR_LOG_PACKETS
34 
35 namespace lldb_private {
36 namespace process_gdb_remote {
37 
38 class ProcessGDBRemoteLog {
39 public:
40   static void Initialize();
41 
42   static Log *GetLogIfAllCategoriesSet(uint32_t mask = 0);
43 
44   static Log *GetLogIfAnyCategoryIsSet(uint32_t mask);
45 
46   static void DisableLog(const char **categories, Stream *feedback_strm);
47 
48   static Log *EnableLog(lldb::StreamSP &log_stream_sp, uint32_t log_options,
49                         const char **categories, Stream *feedback_strm);
50 
51   static void ListLogCategories(Stream *strm);
52 
53   static void LogIf(uint32_t mask, const char *format, ...);
54 };
55 
56 } // namespace process_gdb_remote
57 } // namespace lldb_private
58 
59 #endif // liblldb_ProcessGDBRemoteLog_h_
60