1 //===-- MIUtilDebug.h -------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 #define MI_USE_DEBUG_TRACE_FN // Undefine to compile out fn trace code
14 #include "MIUtilString.h"
20 //============================================================================
21 // Details: MI debugging aid utility class.
26 static void WaitForDbgAttachInfinteLoop();
30 /* ctor */ CMIUtilDebug();
35 /* dtor */ virtual ~CMIUtilDebug();
39 //============================================================================
40 // Details: MI debug utility class. Used to indicate the current function
41 // depth in the call stack. It uses the CMIlCmnLog logger to output
42 // the current fn trace information.
43 // Use macro MI_TRACEFN( "Some fn name" ) and implement the scope of
44 // the functions you wish to build up a trace off.
45 // Use preprocessor definition MI_USE_DEBUG_TRACE_FN to turn off or on
48 class CMIUtilDebugFnTrace {
51 /* ctor */ CMIUtilDebugFnTrace(const CMIUtilString &vFnName);
56 /* dtor */ virtual ~CMIUtilDebugFnTrace();
60 const CMIUtilString m_strFnName;
62 static CMICmnLog &ms_rLog;
63 static MIuint ms_fnDepthCnt; // Increment count as fn depth increases,
64 // decrement count as fn stack pops off
68 //============================================================================
69 // Details: Take the given text and send it to the server's Logger to output to
72 // Type: Compile preprocess.
73 // Args: x - (R) Message (may be seen by user).
75 #ifdef MI_USE_DEBUG_TRACE_FN
76 #define MI_TRACEFN(x) CMIUtilDebugFnTrace __MITrace(x)
79 #endif // MI_USE_DEBUG_TRACE_FN