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 //===----------------------------------------------------------------------===//
11 // File: MIUtilDebug.h
13 // Overview: Terminal setting termios functions.
15 // Environment: Compilers: Visual C++ 12.
16 // gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17 // Libraries: See MIReadmetxt.
22 // Third party headers:
28 #include "MIUtilDebug.h"
32 //++ ------------------------------------------------------------------------------------
33 // Details: CMIUtilDebug constructor.
39 CMIUtilDebug::CMIUtilDebug( void )
43 //++ ------------------------------------------------------------------------------------
44 // Details: CMIUtilDebug destructor.
50 CMIUtilDebug::~CMIUtilDebug( void )
54 //++ ------------------------------------------------------------------------------------
55 // Details: Show a dialog to the process/application halts. It gives the opportunity to
57 // Type: Static method.
62 void CMIUtilDebug::ShowDlgWaitForDbgAttach( void )
64 const CMIUtilString strCaption( CMIDriver::Instance().GetAppNameShort() );
66 ::MessageBoxA( NULL, "Attach your debugger now", strCaption.c_str(), MB_OK );
68 // ToDo: Implement other platform version of an Ok to continue dialog box
72 //++ ------------------------------------------------------------------------------------
73 // Details: Temporarily stall the process/application to give the programmer the
74 // opportunity to attach a debugger. How to use: Put a break in the programmer
75 // where you want to visit, run the application then attach your debugger to the
76 // application. Hit the debugger's pause button and the debugger should should
77 // show this loop. Change the i variable value to break out of the loop and
78 // visit your break point.
79 // Type: Static method.
84 void CMIUtilDebug::WaitForDbgAttachInfinteLoop( void )
89 const std::chrono::milliseconds time( 100 );
90 std::this_thread::sleep_for( time );
94 //---------------------------------------------------------------------------------------
95 //---------------------------------------------------------------------------------------
96 //---------------------------------------------------------------------------------------
99 CMICmnLog & CMIUtilDebugFnTrace::ms_rLog = CMICmnLog::Instance();
100 MIuint CMIUtilDebugFnTrace::ms_fnDepthCnt = 0;
102 //++ ------------------------------------------------------------------------------------
103 // Details: CMIUtilDebugFnTrace constructor.
105 // Args: vFnName - (R) The text to insert into the log.
109 CMIUtilDebugFnTrace::CMIUtilDebugFnTrace( const CMIUtilString & vFnName )
110 : m_strFnName( vFnName )
112 const CMIUtilString txt( CMIUtilString::Format( "%d>%s", ++ms_fnDepthCnt, m_strFnName.c_str() ) );
113 ms_rLog.Write( txt, CMICmnLog::eLogVerbosity_FnTrace );
116 //++ ------------------------------------------------------------------------------------
117 // Details: CMIUtilDebugFnTrace destructor.
123 CMIUtilDebugFnTrace::~CMIUtilDebugFnTrace( void )
125 const CMIUtilString txt( CMIUtilString::Format( "%d<%s", ms_fnDepthCnt--, m_strFnName.c_str() ) );
126 ms_rLog.Write( txt, CMICmnLog::eLogVerbosity_FnTrace );