1 //===-- MIUtilDebug.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 //===----------------------------------------------------------------------===//
12 #define MI_USE_DEBUG_TRACE_FN // Undefine to compile out fn trace code
15 #include "MIUtilString.h"
21 //============================================================================
22 // Details: MI debugging aid utility class.
27 static void ShowDlgWaitForDbgAttach();
28 static void WaitForDbgAttachInfinteLoop();
32 /* ctor */ CMIUtilDebug();
37 /* dtor */ virtual ~CMIUtilDebug();
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
50 class CMIUtilDebugFnTrace {
53 /* ctor */ CMIUtilDebugFnTrace(const CMIUtilString &vFnName);
58 /* dtor */ virtual ~CMIUtilDebugFnTrace();
62 const CMIUtilString m_strFnName;
64 static CMICmnLog &ms_rLog;
65 static MIuint ms_fnDepthCnt; // Increment count as fn depth increases,
66 // decrement count as fn stack pops off
70 //============================================================================
71 // Details: Take the given text and send it to the server's Logger to output to
74 // Type: Compile preprocess.
75 // Args: x - (R) Message (may be seen by user).
77 #ifdef MI_USE_DEBUG_TRACE_FN
78 #define MI_TRACEFN(x) CMIUtilDebugFnTrace __MITrace(x)
81 #endif // MI_USE_DEBUG_TRACE_FN