1 //===-- ProcessPOSIXLog.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_ProcessPOSIXLog_h_
11 #define liblldb_ProcessPOSIXLog_h_
15 // Other libraries and framework includes
18 #include "lldb/Core/Log.h"
20 #define POSIX_LOG_VERBOSE (1u << 0)
21 #define POSIX_LOG_PROCESS (1u << 1)
22 #define POSIX_LOG_THREAD (1u << 2)
23 #define POSIX_LOG_PACKETS (1u << 3)
24 #define POSIX_LOG_MEMORY (1u << 4) // Log memory reads/writes calls
25 #define POSIX_LOG_MEMORY_DATA_SHORT (1u << 5) // Log short memory reads/writes bytes
26 #define POSIX_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes
27 #define POSIX_LOG_BREAKPOINTS (1u << 7)
28 #define POSIX_LOG_WATCHPOINTS (1u << 8)
29 #define POSIX_LOG_STEP (1u << 9)
30 #define POSIX_LOG_COMM (1u << 10)
31 #define POSIX_LOG_ASYNC (1u << 11)
32 #define POSIX_LOG_PTRACE (1u << 12)
33 #define POSIX_LOG_REGISTERS (1u << 13)
34 #define POSIX_LOG_ALL (UINT32_MAX)
35 #define POSIX_LOG_DEFAULT POSIX_LOG_PACKETS
37 // The size which determines "short memory reads/writes".
38 #define POSIX_LOG_MEMORY_SHORT_BYTES (4 * sizeof(ptrdiff_t))
42 static int m_nestinglevel;
43 static const char *m_pluginname;
47 RegisterPluginName(const char *pluginName)
49 m_pluginname = pluginName;
53 RegisterPluginName(lldb_private::ConstString pluginName)
55 m_pluginname = pluginName.GetCString();
58 static lldb_private::Log *
59 GetLogIfAllCategoriesSet(uint32_t mask = 0);
62 DisableLog (const char **args, lldb_private::Stream *feedback_strm);
64 static lldb_private::Log *
65 EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options,
66 const char **args, lldb_private::Stream *feedback_strm);
69 ListLogCategories (lldb_private::Stream *strm);
72 LogIf (uint32_t mask, const char *format, ...);
74 // The following functions can be used to enable the client to limit
75 // logging to only the top level function calls. This is useful for
76 // recursive functions. FIXME: not thread safe!
78 // void NestingFunc() {
79 // LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_ALL));
82 // ProcessPOSIXLog::IncNestLevel();
83 // if (ProcessPOSIXLog::AtTopNestLevel())
88 // ProcessPOSIXLog::DecNestLevel();
94 return m_nestinglevel == 1;
107 assert(m_nestinglevel >= 0);
111 #endif // liblldb_ProcessPOSIXLog_h_