1 //===-- MIUtilDebug.cpp -----------------------------------------*- 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 // Third party headers:
18 #include "MIUtilDebug.h"
21 //------------------------------------------------------------------------------------
22 // Details: CMIUtilDebug constructor.
28 CMIUtilDebug::CMIUtilDebug() {}
31 //------------------------------------------------------------------------------------
32 // Details: CMIUtilDebug destructor.
38 CMIUtilDebug::~CMIUtilDebug() {}
41 //------------------------------------------------------------------------------------
42 // Details: Show a dialog to the process/application halts. It gives the
45 // Type: Static method.
50 void CMIUtilDebug::ShowDlgWaitForDbgAttach() {
51 const CMIUtilString strCaption(CMIDriver::Instance().GetAppNameShort());
53 ::MessageBoxA(NULL, "Attach your debugger now", strCaption.c_str(), MB_OK);
55 // ToDo: Implement other platform version of an Ok to continue dialog box
60 //------------------------------------------------------------------------------------
61 // Details: Temporarily stall the process/application to give the programmer the
62 // opportunity to attach a debugger. How to use: Put a break in the
64 // where you want to visit, run the application then attach your
66 // application. Hit the debugger's pause button and the debugger should
68 // show this loop. Change the i variable value to break out of the loop
70 // visit your break point.
71 // Type: Static method.
76 void CMIUtilDebug::WaitForDbgAttachInfinteLoop() {
79 const std::chrono::milliseconds time(100);
80 std::this_thread::sleep_for(time);
84 //---------------------------------------------------------------------------------------
85 //---------------------------------------------------------------------------------------
86 //---------------------------------------------------------------------------------------
89 CMICmnLog &CMIUtilDebugFnTrace::ms_rLog = CMICmnLog::Instance();
90 MIuint CMIUtilDebugFnTrace::ms_fnDepthCnt = 0;
93 //------------------------------------------------------------------------------------
94 // Details: CMIUtilDebugFnTrace constructor.
96 // Args: vFnName - (R) The text to insert into the log.
100 CMIUtilDebugFnTrace::CMIUtilDebugFnTrace(const CMIUtilString &vFnName)
101 : m_strFnName(vFnName) {
102 const CMIUtilString txt(
103 CMIUtilString::Format("%d>%s", ++ms_fnDepthCnt, m_strFnName.c_str()));
104 ms_rLog.Write(txt, CMICmnLog::eLogVerbosity_FnTrace);
108 //------------------------------------------------------------------------------------
109 // Details: CMIUtilDebugFnTrace destructor.
115 CMIUtilDebugFnTrace::~CMIUtilDebugFnTrace() {
116 const CMIUtilString txt(
117 CMIUtilString::Format("%d<%s", ms_fnDepthCnt--, m_strFnName.c_str()));
118 ms_rLog.Write(txt, CMICmnLog::eLogVerbosity_FnTrace);