]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/lldb-mi/MIUtilDebug.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / tools / lldb-mi / MIUtilDebug.h
1 //===-- MIUtilDebug.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 #pragma once
11
12 #define MI_USE_DEBUG_TRACE_FN // Undefine to compile out fn trace code
13
14 // In-house headers:
15 #include "MIUtilString.h"
16
17 // Declarations:
18 class CMICmnLog;
19
20 //++
21 //============================================================================
22 // Details: MI debugging aid utility class.
23 //--
24 class CMIUtilDebug {
25   // Statics:
26 public:
27   static void ShowDlgWaitForDbgAttach();
28   static void WaitForDbgAttachInfinteLoop();
29
30   // Methods:
31 public:
32   /* ctor */ CMIUtilDebug();
33
34   // Overrideable:
35 public:
36   // From CMICmnBase
37   /* dtor */ virtual ~CMIUtilDebug();
38 };
39
40 //++
41 //============================================================================
42 // Details: MI debug utility class. Used to indicate the current function
43 //          depth in the call stack. It uses the CMIlCmnLog logger to output
44 //          the current fn trace information.
45 //          Use macro MI_TRACEFN( "Some fn name" ) and implement the scope of
46 //          the functions you wish to build up a trace off.
47 //          Use preprocessor definition MI_USE_DEBUG_TRACE_FN to turn off or on
48 //          tracing code.
49 //--
50 class CMIUtilDebugFnTrace {
51   // Methods:
52 public:
53   /* ctor */ CMIUtilDebugFnTrace(const CMIUtilString &vFnName);
54
55   // Overrideable:
56 public:
57   // From CMICmnBase
58   /* dtor */ virtual ~CMIUtilDebugFnTrace();
59
60   // Attributes:
61 private:
62   const CMIUtilString m_strFnName;
63
64   static CMICmnLog &ms_rLog;
65   static MIuint ms_fnDepthCnt; // Increment count as fn depth increases,
66                                // decrement count as fn stack pops off
67 };
68
69 //++
70 //============================================================================
71 // Details: Take the given text and send it to the server's Logger to output to
72 // the
73 //          trace file.
74 // Type:    Compile preprocess.
75 // Args:    x   - (R) Message (may be seen by user).
76 //--
77 #ifdef MI_USE_DEBUG_TRACE_FN
78 #define MI_TRACEFN(x) CMIUtilDebugFnTrace __MITrace(x)
79 #else
80 #define MI_TRACEFN(x)
81 #endif // MI_USE_DEBUG_TRACE_FN