[Lldb-commits] [lldb] r222150 - Reformat lldb-mi using clang-format.

Zachary Turner zturner at google.com
Mon Nov 17 10:06:24 PST 2014


Modified: lldb/trunk/tools/lldb-mi/MICmnStreamStdinWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdinWindows.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdinWindows.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdinWindows.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilStreamStdin.h
+// File:        MIUtilStreamStdin.h
 //
-// Overview:	CMICmnStreamStdinWindows interface.
+// Overview:    CMICmnStreamStdinWindows interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -27,55 +27,53 @@
 #include "MIUtilSingletonBase.h"
 
 //++ ============================================================================
-// Details:	MI common code class. Specific OS stdin handling implementation.
-//			CMICmnStreamStdin instance is set with stdin handler before using the
-//			the stream. An instance of this class must be set up and ready to give
-//			to the CMICmnStreamStdin before it initialises other CMICmnStreamStdin
-//			will give an error.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 16/06/2014.
-// Changes:	None.
+// Details: MI common code class. Specific OS stdin handling implementation.
+//          CMICmnStreamStdin instance is set with stdin handler before using the
+//          the stream. An instance of this class must be set up and ready to give
+//          to the CMICmnStreamStdin before it initialises other CMICmnStreamStdin
+//          will give an error.
+// Gotchas: None.
+// Authors: Illya Rudkin 16/06/2014.
+// Changes: None.
 //--
-class CMICmnStreamStdinWindows
-:	public CMICmnBase
-,	public CMICmnStreamStdin::IOSStdinHandler
-,	public MI::ISingleton< CMICmnStreamStdinWindows >
+class CMICmnStreamStdinWindows : public CMICmnBase,
+                                 public CMICmnStreamStdin::IOSStdinHandler,
+                                 public MI::ISingleton<CMICmnStreamStdinWindows>
 {
-	// Give singleton access to private constructors
-	friend MI::ISingleton< CMICmnStreamStdinWindows >;
+    // Give singleton access to private constructors
+    friend MI::ISingleton<CMICmnStreamStdinWindows>;
 
-// Methods:
-public:
-	bool	Initialize( void );
-	bool	Shutdown( void );
-
-// Overridden:
-public:
-	// From CMICmnStreamStdin::IOSpecificReadStreamStdin
-	virtual bool			InputAvailable( bool & vwbAvail );
-	virtual const MIchar *	ReadLine( CMIUtilString & vwErrMsg );
-	
-// Methods:
-private:
-	/* ctor */	CMICmnStreamStdinWindows( void );
-	/* ctor */	CMICmnStreamStdinWindows( const CMICmnStreamStdinWindows & );
-	void		operator=( const CMICmnStreamStdinWindows & );
-	//
-	bool	InputAvailableConsoleWin( bool & vwbAvail );
-	bool	InputAvailableApplication( bool & vwbAvail );
-	
-// Overridden:
-private:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMICmnStreamStdinWindows( void );
-
-// Attributes:
-private:
-	const MIuint	m_constBufferSize;
-	FILE *			m_pStdin;
-	MIchar *		m_pCmdBuffer;
-	MIchar *		m_pStdinBuffer;				// Custom buffer to store std input
-	MIuint			m_nBytesToBeRead;			// Checks that ::fgets() is holding on to data while ::PeekNamedPipe() returns nothing which causes a problem
-	bool			m_bRunningInConsoleWin;		// True = The application is being run in a Windows command line prompt window, false = by other means
+    // Methods:
+  public:
+    bool Initialize(void);
+    bool Shutdown(void);
+
+    // Overridden:
+  public:
+    // From CMICmnStreamStdin::IOSpecificReadStreamStdin
+    virtual bool InputAvailable(bool &vwbAvail);
+    virtual const MIchar *ReadLine(CMIUtilString &vwErrMsg);
+
+    // Methods:
+  private:
+    /* ctor */ CMICmnStreamStdinWindows(void);
+    /* ctor */ CMICmnStreamStdinWindows(const CMICmnStreamStdinWindows &);
+    void operator=(const CMICmnStreamStdinWindows &);
+    //
+    bool InputAvailableConsoleWin(bool &vwbAvail);
+    bool InputAvailableApplication(bool &vwbAvail);
+
+    // Overridden:
+  private:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMICmnStreamStdinWindows(void);
+
+    // Attributes:
+  private:
+    const MIuint m_constBufferSize;
+    FILE *m_pStdin;
+    MIchar *m_pCmdBuffer;
+    MIchar *m_pStdinBuffer;  // Custom buffer to store std input
+    MIuint m_nBytesToBeRead; // Checks that ::fgets() is holding on to data while ::PeekNamedPipe() returns nothing which causes a problem
+    bool m_bRunningInConsoleWin; // True = The application is being run in a Windows command line prompt window, false = by other means
 };
-

Modified: lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdout.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilStreamcStdout.cpp
+// File:        MIUtilStreamcStdout.cpp
 //
-// Overview:	CMICmnStreamStdout implementation.
+// Overview:    CMICmnStreamStdout implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // In-house headers:
@@ -26,205 +26,213 @@
 #include "MIDriver.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMICmnStreamStdout constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMICmnStreamStdout constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMICmnStreamStdout::CMICmnStreamStdout( void )
+CMICmnStreamStdout::CMICmnStreamStdout(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMICmnStreamStdout destructor.
-// Type:	Overridable.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMICmnStreamStdout destructor.
+// Type:    Overridable.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMICmnStreamStdout::~CMICmnStreamStdout( void )
+CMICmnStreamStdout::~CMICmnStreamStdout(void)
 {
-	Shutdown();
+    Shutdown();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Initialize resources for *this Stdout stream.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Initialize resources for *this Stdout stream.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::Initialize( void )
+bool
+CMICmnStreamStdout::Initialize(void)
 {
-	m_clientUsageRefCnt++;
+    m_clientUsageRefCnt++;
 
-	if( m_bInitialized )
-		return MIstatus::success;
+    if (m_bInitialized)
+        return MIstatus::success;
+
+    bool bOk = MIstatus::success;
 
-	bool bOk = MIstatus::success;
-	
 #ifdef _MSC_VER
-	// Debugging / I/O issues with client.
-	// This is only required on Windows if you do not use ::flush(stdout). MI uses 
-	// ::flush(stdout)
-	// It trys to ensure the process attached to the stdout steam gets ALL the data.
-	//::setbuf( stdout, NULL );
+// Debugging / I/O issues with client.
+// This is only required on Windows if you do not use ::flush(stdout). MI uses
+// ::flush(stdout)
+// It trys to ensure the process attached to the stdout steam gets ALL the data.
+//::setbuf( stdout, NULL );
 #endif // _MSC_VER
-	
-	m_bInitialized = bOk;
 
-	return  MIstatus::success;
+    m_bInitialized = bOk;
+
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release resources for *this Stdout stream.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Release resources for *this Stdout stream.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::Shutdown( void )
+bool
+CMICmnStreamStdout::Shutdown(void)
 {
-	if( --m_clientUsageRefCnt > 0 )
-		return MIstatus::success;
-	
-	if( !m_bInitialized )
-		return MIstatus::success;
+    if (--m_clientUsageRefCnt > 0)
+        return MIstatus::success;
+
+    if (!m_bInitialized)
+        return MIstatus::success;
 
-	ClrErrorDescription();
+    ClrErrorDescription();
 
-	m_bInitialized = false;
+    m_bInitialized = false;
 
-	return MIstatus::success;
-}	
+    return MIstatus::success;
+}
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Write an MI format type response to stdout. The text data does not need to
-//			include a carrage line return as this is added to the text. The function also
-//			then passes the text data into the CMICmnLog logger.
-// Type:	Method.
-// Args:	vText		- (R) MI formatted text.
-//			vbSendToLog	- (R) True = Yes send to the Log file too, false = do not. (Dflt = true)
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Write an MI format type response to stdout. The text data does not need to
+//          include a carrage line return as this is added to the text. The function also
+//          then passes the text data into the CMICmnLog logger.
+// Type:    Method.
+// Args:    vText       - (R) MI formatted text.
+//          vbSendToLog - (R) True = Yes send to the Log file too, false = do not. (Dflt = true)
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::WriteMIResponse( const CMIUtilString & vText, const bool vbSendToLog /* = true */ )
+bool
+CMICmnStreamStdout::WriteMIResponse(const CMIUtilString &vText, const bool vbSendToLog /* = true */)
 {
-	return WritePriv( vText, vText, vbSendToLog );
+    return WritePriv(vText, vText, vbSendToLog);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Write text data to stdout. The text data does not need to
-//			include a carrage line return as this is added to the text. The function also
-//			then passes the text data into the CMICmnLog logger.
-// Type:	Method.
-// Args:	vText		- (R) Text data.
-//			vbSendToLog	- (R) True = Yes send to the Log file too, false = do not. (Dflt = true)
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Write text data to stdout. The text data does not need to
+//          include a carrage line return as this is added to the text. The function also
+//          then passes the text data into the CMICmnLog logger.
+// Type:    Method.
+// Args:    vText       - (R) Text data.
+//          vbSendToLog - (R) True = Yes send to the Log file too, false = do not. (Dflt = true)
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::Write( const CMIUtilString & vText, const bool vbSendToLog /* = true */ )
+bool
+CMICmnStreamStdout::Write(const CMIUtilString &vText, const bool vbSendToLog /* = true */)
 {
-	if( vText.length() == 0 )
-		return MIstatus::failure;
+    if (vText.length() == 0)
+        return MIstatus::failure;
 
-	const CMIUtilString strPrefixed( CMIUtilString::Format( "%s: %s", CMIDriver::Instance().GetAppNameShort().c_str(), vText.c_str() ) );
+    const CMIUtilString strPrefixed(CMIUtilString::Format("%s: %s", CMIDriver::Instance().GetAppNameShort().c_str(), vText.c_str()));
 
-	return WritePriv( strPrefixed, vText, vbSendToLog );
+    return WritePriv(strPrefixed, vText, vbSendToLog);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Write text data to stdout. The text data does not need to
-//			include a carrage line return as this is added to the text. The function also
-//			then passes the text data into the CMICmnLog logger.
-// Type:	Method.
-// Args:	vText			- (R) Text data prefixed with MI app's short name.
-//			vTxtForLogFile	- (R) Text data.
-//			vbSendToLog		- (R) True = Yes send to the Log file too, false = do not. (Dflt = true)
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Write text data to stdout. The text data does not need to
+//          include a carrage line return as this is added to the text. The function also
+//          then passes the text data into the CMICmnLog logger.
+// Type:    Method.
+// Args:    vText           - (R) Text data prefixed with MI app's short name.
+//          vTxtForLogFile  - (R) Text data.
+//          vbSendToLog     - (R) True = Yes send to the Log file too, false = do not. (Dflt = true)
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::WritePriv( const CMIUtilString & vText, const CMIUtilString & vTxtForLogFile, const bool vbSendToLog /* = true */ )
+bool
+CMICmnStreamStdout::WritePriv(const CMIUtilString &vText, const CMIUtilString &vTxtForLogFile, const bool vbSendToLog /* = true */)
 {
-	if( vText.length() == 0 )
-		return MIstatus::failure;
+    if (vText.length() == 0)
+        return MIstatus::failure;
+
+    bool bOk = MIstatus::success;
+    {
+        // Grab the stdout thread lock while we print
+        CMIUtilThreadLock _lock(m_mutex);
 
-	bool bOk = MIstatus::success;
-	{
-		// Grab the stdout thread lock while we print
-		CMIUtilThreadLock _lock( m_mutex );
+        // Send this text to stdout
+        const MIint status = ::fputs(vText.c_str(), stdout);
+        if (status == EOF)
+        {
+            const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_STDOUT_ERR_NOT_ALL_DATA_WRITTEN), vText.c_str()));
+            SetErrorDescription(errMsg);
+            bOk = MIstatus::failure;
+        }
+        else
+        {
+            ::fprintf(stdout, "\n");
+            ::fflush(stdout);
+        }
 
-		// Send this text to stdout
-		const MIint status = ::fputs( vText.c_str(), stdout );
-		if( status == EOF )
-		{
-			const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_STDOUT_ERR_NOT_ALL_DATA_WRITTEN ), vText.c_str() ) );
-			SetErrorDescription( errMsg );
-			bOk = MIstatus::failure;
-		}
-		else
-		{
-			::fprintf( stdout, "\n" );
-			::fflush( stdout );
-		}
+        // Send this text to the log
+        if (bOk && vbSendToLog)
+            bOk &= m_pLog->WriteLog(vTxtForLogFile);
+    }
 
-		// Send this text to the log
-		if( bOk && vbSendToLog )
-			bOk &= m_pLog->WriteLog( vTxtForLogFile );
-	}
-	
-	return bOk;
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Lock the availability of the stream stdout. Other users of *this stream will 
-//			be stalled until it is available (Unlock()).
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Lock the availability of the stream stdout. Other users of *this stream will
+//          be stalled until it is available (Unlock()).
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::Lock( void )
+bool
+CMICmnStreamStdout::Lock(void)
 {
-	m_mutex.Lock();
-	return MIstatus::success;
+    m_mutex.Lock();
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release a previously locked stdout.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Release a previously locked stdout.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::Unlock( void )
+bool
+CMICmnStreamStdout::Unlock(void)
 {
-	m_mutex.Unlock();
-	return MIstatus::success;
+    m_mutex.Unlock();
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Take a text data and send to the stdout stream. Also output to the MI Log
-//			file.
-// Type:	Static method.
-// Args:	vrTxt	- (R) Text.
-// Return:	MIstatus::success - Functionality succeeded.
-//			MIstatus::failure - Functionality failed.
-// Throws:	None.
+// Details: Take a text data and send to the stdout stream. Also output to the MI Log
+//          file.
+// Type:    Static method.
+// Args:    vrTxt   - (R) Text.
+// Return:  MIstatus::success - Functionality succeeded.
+//          MIstatus::failure - Functionality failed.
+// Throws:  None.
 //--
-bool CMICmnStreamStdout::TextToStdout( const CMIUtilString & vrTxt )
+bool
+CMICmnStreamStdout::TextToStdout(const CMIUtilString &vrTxt)
 {
-	const bool bLock = CMICmnStreamStdout::Instance().Lock();
-	const bool bOk = bLock && CMICmnStreamStdout::Instance().WriteMIResponse( vrTxt );
-	bLock && CMICmnStreamStdout::Instance().Unlock();
-	
-	return bOk;
+    const bool bLock = CMICmnStreamStdout::Instance().Lock();
+    const bool bOk = bLock && CMICmnStreamStdout::Instance().WriteMIResponse(vrTxt);
+    bLock &&CMICmnStreamStdout::Instance().Unlock();
+
+    return bOk;
 }

Modified: lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdout.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MICmnStreamStdout.h
+// File:        MICmnStreamStdout.h
 //
-// Overview:	CMICmnStreamStdout interface.
+// Overview:    CMICmnStreamStdout interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -28,48 +28,46 @@
 #include "MIUtilSingletonBase.h"
 
 //++ ============================================================================
-// Details:	MI common code class. The MI driver requires this object. 
-//			CMICmnStreamStdout sets up and tears downs stdout for the driver.
-//			
-//			Singleton class.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 12/02/2014.
-// Changes:	None.
+// Details: MI common code class. The MI driver requires this object.
+//          CMICmnStreamStdout sets up and tears downs stdout for the driver.
+//
+//          Singleton class.
+// Gotchas: None.
+// Authors: Illya Rudkin 12/02/2014.
+// Changes: None.
 //--
-class CMICmnStreamStdout
-:	public CMICmnBase
-,	public MI::ISingleton< CMICmnStreamStdout >
+class CMICmnStreamStdout : public CMICmnBase, public MI::ISingleton<CMICmnStreamStdout>
 {
-	friend class MI::ISingleton< CMICmnStreamStdout >;
+    friend class MI::ISingleton<CMICmnStreamStdout>;
 
-// Statics:
-public:
-	static bool	TextToStdout( const CMIUtilString & vrTxt );
-
-// Methods:
-public:
-	bool	Initialize( void );
-	bool	Shutdown( void );
-	//
-	bool	Lock( void );										
-	bool	Unlock( void );										
-	bool	Write( const CMIUtilString & vText, const bool vbSendToLog = true );
-	bool	WriteMIResponse( const CMIUtilString & vText, const bool vbSendToLog = true );
-
-// Methods:
-private:
-	/* ctor */	CMICmnStreamStdout( void );
-	/* ctor */	CMICmnStreamStdout( const CMICmnStreamStdout & );
-	void		operator=( const CMICmnStreamStdout & );
-	//
-	bool	WritePriv( const CMIUtilString & vText, const CMIUtilString & vTxtForLogFile, const bool vbSendToLog = true );
-	
-// Overridden:
-private:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMICmnStreamStdout( void );
-
-// Attributes:
-private:
-	CMIUtilThreadMutex m_mutex;	// Mutex object for sync during writing to stream
+    // Statics:
+  public:
+    static bool TextToStdout(const CMIUtilString &vrTxt);
+
+    // Methods:
+  public:
+    bool Initialize(void);
+    bool Shutdown(void);
+    //
+    bool Lock(void);
+    bool Unlock(void);
+    bool Write(const CMIUtilString &vText, const bool vbSendToLog = true);
+    bool WriteMIResponse(const CMIUtilString &vText, const bool vbSendToLog = true);
+
+    // Methods:
+  private:
+    /* ctor */ CMICmnStreamStdout(void);
+    /* ctor */ CMICmnStreamStdout(const CMICmnStreamStdout &);
+    void operator=(const CMICmnStreamStdout &);
+    //
+    bool WritePriv(const CMIUtilString &vText, const CMIUtilString &vTxtForLogFile, const bool vbSendToLog = true);
+
+    // Overridden:
+  private:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMICmnStreamStdout(void);
+
+    // Attributes:
+  private:
+    CMIUtilThreadMutex m_mutex; // Mutex object for sync during writing to stream
 };

Modified: lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MICmnThreadMgr.cpp
+// File:        MICmnThreadMgr.cpp
 //
-// Overview:	CMICmnThreadMgr implementation.
+// Overview:    CMICmnThreadMgr implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // In-house headers:
@@ -26,142 +26,146 @@
 #include "MIUtilSingletonHelper.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMICmnThreadMgr constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMICmnThreadMgr constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMICmnThreadMgrStd::CMICmnThreadMgrStd( void )
+CMICmnThreadMgrStd::CMICmnThreadMgrStd(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMICmnThreadMgr destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMICmnThreadMgr destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMICmnThreadMgrStd::~CMICmnThreadMgrStd( void )
+CMICmnThreadMgrStd::~CMICmnThreadMgrStd(void)
 {
-	Shutdown();
+    Shutdown();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Initialise resources for *this thread manager.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Initialise resources for *this thread manager.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnThreadMgrStd::Initialize( void )
+bool
+CMICmnThreadMgrStd::Initialize(void)
 {
-	m_clientUsageRefCnt++;
+    m_clientUsageRefCnt++;
 
-	if( m_bInitialized )
-		return MIstatus::success;
+    if (m_bInitialized)
+        return MIstatus::success;
 
-	bool bOk = MIstatus::success;
-	
-	ClrErrorDescription();
-	CMIUtilString errMsg;
+    bool bOk = MIstatus::success;
 
-	// Note initialisation order is important here as some resources depend on previous
-	MI::ModuleInit< CMICmnLog >      ( IDS_MI_INIT_ERR_LOG      , bOk, errMsg );
-	MI::ModuleInit< CMICmnResources >( IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg );
+    ClrErrorDescription();
+    CMIUtilString errMsg;
 
-	m_bInitialized = bOk;
-	
-	if( !bOk )
-	{
-		CMIUtilString strInitError( CMIUtilString::Format( MIRSRC( IDS_MI_INIT_ERR_THREADMGR ), errMsg.c_str() ) );
-		SetErrorDescription( strInitError );
-		return MIstatus::failure;
-	}
+    // Note initialisation order is important here as some resources depend on previous
+    MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
+    MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
 
-	return bOk;
+    m_bInitialized = bOk;
+
+    if (!bOk)
+    {
+        CMIUtilString strInitError(CMIUtilString::Format(MIRSRC(IDS_MI_INIT_ERR_THREADMGR), errMsg.c_str()));
+        SetErrorDescription(strInitError);
+        return MIstatus::failure;
+    }
+
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release resources for *this thread manager.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Release resources for *this thread manager.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnThreadMgrStd::Shutdown( void )
+bool
+CMICmnThreadMgrStd::Shutdown(void)
 {
-	if( --m_clientUsageRefCnt > 0 )
-		return MIstatus::success;
-	
-	if( !m_bInitialized )
-		return MIstatus::success;
+    if (--m_clientUsageRefCnt > 0)
+        return MIstatus::success;
+
+    if (!m_bInitialized)
+        return MIstatus::success;
 
-	m_bInitialized = false;
+    m_bInitialized = false;
 
-	ClrErrorDescription();
+    ClrErrorDescription();
 
-	bool bOk = MIstatus::success;
-	CMIUtilString errMsg;
+    bool bOk = MIstatus::success;
+    CMIUtilString errMsg;
 
-	// Tidy up
-	ThreadAllTerminate();
-	
-	// Note shutdown order is important here
-	MI::ModuleShutdown< CMICmnResources >( IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg );
-	MI::ModuleShutdown< CMICmnLog >      ( IDS_MI_SHTDWN_ERR_LOG      , bOk, errMsg );
+    // Tidy up
+    ThreadAllTerminate();
 
-	if( !bOk )
-	{
-		SetErrorDescriptionn( MIRSRC( IDS_MI_SHUTDOWN_ERR ), errMsg.c_str() );
-	}
+    // Note shutdown order is important here
+    MI::ModuleShutdown<CMICmnResources>(IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnLog>(IDS_MI_SHTDWN_ERR_LOG, bOk, errMsg);
 
-	return bOk;
+    if (!bOk)
+    {
+        SetErrorDescriptionn(MIRSRC(IDS_MI_SHUTDOWN_ERR), errMsg.c_str());
+    }
+
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Ask the thread manager to kill all threads and wait until they have died
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Ask the thread manager to kill all threads and wait until they have died
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnThreadMgrStd::ThreadAllTerminate( void )
+bool
+CMICmnThreadMgrStd::ThreadAllTerminate(void)
 {
-	ThreadList_t::const_iterator it = m_threadList.begin();
-	for( ; it != m_threadList.end(); ++it )
-	{
-		// If the thread is still running
-		CMIUtilThreadActiveObjBase * pThread = *it;
-		if( pThread->ThreadIsActive() )
-		{
-			// Ask this thread to kill itself
-			pThread->ThreadKill();
-			
-			// Wait for this thread to die
-			pThread->ThreadJoin();
-		}
-	}
+    ThreadList_t::const_iterator it = m_threadList.begin();
+    for (; it != m_threadList.end(); ++it)
+    {
+        // If the thread is still running
+        CMIUtilThreadActiveObjBase *pThread = *it;
+        if (pThread->ThreadIsActive())
+        {
+            // Ask this thread to kill itself
+            pThread->ThreadKill();
+
+            // Wait for this thread to die
+            pThread->ThreadJoin();
+        }
+    }
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Add a thread object to *this manager's list of thread objects. The list to 
-//			used to manage thread objects centrally. 
-// Type:	Method.
-// Args:	vrObj	- (R) A thread object.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Add a thread object to *this manager's list of thread objects. The list to
+//          used to manage thread objects centrally.
+// Type:    Method.
+// Args:    vrObj   - (R) A thread object.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMICmnThreadMgrStd::AddThread( const CMIUtilThreadActiveObjBase & vrObj )
+bool
+CMICmnThreadMgrStd::AddThread(const CMIUtilThreadActiveObjBase &vrObj)
 {
-	m_threadList.push_back( const_cast< CMIUtilThreadActiveObjBase * >( &vrObj ) );
+    m_threadList.push_back(const_cast<CMIUtilThreadActiveObjBase *>(&vrObj));
 
-	return MIstatus::success;
+    return MIstatus::success;
 }

Modified: lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnThreadMgrStd.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MICmnThreadMgrStd.h
+// File:        MICmnThreadMgrStd.h
 //
-// Overview:	CMICmnThreadMgr interface.
+// Overview:    CMICmnThreadMgr interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -31,104 +31,108 @@
 #include "MIUtilSingletonBase.h"
 
 //++ ============================================================================
-// Details:	MI's worker thread (active thread) manager.
-//			The manager creates threads and behalf of clients. Client are 
-//			responsible for their threads and can delete them when necessary.
-//			This manager will stop and delete all threads on *this manager's
-//			shutdown.
-//			Singleton class.
-// Gotchas:	None.
-// Authors:	Aidan Dodds 12/03/2014.
-// Changes:	None.
+// Details: MI's worker thread (active thread) manager.
+//          The manager creates threads and behalf of clients. Client are
+//          responsible for their threads and can delete them when necessary.
+//          This manager will stop and delete all threads on *this manager's
+//          shutdown.
+//          Singleton class.
+// Gotchas: None.
+// Authors: Aidan Dodds 12/03/2014.
+// Changes: None.
 //--
-class CMICmnThreadMgrStd
-:	public CMICmnBase
-,	public MI::ISingleton< CMICmnThreadMgrStd >
+class CMICmnThreadMgrStd : public CMICmnBase, public MI::ISingleton<CMICmnThreadMgrStd>
 {
-	friend MI::ISingleton< CMICmnThreadMgrStd >;
+    friend MI::ISingleton<CMICmnThreadMgrStd>;
 
-// Methods:
-public:
-	bool	Initialize( void );
-	bool	Shutdown( void );
-	bool	ThreadAllTerminate( void );		// Ask all threads to stop (caution)
-	template< typename T >					// Ask the thread manager to start and stop threads on our behalf
-		bool ThreadStart( T & vrwObject );
-
-// Typedef:
-private:
-	typedef std::vector< CMIUtilThreadActiveObjBase * > ThreadList_t;
-	
-// Methods:
-private:
-	/* ctor */	CMICmnThreadMgrStd( void );
-	/* ctor */	CMICmnThreadMgrStd( const CMICmnThreadMgrStd & );
-	void		operator=( const CMICmnThreadMgrStd & );
-	//	
-	bool		AddThread( const CMIUtilThreadActiveObjBase & vrObj );	// Add a thread for monitoring by the threadmanager
-
-// Overridden:
-private:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMICmnThreadMgrStd( void );
-
-// Attributes:
-private:
-	CMIUtilThreadMutex	m_mutex;
-	ThreadList_t		m_threadList;
+    // Methods:
+  public:
+    bool Initialize(void);
+    bool Shutdown(void);
+    bool
+    ThreadAllTerminate(void); // Ask all threads to stop (caution)
+    template <typename T>     // Ask the thread manager to start and stop threads on our behalf
+    bool ThreadStart(T &vrwObject);
+
+    // Typedef:
+  private:
+    typedef std::vector<CMIUtilThreadActiveObjBase *> ThreadList_t;
+
+    // Methods:
+  private:
+    /* ctor */ CMICmnThreadMgrStd(void);
+    /* ctor */ CMICmnThreadMgrStd(const CMICmnThreadMgrStd &);
+    void operator=(const CMICmnThreadMgrStd &);
+    //
+    bool
+    AddThread(const CMIUtilThreadActiveObjBase &vrObj); // Add a thread for monitoring by the threadmanager
+
+    // Overridden:
+  private:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMICmnThreadMgrStd(void);
+
+    // Attributes:
+  private:
+    CMIUtilThreadMutex m_mutex;
+    ThreadList_t m_threadList;
 };
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Given a thread object start its (worker) thread to do work. The object is 
-//			added to the *this manager for housekeeping and deletion of all thread objects.
-// Type:	Template method.
-// Args:	vrwThreadObj	- (RW) A CMIUtilThreadActiveObjBase derived object.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Given a thread object start its (worker) thread to do work. The object is
+//          added to the *this manager for housekeeping and deletion of all thread objects.
+// Type:    Template method.
+// Args:    vrwThreadObj      - (RW) A CMIUtilThreadActiveObjBase derived object.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-template< typename T >
-bool CMICmnThreadMgrStd::ThreadStart( T & vrwThreadObj )
+template <typename T>
+bool
+CMICmnThreadMgrStd::ThreadStart(T &vrwThreadObj)
 {
-	bool bOk = MIstatus::success;
-	
-	// Grab a reference to the base object type
-	CMIUtilThreadActiveObjBase & rObj = static_cast< CMIUtilThreadActiveObjBase & >( vrwThreadObj );
-
-	// Add to the thread managers internal database
-	bOk &= AddThread( rObj );
-	if( !bOk )
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_THREADMGR_ERR_THREAD_FAIL_CREATE ), vrwThreadObj.ThreadGetName().c_str() ) );
-		SetErrorDescription( errMsg );
-		return MIstatus::failure;
-	}
-	
-	// Grab a reference on behalf of the caller
-	bOk &= vrwThreadObj.Acquire();
-	if( !bOk )
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_THREADMGR_ERR_THREAD_FAIL_CREATE ), vrwThreadObj.ThreadGetName().c_str() ) );
-		SetErrorDescription( errMsg );
-		return MIstatus::failure;
-	}
-	
-	// Thread is already started
-	// This call must come after the reference count increment
-	if( vrwThreadObj.ThreadIsActive() )
-	{
-		// Early exit on thread already running condition
-		return MIstatus::success;
-	}
-
-	// Start the thread running
-	bOk &= vrwThreadObj.ThreadExecute();
-	if( !bOk )
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_THREADMGR_ERR_THREAD_FAIL_CREATE ), vrwThreadObj.ThreadGetName().c_str() ) );
-		SetErrorDescription( errMsg );
-		return MIstatus::failure;
-	}
-	
-	return MIstatus::success;
+    bool bOk = MIstatus::success;
+
+    // Grab a reference to the base object type
+    CMIUtilThreadActiveObjBase &rObj = static_cast<CMIUtilThreadActiveObjBase &>(vrwThreadObj);
+
+    // Add to the thread managers internal database
+    bOk &= AddThread(rObj);
+    if (!bOk)
+    {
+        const CMIUtilString errMsg(
+            CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), vrwThreadObj.ThreadGetName().c_str()));
+        SetErrorDescription(errMsg);
+        return MIstatus::failure;
+    }
+
+    // Grab a reference on behalf of the caller
+    bOk &= vrwThreadObj.Acquire();
+    if (!bOk)
+    {
+        const CMIUtilString errMsg(
+            CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), vrwThreadObj.ThreadGetName().c_str()));
+        SetErrorDescription(errMsg);
+        return MIstatus::failure;
+    }
+
+    // Thread is already started
+    // This call must come after the reference count increment
+    if (vrwThreadObj.ThreadIsActive())
+    {
+        // Early exit on thread already running condition
+        return MIstatus::success;
+    }
+
+    // Start the thread running
+    bOk &= vrwThreadObj.ThreadExecute();
+    if (!bOk)
+    {
+        const CMIUtilString errMsg(
+            CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), vrwThreadObj.ThreadGetName().c_str()));
+        SetErrorDescription(errMsg);
+        return MIstatus::failure;
+    }
+
+    return MIstatus::success;
 }

Modified: lldb/trunk/tools/lldb-mi/MIDataTypes.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDataTypes.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDataTypes.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDataTypes.h Mon Nov 17 12:06:21 2014
@@ -8,19 +8,19 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDataTypes.h
+// File:        MIDataTypes.h
 //
-// Overview:	Common global switches, macros, etc.
+// Overview:    Common global switches, macros, etc.
 //
-//				This file contains common data types required by applications
-//				generally. If supported by the compiler, this file should be
-//				#include'd as part of the project's PCH (precompiled header).
+//              This file contains common data types required by applications
+//              generally. If supported by the compiler, this file should be
+//              #include'd as part of the project's PCH (precompiled header).
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -31,8 +31,8 @@
 
 // Debugging:
 #ifdef _DEBUG
-#include <crtdbg.h>			// C-runtime debugging library (defines _ASSERT).
-#endif // _DEBUG
+#include <crtdbg.h> // C-runtime debugging library (defines _ASSERT).
+#endif              // _DEBUG
 
 #endif // _WIN32
 
@@ -42,15 +42,15 @@
 // Function return status
 namespace MIstatus
 {
-	const bool success = true;
-	const bool failure = false;
+const bool success = true;
+const bool failure = false;
 }
 
 // Use to avoid "unused parameter" compiler warnings:
-#define MIunused( x ) (void) x;
+#define MIunused(x) (void) x;
 
 #ifdef _WIN32
-#define MI_NO_INITIALIZE_VTABLE __declspec( novtable )
+#define MI_NO_INITIALIZE_VTABLE __declspec(novtable)
 #define MI_FORCE_INLINE __forceinline
 #else
 #define MI_NO_INITIALIZE_VTABLE
@@ -59,40 +59,40 @@ namespace MIstatus
 #endif // _WIN32
 
 // Portability issues
-#ifdef  _WIN64
-	typedef unsigned __int64  size_t;
-	typedef unsigned __int64  PointerToInteger_t;
-	typedef			 __int64  MIint;
-	typedef unsigned __int64  MIuint;
+#ifdef _WIN64
+typedef unsigned __int64 size_t;
+typedef unsigned __int64 PointerToInteger_t;
+typedef __int64 MIint;
+typedef unsigned __int64 MIuint;
 #else
-	#ifdef _WIN32
-		typedef  unsigned int size_t;
-		typedef  unsigned int PointerToInteger_t;
-		typedef			  int MIint;
-		typedef  unsigned int MIuint;
-	#else
-//		typedef	 long unsigned int size_t; // size_t already defined
-		typedef  unsigned int PointerToInteger_t;
-		typedef			  int MIint;
-		typedef  unsigned int MIuint;
+#ifdef _WIN32
+typedef unsigned int size_t;
+typedef unsigned int PointerToInteger_t;
+typedef int MIint;
+typedef unsigned int MIuint;
+#else
+//       typedef     long unsigned int size_t; // size_t already defined
+typedef unsigned int PointerToInteger_t;
+typedef int MIint;
+typedef unsigned int MIuint;
 
-		#define MAX_PATH	4096
-	#endif // _WIN32
+#define MAX_PATH 4096
+#endif // _WIN32
 #endif // _WIN64
 
 //--------------------------------------------------------------------------------------
 // Common types:
 
 // Fundamentals:
-typedef float				MIflt;
-typedef double				MIdbl;
-typedef char				MIchar;		// Defaults to signed char, i.e. MIschar.
-typedef signed char			MIschar;	// Range: -128 to 127. More explicit than using MIchar.
-typedef unsigned char		MIuchar;	// Range: 0 to 255.
-typedef long long			MIint64;	// 64bit signed integer.
-typedef unsigned long long	MIuint64;	// 64bit unsigned integer.
+typedef float MIflt;
+typedef double MIdbl;
+typedef char MIchar;                 // Defaults to signed char, i.e. MIschar.
+typedef signed char MIschar;         // Range: -128 to 127. More explicit than using MIchar.
+typedef unsigned char MIuchar;       // Range: 0 to 255.
+typedef long long MIint64;           // 64bit signed integer.
+typedef unsigned long long MIuint64; // 64bit unsigned integer.
 
-//using namespace std;	// Better to put this or std:: at translation units scope.
+// using namespace std; // Better to put this or std:: at translation units scope.
 
 //--------------------------------------------------------------------------------------
 // Common routines:

Modified: lldb/trunk/tools/lldb-mi/MIDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriver.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriver.cpp Mon Nov 17 12:06:21 2014
@@ -8,19 +8,19 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriver.cpp
+// File:        MIDriver.cpp
 //
-// Overview:	CMIDriver implementation.
+// Overview:    CMIDriver implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third party headers:
-#include <stdarg.h>		// va_list, va_start, var_end
+#include <stdarg.h> // va_list, va_start, var_end
 #include <iostream>
 #include <lldb/API/SBError.h>
 
@@ -44,1231 +44,1284 @@
 
 // Instantiations:
 #if _DEBUG
-	const CMIUtilString	CMIDriver::ms_constMIVersion = MIRSRC( IDS_MI_VERSION_DESCRIPTION_DEBUG );	
+const CMIUtilString CMIDriver::ms_constMIVersion = MIRSRC(IDS_MI_VERSION_DESCRIPTION_DEBUG);
 #else
-	const CMIUtilString	CMIDriver::ms_constMIVersion = MIRSRC( IDS_MI_VERSION_DESCRIPTION );	// Matches version in resources file
+const CMIUtilString CMIDriver::ms_constMIVersion = MIRSRC(IDS_MI_VERSION_DESCRIPTION); // Matches version in resources file
 #endif // _DEBUG
-const CMIUtilString	CMIDriver::ms_constAppNameShort( MIRSRC( IDS_MI_APPNAME_SHORT ) );
-const CMIUtilString	CMIDriver::ms_constAppNameLong( MIRSRC( IDS_MI_APPNAME_LONG ) );
+const CMIUtilString CMIDriver::ms_constAppNameShort(MIRSRC(IDS_MI_APPNAME_SHORT));
+const CMIUtilString CMIDriver::ms_constAppNameLong(MIRSRC(IDS_MI_APPNAME_LONG));
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIDriver constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIDriver constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIDriver::CMIDriver( void )
-:	m_bFallThruToOtherDriverEnabled( false )
-,	m_bDriverIsExiting( false )
-,	m_handleMainThread( 0 )
-,	m_rStdin( CMICmnStreamStdin::Instance() )
-,	m_rLldbDebugger( CMICmnLLDBDebugger::Instance() )
-,	m_rStdOut( CMICmnStreamStdout::Instance() )
-,	m_eCurrentDriverState( eDriverState_NotRunning )
-,	m_bHaveExecutableFileNamePathOnCmdLine( false )
-,	m_bDriverDebuggingArgExecutable( false )
+CMIDriver::CMIDriver(void)
+    : m_bFallThruToOtherDriverEnabled(false)
+    , m_bDriverIsExiting(false)
+    , m_handleMainThread(0)
+    , m_rStdin(CMICmnStreamStdin::Instance())
+    , m_rLldbDebugger(CMICmnLLDBDebugger::Instance())
+    , m_rStdOut(CMICmnStreamStdout::Instance())
+    , m_eCurrentDriverState(eDriverState_NotRunning)
+    , m_bHaveExecutableFileNamePathOnCmdLine(false)
+    , m_bDriverDebuggingArgExecutable(false)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIDriver destructor.
-// Type:	Overridden.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIDriver destructor.
+// Type:    Overridden.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIDriver::~CMIDriver( void )
+CMIDriver::~CMIDriver(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Set whether *this driver (the parent) is enabled to pass a command to its 
-//			fall through (child) driver to interpret the command and do work instead
-//			(if *this driver decides it can't hanled the command).
-// Type:	Method.
-// Args:	vbYes	- (R) True = yes fall through, false = do not pass on command.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Set whether *this driver (the parent) is enabled to pass a command to its
+//          fall through (child) driver to interpret the command and do work instead
+//          (if *this driver decides it can't hanled the command).
+// Type:    Method.
+// Args:    vbYes   - (R) True = yes fall through, false = do not pass on command.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriver::SetEnableFallThru( const bool vbYes )
+bool
+CMIDriver::SetEnableFallThru(const bool vbYes)
 {
-	m_bFallThruToOtherDriverEnabled = vbYes;
-	return MIstatus::success;
+    m_bFallThruToOtherDriverEnabled = vbYes;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Get whether *this driver (the parent) is enabled to pass a command to its 
-//			fall through (child) driver to interpret the command and do work instead
-//			(if *this driver decides it can't hanled the command).
-// Type:	Method.
-// Args:	None.
-// Return:	bool - True = yes fall through, false = do not pass on command.
-// Throws:	None.
+// Details: Get whether *this driver (the parent) is enabled to pass a command to its
+//          fall through (child) driver to interpret the command and do work instead
+//          (if *this driver decides it can't hanled the command).
+// Type:    Method.
+// Args:    None.
+// Return:  bool - True = yes fall through, false = do not pass on command.
+// Throws:  None.
 //--
-bool CMIDriver::GetEnableFallThru( void ) const
+bool
+CMIDriver::GetEnableFallThru(void) const
 {
-	return m_bFallThruToOtherDriverEnabled;
+    return m_bFallThruToOtherDriverEnabled;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve MI's application name of itself.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString & - Text description.
-// Throws:	None.
+// Details: Retrieve MI's application name of itself.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString & - Text description.
+// Throws:  None.
 //--
-const CMIUtilString & CMIDriver::GetAppNameShort( void ) const
+const CMIUtilString &
+CMIDriver::GetAppNameShort(void) const
 {
-	return ms_constAppNameShort;
+    return ms_constAppNameShort;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve MI's application name of itself.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString & - Text description.
-// Throws:	None.
+// Details: Retrieve MI's application name of itself.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString & - Text description.
+// Throws:  None.
 //--
-const CMIUtilString & CMIDriver::GetAppNameLong( void ) const
+const CMIUtilString &
+CMIDriver::GetAppNameLong(void) const
 {
-	return ms_constAppNameLong;
+    return ms_constAppNameLong;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve MI's version description of itself.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString & - Text description.
-// Throws:	None.
+// Details: Retrieve MI's version description of itself.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString & - Text description.
+// Throws:  None.
 //--
-const CMIUtilString & CMIDriver::GetVersionDescription( void ) const
+const CMIUtilString &
+CMIDriver::GetVersionDescription(void) const
 {
-	return ms_constMIVersion;
+    return ms_constMIVersion;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Initialize setup *this driver ready for use.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Initialize setup *this driver ready for use.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriver::Initialize( void )
+bool
+CMIDriver::Initialize(void)
 {
-	m_eCurrentDriverState = eDriverState_Initialising;
-	m_clientUsageRefCnt++;
+    m_eCurrentDriverState = eDriverState_Initialising;
+    m_clientUsageRefCnt++;
 
-	ClrErrorDescription();
+    ClrErrorDescription();
 
-	if( m_bInitialized )
-		return MIstatus::success;
+    if (m_bInitialized)
+        return MIstatus::success;
 
-	bool bOk = MIstatus::success;
-	CMIUtilString errMsg;
+    bool bOk = MIstatus::success;
+    CMIUtilString errMsg;
 
-	// Initialize all of the modules we depend on
-	MI::ModuleInit< CMICmnLog >         ( IDS_MI_INIT_ERR_LOG          , bOk, errMsg );
-	MI::ModuleInit< CMICmnStreamStdout >( IDS_MI_INIT_ERR_STREAMSTDOUT , bOk, errMsg );
-	MI::ModuleInit< CMICmnStreamStderr >( IDS_MI_INIT_ERR_STREAMSTDERR , bOk, errMsg );
-	MI::ModuleInit< CMICmnResources >   ( IDS_MI_INIT_ERR_RESOURCES    , bOk, errMsg );
-	MI::ModuleInit< CMICmnThreadMgrStd >( IDS_MI_INIT_ERR_THREADMANAGER, bOk, errMsg );
-	MI::ModuleInit< CMICmnStreamStdin > ( IDS_MI_INIT_ERR_STREAMSTDIN  , bOk, errMsg );
-	MI::ModuleInit< CMICmdMgr >         ( IDS_MI_INIT_ERR_CMDMGR       , bOk, errMsg );
-	bOk &= m_rLldbDebugger.SetDriver( *this );
-	MI::ModuleInit< CMICmnLLDBDebugger >( IDS_MI_INIT_ERR_LLDBDEBUGGER , bOk, errMsg );
+    // Initialize all of the modules we depend on
+    MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
+    MI::ModuleInit<CMICmnStreamStdout>(IDS_MI_INIT_ERR_STREAMSTDOUT, bOk, errMsg);
+    MI::ModuleInit<CMICmnStreamStderr>(IDS_MI_INIT_ERR_STREAMSTDERR, bOk, errMsg);
+    MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
+    MI::ModuleInit<CMICmnThreadMgrStd>(IDS_MI_INIT_ERR_THREADMANAGER, bOk, errMsg);
+    MI::ModuleInit<CMICmnStreamStdin>(IDS_MI_INIT_ERR_STREAMSTDIN, bOk, errMsg);
+    MI::ModuleInit<CMICmdMgr>(IDS_MI_INIT_ERR_CMDMGR, bOk, errMsg);
+    bOk &= m_rLldbDebugger.SetDriver(*this);
+    MI::ModuleInit<CMICmnLLDBDebugger>(IDS_MI_INIT_ERR_LLDBDEBUGGER, bOk, errMsg);
 
 #if MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
-	CMIDriverMgr & rDrvMgr = CMIDriverMgr::Instance();
-	bOk = bOk && rDrvMgr.RegisterDriver( *g_driver, "LLDB driver" );	// Will be pass thru driver
-	if( bOk )
-	{
-		bOk = SetEnableFallThru( false ); // This is intentional at this time - yet to be fully implemented
-		bOk = bOk && SetDriverToFallThruTo( *g_driver );
-		CMIUtilString strOtherDrvErrMsg;
-		if( bOk && GetEnableFallThru() && !g_driver->MISetup( strOtherDrvErrMsg ) )
-		{
-			bOk = false;
-			errMsg = CMIUtilString::Format( MIRSRC( IDS_MI_INIT_ERR_FALLTHRUDRIVER ), strOtherDrvErrMsg.c_str()  );
-		}
-	}
+    CMIDriverMgr &rDrvMgr = CMIDriverMgr::Instance();
+    bOk = bOk && rDrvMgr.RegisterDriver(*g_driver, "LLDB driver"); // Will be pass thru driver
+    if (bOk)
+    {
+        bOk = SetEnableFallThru(false); // This is intentional at this time - yet to be fully implemented
+        bOk = bOk && SetDriverToFallThruTo(*g_driver);
+        CMIUtilString strOtherDrvErrMsg;
+        if (bOk && GetEnableFallThru() && !g_driver->MISetup(strOtherDrvErrMsg))
+        {
+            bOk = false;
+            errMsg = CMIUtilString::Format(MIRSRC(IDS_MI_INIT_ERR_FALLTHRUDRIVER), strOtherDrvErrMsg.c_str());
+        }
+    }
 #endif // MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
 
-	m_bExitApp = false;
-		
-	m_bInitialized = bOk;
-
-	if( !bOk )
-	{
-		const CMIUtilString msg = CMIUtilString::Format( MIRSRC( IDS_MI_INIT_ERR_DRIVER ), errMsg.c_str() );
-		SetErrorDescription( msg );
-		return MIstatus::failure;
-	}
-
-	m_eCurrentDriverState = eDriverState_RunningNotDebugging;
-	
-	return bOk;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Unbind detach or release resources used by *this driver.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::Shutdown( void )
-{
-	if( --m_clientUsageRefCnt > 0 )
-		return MIstatus::success;
-	
-	if( !m_bInitialized )
-		return MIstatus::success;
-
-	m_eCurrentDriverState = eDriverState_ShuttingDown;
-
-	ClrErrorDescription();
-
-	bool bOk = MIstatus::success;
-	CMIUtilString errMsg;
-
-	// Shutdown all of the modules we depend on
-	MI::ModuleShutdown< CMICmnLLDBDebugger >( IDS_MI_INIT_ERR_LLDBDEBUGGER , bOk, errMsg );
-	MI::ModuleShutdown< CMICmdMgr >         ( IDS_MI_INIT_ERR_CMDMGR       , bOk, errMsg );
-	MI::ModuleShutdown< CMICmnStreamStdin > ( IDS_MI_INIT_ERR_STREAMSTDIN  , bOk, errMsg );
-	MI::ModuleShutdown< CMICmnThreadMgrStd >( IDS_MI_INIT_ERR_THREADMANAGER, bOk, errMsg );
-	MI::ModuleShutdown< CMICmnResources >   ( IDS_MI_INIT_ERR_RESOURCES    , bOk, errMsg );
-	MI::ModuleShutdown< CMICmnStreamStderr >( IDS_MI_INIT_ERR_STREAMSTDERR , bOk, errMsg );
-	MI::ModuleShutdown< CMICmnStreamStdout >( IDS_MI_INIT_ERR_STREAMSTDOUT , bOk, errMsg );
-	MI::ModuleShutdown< CMICmnLog >         ( IDS_MI_INIT_ERR_LOG          , bOk, errMsg );
-																					 
-	if( !bOk )
-	{
-		SetErrorDescriptionn( MIRSRC( IDS_MI_SHUTDOWN_ERR ), errMsg.c_str() );
-	}
-
-	m_eCurrentDriverState = eDriverState_NotRunning;
-
-	return bOk;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Work function. Client (the driver's user) is able to append their own message 
-//			in to the MI's Log trace file.
-// Type:	Method.
-// Args:	vMessage		- (R) Client's text message.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::WriteMessageToLog( const CMIUtilString & vMessage )
-{
-	CMIUtilString msg;
-	msg = CMIUtilString::Format( MIRSRC( IDS_MI_CLIENT_MSG ), vMessage.c_str() );
-	return m_pLog->Write( msg, CMICmnLog::eLogVerbosity_ClientMsg );
+    m_bExitApp = false;
+
+    m_bInitialized = bOk;
+
+    if (!bOk)
+    {
+        const CMIUtilString msg = CMIUtilString::Format(MIRSRC(IDS_MI_INIT_ERR_DRIVER), errMsg.c_str());
+        SetErrorDescription(msg);
+        return MIstatus::failure;
+    }
+
+    m_eCurrentDriverState = eDriverState_RunningNotDebugging;
+
+    return bOk;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Unbind detach or release resources used by *this driver.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::Shutdown(void)
+{
+    if (--m_clientUsageRefCnt > 0)
+        return MIstatus::success;
+
+    if (!m_bInitialized)
+        return MIstatus::success;
+
+    m_eCurrentDriverState = eDriverState_ShuttingDown;
+
+    ClrErrorDescription();
+
+    bool bOk = MIstatus::success;
+    CMIUtilString errMsg;
+
+    // Shutdown all of the modules we depend on
+    MI::ModuleShutdown<CMICmnLLDBDebugger>(IDS_MI_INIT_ERR_LLDBDEBUGGER, bOk, errMsg);
+    MI::ModuleShutdown<CMICmdMgr>(IDS_MI_INIT_ERR_CMDMGR, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnStreamStdin>(IDS_MI_INIT_ERR_STREAMSTDIN, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnThreadMgrStd>(IDS_MI_INIT_ERR_THREADMANAGER, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnStreamStderr>(IDS_MI_INIT_ERR_STREAMSTDERR, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnStreamStdout>(IDS_MI_INIT_ERR_STREAMSTDOUT, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
+
+    if (!bOk)
+    {
+        SetErrorDescriptionn(MIRSRC(IDS_MI_SHUTDOWN_ERR), errMsg.c_str());
+    }
+
+    m_eCurrentDriverState = eDriverState_NotRunning;
+
+    return bOk;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Work function. Client (the driver's user) is able to append their own message
+//          in to the MI's Log trace file.
+// Type:    Method.
+// Args:    vMessage          - (R) Client's text message.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::WriteMessageToLog(const CMIUtilString &vMessage)
+{
+    CMIUtilString msg;
+    msg = CMIUtilString::Format(MIRSRC(IDS_MI_CLIENT_MSG), vMessage.c_str());
+    return m_pLog->Write(msg, CMICmnLog::eLogVerbosity_ClientMsg);
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: CDriverMgr calls *this driver initialize setup ready for use.
-// Type:	Overridden.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::DoInitialize( void )
-{
-	return CMIDriver::Instance().Initialize();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	CDriverMgr calls *this driver to unbind detach or release resources used by 
-//			*this driver.
-// Type:	Overridden.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::DoShutdown( void )
-{
-	return CMIDriver::Instance().Shutdown();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the name for *this driver.
-// Type:	Overridden.
-// Args:	None.
-// Return:	CMIUtilString & - Driver name.
-// Throws:	None.
-//--
-const CMIUtilString & CMIDriver::GetName( void ) const
-{
-	const CMIUtilString & rName = GetAppNameLong();
-	const CMIUtilString & rVsn = GetVersionDescription();
-	static CMIUtilString strName = CMIUtilString::Format( "%s %s", rName.c_str(), rVsn.c_str() );
-	
-	return strName;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Retrieve *this driver's last error condition.
-// Type:	Overridden.
-// Args:	None.
-// Return:	CMIUtilString - Text description.
-// Throws:	None.
-//--
-CMIUtilString CMIDriver::GetError( void ) const
-{
-	return GetErrorDescription();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Call *this driver to resize the console window.
-// Type:	Overridden.
-// Args:	vTermWidth	- (R) New window column size.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-void CMIDriver::DoResizeWindow( const uint32_t vTermWidth )
-{
-	GetTheDebugger().SetTerminalWidth( vTermWidth );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Call *this driver to return it's debugger.
-// Type:	Overridden.
-// Args:	None.
-// Return:	lldb::SBDebugger & - LLDB debugger object reference.
-// Throws:	None.
-//--
-lldb::SBDebugger & CMIDriver::GetTheDebugger( void )
-{
-	return m_rLldbDebugger.GetTheDebugger();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Specify another driver *this driver can call should this driver not be able 
-//			to handle the client data input. DoFallThruToAnotherDriver() makes the call.
-// Type:	Overridden.
-// Args:	vrOtherDriver	- (R) Reference to another driver object.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::SetDriverToFallThruTo( const CMIDriverBase & vrOtherDriver )
-{
-	m_pDriverFallThru = const_cast< CMIDriverBase * >( &vrOtherDriver );
-
-	return m_pDriverFallThru->SetDriverParent( *this );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Proxy function CMIDriverMgr IDriver interface implementation. *this driver's
-//			implementation called from here to match the existing function name of the 
-//			original LLDb driver class (the extra indirection is not necessarily required).
-//			Check the arguments that were passed to this program to make sure they are 
-//			valid and to get their argument values (if any).
-// Type:	Overridden.
-// Args:	argc		- (R)	An integer that contains the count of arguments that follow in 
-//								argv. The argc parameter is always greater than or equal to 1.
-//			argv		- (R)	An array of null-terminated strings representing command-line 
-//								arguments entered by the user of the program. By convention, 
-//								argv[0] is the command with which the program is invoked.
-//			vpStdOut	- (R)	Pointer to a standard output stream. 
-//			vwbExiting	- (W)	True = *this want to exit, Reasons: help, invalid arg(s),
-//								version information only.
-//								False = Continue to work, start debugger i.e. Command 
-//								interpreter. 
-// Return:	lldb::SBError - LLDB current error status.
-// Throws:	None.
-//--
-lldb::SBError CMIDriver::DoParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting )
-{
-	return ParseArgs( argc, argv, vpStdOut, vwbExiting );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Check the arguments that were passed to this program to make sure they are 
-//			valid and to get their argument values (if any). The following are options 
-//			that are only handled by *this driver: 
-//				--executable 
-//			The application's options --interpreter and --executable in code act very similar.
-//			The --executable is necessary to differentiate whither the MI Driver is being
-//			using by a client i.e. Eclipse or from the command line. Eclipse issues the option
-//			--interpreter and also passes additional arguments which can be interpreted as an
-//			executable if called from the command line. Using --executable tells the MI 
-//			Driver is being called the command line and that the executable argument is indeed
-//			a specified executable an so actions commands to set up the executable for a 
-//			debug session. Using --interpreter on the commnd line does not action additional
-//			commands to initialise a debug session and so be able to launch the process.
-// Type:	Overridden.
-// Args:	argc		- (R)	An integer that contains the count of arguments that follow in 
-//								argv. The argc parameter is always greater than or equal to 1.
-//			argv		- (R)	An array of null-terminated strings representing command-line 
-//								arguments entered by the user of the program. By convention, 
-//								argv[0] is the command with which the program is invoked.
-//			vpStdOut	- (R)	Pointer to a standard output stream. 
-//			vwbExiting	- (W)	True = *this want to exit, Reasons: help, invalid arg(s),
-//								version information only.
-//								False = Continue to work, start debugger i.e. Command 
-//								interpreter. 
-// Return:	lldb::SBError - LLDB current error status.
-// Throws:	None.
-//--
-lldb::SBError CMIDriver::ParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting )
-{
-	lldb::SBError errStatus;
-	const bool bHaveArgs( argc >= 2 );
-	
-	// *** Add any args handled here to GetHelpOnCmdLineArgOptions() ***
-	
-	// CODETAG_MIDRIVE_CMD_LINE_ARG_HANDLING
-	// Look for the command line options		
-	bool bHaveExecutableFileNamePath = false;
-	bool bHaveExecutableLongOption = false;
-	
-	if( bHaveArgs )
-	{
-		// Search right to left to look for the executable
-		for( MIint i = argc - 1; i > 0; i-- ) 
-		{ 
-			const CMIUtilString strArg( argv[ i ] );
-			const CMICmdArgValFile argFile;
-			if( argFile.IsFilePath( strArg  ) || 
-				CMICmdArgValString( true, false, true ).IsStringArg( strArg ))
-			{
-				bHaveExecutableFileNamePath = true;
-				m_strCmdLineArgExecuteableFileNamePath = argFile.GetFileNamePath( strArg );
-				m_bHaveExecutableFileNamePathOnCmdLine = true;
-			}
-			// This argument is also check for in CMIDriverMgr::ParseArgs()
-			if( 0 == strArg.compare( "--executable" ) )	// Used to specify that there is executable argument also on the command line 
-			{											// See fn description.
-				   bHaveExecutableLongOption = true;
-			}
-		}
-	}
-
-	if( bHaveExecutableFileNamePath && bHaveExecutableLongOption )
-	{
-		// CODETAG_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
+// Type:    Overridden.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::DoInitialize(void)
+{
+    return CMIDriver::Instance().Initialize();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CDriverMgr calls *this driver to unbind detach or release resources used by
+//          *this driver.
+// Type:    Overridden.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::DoShutdown(void)
+{
+    return CMIDriver::Instance().Shutdown();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Retrieve the name for *this driver.
+// Type:    Overridden.
+// Args:    None.
+// Return:  CMIUtilString & - Driver name.
+// Throws:  None.
+//--
+const CMIUtilString &
+CMIDriver::GetName(void) const
+{
+    const CMIUtilString &rName = GetAppNameLong();
+    const CMIUtilString &rVsn = GetVersionDescription();
+    static CMIUtilString strName = CMIUtilString::Format("%s %s", rName.c_str(), rVsn.c_str());
+
+    return strName;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Retrieve *this driver's last error condition.
+// Type:    Overridden.
+// Args:    None.
+// Return:  CMIUtilString - Text description.
+// Throws:  None.
+//--
+CMIUtilString
+CMIDriver::GetError(void) const
+{
+    return GetErrorDescription();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Call *this driver to resize the console window.
+// Type:    Overridden.
+// Args:    vTermWidth - (R) New window column size.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+void
+CMIDriver::DoResizeWindow(const uint32_t vTermWidth)
+{
+    GetTheDebugger().SetTerminalWidth(vTermWidth);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Call *this driver to return it's debugger.
+// Type:    Overridden.
+// Args:    None.
+// Return:  lldb::SBDebugger & - LLDB debugger object reference.
+// Throws:  None.
+//--
+lldb::SBDebugger &
+CMIDriver::GetTheDebugger(void)
+{
+    return m_rLldbDebugger.GetTheDebugger();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Specify another driver *this driver can call should this driver not be able
+//          to handle the client data input. DoFallThruToAnotherDriver() makes the call.
+// Type:    Overridden.
+// Args:    vrOtherDriver     - (R) Reference to another driver object.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver)
+{
+    m_pDriverFallThru = const_cast<CMIDriverBase *>(&vrOtherDriver);
+
+    return m_pDriverFallThru->SetDriverParent(*this);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Proxy function CMIDriverMgr IDriver interface implementation. *this driver's
+//          implementation called from here to match the existing function name of the
+//          original LLDb driver class (the extra indirection is not necessarily required).
+//          Check the arguments that were passed to this program to make sure they are
+//          valid and to get their argument values (if any).
+// Type:    Overridden.
+// Args:    argc        - (R)   An integer that contains the count of arguments that follow in
+//                              argv. The argc parameter is always greater than or equal to 1.
+//          argv        - (R)   An array of null-terminated strings representing command-line
+//                              arguments entered by the user of the program. By convention,
+//                              argv[0] is the command with which the program is invoked.
+//          vpStdOut    - (R)   Pointer to a standard output stream.
+//          vwbExiting  - (W)   True = *this want to exit, Reasons: help, invalid arg(s),
+//                              version information only.
+//                              False = Continue to work, start debugger i.e. Command
+//                              interpreter.
+// Return:  lldb::SBError - LLDB current error status.
+// Throws:  None.
+//--
+lldb::SBError
+CMIDriver::DoParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting)
+{
+    return ParseArgs(argc, argv, vpStdOut, vwbExiting);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Check the arguments that were passed to this program to make sure they are
+//          valid and to get their argument values (if any). The following are options
+//          that are only handled by *this driver:
+//              --executable
+//          The application's options --interpreter and --executable in code act very similar.
+//          The --executable is necessary to differentiate whither the MI Driver is being
+//          using by a client i.e. Eclipse or from the command line. Eclipse issues the option
+//          --interpreter and also passes additional arguments which can be interpreted as an
+//          executable if called from the command line. Using --executable tells the MI
+//          Driver is being called the command line and that the executable argument is indeed
+//          a specified executable an so actions commands to set up the executable for a
+//          debug session. Using --interpreter on the commnd line does not action additional
+//          commands to initialise a debug session and so be able to launch the process.
+// Type:    Overridden.
+// Args:    argc        - (R)   An integer that contains the count of arguments that follow in
+//                              argv. The argc parameter is always greater than or equal to 1.
+//          argv        - (R)   An array of null-terminated strings representing command-line
+//                              arguments entered by the user of the program. By convention,
+//                              argv[0] is the command with which the program is invoked.
+//          vpStdOut    - (R)   Pointer to a standard output stream.
+//          vwbExiting  - (W)   True = *this want to exit, Reasons: help, invalid arg(s),
+//                              version information only.
+//                              False = Continue to work, start debugger i.e. Command
+//                              interpreter.
+// Return:  lldb::SBError - LLDB current error status.
+// Throws:  None.
+//--
+lldb::SBError
+CMIDriver::ParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting)
+{
+    lldb::SBError errStatus;
+    const bool bHaveArgs(argc >= 2);
+
+    // *** Add any args handled here to GetHelpOnCmdLineArgOptions() ***
+
+    // CODETAG_MIDRIVE_CMD_LINE_ARG_HANDLING
+    // Look for the command line options
+    bool bHaveExecutableFileNamePath = false;
+    bool bHaveExecutableLongOption = false;
+
+    if (bHaveArgs)
+    {
+        // Search right to left to look for the executable
+        for (MIint i = argc - 1; i > 0; i--)
+        {
+            const CMIUtilString strArg(argv[i]);
+            const CMICmdArgValFile argFile;
+            if (argFile.IsFilePath(strArg) || CMICmdArgValString(true, false, true).IsStringArg(strArg))
+            {
+                bHaveExecutableFileNamePath = true;
+                m_strCmdLineArgExecuteableFileNamePath = argFile.GetFileNamePath(strArg);
+                m_bHaveExecutableFileNamePathOnCmdLine = true;
+            }
+            // This argument is also check for in CMIDriverMgr::ParseArgs()
+            if (0 == strArg.compare("--executable")) // Used to specify that there is executable argument also on the command line
+            {                                        // See fn description.
+                bHaveExecutableLongOption = true;
+            }
+        }
+    }
+
+    if (bHaveExecutableFileNamePath && bHaveExecutableLongOption)
+    {
+// CODETAG_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
 #if MICONFIG_ENABLE_MI_DRIVER_MI_MODE_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
-		SetDriverDebuggingArgExecutable();
+        SetDriverDebuggingArgExecutable();
 #else
-		vwbExiting = true;
-		errStatus.SetErrorString( MIRSRC( IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL ) );
+        vwbExiting = true;
+        errStatus.SetErrorString(MIRSRC(IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL));
 #endif // MICONFIG_ENABLE_MI_DRIVER_MI_MODE_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
-	}
+    }
 
-	return errStatus;
+    return errStatus;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	A client can ask if *this driver is GDB/MI compatible.
-// Type:	Overridden.
-// Args:	None.
-// Return:	True - GBD/MI compatible LLDB front end.
-//			False - Not GBD/MI compatible LLDB front end.
-// Throws:	None.
+// Details: A client can ask if *this driver is GDB/MI compatible.
+// Type:    Overridden.
+// Args:    None.
+// Return:  True - GBD/MI compatible LLDB front end.
+//          False - Not GBD/MI compatible LLDB front end.
+// Throws:  None.
 //--
-bool CMIDriver::GetDriverIsGDBMICompatibleDriver( void ) const
+bool
+CMIDriver::GetDriverIsGDBMICompatibleDriver(void) const
 {
-	return true;
+    return true;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Callback function for monitoring stream stdin object. Part of the visitor 
-//			pattern. 
-//			This function is called by the CMICmnStreamStdin::CThreadStdin
-//			"stdin monitor" thread (ID).
-// Type:	Overridden.
-// Args:	vStdInBuffer	- (R) Copy of the current stdin line data.
-//			vrbYesExit		- (RW) True = yes exit stdin monitoring, false = continue monitor.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Callback function for monitoring stream stdin object. Part of the visitor
+//          pattern.
+//          This function is called by the CMICmnStreamStdin::CThreadStdin
+//          "stdin monitor" thread (ID).
+// Type:    Overridden.
+// Args:    vStdInBuffer    - (R) Copy of the current stdin line data.
+//          vrbYesExit      - (RW) True = yes exit stdin monitoring, false = continue monitor.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriver::ReadLine( const CMIUtilString & vStdInBuffer, bool & vrwbYesExit )
+bool
+CMIDriver::ReadLine(const CMIUtilString &vStdInBuffer, bool &vrwbYesExit)
 {
-	// For debugging. Update prompt show stdin is working
-	//printf( "%s\n", vStdInBuffer.c_str() );
-	//fflush( stdout );
+    // For debugging. Update prompt show stdin is working
+    // printf( "%s\n", vStdInBuffer.c_str() );
+    // fflush( stdout );
 
-	// Special case look for the quit command here so stop monitoring stdin stream
-	// So we do not go back to fgetc() and wait and hang thread on exit
-	if( vStdInBuffer == "quit" )
-		vrwbYesExit = true;
+    // Special case look for the quit command here so stop monitoring stdin stream
+    // So we do not go back to fgetc() and wait and hang thread on exit
+    if (vStdInBuffer == "quit")
+        vrwbYesExit = true;
 
-	// 1. Put new line in the queue container by stdin monitor thread
-	// 2. Then *this driver calls ReadStdinLineQueue() when ready to read the queue in its
-	// own thread
-	const bool bOk = QueueMICommand( vStdInBuffer );
+    // 1. Put new line in the queue container by stdin monitor thread
+    // 2. Then *this driver calls ReadStdinLineQueue() when ready to read the queue in its
+    // own thread
+    const bool bOk = QueueMICommand(vStdInBuffer);
 
-	// Check to see if the *this driver is shutting down (exit application)
-	if( !vrwbYesExit )
-		vrwbYesExit = m_bDriverIsExiting;
+    // Check to see if the *this driver is shutting down (exit application)
+    if (!vrwbYesExit)
+        vrwbYesExit = m_bDriverIsExiting;
 
-	return bOk;
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Start worker threads for the driver.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Start worker threads for the driver.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriver::StartWorkerThreads( void )
+bool
+CMIDriver::StartWorkerThreads(void)
 {
-	bool bOk = MIstatus::success;
-	
-	// Grab the thread manager
-	CMICmnThreadMgrStd & rThreadMgr = CMICmnThreadMgrStd::Instance();
+    bool bOk = MIstatus::success;
+
+    // Grab the thread manager
+    CMICmnThreadMgrStd &rThreadMgr = CMICmnThreadMgrStd::Instance();
 
-	// Start the stdin thread
-	bOk &= m_rStdin.SetVisitor( *this );
-	if( bOk && !rThreadMgr.ThreadStart< CMICmnStreamStdin >( m_rStdin ))
-	{
-		const CMIUtilString errMsg = CMIUtilString::Format( MIRSRC( IDS_THREADMGR_ERR_THREAD_FAIL_CREATE ), CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str() );
-		SetErrorDescriptionn( errMsg );
-		return MIstatus::failure;
-	}
+    // Start the stdin thread
+    bOk &= m_rStdin.SetVisitor(*this);
+    if (bOk && !rThreadMgr.ThreadStart<CMICmnStreamStdin>(m_rStdin))
+    {
+        const CMIUtilString errMsg = CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
+                                                           CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str());
+        SetErrorDescriptionn(errMsg);
+        return MIstatus::failure;
+    }
 
-	// Start the event polling thread
-	if( bOk && !rThreadMgr.ThreadStart< CMICmnLLDBDebugger >( m_rLldbDebugger ) )
-	{
-		const CMIUtilString errMsg = CMIUtilString::Format( MIRSRC( IDS_THREADMGR_ERR_THREAD_FAIL_CREATE ), CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str() );
-		SetErrorDescriptionn( errMsg );
-		return MIstatus::failure;
-	}
+    // Start the event polling thread
+    if (bOk && !rThreadMgr.ThreadStart<CMICmnLLDBDebugger>(m_rLldbDebugger))
+    {
+        const CMIUtilString errMsg = CMIUtilString::Format(MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE),
+                                                           CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str());
+        SetErrorDescriptionn(errMsg);
+        return MIstatus::failure;
+    }
 
-	return bOk;
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Stop worker threads for the driver.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Stop worker threads for the driver.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriver::StopWorkerThreads( void )
+bool
+CMIDriver::StopWorkerThreads(void)
 {
-	CMICmnThreadMgrStd & rThreadMgr = CMICmnThreadMgrStd::Instance();
-	return rThreadMgr.ThreadAllTerminate();
+    CMICmnThreadMgrStd &rThreadMgr = CMICmnThreadMgrStd::Instance();
+    return rThreadMgr.ThreadAllTerminate();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Call this function puts *this driver to work.
-//			This function is used by the application's main thread.
-// Type:	Overridden.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Call this function puts *this driver to work.
+//          This function is used by the application's main thread.
+// Type:    Overridden.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriver::DoMainLoop( void )
+bool
+CMIDriver::DoMainLoop(void)
 {
-	if( !InitClientIDEToMIDriver() ) // Init Eclipse IDE
-	{
-		SetErrorDescriptionn( MIRSRC( IDS_MI_INIT_ERR_CLIENT_USING_DRIVER ) );
-		return MIstatus::failure;
-	}
+    if (!InitClientIDEToMIDriver()) // Init Eclipse IDE
+    {
+        SetErrorDescriptionn(MIRSRC(IDS_MI_INIT_ERR_CLIENT_USING_DRIVER));
+        return MIstatus::failure;
+    }
 
-	if( !StartWorkerThreads() )
-		return MIstatus::failure;
-	
-	// App is not quitting currently
-	m_bExitApp = false;
+    if (!StartWorkerThreads())
+        return MIstatus::failure;
 
-	// CODETAG_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
+    // App is not quitting currently
+    m_bExitApp = false;
+
+// CODETAG_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
 #if MICONFIG_ENABLE_MI_DRIVER_MI_MODE_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
-	if( HaveExecutableFileNamePathOnCmdLine() )
-	{
-		if( !LocalDebugSessionStartupInjectCommands() )
-		{
-			SetErrorDescription( MIRSRC( IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION ) );
-			return MIstatus::failure;
-		}
-	}
+    if (HaveExecutableFileNamePathOnCmdLine())
+    {
+        if (!LocalDebugSessionStartupInjectCommands())
+        {
+            SetErrorDescription(MIRSRC(IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION));
+            return MIstatus::failure;
+        }
+    }
 #endif // MICONFIG_ENABLE_MI_DRIVER_MI_MODE_CMDLINE_ARG_EXECUTABLE_DEBUG_SESSION
 
-	// While the app is active
-	while( !m_bExitApp )
-	{
-		// Poll stdin queue and dispatch
-		if( !ReadStdinLineQueue() )
-		{
-			// Something went wrong
-			break;
-		}
-	}
-
-	// Signal that the application is shutting down
-	DoAppQuit();
-
-	// Close and wait for the workers to stop
-	StopWorkerThreads();
-
-	// Ensure that a new line is sent as the last act of the dying driver
-	m_rStdOut.WriteMIResponse( "\n", false );
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	*this driver sits and waits for input to the stdin line queue shared by *this
-//			driver and the stdin monitor thread, it queues, *this reads, interprets and
-//			reacts.
-//			This function is used by the application's main thread.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::ReadStdinLineQueue( void )
-{
-	// True when queue contains input
-	bool bHaveInput = false;
-
-	// Stores the current input line
-	CMIUtilString lineText;
-	{
-		// Lock while we access the queue
-		CMIUtilThreadLock lock( m_threadMutex );
-		if( !m_queueStdinLine.empty() )
-		{
-			lineText = m_queueStdinLine.front();
-			m_queueStdinLine.pop();
-			bHaveInput = !lineText.empty();
-		}
-	}
-
-	// Process while we have input
-	if( bHaveInput )
-	{
-		if( lineText == "quit" )
-		{
-			// We want to be exiting when receiving a quit command
-			m_bExitApp = true;
-			return MIstatus::success;
-		}
-
-		// Process the command
-		const bool bOk = InterpretCommand( lineText );
-
-		// Draw prompt if desired
-		if( bOk && m_rStdin.GetEnablePrompt() )
-			m_rStdOut.WriteMIResponse( m_rStdin.GetPrompt() );
-
-		// Input has been processed
-		bHaveInput = false;
-	}
-	else
-	{
-		// Give resources back to the OS
-		const std::chrono::milliseconds time( 1 );
-		std::this_thread::sleep_for( time );
-	}
-	
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Set things in motion, set state etc that brings *this driver (and the 
-//			application) to a tidy shutdown.
-//			This function is used by the application's main thread.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::DoAppQuit( void )
-{
-	bool bYesQuit = true;
-
-	// Shutdown stuff, ready app for exit
-	{
-		CMIUtilThreadLock lock( m_threadMutex );
-		m_bDriverIsExiting = true;
-	}
-
-	return bYesQuit;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	*this driver passes text commands to a fall through driver is it does not
-//			understand them (the LLDB driver).
-//			This function is used by the application's main thread.
-// Type:	Method.
-// Args:	vTextLine			- (R) Text data representing a possible command.
-//			vwbCmdYesValid		- (W) True = Command valid, false = command not handled.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::InterpretCommandFallThruDriver( const CMIUtilString & vTextLine, bool & vwbCmdYesValid )
-{
-	MIunused( vTextLine );
-	MIunused( vwbCmdYesValid );
-
-	// ToDo: Implement when less urgent work to be done or decide remove as not required
-	//bool bOk = MIstatus::success;
-	//bool bCmdNotUnderstood = true;
-	//if( bCmdNotUnderstood && GetEnableFallThru() )
-	//{
-	//	CMIUtilString errMsg;
-	//	bOk = DoFallThruToAnotherDriver( vStdInBuffer, errMsg );
-	//	if( !bOk )
-	//	{
-	//		errMsg = errMsg.StripCREndOfLine();
-	//		errMsg = errMsg.StripCRAll();
-	//		const CMIDriverBase * pOtherDriver = GetDriverToFallThruTo();
-	//		const MIchar * pName = pOtherDriver->GetDriverName().c_str();
-	//		const MIchar * pId = pOtherDriver->GetDriverId().c_str();
-	//		const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR ), pName, pId, errMsg.c_str() ) );
-	//		m_pLog->WriteMsg( msg );
-	//	}
-	//}
-	//
-	//vwbCmdYesValid = bOk;
-	//CMIUtilString strNot;
-	//if( vwbCmdYesValid)
-	//	strNot = CMIUtilString::Format( "%s ", MIRSRC( IDS_WORD_NOT ) );
-	//const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDS_FALLTHRU_DRIVER_CMD_RECEIVED ), vTextLine.c_str(), strNot.c_str() ) );
-	//m_pLog->WriteLog( msg );
-	
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the name for *this driver.
-// Type:	Overridden.
-// Args:	None.
-// Return:	CMIUtilString & - Driver name.
-// Throws:	None.
-//--
-const CMIUtilString & CMIDriver::GetDriverName( void ) const
-{
-	return GetName();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Get the unique ID for *this driver.
-// Type:	Overridden.
-// Args:	None.
-// Return:	CMIUtilString & - Text description.
-// Throws:	None.
-//--
-const CMIUtilString & CMIDriver::GetDriverId( void ) const
-{
-	return GetId();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	This function allows *this driver to call on another driver to perform work
-//			should this driver not be able to handle the client data input.
-//			SetDriverToFallThruTo() specifies the fall through to driver.
-//			Check the error message if the function returns a failure.
-// Type:	Overridden.
-// Args:	vCmd		- (R) Command instruction to interpret.
-//			vwErrMsg	- (W) Error description on command failing.
-// Return:	MIstatus::success - Command succeeded.
-//			MIstatus::failure - Command failed.
-// Throws:	None.
-//--
-bool CMIDriver::DoFallThruToAnotherDriver( const CMIUtilString & vCmd, CMIUtilString & vwErrMsg )
-{
-	bool bOk = MIstatus::success;
-
-	CMIDriverBase * pOtherDriver = GetDriverToFallThruTo();
-	if( pOtherDriver == nullptr )
-		return bOk;
-
-	return pOtherDriver->DoFallThruToAnotherDriver( vCmd, vwErrMsg );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	*this driver provides a file stream to other drivers on which *this driver
-//			write's out to and they read as expected input. *this driver is passing
-//			through commands to the (child) pass through assigned driver.
-// Type:	Overrdidden.
-// Args:	None.
-// Return:	FILE * - Pointer to stream.
-// Throws:	None.
-//--
-FILE * CMIDriver::GetStdin( void ) const
-{
-	// Note this fn is called on CMIDriverMgr register driver so stream has to be
-	// available before *this driver has been initialized! Flaw?
-
-	// This very likely to change later to a stream that the pass thru driver
-	// will read and we write to give it 'input'
-	return stdin;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	*this driver provides a file stream to other pass through assigned drivers 
-//			so they know what to write to.
-// Type:	Overidden.
-// Args:	None.
-// Return:	FILE * - Pointer to stream.
-// Throws:	None.
-//--
-FILE * CMIDriver::GetStdout( void ) const
-{
-	// Note this fn is called on CMIDriverMgr register driver so stream has to be
-	// available before *this driver has been initialized! Flaw?
-
-	// Do not want to pass through driver to write to stdout
-	return NULL;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	*this driver provides a error file stream to other pass through assigned drivers 
-//			so they know what to write to.
-// Type:	Overidden.
-// Args:	None.
-// Return:	FILE * - Pointer to stream.
-// Throws:	None.
-//--
-FILE * CMIDriver::GetStderr( void ) const
-{
-	// Note this fn is called on CMIDriverMgr register driver so stream has to be
-	// available before *this driver has been initialized! Flaw?
-
-	// This very likely to change later to a stream that the pass thru driver
-	// will write to and *this driver reads from to pass on the CMICmnLog object
-	return stderr;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Set a unique ID for *this driver. It cannot be empty.
-// Type:	Overridden.
-// Args:	vId	- (R) Text description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::SetId( const CMIUtilString & vId )
-{
-	if( vId.empty() )
-	{
-		SetErrorDescriptionn( MIRSRC( IDS_DRIVER_ERR_ID_INVALID ), GetName().c_str(), vId.c_str() );
-		return MIstatus::failure;
-	}
-
-	m_strDriverId = vId;
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Get the unique ID for *this driver.
-// Type:	Overridden.
-// Args:	None.
-// Return:	CMIUtilString & - Text description.
-// Throws:	None.
-//--
-const CMIUtilString & CMIDriver::GetId( void ) const
-{
-	return m_strDriverId;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Inject a command into the command processing system to be interpreted as a
-//			command read from stdin. The text representing the command is also written
-//			out to stdout as the command did not come from via stdin.
-// Type:	Method.
-// Args:	vMICmd	- (R) Text data representing a possible command.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::InjectMICommand( const CMIUtilString & vMICmd )
-{
-	const bool bOk = m_rStdOut.WriteMIResponse( vMICmd );
-
-	return bOk && QueueMICommand( vMICmd );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Add a new command candidate to the command queue to be processed by the 
-//			command system.
-// Type:	Method.
-// Args:	vMICmd	- (R) Text data representing a possible command.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::QueueMICommand( const CMIUtilString & vMICmd )
-{
-	CMIUtilThreadLock lock( m_threadMutex );
-	m_queueStdinLine.push( vMICmd );
-	
-	return MIstatus::success;
-}
-	
-//++ ------------------------------------------------------------------------------------
-// Details:	Interpret the text data and match against current commands to see if there 
-//			is a match. If a match then the command is issued and actioned on. The 
-//			text data if not understood by *this driver is past on to the Fall Thru
-//			driver.
-//			This function is used by the application's main thread.
-// Type:	Method.
-// Args:	vTextLine	- (R) Text data representing a possible command.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::InterpretCommand( const CMIUtilString & vTextLine )
-{
-	bool bCmdYesValid = false;
-	bool bOk = InterpretCommandThisDriver( vTextLine, bCmdYesValid );
-	if( bOk && !bCmdYesValid )
-		bOk = InterpretCommandFallThruDriver( vTextLine, bCmdYesValid );
-
-	return bOk;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Interpret the text data and match against current commands to see if there 
-//			is a match. If a match then the command is issued and actioned on. If a
-//			command cannot be found to match then vwbCmdYesValid is set to false and
-//			nothing else is done here.
-//			This function is used by the application's main thread.
-// Type:	Method.
-// Args:	vTextLine			- (R) Text data representing a possible command.
-//			vwbCmdYesValid		- (W) True = Command invalid, false = command acted on.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::InterpretCommandThisDriver( const CMIUtilString & vTextLine, bool & vwbCmdYesValid )
-{
-	vwbCmdYesValid = false;
-
-	bool bCmdNotInCmdFactor = false;
-	SMICmdData cmdData;
-	CMICmdMgr & rCmdMgr = CMICmdMgr::Instance();
-	if( !rCmdMgr.CmdInterpret( vTextLine, vwbCmdYesValid, bCmdNotInCmdFactor, cmdData ) )
-		return MIstatus::failure;
-	
-	if( vwbCmdYesValid )
-	{
-		// For debugging only
-		//m_pLog->WriteLog( cmdData.strMiCmdAll.c_str() );
-		
-		return ExecuteCommand( cmdData );
-	}
-
-	// Check for escape character, may be cursor control characters
-	// This code is not necessary for application operation, just want to keep tabs on what 
-	// is been given to the driver to try and intepret.
-	if( vTextLine.at( 0 ) == 27 )
-	{
-		CMIUtilString logInput( MIRSRC( IDS_STDIN_INPUT_CTRL_CHARS ) );
-		for( MIuint i = 0; i < vTextLine.length(); i++ )
-		{
-			logInput += CMIUtilString::Format( "%d ", vTextLine.at( i ) );
-		}
-		m_pLog->WriteLog( logInput );
-		return MIstatus::success;
-	}
-
-	// Write to the Log that a 'command' was not valid. 
-	// Report back to the MI client via MI result record.
-	CMIUtilString strNotInCmdFactory;
-	if( bCmdNotInCmdFactor )
-		strNotInCmdFactory = CMIUtilString::Format( MIRSRC( IDS_DRIVER_CMD_NOT_IN_FACTORY ), cmdData.strMiCmd.c_str() );
-	const CMIUtilString strNot( CMIUtilString::Format( "%s ", MIRSRC( IDS_WORD_NOT ) ) );
-	const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_CMD_RECEIVED ), vTextLine.c_str(), strNot.c_str(), strNotInCmdFactory.c_str() ) );
-	const CMICmnMIValueConst vconst = CMICmnMIValueConst( msg );
-	const CMICmnMIValueResult valueResult( "msg", vconst );
-	const CMICmnMIResultRecord miResultRecord( cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, valueResult );
-	m_rStdOut.WriteMIResponse( miResultRecord.GetString() );
-	
-	// Proceed to wait for or execute next command
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Having previously had the potential command validated and found valid now
-//			get the command executed.
-//			This function is used by the application's main thread.
-// Type:	Method.
-// Args:	vCmdData	- (RW) Command meta data.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriver::ExecuteCommand( const SMICmdData & vCmdData )
-{
-	CMICmdMgr & rCmdMgr = CMICmdMgr::Instance();
-	return rCmdMgr.CmdExecute( vCmdData );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Set the MI Driver's exit application flag. The application checks this flag 
-//			after every stdin line is read so the exit may not be instantaneous.
-//			If vbForceExit is false the MI Driver queries its state and determines if is
-//			should exit or continue operating depending on that running state.
-//			This is related to the running state of the MI driver.
-// Type:	Overridden.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-void CMIDriver::SetExitApplicationFlag( const bool vbForceExit )
-{
-	if( vbForceExit )
-	{
-		CMIUtilThreadLock lock( m_threadMutex );
-		m_bExitApp = true;
-		return;
-	}
-
-	// CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-	// Did we receive a SIGINT from the client during a running debug program, if
-	// so then SIGINT is not to be taken as meaning kill the MI driver application
-	// but halt the inferior program being debugged instead
-	if( m_eCurrentDriverState == eDriverState_RunningDebugging )
-	{
-		InjectMICommand( "-exec-interrupt" );
-		return;
-	}
-
-	m_bExitApp = true;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Get the  MI Driver's exit exit application flag. 
-//			This is related to the running state of the MI driver.
-// Type:	Method.
-// Args:	None.
-// Return:	bool	- True = MI Driver is shutting down, false = MI driver is running.
-// Throws:	None.
-//--
-bool CMIDriver::GetExitApplicationFlag( void ) const
-{
-	return m_bExitApp;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Get the current running state of the MI Driver. 
-// Type:	Method.
-// Args:	None.
-// Return:	DriverState_e	- The current running state of the application.
-// Throws:	None.
-//--
-CMIDriver::DriverState_e CMIDriver::GetCurrentDriverState( void ) const
-{
-	return m_eCurrentDriverState;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Set the current running state of the MI Driver to running and currently not in
-//			a debug session. 
-// Type:	Method.
-// Return:	MIstatus::success - Functionality succeeded.
-//			MIstatus::failure - Functionality failed.
-// Return:	DriverState_e	- The current running state of the application.
-// Throws:	None.
-//--
-bool CMIDriver::SetDriverStateRunningNotDebugging( void )
-{
-	// CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-		
-	if( m_eCurrentDriverState == eDriverState_RunningNotDebugging )
-		return MIstatus::success;
-
-	// Driver cannot be in the following states to set eDriverState_RunningNotDebugging
-	switch( m_eCurrentDriverState )
-	{
-	case eDriverState_NotRunning:
-	case eDriverState_Initialising:
-	case eDriverState_ShuttingDown:
-	{
-		SetErrorDescription( MIRSRC( IDS_DRIVER_ERR_DRIVER_STATE_ERROR ) );
-		return MIstatus::failure;
-	}
-	case eDriverState_RunningDebugging:
-	case eDriverState_RunningNotDebugging:
-		break;
-	case eDriverState_count:
-		SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_CODE_ERR_INVALID_ENUMERATION_VALUE ), "SetDriverStateRunningNotDebugging()" ) );
-		return MIstatus::failure;
-	}
-
-	// Driver must be in this state to set eDriverState_RunningNotDebugging
-	if( m_eCurrentDriverState != eDriverState_RunningDebugging )
-	{
-		SetErrorDescription( MIRSRC( IDS_DRIVER_ERR_DRIVER_STATE_ERROR ) );
-		return MIstatus::failure;
-	}
-
-	m_eCurrentDriverState = eDriverState_RunningNotDebugging;
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Set the current running state of the MI Driver to running and currently not in
-//			a debug session. The driver's state must in the state running and in a
-//			debug session to set this new state.
-// Type:	Method.
-// Return:	MIstatus::success - Functionality succeeded.
-//			MIstatus::failure - Functionality failed.
-// Return:	DriverState_e	- The current running state of the application.
-// Throws:	None.
-//--
-bool CMIDriver::SetDriverStateRunningDebugging( void )
-{
-	// CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-		
-	if( m_eCurrentDriverState == eDriverState_RunningDebugging )
-		return MIstatus::success;
-
-	// Driver cannot be in the following states to set eDriverState_RunningDebugging
-	switch( m_eCurrentDriverState )
-	{
-	case eDriverState_NotRunning:
-	case eDriverState_Initialising:
-	case eDriverState_ShuttingDown:
-	{
-		SetErrorDescription( MIRSRC( IDS_DRIVER_ERR_DRIVER_STATE_ERROR ) );
-		return MIstatus::failure;
-	}
-	case eDriverState_RunningDebugging:
-	case eDriverState_RunningNotDebugging:
-		break;
-	case eDriverState_count:
-		SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_CODE_ERR_INVALID_ENUMERATION_VALUE ), "SetDriverStateRunningDebugging()" ) );
-		return MIstatus::failure;
-	}
-
-	// Driver must be in this state to set eDriverState_RunningDebugging
-	if( m_eCurrentDriverState != eDriverState_RunningNotDebugging )
-	{
-		SetErrorDescription( MIRSRC( IDS_DRIVER_ERR_DRIVER_STATE_ERROR ) );
-		return MIstatus::failure;
-	}
-
-	m_eCurrentDriverState = eDriverState_RunningDebugging;
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details: Prepare the client IDE so it will start working/communicating with *this MI 
-//			driver.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functionality succeeded.
-//			MIstatus::failure - Functionality failed.
-// Throws:	None.
+    // While the app is active
+    while (!m_bExitApp)
+    {
+        // Poll stdin queue and dispatch
+        if (!ReadStdinLineQueue())
+        {
+            // Something went wrong
+            break;
+        }
+    }
+
+    // Signal that the application is shutting down
+    DoAppQuit();
+
+    // Close and wait for the workers to stop
+    StopWorkerThreads();
+
+    // Ensure that a new line is sent as the last act of the dying driver
+    m_rStdOut.WriteMIResponse("\n", false);
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: *this driver sits and waits for input to the stdin line queue shared by *this
+//          driver and the stdin monitor thread, it queues, *this reads, interprets and
+//          reacts.
+//          This function is used by the application's main thread.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::ReadStdinLineQueue(void)
+{
+    // True when queue contains input
+    bool bHaveInput = false;
+
+    // Stores the current input line
+    CMIUtilString lineText;
+    {
+        // Lock while we access the queue
+        CMIUtilThreadLock lock(m_threadMutex);
+        if (!m_queueStdinLine.empty())
+        {
+            lineText = m_queueStdinLine.front();
+            m_queueStdinLine.pop();
+            bHaveInput = !lineText.empty();
+        }
+    }
+
+    // Process while we have input
+    if (bHaveInput)
+    {
+        if (lineText == "quit")
+        {
+            // We want to be exiting when receiving a quit command
+            m_bExitApp = true;
+            return MIstatus::success;
+        }
+
+        // Process the command
+        const bool bOk = InterpretCommand(lineText);
+
+        // Draw prompt if desired
+        if (bOk && m_rStdin.GetEnablePrompt())
+            m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt());
+
+        // Input has been processed
+        bHaveInput = false;
+    }
+    else
+    {
+        // Give resources back to the OS
+        const std::chrono::milliseconds time(1);
+        std::this_thread::sleep_for(time);
+    }
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Set things in motion, set state etc that brings *this driver (and the
+//          application) to a tidy shutdown.
+//          This function is used by the application's main thread.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::DoAppQuit(void)
+{
+    bool bYesQuit = true;
+
+    // Shutdown stuff, ready app for exit
+    {
+        CMIUtilThreadLock lock(m_threadMutex);
+        m_bDriverIsExiting = true;
+    }
+
+    return bYesQuit;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: *this driver passes text commands to a fall through driver is it does not
+//          understand them (the LLDB driver).
+//          This function is used by the application's main thread.
+// Type:    Method.
+// Args:    vTextLine           - (R) Text data representing a possible command.
+//          vwbCmdYesValid      - (W) True = Command valid, false = command not handled.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::InterpretCommandFallThruDriver(const CMIUtilString &vTextLine, bool &vwbCmdYesValid)
+{
+    MIunused(vTextLine);
+    MIunused(vwbCmdYesValid);
+
+    // ToDo: Implement when less urgent work to be done or decide remove as not required
+    // bool bOk = MIstatus::success;
+    // bool bCmdNotUnderstood = true;
+    // if( bCmdNotUnderstood && GetEnableFallThru() )
+    //{
+    //  CMIUtilString errMsg;
+    //  bOk = DoFallThruToAnotherDriver( vStdInBuffer, errMsg );
+    //  if( !bOk )
+    //  {
+    //      errMsg = errMsg.StripCREndOfLine();
+    //      errMsg = errMsg.StripCRAll();
+    //      const CMIDriverBase * pOtherDriver = GetDriverToFallThruTo();
+    //      const MIchar * pName = pOtherDriver->GetDriverName().c_str();
+    //      const MIchar * pId = pOtherDriver->GetDriverId().c_str();
+    //      const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR ), pName, pId, errMsg.c_str() )
+    //);
+    //      m_pLog->WriteMsg( msg );
+    //  }
+    //}
+    //
+    // vwbCmdYesValid = bOk;
+    // CMIUtilString strNot;
+    // if( vwbCmdYesValid)
+    //  strNot = CMIUtilString::Format( "%s ", MIRSRC( IDS_WORD_NOT ) );
+    // const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDS_FALLTHRU_DRIVER_CMD_RECEIVED ), vTextLine.c_str(), strNot.c_str() ) );
+    // m_pLog->WriteLog( msg );
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Retrieve the name for *this driver.
+// Type:    Overridden.
+// Args:    None.
+// Return:  CMIUtilString & - Driver name.
+// Throws:  None.
+//--
+const CMIUtilString &
+CMIDriver::GetDriverName(void) const
+{
+    return GetName();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get the unique ID for *this driver.
+// Type:    Overridden.
+// Args:    None.
+// Return:  CMIUtilString & - Text description.
+// Throws:  None.
+//--
+const CMIUtilString &
+CMIDriver::GetDriverId(void) const
+{
+    return GetId();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: This function allows *this driver to call on another driver to perform work
+//          should this driver not be able to handle the client data input.
+//          SetDriverToFallThruTo() specifies the fall through to driver.
+//          Check the error message if the function returns a failure.
+// Type:    Overridden.
+// Args:    vCmd        - (R) Command instruction to interpret.
+//          vwErrMsg    - (W) Error description on command failing.
+// Return:  MIstatus::success - Command succeeded.
+//          MIstatus::failure - Command failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::DoFallThruToAnotherDriver(const CMIUtilString &vCmd, CMIUtilString &vwErrMsg)
+{
+    bool bOk = MIstatus::success;
+
+    CMIDriverBase *pOtherDriver = GetDriverToFallThruTo();
+    if (pOtherDriver == nullptr)
+        return bOk;
+
+    return pOtherDriver->DoFallThruToAnotherDriver(vCmd, vwErrMsg);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: *this driver provides a file stream to other drivers on which *this driver
+//          write's out to and they read as expected input. *this driver is passing
+//          through commands to the (child) pass through assigned driver.
+// Type:    Overrdidden.
+// Args:    None.
+// Return:  FILE * - Pointer to stream.
+// Throws:  None.
+//--
+FILE *
+CMIDriver::GetStdin(void) const
+{
+    // Note this fn is called on CMIDriverMgr register driver so stream has to be
+    // available before *this driver has been initialized! Flaw?
+
+    // This very likely to change later to a stream that the pass thru driver
+    // will read and we write to give it 'input'
+    return stdin;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: *this driver provides a file stream to other pass through assigned drivers
+//          so they know what to write to.
+// Type:    Overidden.
+// Args:    None.
+// Return:  FILE * - Pointer to stream.
+// Throws:  None.
+//--
+FILE *
+CMIDriver::GetStdout(void) const
+{
+    // Note this fn is called on CMIDriverMgr register driver so stream has to be
+    // available before *this driver has been initialized! Flaw?
+
+    // Do not want to pass through driver to write to stdout
+    return NULL;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: *this driver provides a error file stream to other pass through assigned drivers
+//          so they know what to write to.
+// Type:    Overidden.
+// Args:    None.
+// Return:  FILE * - Pointer to stream.
+// Throws:  None.
+//--
+FILE *
+CMIDriver::GetStderr(void) const
+{
+    // Note this fn is called on CMIDriverMgr register driver so stream has to be
+    // available before *this driver has been initialized! Flaw?
+
+    // This very likely to change later to a stream that the pass thru driver
+    // will write to and *this driver reads from to pass on the CMICmnLog object
+    return stderr;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Set a unique ID for *this driver. It cannot be empty.
+// Type:    Overridden.
+// Args:    vId - (R) Text description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::SetId(const CMIUtilString &vId)
+{
+    if (vId.empty())
+    {
+        SetErrorDescriptionn(MIRSRC(IDS_DRIVER_ERR_ID_INVALID), GetName().c_str(), vId.c_str());
+        return MIstatus::failure;
+    }
+
+    m_strDriverId = vId;
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get the unique ID for *this driver.
+// Type:    Overridden.
+// Args:    None.
+// Return:  CMIUtilString & - Text description.
+// Throws:  None.
+//--
+const CMIUtilString &
+CMIDriver::GetId(void) const
+{
+    return m_strDriverId;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Inject a command into the command processing system to be interpreted as a
+//          command read from stdin. The text representing the command is also written
+//          out to stdout as the command did not come from via stdin.
+// Type:    Method.
+// Args:    vMICmd  - (R) Text data representing a possible command.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::InjectMICommand(const CMIUtilString &vMICmd)
+{
+    const bool bOk = m_rStdOut.WriteMIResponse(vMICmd);
+
+    return bOk && QueueMICommand(vMICmd);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Add a new command candidate to the command queue to be processed by the
+//          command system.
+// Type:    Method.
+// Args:    vMICmd  - (R) Text data representing a possible command.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::QueueMICommand(const CMIUtilString &vMICmd)
+{
+    CMIUtilThreadLock lock(m_threadMutex);
+    m_queueStdinLine.push(vMICmd);
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Interpret the text data and match against current commands to see if there
+//          is a match. If a match then the command is issued and actioned on. The
+//          text data if not understood by *this driver is past on to the Fall Thru
+//          driver.
+//          This function is used by the application's main thread.
+// Type:    Method.
+// Args:    vTextLine   - (R) Text data representing a possible command.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::InterpretCommand(const CMIUtilString &vTextLine)
+{
+    bool bCmdYesValid = false;
+    bool bOk = InterpretCommandThisDriver(vTextLine, bCmdYesValid);
+    if (bOk && !bCmdYesValid)
+        bOk = InterpretCommandFallThruDriver(vTextLine, bCmdYesValid);
+
+    return bOk;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Interpret the text data and match against current commands to see if there
+//          is a match. If a match then the command is issued and actioned on. If a
+//          command cannot be found to match then vwbCmdYesValid is set to false and
+//          nothing else is done here.
+//          This function is used by the application's main thread.
+// Type:    Method.
+// Args:    vTextLine           - (R) Text data representing a possible command.
+//          vwbCmdYesValid      - (W) True = Command invalid, false = command acted on.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::InterpretCommandThisDriver(const CMIUtilString &vTextLine, bool &vwbCmdYesValid)
+{
+    vwbCmdYesValid = false;
+
+    bool bCmdNotInCmdFactor = false;
+    SMICmdData cmdData;
+    CMICmdMgr &rCmdMgr = CMICmdMgr::Instance();
+    if (!rCmdMgr.CmdInterpret(vTextLine, vwbCmdYesValid, bCmdNotInCmdFactor, cmdData))
+        return MIstatus::failure;
+
+    if (vwbCmdYesValid)
+    {
+        // For debugging only
+        // m_pLog->WriteLog( cmdData.strMiCmdAll.c_str() );
+
+        return ExecuteCommand(cmdData);
+    }
+
+    // Check for escape character, may be cursor control characters
+    // This code is not necessary for application operation, just want to keep tabs on what
+    // is been given to the driver to try and intepret.
+    if (vTextLine.at(0) == 27)
+    {
+        CMIUtilString logInput(MIRSRC(IDS_STDIN_INPUT_CTRL_CHARS));
+        for (MIuint i = 0; i < vTextLine.length(); i++)
+        {
+            logInput += CMIUtilString::Format("%d ", vTextLine.at(i));
+        }
+        m_pLog->WriteLog(logInput);
+        return MIstatus::success;
+    }
+
+    // Write to the Log that a 'command' was not valid.
+    // Report back to the MI client via MI result record.
+    CMIUtilString strNotInCmdFactory;
+    if (bCmdNotInCmdFactor)
+        strNotInCmdFactory = CMIUtilString::Format(MIRSRC(IDS_DRIVER_CMD_NOT_IN_FACTORY), cmdData.strMiCmd.c_str());
+    const CMIUtilString strNot(CMIUtilString::Format("%s ", MIRSRC(IDS_WORD_NOT)));
+    const CMIUtilString msg(
+        CMIUtilString::Format(MIRSRC(IDS_DRIVER_CMD_RECEIVED), vTextLine.c_str(), strNot.c_str(), strNotInCmdFactory.c_str()));
+    const CMICmnMIValueConst vconst = CMICmnMIValueConst(msg);
+    const CMICmnMIValueResult valueResult("msg", vconst);
+    const CMICmnMIResultRecord miResultRecord(cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, valueResult);
+    m_rStdOut.WriteMIResponse(miResultRecord.GetString());
+
+    // Proceed to wait for or execute next command
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Having previously had the potential command validated and found valid now
+//          get the command executed.
+//          This function is used by the application's main thread.
+// Type:    Method.
+// Args:    vCmdData    - (RW) Command meta data.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::ExecuteCommand(const SMICmdData &vCmdData)
+{
+    CMICmdMgr &rCmdMgr = CMICmdMgr::Instance();
+    return rCmdMgr.CmdExecute(vCmdData);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Set the MI Driver's exit application flag. The application checks this flag
+//          after every stdin line is read so the exit may not be instantaneous.
+//          If vbForceExit is false the MI Driver queries its state and determines if is
+//          should exit or continue operating depending on that running state.
+//          This is related to the running state of the MI driver.
+// Type:    Overridden.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+void
+CMIDriver::SetExitApplicationFlag(const bool vbForceExit)
+{
+    if (vbForceExit)
+    {
+        CMIUtilThreadLock lock(m_threadMutex);
+        m_bExitApp = true;
+        return;
+    }
+
+    // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
+    // Did we receive a SIGINT from the client during a running debug program, if
+    // so then SIGINT is not to be taken as meaning kill the MI driver application
+    // but halt the inferior program being debugged instead
+    if (m_eCurrentDriverState == eDriverState_RunningDebugging)
+    {
+        InjectMICommand("-exec-interrupt");
+        return;
+    }
+
+    m_bExitApp = true;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get the  MI Driver's exit exit application flag.
+//          This is related to the running state of the MI driver.
+// Type:    Method.
+// Args:    None.
+// Return:  bool    - True = MI Driver is shutting down, false = MI driver is running.
+// Throws:  None.
+//--
+bool
+CMIDriver::GetExitApplicationFlag(void) const
+{
+    return m_bExitApp;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get the current running state of the MI Driver.
+// Type:    Method.
+// Args:    None.
+// Return:  DriverState_e   - The current running state of the application.
+// Throws:  None.
+//--
+CMIDriver::DriverState_e
+CMIDriver::GetCurrentDriverState(void) const
+{
+    return m_eCurrentDriverState;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Set the current running state of the MI Driver to running and currently not in
+//          a debug session.
+// Type:    Method.
+// Return:  MIstatus::success - Functionality succeeded.
+//          MIstatus::failure - Functionality failed.
+// Return:  DriverState_e   - The current running state of the application.
+// Throws:  None.
+//--
+bool
+CMIDriver::SetDriverStateRunningNotDebugging(void)
+{
+    // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
+
+    if (m_eCurrentDriverState == eDriverState_RunningNotDebugging)
+        return MIstatus::success;
+
+    // Driver cannot be in the following states to set eDriverState_RunningNotDebugging
+    switch (m_eCurrentDriverState)
+    {
+        case eDriverState_NotRunning:
+        case eDriverState_Initialising:
+        case eDriverState_ShuttingDown:
+        {
+            SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
+            return MIstatus::failure;
+        }
+        case eDriverState_RunningDebugging:
+        case eDriverState_RunningNotDebugging:
+            break;
+        case eDriverState_count:
+            SetErrorDescription(
+                CMIUtilString::Format(MIRSRC(IDS_CODE_ERR_INVALID_ENUMERATION_VALUE), "SetDriverStateRunningNotDebugging()"));
+            return MIstatus::failure;
+    }
+
+    // Driver must be in this state to set eDriverState_RunningNotDebugging
+    if (m_eCurrentDriverState != eDriverState_RunningDebugging)
+    {
+        SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
+        return MIstatus::failure;
+    }
+
+    m_eCurrentDriverState = eDriverState_RunningNotDebugging;
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Set the current running state of the MI Driver to running and currently not in
+//          a debug session. The driver's state must in the state running and in a
+//          debug session to set this new state.
+// Type:    Method.
+// Return:  MIstatus::success - Functionality succeeded.
+//          MIstatus::failure - Functionality failed.
+// Return:  DriverState_e   - The current running state of the application.
+// Throws:  None.
+//--
+bool
+CMIDriver::SetDriverStateRunningDebugging(void)
+{
+    // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
+
+    if (m_eCurrentDriverState == eDriverState_RunningDebugging)
+        return MIstatus::success;
+
+    // Driver cannot be in the following states to set eDriverState_RunningDebugging
+    switch (m_eCurrentDriverState)
+    {
+        case eDriverState_NotRunning:
+        case eDriverState_Initialising:
+        case eDriverState_ShuttingDown:
+        {
+            SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
+            return MIstatus::failure;
+        }
+        case eDriverState_RunningDebugging:
+        case eDriverState_RunningNotDebugging:
+            break;
+        case eDriverState_count:
+            SetErrorDescription(CMIUtilString::Format(MIRSRC(IDS_CODE_ERR_INVALID_ENUMERATION_VALUE), "SetDriverStateRunningDebugging()"));
+            return MIstatus::failure;
+    }
+
+    // Driver must be in this state to set eDriverState_RunningDebugging
+    if (m_eCurrentDriverState != eDriverState_RunningNotDebugging)
+    {
+        SetErrorDescription(MIRSRC(IDS_DRIVER_ERR_DRIVER_STATE_ERROR));
+        return MIstatus::failure;
+    }
+
+    m_eCurrentDriverState = eDriverState_RunningDebugging;
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Prepare the client IDE so it will start working/communicating with *this MI
+//          driver.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functionality succeeded.
+//          MIstatus::failure - Functionality failed.
+// Throws:  None.
 //--
-bool CMIDriver::InitClientIDEToMIDriver( void ) const
+bool
+CMIDriver::InitClientIDEToMIDriver(void) const
 {
-	// Put other IDE init functions here
-	return InitClientIDEEclipse();
+    // Put other IDE init functions here
+    return InitClientIDEEclipse();
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: The IDE Eclipse when debugging locally expects "(gdb)\n" character
-//			sequence otherwise it refuses to communicate and times out. This should be
-//			sent to Eclipse before anything else.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functionality succeeded.
-//			MIstatus::failure - Functionality failed.
-// Throws:	None.
+//          sequence otherwise it refuses to communicate and times out. This should be
+//          sent to Eclipse before anything else.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functionality succeeded.
+//          MIstatus::failure - Functionality failed.
+// Throws:  None.
 //--
-bool CMIDriver::InitClientIDEEclipse( void ) const
+bool
+CMIDriver::InitClientIDEEclipse(void) const
 {
-	std::cout << "(gdb)" << std::endl;
+    std::cout << "(gdb)" << std::endl;
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details: Ask *this driver whether it found an executable in the MI Driver's list of 
-//			arguments which to open and debug. If so instigate commands to set up a debug
-//			session for that executable.
-// Type:	Method.
-// Args:	None.
-// Return:	bool - True = True = Yes executable given as one of the parameters to the MI 
-//				   Driver.
-//				   False = not found.
-// Throws:	None.
+// Details: Ask *this driver whether it found an executable in the MI Driver's list of
+//          arguments which to open and debug. If so instigate commands to set up a debug
+//          session for that executable.
+// Type:    Method.
+// Args:    None.
+// Return:  bool - True = True = Yes executable given as one of the parameters to the MI
+//                 Driver.
+//                 False = not found.
+// Throws:  None.
 //--
-bool CMIDriver::HaveExecutableFileNamePathOnCmdLine( void ) const
+bool
+CMIDriver::HaveExecutableFileNamePathOnCmdLine(void) const
 {
-	return m_bHaveExecutableFileNamePathOnCmdLine;
+    return m_bHaveExecutableFileNamePathOnCmdLine;
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: Retrieve from *this driver executable file name path to start a debug session
-//			with (if present see HaveExecutableFileNamePathOnCmdLine()).
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString & - Executeable file name path or empty string.
-// Throws:	None.
+//          with (if present see HaveExecutableFileNamePathOnCmdLine()).
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString & - Executeable file name path or empty string.
+// Throws:  None.
 //--
-const CMIUtilString & CMIDriver::GetExecutableFileNamePathOnCmdLine( void ) const
+const CMIUtilString &
+CMIDriver::GetExecutableFileNamePathOnCmdLine(void) const
 {
-	return m_strCmdLineArgExecuteableFileNamePath;
+    return m_strCmdLineArgExecuteableFileNamePath;
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: Execute commands (by injecting them into the stdin line queue container) and
-//			other code to set up the MI Driver such that is can take the executable 
-//			argument passed on the command and create a debug session for it.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functionality succeeded.
-//			MIstatus::failure - Functionality failed.
-// Throws:	None.
-//--
-bool CMIDriver::LocalDebugSessionStartupInjectCommands( void )
-{
-	const CMIUtilString strCmd( CMIUtilString::Format( "-file-exec-and-symbols %s", m_strCmdLineArgExecuteableFileNamePath.c_str() ) );
-	
-	return InjectMICommand( strCmd );
+//          other code to set up the MI Driver such that is can take the executable
+//          argument passed on the command and create a debug session for it.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functionality succeeded.
+//          MIstatus::failure - Functionality failed.
+// Throws:  None.
+//--
+bool
+CMIDriver::LocalDebugSessionStartupInjectCommands(void)
+{
+    const CMIUtilString strCmd(CMIUtilString::Format("-file-exec-and-symbols %s", m_strCmdLineArgExecuteableFileNamePath.c_str()));
+
+    return InjectMICommand(strCmd);
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: Set the MI Driver into "its debugging an executable passed as an argument"
-//			mode as against running via a client like Eclipse.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+//          mode as against running via a client like Eclipse.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIDriver::SetDriverDebuggingArgExecutable( void )
+void
+CMIDriver::SetDriverDebuggingArgExecutable(void)
 {
-	m_bDriverDebuggingArgExecutable = true;
+    m_bDriverDebuggingArgExecutable = true;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details: Retrieve the MI Driver state indicating if it is operating in "its debugging 
-//			an executable passed as an argument" mode as against running via a client 
-//			like Eclipse.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Retrieve the MI Driver state indicating if it is operating in "its debugging
+//          an executable passed as an argument" mode as against running via a client
+//          like Eclipse.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-bool CMIDriver::IsDriverDebuggingArgExecutable( void ) const
+bool
+CMIDriver::IsDriverDebuggingArgExecutable(void) const
 {
-	return m_bDriverDebuggingArgExecutable;
+    return m_bDriverDebuggingArgExecutable;
 }
-

Modified: lldb/trunk/tools/lldb-mi/MIDriver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriver.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDriver.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriver.h
+// File:        MIDriver.h
 //
-// Overview:	CMIDriver interface.
+// Overview:    CMIDriver interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -38,145 +38,145 @@ class CMICmnLLDBDebugger;
 class CMICmnStreamStdout;
 
 //++ ============================================================================
-// Details:	MI driver implementation class. A singleton class derived from
-//			LLDB SBBroadcaster class. Register the instance of *this class with
-//			the CMIDriverMgr. The CMIDriverMgr sets the driver(s) of to start
-//			work depending on the one selected to work. A driver can if not able
-//			to handle an instruction or 'command' can pass that command onto 
-//			another driver object registered with the Driver Manager.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 29/01/2014.
-// Changes:	None.
+// Details: MI driver implementation class. A singleton class derived from
+//          LLDB SBBroadcaster class. Register the instance of *this class with
+//          the CMIDriverMgr. The CMIDriverMgr sets the driver(s) of to start
+//          work depending on the one selected to work. A driver can if not able
+//          to handle an instruction or 'command' can pass that command onto
+//          another driver object registered with the Driver Manager.
+// Gotchas: None.
+// Authors: Illya Rudkin 29/01/2014.
+// Changes: None.
 //--
-class CMIDriver 
-:	public CMICmnBase
-,	public CMIDriverMgr::IDriver
-,	public CMIDriverBase
-,	public CMICmnStreamStdin::IStreamStdin
-,	public MI::ISingleton< CMIDriver >
+class CMIDriver : public CMICmnBase,
+                  public CMIDriverMgr::IDriver,
+                  public CMIDriverBase,
+                  public CMICmnStreamStdin::IStreamStdin,
+                  public MI::ISingleton<CMIDriver>
 {
-	friend class MI::ISingleton< CMIDriver >;
+    friend class MI::ISingleton<CMIDriver>;
 
-// Enumerations:
-public:
-	//++ ----------------------------------------------------------------------
-	// Details: The MI Driver has a running state which is used to help determin
-	//			which specific action(s) it should take or not allow. 
-	//			The driver when operational and not shutting down alternates
-	//			between eDriverState_RunningNotDebugging and 
-	//			eDriverState_RunningDebugging. eDriverState_RunningNotDebugging
-	//			is normally set when a breakpoint is hit or halted.
-	//			eDriverState_RunningDebugging is normally set when "exec-continue"
-	//			or "exec-run" is issued.
-	//--
-	enum DriverState_e
-	{
-		eDriverState_NotRunning				= 0,	// The MI Driver is not operating
-		eDriverState_Initialising,					// The MI Driver is setting itself up
-		eDriverState_RunningNotDebugging,			// The MI Driver is operational acting on any MI commands sent to it
-		eDriverState_RunningDebugging,				// The MI Driver is currently overseeing an inferior program that is running
-		eDriverState_ShuttingDown,					// The MI Driver is tearing down resources and about exit
-		eDriverState_count							// Always last
-	};
-
-// Methods:
-public:
-	// MI system
-	bool			Initialize( void );
-	bool			Shutdown( void );
-	
-	// MI state
-	bool			GetExitApplicationFlag( void ) const;
-	DriverState_e	GetCurrentDriverState( void ) const;
-	bool			SetDriverStateRunningNotDebugging( void );
-	bool			SetDriverStateRunningDebugging( void );
-	void			SetDriverDebuggingArgExecutable( void );
-	bool			IsDriverDebuggingArgExecutable( void ) const;
-
-	// MI information about itself
-	const CMIUtilString &	GetAppNameShort( void ) const;
-	const CMIUtilString &	GetAppNameLong( void ) const;
-	const CMIUtilString &	GetVersionDescription( void ) const;
-		
-	// MI do work
-	bool					WriteMessageToLog( const CMIUtilString & vMessage );
-	bool					SetEnableFallThru( const bool vbYes );
-	bool					GetEnableFallThru( void ) const;
-	bool					InjectMICommand( const CMIUtilString & vMICmd );
-	bool					HaveExecutableFileNamePathOnCmdLine( void ) const;
-	const CMIUtilString &	GetExecutableFileNamePathOnCmdLine( void ) const;
-
-// Overridden:
-public:
-	// From CMIDriverMgr::IDriver
-	virtual bool					DoInitialize( void );
-	virtual bool					DoShutdown( void );
-	virtual bool					DoMainLoop( void );
-	virtual void					DoResizeWindow( const uint32_t vWindowSizeWsCol );
-	virtual lldb::SBError			DoParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting );
-	virtual CMIUtilString 			GetError( void ) const;
-	virtual const CMIUtilString & 	GetName( void ) const;
-	virtual lldb::SBDebugger &		GetTheDebugger( void );	
-	virtual bool					GetDriverIsGDBMICompatibleDriver( void ) const;
-	virtual bool					SetId( const CMIUtilString & vId );
-	virtual const CMIUtilString &	GetId( void ) const;
-	// From CMIDriverBase
-	virtual void					SetExitApplicationFlag( const bool vbForceExit );
-	virtual bool					DoFallThruToAnotherDriver( const CMIUtilString & vCmd, CMIUtilString & vwErrMsg );
-	virtual bool					SetDriverToFallThruTo( const CMIDriverBase & vrOtherDriver );
-	virtual FILE *					GetStdin( void ) const;		
-	virtual FILE *					GetStdout( void ) const;	
-	virtual FILE *					GetStderr( void ) const;	
-	virtual const CMIUtilString & 	GetDriverName( void ) const;
-	virtual const CMIUtilString &	GetDriverId( void ) const;
-	// From CMICmnStreamStdin
-	virtual bool ReadLine( const CMIUtilString & vStdInBuffer, bool & vrbYesExit );
-
-// Typedefs:
-private:
-	typedef std::queue< CMIUtilString >	QueueStdinLine_t;
-
-// Methods:
-private:
-	/* ctor */	CMIDriver( void );
-	/* ctor */	CMIDriver( const CMIDriver & );
-	void		operator=( const CMIDriver & );
-	
-	lldb::SBError	ParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting );
-	bool			ReadStdinLineQueue( void );
-	bool			DoAppQuit( void );
-	bool			InterpretCommand( const CMIUtilString & vTextLine );
-	bool			InterpretCommandThisDriver( const CMIUtilString & vTextLine, bool & vwbCmdYesValid );
-	bool			InterpretCommandFallThruDriver( const CMIUtilString & vTextLine, bool & vwbCmdYesValid );
-	bool			ExecuteCommand( const SMICmdData & vCmdData );
-	bool			StartWorkerThreads( void );
-	bool			StopWorkerThreads( void );
-	bool			InitClientIDEToMIDriver( void ) const;
-	bool			InitClientIDEEclipse( void ) const;
-	bool			QueueMICommand( const CMIUtilString & vMICmd );
-	bool			LocalDebugSessionStartupInjectCommands( void );
-
-// Overridden:
-private:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIDriver( void );
-
-// Attributes:
-private:
-	static const CMIUtilString	ms_constAppNameShort;
-	static const CMIUtilString	ms_constAppNameLong;
-	static const CMIUtilString	ms_constMIVersion;
-	//
-	bool					m_bFallThruToOtherDriverEnabled;			// True = yes fall through, false = do not pass on command
-	CMIUtilThreadMutex		m_threadMutex;
-	QueueStdinLine_t		m_queueStdinLine;							// Producer = stdin monitor, consumer = *this driver 
-	bool					m_bDriverIsExiting;							// True = yes, driver told to quit, false = continue working
-	void *					m_handleMainThread;							// *this driver is run by the main thread
-	CMICmnStreamStdin &		m_rStdin;	
-	CMICmnLLDBDebugger &	m_rLldbDebugger;
-	CMICmnStreamStdout &	m_rStdOut;
-	DriverState_e			m_eCurrentDriverState;
-	bool					m_bHaveExecutableFileNamePathOnCmdLine;		// True = Yes executable given as one of the parameters to the MI Driver, false = not found 
-	CMIUtilString			m_strCmdLineArgExecuteableFileNamePath;
-	bool					m_bDriverDebuggingArgExecutable;			// True = The MI Driver (MI mode) is debugging executable passed as argument, false = running via a client i.e Eclipse
+    // Enumerations:
+  public:
+    //++ ----------------------------------------------------------------------
+    // Details: The MI Driver has a running state which is used to help determin
+    //          which specific action(s) it should take or not allow.
+    //          The driver when operational and not shutting down alternates
+    //          between eDriverState_RunningNotDebugging and
+    //          eDriverState_RunningDebugging. eDriverState_RunningNotDebugging
+    //          is normally set when a breakpoint is hit or halted.
+    //          eDriverState_RunningDebugging is normally set when "exec-continue"
+    //          or "exec-run" is issued.
+    //--
+    enum DriverState_e
+    {
+        eDriverState_NotRunning = 0,      // The MI Driver is not operating
+        eDriverState_Initialising,        // The MI Driver is setting itself up
+        eDriverState_RunningNotDebugging, // The MI Driver is operational acting on any MI commands sent to it
+        eDriverState_RunningDebugging,    // The MI Driver is currently overseeing an inferior program that is running
+        eDriverState_ShuttingDown,        // The MI Driver is tearing down resources and about exit
+        eDriverState_count                // Always last
+    };
+
+    // Methods:
+  public:
+    // MI system
+    bool Initialize(void);
+    bool Shutdown(void);
+
+    // MI state
+    bool GetExitApplicationFlag(void) const;
+    DriverState_e GetCurrentDriverState(void) const;
+    bool SetDriverStateRunningNotDebugging(void);
+    bool SetDriverStateRunningDebugging(void);
+    void SetDriverDebuggingArgExecutable(void);
+    bool IsDriverDebuggingArgExecutable(void) const;
+
+    // MI information about itself
+    const CMIUtilString &GetAppNameShort(void) const;
+    const CMIUtilString &GetAppNameLong(void) const;
+    const CMIUtilString &GetVersionDescription(void) const;
+
+    // MI do work
+    bool WriteMessageToLog(const CMIUtilString &vMessage);
+    bool SetEnableFallThru(const bool vbYes);
+    bool GetEnableFallThru(void) const;
+    bool InjectMICommand(const CMIUtilString &vMICmd);
+    bool HaveExecutableFileNamePathOnCmdLine(void) const;
+    const CMIUtilString &GetExecutableFileNamePathOnCmdLine(void) const;
+
+    // Overridden:
+  public:
+    // From CMIDriverMgr::IDriver
+    virtual bool DoInitialize(void);
+    virtual bool DoShutdown(void);
+    virtual bool DoMainLoop(void);
+    virtual void DoResizeWindow(const uint32_t vWindowSizeWsCol);
+    virtual lldb::SBError DoParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting);
+    virtual CMIUtilString GetError(void) const;
+    virtual const CMIUtilString &GetName(void) const;
+    virtual lldb::SBDebugger &GetTheDebugger(void);
+    virtual bool GetDriverIsGDBMICompatibleDriver(void) const;
+    virtual bool SetId(const CMIUtilString &vId);
+    virtual const CMIUtilString &GetId(void) const;
+    // From CMIDriverBase
+    virtual void SetExitApplicationFlag(const bool vbForceExit);
+    virtual bool DoFallThruToAnotherDriver(const CMIUtilString &vCmd, CMIUtilString &vwErrMsg);
+    virtual bool SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver);
+    virtual FILE *GetStdin(void) const;
+    virtual FILE *GetStdout(void) const;
+    virtual FILE *GetStderr(void) const;
+    virtual const CMIUtilString &GetDriverName(void) const;
+    virtual const CMIUtilString &GetDriverId(void) const;
+    // From CMICmnStreamStdin
+    virtual bool ReadLine(const CMIUtilString &vStdInBuffer, bool &vrbYesExit);
+
+    // Typedefs:
+  private:
+    typedef std::queue<CMIUtilString> QueueStdinLine_t;
+
+    // Methods:
+  private:
+    /* ctor */ CMIDriver(void);
+    /* ctor */ CMIDriver(const CMIDriver &);
+    void operator=(const CMIDriver &);
+
+    lldb::SBError ParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting);
+    bool ReadStdinLineQueue(void);
+    bool DoAppQuit(void);
+    bool InterpretCommand(const CMIUtilString &vTextLine);
+    bool InterpretCommandThisDriver(const CMIUtilString &vTextLine, bool &vwbCmdYesValid);
+    bool InterpretCommandFallThruDriver(const CMIUtilString &vTextLine, bool &vwbCmdYesValid);
+    bool ExecuteCommand(const SMICmdData &vCmdData);
+    bool StartWorkerThreads(void);
+    bool StopWorkerThreads(void);
+    bool InitClientIDEToMIDriver(void) const;
+    bool InitClientIDEEclipse(void) const;
+    bool QueueMICommand(const CMIUtilString &vMICmd);
+    bool LocalDebugSessionStartupInjectCommands(void);
+
+    // Overridden:
+  private:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIDriver(void);
+
+    // Attributes:
+  private:
+    static const CMIUtilString ms_constAppNameShort;
+    static const CMIUtilString ms_constAppNameLong;
+    static const CMIUtilString ms_constMIVersion;
+    //
+    bool m_bFallThruToOtherDriverEnabled; // True = yes fall through, false = do not pass on command
+    CMIUtilThreadMutex m_threadMutex;
+    QueueStdinLine_t m_queueStdinLine; // Producer = stdin monitor, consumer = *this driver
+    bool m_bDriverIsExiting;           // True = yes, driver told to quit, false = continue working
+    void *m_handleMainThread;          // *this driver is run by the main thread
+    CMICmnStreamStdin &m_rStdin;
+    CMICmnLLDBDebugger &m_rLldbDebugger;
+    CMICmnStreamStdout &m_rStdOut;
+    DriverState_e m_eCurrentDriverState;
+    bool m_bHaveExecutableFileNamePathOnCmdLine; // True = Yes executable given as one of the parameters to the MI Driver, false = not found
+    CMIUtilString m_strCmdLineArgExecuteableFileNamePath;
+    bool m_bDriverDebuggingArgExecutable; // True = The MI Driver (MI mode) is debugging executable passed as argument, false = running via
+                                          // a client i.e Eclipse
 };

Modified: lldb/trunk/tools/lldb-mi/MIDriverBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverBase.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverBase.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverBase.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriverBase.cpp
+// File:        MIDriverBase.cpp
 //
-// Overview:	CMIDriverBase implementation.
+// Overview:    CMIDriverBase implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third party headers:
@@ -27,169 +27,178 @@
 #include "MIDriverBase.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIDriverBase constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIDriverBase constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIDriverBase::CMIDriverBase( void )
-:	m_pDriverFallThru( nullptr )
-,	m_pDriverParent( nullptr )
-,	m_bExitApp( false )
+CMIDriverBase::CMIDriverBase(void)
+    : m_pDriverFallThru(nullptr)
+    , m_pDriverParent(nullptr)
+    , m_bExitApp(false)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIDriverBase destructor.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIDriverBase destructor.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIDriverBase::~CMIDriverBase( void )
+CMIDriverBase::~CMIDriverBase(void)
 {
-	m_pDriverFallThru = NULL;
+    m_pDriverFallThru = NULL;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	This function allows *this driver to call on another driver to perform work
-//			should this driver not be able to handle the client data input.
-// Type:	Overrideable.
-//			Check the error message if the function returns a failure.
-// Type:	Overridden.
-// Args:	vCmd		- (R) Command instruction to interpret.
-//			vwErrMsg	- (W) Error description on command failing.
-// Return:	MIstatus::success - Command succeeded.
-//			MIstatus::failure - Command failed.
-// Throws:	None.
+// Details: This function allows *this driver to call on another driver to perform work
+//          should this driver not be able to handle the client data input.
+// Type:    Overrideable.
+//          Check the error message if the function returns a failure.
+// Type:    Overridden.
+// Args:    vCmd        - (R) Command instruction to interpret.
+//          vwErrMsg    - (W) Error description on command failing.
+// Return:  MIstatus::success - Command succeeded.
+//          MIstatus::failure - Command failed.
+// Throws:  None.
 //--
-bool CMIDriverBase::DoFallThruToAnotherDriver( const CMIUtilString & vCmd, CMIUtilString & vwErrMsg )
+bool
+CMIDriverBase::DoFallThruToAnotherDriver(const CMIUtilString &vCmd, CMIUtilString &vwErrMsg)
 {
-	// Do nothing - override and implement. Use m_pDriverFallThru.
-	return MIstatus::success;
+    // Do nothing - override and implement. Use m_pDriverFallThru.
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	This function allows *this driver to call on another driver to perform work
-//			should this driver not be able to handle the client data input.
-// Type:	Overrideable.
-// Args:	vrOtherDriver	- (R) Reference to another driver object.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: This function allows *this driver to call on another driver to perform work
+//          should this driver not be able to handle the client data input.
+// Type:    Overrideable.
+// Args:    vrOtherDriver   - (R) Reference to another driver object.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriverBase::SetDriverToFallThruTo( const CMIDriverBase & vrOtherDriver )
+bool
+CMIDriverBase::SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver)
 {
-	MIunused( vrOtherDriver );
+    MIunused(vrOtherDriver);
 
-	// Do nothing - override and implement. Set m_pDriverFallThru.
+    // Do nothing - override and implement. Set m_pDriverFallThru.
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	This function allows *this driver to call functionality on the parent driver
-//			ask for information for example.
-// Type:	Overrideable.
-// Args:	vrOtherDriver	- (R) Reference to another driver object.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: This function allows *this driver to call functionality on the parent driver
+//          ask for information for example.
+// Type:    Overrideable.
+// Args:    vrOtherDriver     - (R) Reference to another driver object.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriverBase::SetDriverParent( const CMIDriverBase & vrOtherDriver )
+bool
+CMIDriverBase::SetDriverParent(const CMIDriverBase &vrOtherDriver)
 {
-	MIunused( vrOtherDriver );
+    MIunused(vrOtherDriver);
 
-	// Do nothing - override and implement. Set m_pDriverParent.
+    // Do nothing - override and implement. Set m_pDriverParent.
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the parent driver to *this driver if one assigned. If assigned *this
-//			is the pass through driver that the parent driver passes work to.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIDriverBase *	- Pointer to a driver object.
-//								- NULL = there is not parent to *this driver.
-// Throws:	None.
+// Details: Retrieve the parent driver to *this driver if one assigned. If assigned *this
+//          is the pass through driver that the parent driver passes work to.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIDriverBase * - Pointer to a driver object.
+//                          - NULL = there is not parent to *this driver.
+// Throws:  None.
 //--
-CMIDriverBase * CMIDriverBase::GetDriversParent( void ) const
+CMIDriverBase *
+CMIDriverBase::GetDriversParent(void) const
 {
-	return m_pDriverParent;
+    return m_pDriverParent;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the pointer to the other fall through driver *this driver is using
-//			(or not using).
-// Type:	Method.
-// Args:	None.
-// Return:	CMIDriverBase * - Pointer to other driver.
-//							 - NULL if no driver set.
-// Throws:	None.
+// Details: Retrieve the pointer to the other fall through driver *this driver is using
+//          (or not using).
+// Type:    Method.
+// Args:    None.
+// Return:  CMIDriverBase * - Pointer to other driver.
+//                          - NULL if no driver set.
+// Throws:  None.
 //--
-CMIDriverBase * CMIDriverBase::GetDriverToFallThruTo( void ) const
+CMIDriverBase *
+CMIDriverBase::GetDriverToFallThruTo(void) const
 {
-	return m_pDriverFallThru;
+    return m_pDriverFallThru;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	*this driver provides a file stream to other drivers on which *this driver
-//			write's out to and they read as expected input. *this driver is passing
-//			through commands to the (child) pass through assigned driver.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	FILE * - Pointer to stream.
-// Throws:	None.
+// Details: *this driver provides a file stream to other drivers on which *this driver
+//          write's out to and they read as expected input. *this driver is passing
+//          through commands to the (child) pass through assigned driver.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  FILE * - Pointer to stream.
+// Throws:  None.
 //--
-FILE * CMIDriverBase::GetStdin( void ) const
+FILE *
+CMIDriverBase::GetStdin(void) const
 {
-	// Do nothing - override and implement
-	return nullptr;
+    // Do nothing - override and implement
+    return nullptr;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	*this driver provides a file stream to other pass through assigned drivers 
-//			so they know what to write to.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	FILE * - Pointer to stream.
-// Throws:	None.
+// Details: *this driver provides a file stream to other pass through assigned drivers
+//          so they know what to write to.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  FILE * - Pointer to stream.
+// Throws:  None.
 //--
-FILE * CMIDriverBase::GetStdout( void ) const
+FILE *
+CMIDriverBase::GetStdout(void) const
 {
-	// Do nothing - override and implement
-	return nullptr;
+    // Do nothing - override and implement
+    return nullptr;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	*this driver provides a error file stream to other pass through assigned drivers 
-//			so they know what to write to.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	FILE * - Pointer to stream.
-// Throws:	None.
+// Details: *this driver provides a error file stream to other pass through assigned drivers
+//          so they know what to write to.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  FILE * - Pointer to stream.
+// Throws:  None.
 //--
-FILE * CMIDriverBase::GetStderr( void ) const
+FILE *
+CMIDriverBase::GetStderr(void) const
 {
-	// Do nothing - override and implement
-	return nullptr;
+    // Do nothing - override and implement
+    return nullptr;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Set the MI Driver's exit application flag. The application checks this flag 
-//			after every stdin line is read so the exit may not be instantious.
-//			If vbForceExit is false the MI Driver queries its state and determines if is
-//			should exit or continue operating depending on that running state.
-// Type:	Overrideable.
-// Args:	vbForceExit	- (R) True = Do not query, set state to exit, false = query if can/should exit right now.
-// Return:	None.
-// Throws:	None.
+// Details: Set the MI Driver's exit application flag. The application checks this flag
+//          after every stdin line is read so the exit may not be instantious.
+//          If vbForceExit is false the MI Driver queries its state and determines if is
+//          should exit or continue operating depending on that running state.
+// Type:    Overrideable.
+// Args:    vbForceExit - (R) True = Do not query, set state to exit, false = query if can/should exit right now.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIDriverBase::SetExitApplicationFlag( const bool vbForceExit )
+void
+CMIDriverBase::SetExitApplicationFlag(const bool vbForceExit)
 {
-	MIunused( vbForceExit );
+    MIunused(vbForceExit);
 
-	// Do nothing - override and implement
-}
\ No newline at end of file
+    // Do nothing - override and implement
+}

Modified: lldb/trunk/tools/lldb-mi/MIDriverBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverBase.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverBase.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverBase.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriverBase.h
+// File:        MIDriverBase.h
 //
-// Overview:	CMIDriverBase interface.
+// Overview:    CMIDriverBase interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -29,50 +29,53 @@
 #include "MIUtilString.h"
 
 // Declarations:
-namespace lldb { class SBBroadcaster; }
+namespace lldb
+{
+class SBBroadcaster;
+}
 
 //++ ============================================================================
-// Details:	MI driver base implementation class. This class has been created so 
-//			not have to edit the lldb::SBBroadcaster class code. Functionality 
-//			and attributes need to be common to the LLDB Driver class and the 
-//			MI Driver class (derived from lldb::SBBroadcaster) so they can call 
-//			upon each other for functionality fall through and allow the 
-//			CDriverMgr to manage either (any) driver to be operated on.
-//			Each driver instance (the CMIDriver, LLDB::Driver) has its own
-//			LLDB::SBDebugger object.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 30/01/2014.
-// Changes:	None.
+// Details: MI driver base implementation class. This class has been created so
+//          not have to edit the lldb::SBBroadcaster class code. Functionality
+//          and attributes need to be common to the LLDB Driver class and the
+//          MI Driver class (derived from lldb::SBBroadcaster) so they can call
+//          upon each other for functionality fall through and allow the
+//          CDriverMgr to manage either (any) driver to be operated on.
+//          Each driver instance (the CMIDriver, LLDB::Driver) has its own
+//          LLDB::SBDebugger object.
+// Gotchas: None.
+// Authors: Illya Rudkin 30/01/2014.
+// Changes: None.
 //--
 class CMIDriverBase
 {
-// Methods:
-public:
-	/* ctor */	CMIDriverBase( void );
-	
-	CMIDriverBase *	GetDriverToFallThruTo( void ) const;
-	CMIDriverBase *	GetDriversParent( void ) const;
-
-// Overrideable:
-public:
-	/* dtor */ virtual ~CMIDriverBase( void );
-	
-	virtual bool					DoFallThruToAnotherDriver( const CMIUtilString & vCmd, CMIUtilString & vwErrMsg );
-	virtual bool					SetDriverToFallThruTo( const CMIDriverBase & vrOtherDriver );
-	virtual bool					SetDriverParent( const CMIDriverBase & vrOtherDriver );
-	virtual const CMIUtilString &	GetDriverName( void ) const = 0;
-	virtual const CMIUtilString &	GetDriverId( void ) const = 0;
-	virtual void					SetExitApplicationFlag( const bool vbForceExit );
-	
-	// MI provide information for the pass through (child) assigned driver
-	virtual FILE *	GetStdin( void ) const;		
-	virtual FILE *	GetStdout( void ) const;	
-	virtual FILE *	GetStderr( void ) const;
-		
-// Attributes:
-protected:
-	CMIDriverBase *	m_pDriverFallThru;	// Child driver to use should *this driver not be able to handle client input
-	CMIDriverBase *	m_pDriverParent;	// The parent driver who passes work to *this driver to do work
-	CMIUtilString	m_strDriverId;
-	bool			m_bExitApp;			// True = Yes, exit application, false = continue execution
+    // Methods:
+  public:
+    /* ctor */ CMIDriverBase(void);
+
+    CMIDriverBase *GetDriverToFallThruTo(void) const;
+    CMIDriverBase *GetDriversParent(void) const;
+
+    // Overrideable:
+  public:
+    /* dtor */ virtual ~CMIDriverBase(void);
+
+    virtual bool DoFallThruToAnotherDriver(const CMIUtilString &vCmd, CMIUtilString &vwErrMsg);
+    virtual bool SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver);
+    virtual bool SetDriverParent(const CMIDriverBase &vrOtherDriver);
+    virtual const CMIUtilString &GetDriverName(void) const = 0;
+    virtual const CMIUtilString &GetDriverId(void) const = 0;
+    virtual void SetExitApplicationFlag(const bool vbForceExit);
+
+    // MI provide information for the pass through (child) assigned driver
+    virtual FILE *GetStdin(void) const;
+    virtual FILE *GetStdout(void) const;
+    virtual FILE *GetStderr(void) const;
+
+    // Attributes:
+  protected:
+    CMIDriverBase *m_pDriverFallThru; // Child driver to use should *this driver not be able to handle client input
+    CMIDriverBase *m_pDriverParent;   // The parent driver who passes work to *this driver to do work
+    CMIUtilString m_strDriverId;
+    bool m_bExitApp; // True = Yes, exit application, false = continue execution
 };

Modified: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMain.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp Mon Nov 17 12:06:21 2014
@@ -8,44 +8,44 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriverMain.cpp
+// File:        MIDriverMain.cpp
 //
-// Overview:	Defines the entry point for the console application.
-//				The MI application (project name MI) runs in two modes:
-//				An LLDB native driver mode where it acts no different from the LLDB driver.
-//				The other mode is the MI when it finds on the command line
-//				the --interpreter option. Command line argument --help on its own will give
-//				help for the LLDB driver. If entered with --interpreter then MI help will
-//				provided.
-//				To implement new MI commands derive a new command class from the command base 
-//				class. To enable the new command for interpretation add the new command class
-//				to the command factory. The files of relevance are:
-//					MICmdCommands.cpp
-//					MICmdBase.h / .cpp
-//					MICmdCmd.h / .cpp
-// Versions:	1.0.0.1		First version from scratch 28/1/2014 to 28/3/2014. MI not complete.
-//				1.0.0.2		First deliverable to client 7/3/2014. MI not complete.
-//				1.0.0.3		Code refactor tidy. Release to community for evaluation 17/5/2014. MI not complete.
-//				1.0.0.4		Post release to the community for evaluation 17/5/2014. MI not complete.
-//				1.0.0.5		Second deliverable to client 16/6/2014.
-//				1.0.0.6		Post release of second deliverable to client 16/6/2014.
-//							Released to the community 24/6/2014.
-//				1.0.0.7 	Post release to the community.
-//							Delivered to client 30/6/2014.
-//				1.0.0.8		Delivered to client 29/7/2014.
-//				1.0.0.9		Post release to client 29/7/2014.
-//				See MIreadme.txt for list of MI commands implemented.
+// Overview:    Defines the entry point for the console application.
+//              The MI application (project name MI) runs in two modes:
+//              An LLDB native driver mode where it acts no different from the LLDB driver.
+//              The other mode is the MI when it finds on the command line
+//              the --interpreter option. Command line argument --help on its own will give
+//              help for the LLDB driver. If entered with --interpreter then MI help will
+//              provided.
+//              To implement new MI commands derive a new command class from the command base
+//              class. To enable the new command for interpretation add the new command class
+//              to the command factory. The files of relevance are:
+//                  MICmdCommands.cpp
+//                  MICmdBase.h / .cpp
+//                  MICmdCmd.h / .cpp
+// Versions:    1.0.0.1     First version from scratch 28/1/2014 to 28/3/2014. MI not complete.
+//              1.0.0.2     First deliverable to client 7/3/2014. MI not complete.
+//              1.0.0.3     Code refactor tidy. Release to community for evaluation 17/5/2014. MI not complete.
+//              1.0.0.4     Post release to the community for evaluation 17/5/2014. MI not complete.
+//              1.0.0.5     Second deliverable to client 16/6/2014.
+//              1.0.0.6     Post release of second deliverable to client 16/6/2014.
+//                          Released to the community 24/6/2014.
+//              1.0.0.7     Post release to the community.
+//                          Delivered to client 30/6/2014.
+//              1.0.0.8     Delivered to client 29/7/2014.
+//              1.0.0.9     Post release to client 29/7/2014.
+//              See MIreadme.txt for list of MI commands implemented.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadme.txt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadme.txt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
-#if defined( _MSC_VER )
-	#define _INC_SIGNAL // Stop window's signal.h being included - CODETAG_IOR_SIGNALS
-#endif // _MSC_VER
+#if defined(_MSC_VER)
+#define _INC_SIGNAL // Stop window's signal.h being included - CODETAG_IOR_SIGNALS
+#endif              // _MSC_VER
 
 // Third party headers:
 #include <stdio.h>
@@ -53,7 +53,7 @@
 
 // In house headers:
 #include "MICmnConfig.h"
-#include "Platform.h"	// Define signals - CODETAG_IOR_SIGNALS
+#include "Platform.h" // Define signals - CODETAG_IOR_SIGNALS
 #include "Driver.h"
 #include "MIDriverMgr.h"
 #include "MIDriver.h"
@@ -64,330 +64,336 @@
 
 #if MICONFIG_COMPILE_MIDRIVER_VERSION
 
-#if defined( _MSC_VER )
-#pragma warning( once : 4530 ) // Warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
-#endif // _MSC_VER
+#if defined(_MSC_VER)
+#pragma warning(once : 4530) // Warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
+#endif                       // _MSC_VER
 
 // ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
 // CODETAG_IOR_SIGNALS
 //++ ------------------------------------------------------------------------------------
-// Details:	The SIGWINCH signal is sent to a process when its controlling terminal 
-//			changes its size (a window change).
-// Type:	Function.
-// Args:	vSigno	- (R) Signal number.				  	
-// Return:	None.
-// Throws:	None.
+// Details: The SIGWINCH signal is sent to a process when its controlling terminal
+//          changes its size (a window change).
+// Type:    Function.
+// Args:    vSigno  - (R) Signal number.
+// Return:  None.
+// Throws:  None.
 //--
-void sigwinch_handler( int vSigno )
+void
+sigwinch_handler(int vSigno)
 {
-	MIunused( vSigno );
+    MIunused(vSigno);
 
-	struct winsize window_size;
-	if( ::isatty( STDIN_FILENO ) && ::ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) == 0 )
-	{
-		CMIDriverMgr & rDriverMgr = CMIDriverMgr::Instance();
-		if( window_size.ws_col > 0 )
-		{
- 			rDriverMgr.DriverResizeWindow( (uint32_t) window_size.ws_col );
-		}
-	}
+    struct winsize window_size;
+    if (::isatty(STDIN_FILENO) && ::ioctl(STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
+    {
+        CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
+        if (window_size.ws_col > 0)
+        {
+            rDriverMgr.DriverResizeWindow((uint32_t)window_size.ws_col);
+        }
+    }
 
-	CMICmnLog::Instance().WriteLog( CMIUtilString::Format( MIRSRC( IDS_PROCESS_SIGNAL_RECEIVED ), "SIGWINCH", vSigno ) );
+    CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGWINCH", vSigno));
 }
 
 // CODETAG_IOR_SIGNALS
 //++ ------------------------------------------------------------------------------------
-// Details:	The SIGINT signal is sent to a process by its controlling terminal when a 
-//			user wishes to interrupt the process. This is typically initiated by pressing 
-//			Control-C, but on some systems, the "delete" character or "break" key can be 
-//			used.
-//			Be aware this function may be called on another thread besides the main thread.
-// Type:	Function.
-// Args:	vSigno	- (R) Signal number.				  	
-// Return:	None.
-// Throws:	None.
+// Details: The SIGINT signal is sent to a process by its controlling terminal when a
+//          user wishes to interrupt the process. This is typically initiated by pressing
+//          Control-C, but on some systems, the "delete" character or "break" key can be
+//          used.
+//          Be aware this function may be called on another thread besides the main thread.
+// Type:    Function.
+// Args:    vSigno  - (R) Signal number.
+// Return:  None.
+// Throws:  None.
 //--
-void sigint_handler( int vSigno )
+void
+sigint_handler(int vSigno)
 {
-	static bool g_interrupt_sent = false;
-	CMIDriverMgr & rDriverMgr = CMIDriverMgr::Instance();
-	lldb::SBDebugger * pDebugger = rDriverMgr.DriverGetTheDebugger();
-	if( pDebugger != nullptr )
-	{
-		if( !g_interrupt_sent )
-		{
-			g_interrupt_sent = true;
-			pDebugger->DispatchInputInterrupt();
-			g_interrupt_sent = false;
-		}
-	}
-
-	CMICmnLog::Instance().WriteLog( CMIUtilString::Format( MIRSRC( IDS_PROCESS_SIGNAL_RECEIVED ), "SIGINT", vSigno ) );
-
-	// CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
-	// Signal MI to shutdown or halt a running debug session
-	CMICmnStreamStdin::Instance().SetCtrlCHit();
+    static bool g_interrupt_sent = false;
+    CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
+    lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
+    if (pDebugger != nullptr)
+    {
+        if (!g_interrupt_sent)
+        {
+            g_interrupt_sent = true;
+            pDebugger->DispatchInputInterrupt();
+            g_interrupt_sent = false;
+        }
+    }
+
+    CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGINT", vSigno));
+
+    // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM
+    // Signal MI to shutdown or halt a running debug session
+    CMICmnStreamStdin::Instance().SetCtrlCHit();
 }
 
 // ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
 // CODETAG_IOR_SIGNALS
 //++ ------------------------------------------------------------------------------------
-// Details:	The SIGTSTP signal is sent to a process by its controlling terminal to 
-//			request it to stop temporarily. It is commonly initiated by the user pressing 
-//			Control-Z. Unlike SIGSTOP, the process can register a signal handler for or 
-//			ignore the signal.
-//			*** The function does not behave ATM like the UNIX equivalent ***
-// Type:	Function.
-// Args:	vSigno	- (R) Signal number.				  	
-// Return:	None.
-// Throws:	None.
+// Details: The SIGTSTP signal is sent to a process by its controlling terminal to
+//          request it to stop temporarily. It is commonly initiated by the user pressing
+//          Control-Z. Unlike SIGSTOP, the process can register a signal handler for or
+//          ignore the signal.
+//          *** The function does not behave ATM like the UNIX equivalent ***
+// Type:    Function.
+// Args:    vSigno  - (R) Signal number.
+// Return:  None.
+// Throws:  None.
 //--
-void sigtstp_handler( int vSigno )
+void
+sigtstp_handler(int vSigno)
 {
-	CMIDriverMgr & rDriverMgr = CMIDriverMgr::Instance();
-	lldb::SBDebugger * pDebugger = rDriverMgr.DriverGetTheDebugger();
-	if( pDebugger != nullptr )
-	{
-		pDebugger->SaveInputTerminalState();
-	}
+    CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
+    lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
+    if (pDebugger != nullptr)
+    {
+        pDebugger->SaveInputTerminalState();
+    }
 
-	CMICmnLog::Instance().WriteLog( CMIUtilString::Format( MIRSRC( IDS_PROCESS_SIGNAL_RECEIVED ), "SIGTSTP", vSigno ) );
+    CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGTSTP", vSigno));
 
-	// Signal MI to shutdown
-	CMICmnStreamStdin::Instance().SetCtrlCHit();
+    // Signal MI to shutdown
+    CMICmnStreamStdin::Instance().SetCtrlCHit();
 }
 
 // ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
 // CODETAG_IOR_SIGNALS
 //++ ------------------------------------------------------------------------------------
-// Details:	The SIGCONT signal instructs the operating system to continue (restart) a 
-//			process previously paused by the SIGSTOP or SIGTSTP signal. One important use 
-//			of this signal is in job control in the UNIX shell.
-//			*** The function does not behave ATM like the UNIX equivalent ***
-// Type:	Function.
-// Args:	vSigno	- (R) Signal number.			  	
-// Return:	None.
-// Throws:	None.
+// Details: The SIGCONT signal instructs the operating system to continue (restart) a
+//          process previously paused by the SIGSTOP or SIGTSTP signal. One important use
+//          of this signal is in job control in the UNIX shell.
+//          *** The function does not behave ATM like the UNIX equivalent ***
+// Type:    Function.
+// Args:    vSigno  - (R) Signal number.
+// Return:  None.
+// Throws:  None.
 //--
-void sigcont_handler( int vSigno )
+void
+sigcont_handler(int vSigno)
 {
-	CMIDriverMgr & rDriverMgr = CMIDriverMgr::Instance();
-	lldb::SBDebugger * pDebugger = rDriverMgr.DriverGetTheDebugger();
-	if( pDebugger != nullptr )
-	{
-		pDebugger->RestoreInputTerminalState();
-	}
+    CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
+    lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
+    if (pDebugger != nullptr)
+    {
+        pDebugger->RestoreInputTerminalState();
+    }
 
-	CMICmnLog::Instance().WriteLog( CMIUtilString::Format( MIRSRC( IDS_PROCESS_SIGNAL_RECEIVED ), "SIGCONT", vSigno ) );
+    CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGCONT", vSigno));
 
-	// Signal MI to shutdown
-	CMICmnStreamStdin::Instance().SetCtrlCHit();
+    // Signal MI to shutdown
+    CMICmnStreamStdin::Instance().SetCtrlCHit();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Init the MI driver system. Initialize the whole driver system which includes
-//			both the original LLDB driver and the MI driver.
-// Type:	Function.
-// Args:	None.			  	
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Init the MI driver system. Initialize the whole driver system which includes
+//          both the original LLDB driver and the MI driver.
+// Type:    Function.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool DriverSystemInit( void )
+bool
+DriverSystemInit(void)
 {
-	bool bOk = MIstatus::success;
+    bool bOk = MIstatus::success;
 
 #if MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
-	Driver * pDriver = Driver::CreateSelf();
-	if( pDriver == nullptr )
-		return MIstatus::failure;
+    Driver *pDriver = Driver::CreateSelf();
+    if (pDriver == nullptr)
+        return MIstatus::failure;
 #endif // MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
 
-	CMIDriver & rMIDriver = CMIDriver::Instance();
-	CMIDriverMgr & rDriverMgr = CMIDriverMgr::Instance();
-	bOk = rDriverMgr.Initialize();
-
-	// Register MIDriver first as it needs to initialize and be ready
-	// for the Driver to get information from MIDriver when it initializes
-	// (LLDB Driver is registered with the Driver Manager in MI's Initialize())
-	bOk = bOk && rDriverMgr.RegisterDriver( rMIDriver, "MIDriver" );	// Will be main driver
+    CMIDriver &rMIDriver = CMIDriver::Instance();
+    CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
+    bOk = rDriverMgr.Initialize();
+
+    // Register MIDriver first as it needs to initialize and be ready
+    // for the Driver to get information from MIDriver when it initializes
+    // (LLDB Driver is registered with the Driver Manager in MI's Initialize())
+    bOk = bOk && rDriverMgr.RegisterDriver(rMIDriver, "MIDriver"); // Will be main driver
 
-	return bOk;
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Shutdown the debugger system. Release / terminate resources external to
-//			specifically the MI driver.
-// Type:	Function.
-// Args:	vbAppExitOk	- (R) True = No problems, false = App exiting with problems (investigate!).			  	
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Shutdown the debugger system. Release / terminate resources external to
+//          specifically the MI driver.
+// Type:    Function.
+// Args:    vbAppExitOk - (R) True = No problems, false = App exiting with problems (investigate!).
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool DriverSystemShutdown( const bool vbAppExitOk )
+bool
+DriverSystemShutdown(const bool vbAppExitOk)
 {
-	bool bOk = MIstatus::success;
+    bool bOk = MIstatus::success;
 
-	// *** Order is important here ***
-	CMIDriverMgr::Instance().Shutdown();
+    // *** Order is important here ***
+    CMIDriverMgr::Instance().Shutdown();
 
 #if MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
-	delete g_driver;
-	g_driver = nullptr;	
+    delete g_driver;
+    g_driver = nullptr;
 #endif // MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
 
-	return bOk;
+    return bOk;
 }
 
 #else
 void
-sigwinch_handler (int signo)
+sigwinch_handler(int signo)
 {
     struct winsize window_size;
-    if (isatty (STDIN_FILENO)
-        && ::ioctl (STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
+    if (isatty(STDIN_FILENO) && ::ioctl(STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
     {
         if ((window_size.ws_col > 0) && g_driver != NULL)
         {
-            g_driver->ResizeWindow (window_size.ws_col);
+            g_driver->ResizeWindow(window_size.ws_col);
         }
     }
 }
 
 void
-sigint_handler (int signo)
+sigint_handler(int signo)
 {
-	static bool g_interrupt_sent = false;
+    static bool g_interrupt_sent = false;
     if (g_driver)
-	{
-		if (!g_interrupt_sent)
-		{
-			g_interrupt_sent = true;
-        	g_driver->GetDebugger().DispatchInputInterrupt();
-			g_interrupt_sent = false;
-			return;
-		}
-	}
-    
-	exit (signo);
+    {
+        if (!g_interrupt_sent)
+        {
+            g_interrupt_sent = true;
+            g_driver->GetDebugger().DispatchInputInterrupt();
+            g_interrupt_sent = false;
+            return;
+        }
+    }
+
+    exit(signo);
 }
 
 void
-sigtstp_handler (int signo)
+sigtstp_handler(int signo)
 {
     g_driver->GetDebugger().SaveInputTerminalState();
-    signal (signo, SIG_DFL);
-    kill (getpid(), signo);
-    signal (signo, sigtstp_handler);
+    signal(signo, SIG_DFL);
+    kill(getpid(), signo);
+    signal(signo, sigtstp_handler);
 }
 
 void
-sigcont_handler (int signo)
+sigcont_handler(int signo)
 {
     g_driver->GetDebugger().RestoreInputTerminalState();
-    signal (signo, SIG_DFL);
-    kill (getpid(), signo);
-    signal (signo, sigcont_handler);
+    signal(signo, SIG_DFL);
+    kill(getpid(), signo);
+    signal(signo, sigcont_handler);
 }
 #endif // #if MICONFIG_COMPILE_MIDRIVER_VERSION
 
 //++ ------------------------------------------------------------------------------------
-// Details:	MI's application start point of execution. The applicaton runs in two modes.
-//			An LLDB native driver mode where it acts no different from the LLDB driver.
-//			The other mode is the MI when it finds on the command line
-//			the --interpreter option. Command line argument --help on its own will give
-//			help for the LLDB driver. If entered with --interpreter then application
-//			help will provided.
-// Type:	Method.
-// Args:	argc	- (R) An integer that contains the count of arguments that follow in 
-//						  argv. The argc parameter is always greater than or equal to 1.
-//			argv	- (R) An array of null-terminated strings representing command-line 
-//						  arguments entered by the user of the program. By convention, 
-//						  argv[0] is the command with which the program is invoked.
-// Return:	int -  0 =	 Normal exit, program success.
-//				  >0	= Program success with status	i.e. Control-C signal status
-//				  <0	= Program failed.
-//				-1		= Program failed reason not specified here, see MI log file.
-//				-1000	= Program failed did not initailize successfully.
-// Throws:	None.
+// Details: MI's application start point of execution. The applicaton runs in two modes.
+//          An LLDB native driver mode where it acts no different from the LLDB driver.
+//          The other mode is the MI when it finds on the command line
+//          the --interpreter option. Command line argument --help on its own will give
+//          help for the LLDB driver. If entered with --interpreter then application
+//          help will provided.
+// Type:    Method.
+// Args:    argc    - (R) An integer that contains the count of arguments that follow in
+//                        argv. The argc parameter is always greater than or equal to 1.
+//          argv    - (R) An array of null-terminated strings representing command-line
+//                        arguments entered by the user of the program. By convention,
+//                        argv[0] is the command with which the program is invoked.
+// Return:  int -  0 =   Normal exit, program success.
+//                >0    = Program success with status i.e. Control-C signal status
+//                <0    = Program failed.
+//              -1      = Program failed reason not specified here, see MI log file.
+//              -1000   = Program failed did not initailize successfully.
+// Throws:  None.
 //--
 #if MICONFIG_COMPILE_MIDRIVER_VERSION
-int main( int argc, char const *argv[] )
+int
+main(int argc, char const *argv[])
 {
 #if MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG
 #ifdef _WIN32
-	CMIUtilDebug::ShowDlgWaitForDbgAttach();
+    CMIUtilDebug::ShowDlgWaitForDbgAttach();
 #else
-	CMIUtilDebug::WaitForDbgAttachInfinteLoop();
+    CMIUtilDebug::WaitForDbgAttachInfinteLoop();
 #endif //  _WIN32
 #endif // MICONFIG_DEBUG_SHOW_ATTACH_DBG_DLG
 
-	// *** Order is important here ***
-	bool bOk = DriverSystemInit();
-	if( !bOk )
-	{
-		DriverSystemShutdown( bOk );
-		return -1000;
-	}
-		
-	// CODETAG_IOR_SIGNALS
-	signal( SIGPIPE, SIG_IGN );
-	signal( SIGWINCH, sigwinch_handler );
-	signal( SIGINT, sigint_handler );
-	signal( SIGTSTP, sigtstp_handler );
-	signal( SIGCONT, sigcont_handler );
-		
-	bool bExiting = false;
-	CMIDriverMgr & rDriverMgr = CMIDriverMgr::Instance();
-	bOk = bOk && rDriverMgr.ParseArgs( argc, argv, bExiting );
-	if( bOk && !bExiting )
-		bOk = rDriverMgr.DriverParseArgs( argc, argv, stdout, bExiting );
-	if( bOk && !bExiting )
-		bOk = rDriverMgr.DriverMainLoop();
-	
-	// Logger and other resources shutdown now
-	DriverSystemShutdown( bOk );
-
-	const int appResult = bOk ? 0 : -1;
-
-	return appResult;
-}
-#else // Operate the lldb Driver only version of the code
-int main(int argc, char const *argv[], char *envp[])
-{
-	MIunused( envp );
-	using namespace lldb;
-	SBDebugger::Initialize();
-
-	SBHostOS::ThreadCreated ("<lldb.driver.main-thread>");
-
-	signal (SIGPIPE, SIG_IGN);
-	signal (SIGWINCH, sigwinch_handler);
-	signal (SIGINT, sigint_handler);
-	signal (SIGTSTP, sigtstp_handler);
-	signal (SIGCONT, sigcont_handler);
-
-	// Create a scope for driver so that the driver object will destroy itself
-	// before SBDebugger::Terminate() is called.
-	{
-		Driver driver;
-
-		bool exiting = false;
-		SBError error (driver.ParseArgs (argc, argv, stdout, exiting));
-		if (error.Fail())
-		{
-			const char *error_cstr = error.GetCString ();
-			if (error_cstr)
-				::fprintf (stderr, "error: %s\n", error_cstr);
-		}
-		else if (!exiting)
-		{
-			driver.MainLoop();
-		}
-	}
+    // *** Order is important here ***
+    bool bOk = DriverSystemInit();
+    if (!bOk)
+    {
+        DriverSystemShutdown(bOk);
+        return -1000;
+    }
+
+    // CODETAG_IOR_SIGNALS
+    signal(SIGPIPE, SIG_IGN);
+    signal(SIGWINCH, sigwinch_handler);
+    signal(SIGINT, sigint_handler);
+    signal(SIGTSTP, sigtstp_handler);
+    signal(SIGCONT, sigcont_handler);
+
+    bool bExiting = false;
+    CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
+    bOk = bOk && rDriverMgr.ParseArgs(argc, argv, bExiting);
+    if (bOk && !bExiting)
+        bOk = rDriverMgr.DriverParseArgs(argc, argv, stdout, bExiting);
+    if (bOk && !bExiting)
+        bOk = rDriverMgr.DriverMainLoop();
+
+    // Logger and other resources shutdown now
+    DriverSystemShutdown(bOk);
+
+    const int appResult = bOk ? 0 : -1;
+
+    return appResult;
+}
+#else  // Operate the lldb Driver only version of the code
+int
+main(int argc, char const *argv[], char *envp[])
+{
+    MIunused(envp);
+    using namespace lldb;
+    SBDebugger::Initialize();
+
+    SBHostOS::ThreadCreated("<lldb.driver.main-thread>");
+
+    signal(SIGPIPE, SIG_IGN);
+    signal(SIGWINCH, sigwinch_handler);
+    signal(SIGINT, sigint_handler);
+    signal(SIGTSTP, sigtstp_handler);
+    signal(SIGCONT, sigcont_handler);
 
-	SBDebugger::Terminate();
-	return 0;
+    // Create a scope for driver so that the driver object will destroy itself
+    // before SBDebugger::Terminate() is called.
+    {
+        Driver driver;
+
+        bool exiting = false;
+        SBError error(driver.ParseArgs(argc, argv, stdout, exiting));
+        if (error.Fail())
+        {
+            const char *error_cstr = error.GetCString();
+            if (error_cstr)
+                ::fprintf(stderr, "error: %s\n", error_cstr);
+        }
+        else if (!exiting)
+        {
+            driver.MainLoop();
+        }
+    }
+
+    SBDebugger::Terminate();
+    return 0;
 }
 #endif // MICONFIG_COMPILE_MIDRIVER_VERSION
-

Modified: lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriverMgr.cpp
+// File:        MIDriverMgr.cpp
 //
-// Overview:	CMIDriverMgr implementation.
+// Overview:    CMIDriverMgr implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third Party Headers:
@@ -33,730 +33,752 @@
 #include "MIUtilSingletonHelper.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIDriverMgr constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIDriverMgr constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIDriverMgr::CMIDriverMgr( void )
-:	m_pDriverCurrent( nullptr )
-,	m_bInMi2Mode( false )
+CMIDriverMgr::CMIDriverMgr(void)
+    : m_pDriverCurrent(nullptr)
+    , m_bInMi2Mode(false)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIDriverMgr destructor.
-// Type:	Overridden.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIDriverMgr destructor.
+// Type:    Overridden.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIDriverMgr::~CMIDriverMgr( void )
+CMIDriverMgr::~CMIDriverMgr(void)
 {
-	Shutdown();
+    Shutdown();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Initialize *this manager.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Initialize *this manager.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriverMgr::Initialize( void )
+bool
+CMIDriverMgr::Initialize(void)
 {
-	m_clientUsageRefCnt++;
+    m_clientUsageRefCnt++;
 
-	ClrErrorDescription();
+    ClrErrorDescription();
 
-	if( m_bInitialized )
-		return MIstatus::success;
+    if (m_bInitialized)
+        return MIstatus::success;
 
-	bool bOk = MIstatus::success;
-	CMIUtilString errMsg;
- 
-	// Note initialisation order is important here as some resources depend on previous
-	MI::ModuleInit< CMICmnLog >      ( IDS_MI_INIT_ERR_LOG      , bOk, errMsg );
-	MI::ModuleInit< CMICmnResources >( IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg );
+    bool bOk = MIstatus::success;
+    CMIUtilString errMsg;
 
-	if( bOk )
-	{
-		MIUtilTermios::StdinTermiosSet();
-	}
-	
-	m_bInitialized = bOk;
-	
-	if( !bOk )
-	{
-		CMIUtilString strInitError( CMIUtilString::Format( MIRSRC( IDS_MI_INIT_ERR_DRIVERMGR ), errMsg.c_str() ) );
-		SetErrorDescription( strInitError );
-		return MIstatus::failure;
-	}
+    // Note initialisation order is important here as some resources depend on previous
+    MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
+    MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
 
-	return bOk;
+    if (bOk)
+    {
+        MIUtilTermios::StdinTermiosSet();
+    }
+
+    m_bInitialized = bOk;
+
+    if (!bOk)
+    {
+        CMIUtilString strInitError(CMIUtilString::Format(MIRSRC(IDS_MI_INIT_ERR_DRIVERMGR), errMsg.c_str()));
+        SetErrorDescription(strInitError);
+        return MIstatus::failure;
+    }
+
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Unbind detach or release resources used by this server in general common 
-//			functionality shared between versions of any server interfaces implemented.
-// Type:	Method.
-// Args:	vbAppExitOk	- (R) True = No problems, false = App exiting with problems (investigate!).	
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Unbind detach or release resources used by this server in general common
+//          functionality shared between versions of any server interfaces implemented.
+// Type:    Method.
+// Args:    vbAppExitOk - (R) True = No problems, false = App exiting with problems (investigate!).
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIDriverMgr::Shutdown( void )
+bool
+CMIDriverMgr::Shutdown(void)
 {
-	// Do not want a ref counter because this function needs to be called how ever this 
-	// application stops running
-	//if( --m_clientUsageRefCnt > 0 )
-	//	return MIstatus::success;
-	
-	bool vbAppExitOk = true;
+    // Do not want a ref counter because this function needs to be called how ever this
+    // application stops running
+    // if( --m_clientUsageRefCnt > 0 )
+    //  return MIstatus::success;
 
-	ClrErrorDescription();
+    bool vbAppExitOk = true;
 
-	if( !m_bInitialized )
-		return MIstatus::success;
+    ClrErrorDescription();
 
-	if( vbAppExitOk )	
-	{
-		// The MI Driver's log updating may have been switched off switch back on to say all is ok. 
-		CMICmnLog::Instance().SetEnabled( true );
+    if (!m_bInitialized)
+        return MIstatus::success;
+
+    if (vbAppExitOk)
+    {
+        // The MI Driver's log updating may have been switched off switch back on to say all is ok.
+        CMICmnLog::Instance().SetEnabled(true);
 #if _DEBUG
-		CMICmnStreamStdout::Instance().Write( MIRSRC( IDE_MI_APP_EXIT_OK ) ); // Both stdout and Log
+        CMICmnStreamStdout::Instance().Write(MIRSRC(IDE_MI_APP_EXIT_OK)); // Both stdout and Log
 #else
-		CMICmnLog::WriteLog( MIRSRC( IDE_MI_APP_EXIT_OK ) ); // Just to the Log
+        CMICmnLog::WriteLog(MIRSRC(IDE_MI_APP_EXIT_OK)); // Just to the Log
 #endif // _DEBUG
-	}
-	else
-	{
-		CMICmnLog & rAppLog = CMICmnLog::Instance();
-		if( rAppLog.GetEnabled()  )
-		{
-			const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDE_MI_APP_EXIT_WITH_PROBLEM ), CMICmnLogMediumFile::Instance().GetFileName().c_str() ) );
-			CMICmnStreamStdout::Instance().Write( msg );
-		}
-		else
-		{
-			// The MI Driver's log updating may have been switched off switch back on to say there has been problem. 
-			rAppLog.SetEnabled( true );
-			const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDE_MI_APP_EXIT_WITH_PROBLEM_NO_LOG ), CMICmnLogMediumFile::Instance().GetFileName().c_str() ) );
-			CMICmnStreamStdout::Instance().Write( msg );
-		}
-	}
-	
-	m_bInitialized = false;
-
-	bool bOk = MIstatus::success;
-	CMIUtilString errMsg;
-
-	// Tidy up
-	UnregisterDriverAll();
-	MIUtilTermios::StdinTermiosReset();
- 
-	// Note shutdown order is important here 
-	MI::ModuleShutdown< CMICmnResources >( IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg );
-	MI::ModuleShutdown< CMICmnLog >      ( IDS_MI_SHTDWN_ERR_LOG      , bOk, errMsg );
-
-	if( !bOk )
-	{
-		SetErrorDescriptionn( MIRSRC( IDS_MI_SHTDWN_ERR_DRIVERMGR ), errMsg.c_str() );
-	}
-
-	return bOk;
-}
-//++ ------------------------------------------------------------------------------------
-// Details:	Unregister all the Driver registered with *this manager. The manager also
-//			deletes
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriverMgr::UnregisterDriverAll( void )
-{
-	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
-	while( it != m_mapDriverIdToDriver.end() )
-	{
-		IDriver * pDriver = (*it).second;
-		pDriver->DoShutdown();
-		
-		// Next
-		++it;
-	}
-
-	m_mapDriverIdToDriver.clear();
-	m_pDriverCurrent = NULL;
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Register a driver with *this Driver Manager. Call SetUseThisDriverToDoWork()
-//			inform the manager which driver is the one to the work. The manager calls
-//			the driver's init function which must be successful in order to complete the
-//			registration.
-// Type:	Method.
-// Args:	vrDriver	- (R) The driver to register.
-//			vrDriverID	- (R) The driver's ID to lookup by.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriverMgr::RegisterDriver( const IDriver & vrDriver, const CMIUtilString & vrDriverID )
-{
-	if( HaveDriverAlready( vrDriver ) )
-		return MIstatus::success;
-
-	IDriver * pDriver = const_cast< IDriver * >( &vrDriver );
-	if( !pDriver->SetId( vrDriverID ) )
-		return MIstatus::failure;
-	if( !pDriver->DoInitialize() )
-	{
-		SetErrorDescriptionn( MIRSRC( IDS_DRIVERMGR_DRIVER_ERR_INIT ), pDriver->GetName().c_str(), vrDriverID.c_str(), pDriver->GetError().c_str() );
-		return MIstatus::failure;
-	}
-
-	MapPairDriverIdToDriver_t pr( vrDriverID, pDriver );
-	m_mapDriverIdToDriver.insert( pr );
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Query the Driver Manager to see if *this manager has the driver already 
-//			registered.
-// Type:	Method.
-// Args:	vrDriver	- (R) The driver to query.
-// Return:	True - registered.
-//			False - not registered.
-// Throws:	None.
-//--
-bool CMIDriverMgr::HaveDriverAlready( const IDriver & vrDriver ) const
-{
-	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
-	while( it != m_mapDriverIdToDriver.end() )
-	{
-		const IDriver * pDrvr = (*it).second;
-		if( pDrvr == &vrDriver )
-			return true;
-
-		// Next
-		++it;
-	}
-
-	return false;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Unregister a driver from the Driver Manager. Call the SetUseThisDriverToDoWork()
-//			function to define another driver to do work if the one being unregistered did
-//			the work previously.
-// Type:	Method.
-// Args:	vrDriver	- (R) The driver to unregister.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriverMgr::UnregisterDriver( const IDriver & vrDriver )
-{
-	const IDriver * pDrvr = nullptr;
-	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
-	while( it != m_mapDriverIdToDriver.end() )
-	{
-		pDrvr = (*it).second;
-		if( pDrvr == &vrDriver )
-			break;
-
-		// Next
-		++it;
-	}
-	m_mapDriverIdToDriver.erase( it );
-
-	if( m_pDriverCurrent == pDrvr )
-		m_pDriverCurrent = nullptr;
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Specify the driver to do work. The Driver Manager drives this driver. Any
-//			previous driver doing work is not called anymore (so be sure the previous
-//			driver is in a tidy state before stopping it working).
-// Type:	Method.
-// Args:	vrADriver	- (R) A lldb::SBBroadcaster/IDriver derived object.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriverMgr::SetUseThisDriverToDoWork( const IDriver & vrADriver )
-{
-	m_pDriverCurrent = const_cast< IDriver * >( &vrADriver );
-
-	const CMIUtilString msg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_SAY_DRIVER_USING ), m_pDriverCurrent->GetName().c_str() ) );
-	m_pLog->Write( msg, CMICmnLog::eLogVerbosity_Log );
-
-	m_bInMi2Mode = m_pDriverCurrent->GetDriverIsGDBMICompatibleDriver();
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Ask *this manager which driver is currently doing the work. 
-// Type:	Method.
-// Args:	None.
-// Return:	IDriver * - Pointer to a driver, NULL if there is no current working driver.
-// Throws:	None.
-//--
-CMIDriverMgr::IDriver * CMIDriverMgr::GetUseThisDriverToDoWork( void ) const
-{
-	return m_pDriverCurrent;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Call this function puts *this driver to work.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriverMgr::DriverMainLoop( void )
-{
-	if( m_pDriverCurrent != nullptr )
-	{
-		if( !m_pDriverCurrent->DoMainLoop() )
-		{
-			const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_MAINLOOP ), m_pDriverCurrent->GetError().c_str() ) );
-			CMICmnStreamStdout::Instance().Write( errMsg, true );
-			return MIstatus::failure;
-		}
-	}
-	else
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_CURRENT_NOT_SET ) ) );
-		CMICmnStreamStdout::Instance().Write( errMsg, true );
-		return MIstatus::failure;
-	}
-
-	return MIstatus::success;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Call *this driver to resize the console window.
-// Type:	Method.
-// Args:	vWindowSizeWsCol	- (R) New window column size.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-void CMIDriverMgr::DriverResizeWindow( const uint32_t vWindowSizeWsCol )
-{
-	if( m_pDriverCurrent != nullptr )
-		return m_pDriverCurrent->DoResizeWindow( vWindowSizeWsCol );
-	else
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_CURRENT_NOT_SET ) ) );
-		CMICmnStreamStdout::Instance().Write( errMsg, true );
-	}
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Get the current driver to validate executable command line arguments.
-// Type:	Method.
-// Args:	argc		- (R)	An integer that contains the count of arguments that follow in 
-//								argv. The argc parameter is always greater than or equal to 1.
-//			argv		- (R)	An array of null-terminated strings representing command-line 
-//								arguments entered by the user of the program. By convention, 
-//								argv[0] is the command with which the program is invoked.
-//			vpStdOut	- (R)	Point to a standard output stream. 
-//			vwbExiting	- (W)	True = *this want to exit, false = continue to work. 
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
-//--
-bool CMIDriverMgr::DriverParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting )
-{
-	if( m_pDriverCurrent == nullptr )
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_CURRENT_NOT_SET ) ) );
-		CMICmnStreamStdout::Instance().Write( errMsg, true );
-		return MIstatus::failure;
-	}
-
-	const lldb::SBError error( m_pDriverCurrent->DoParseArgs( argc, argv, vpStdOut, vwbExiting ) );
-	bool bOk = !error.Fail();
-	if( !bOk )
-	{
-		CMIUtilString errMsg;
-		const MIchar * pErrorCstr = error.GetCString();
-		if( pErrorCstr != nullptr )
-			errMsg = CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_PARSE_ARGS ), m_pDriverCurrent->GetName().c_str(), pErrorCstr );
-		else
-			errMsg = CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN ), m_pDriverCurrent->GetName().c_str() );
-
-		bOk = CMICmnStreamStdout::Instance().Write( errMsg, true );
-	}
-
-	return bOk;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the current driver's last error condition.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Text description.
-// Throws:	None.
-//--
-CMIUtilString CMIDriverMgr::DriverGetError( void ) const
-{
-	if( m_pDriverCurrent != nullptr )
-		return m_pDriverCurrent->GetError();
-	else
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_CURRENT_NOT_SET ) ) );
-		CMICmnStreamStdout::Instance().Write( errMsg, true );
-	}
-
-	return CMIUtilString();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the current driver's name.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Driver name.
-//							 Empty string = no current working driver specified.
-// Throws:	None.
-//--
-CMIUtilString CMIDriverMgr::DriverGetName( void ) const
-{
-	if( m_pDriverCurrent != nullptr )
-		return m_pDriverCurrent->GetName();
-	else
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_CURRENT_NOT_SET ) ) );
-		CMICmnStreamStdout::Instance().Write( errMsg, true );
-	}
-
-	return CMIUtilString();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the current driver's debugger object.
-// Type:	Method.
-// Args:	None.
-// Return:	lldb::SBDebugger * - Ptr to driver's debugger object. 
-//							   - NULL = no current working driver specified.
-// Throws:	None.
-//--
-lldb::SBDebugger * CMIDriverMgr::DriverGetTheDebugger( void )
-{
-	lldb::SBDebugger * pDebugger = nullptr;
-	if( m_pDriverCurrent != nullptr )
-		pDebugger = &m_pDriverCurrent->GetTheDebugger();
-	else
-	{
-		const CMIUtilString errMsg( CMIUtilString::Format( MIRSRC( IDS_DRIVER_ERR_CURRENT_NOT_SET ) ) );
-		CMICmnStreamStdout::Instance().Write( errMsg, true );
-	}
-
-	return pDebugger;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Check the arguments given on the command line. The main purpose of this
-//			function is to check for the presence of the --interpreter option. Having 
-//			this option present tells *this manager to set the CMIDriver to do work. If 
-//			not use the LLDB driver. The following are options that are only handled by
-//			the CMIDriverMgr are: 
-//				--help or -h
-//				--interpreter
-//				--version
-//				--versionLong
-//				--noLog
-//				--executable 
-//			The above arguments are not handled by any driver object except for --executable.
-//			The options --interpreter and --executable in code act very similar. The
-//			--executable is necessary to differentiate whither the MI Driver is being using
-//			by a client i.e. Eclipse or from the command line. Eclipse issues the option
-//			--interpreter and also passes additional arguments which can be interpreted as an
-//			executable if called from the command line. Using --executable tells the MI 
-//			Driver is being called the command line and that the executable argument is indeed
-//			a specified executable an so actions commands to set up the executable for a 
-//			debug session. Using --interpreter on the commnd line does not action additional
-//			commands to initialise a debug session and so be able to launch the process.
-// Type:	Method.
-// Args:	argc		- (R)	An integer that contains the count of arguments that follow in 
-//								argv. The argc parameter is always greater than or equal to 1.
-//			argv		- (R)	An array of null-terminated strings representing command-line 
-//								arguments entered by the user of the program. By convention, 
-//								argv[0] is the command with which the program is invoked.
-//			vwbExiting	- (W)	True = *this want to exit, Reasons: help, invalid arg(s),
-//								version information only.
-//								False = Continue to work, start debugger i.e. Command 
-//								interpreter. 
-// Return:	lldb::SBError - LLDB current error status.
-// Throws:	None.
-//--
-bool CMIDriverMgr::ParseArgs( const int argc, const char * argv[], bool & vwbExiting )
-{
-	bool bOk = MIstatus::success;
-
-	vwbExiting = false;
-
-	// Print MI application path to the Log file
-	const CMIUtilString appPath( CMIUtilString::Format( MIRSRC( IDS_MI_APP_FILEPATHNAME ), argv[ 0 ] ) );
-	bOk = m_pLog->Write( appPath, CMICmnLog::eLogVerbosity_Log );
-		
-	// Print application arguments to the Log file
-	const bool bHaveArgs( argc >= 2 );
-	CMIUtilString strArgs( MIRSRC( IDS_MI_APP_ARGS ) );
-	if( !bHaveArgs )
-	{
-		strArgs += MIRSRC( IDS_WORD_NONE );
-		bOk = bOk && m_pLog->Write( strArgs, CMICmnLog::eLogVerbosity_Log );
-	}
-	else
-	{
-		for( MIint i = 1; i < argc; i++ ) 
-		{ 
-			strArgs += CMIUtilString::Format( "%d:'%s' ", i, argv[ i ] );
-		}
-		bOk = bOk && m_pLog->Write( strArgs, CMICmnLog::eLogVerbosity_Log );
-	}
-	
-	// Look for the command line options		
-	bool bHaveArgInterpret = false;
-	bool bHaveArgVersion = false;
-	bool bHaveArgVersionLong = false;
-	bool bHaveArgNoLog = false;
-	bool bHaveArgHelp = false;
+    }
+    else
+    {
+        CMICmnLog &rAppLog = CMICmnLog::Instance();
+        if (rAppLog.GetEnabled())
+        {
+            const CMIUtilString msg(
+                CMIUtilString::Format(MIRSRC(IDE_MI_APP_EXIT_WITH_PROBLEM), CMICmnLogMediumFile::Instance().GetFileName().c_str()));
+            CMICmnStreamStdout::Instance().Write(msg);
+        }
+        else
+        {
+            // The MI Driver's log updating may have been switched off switch back on to say there has been problem.
+            rAppLog.SetEnabled(true);
+            const CMIUtilString msg(
+                CMIUtilString::Format(MIRSRC(IDE_MI_APP_EXIT_WITH_PROBLEM_NO_LOG), CMICmnLogMediumFile::Instance().GetFileName().c_str()));
+            CMICmnStreamStdout::Instance().Write(msg);
+        }
+    }
+
+    m_bInitialized = false;
+
+    bool bOk = MIstatus::success;
+    CMIUtilString errMsg;
+
+    // Tidy up
+    UnregisterDriverAll();
+    MIUtilTermios::StdinTermiosReset();
+
+    // Note shutdown order is important here
+    MI::ModuleShutdown<CMICmnResources>(IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg);
+    MI::ModuleShutdown<CMICmnLog>(IDS_MI_SHTDWN_ERR_LOG, bOk, errMsg);
+
+    if (!bOk)
+    {
+        SetErrorDescriptionn(MIRSRC(IDS_MI_SHTDWN_ERR_DRIVERMGR), errMsg.c_str());
+    }
+
+    return bOk;
+}
+//++ ------------------------------------------------------------------------------------
+// Details: Unregister all the Driver registered with *this manager. The manager also
+//          deletes
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::UnregisterDriverAll(void)
+{
+    MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
+    while (it != m_mapDriverIdToDriver.end())
+    {
+        IDriver *pDriver = (*it).second;
+        pDriver->DoShutdown();
+
+        // Next
+        ++it;
+    }
+
+    m_mapDriverIdToDriver.clear();
+    m_pDriverCurrent = NULL;
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Register a driver with *this Driver Manager. Call SetUseThisDriverToDoWork()
+//          inform the manager which driver is the one to the work. The manager calls
+//          the driver's init function which must be successful in order to complete the
+//          registration.
+// Type:    Method.
+// Args:    vrDriver    - (R) The driver to register.
+//          vrDriverID  - (R) The driver's ID to lookup by.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::RegisterDriver(const IDriver &vrDriver, const CMIUtilString &vrDriverID)
+{
+    if (HaveDriverAlready(vrDriver))
+        return MIstatus::success;
+
+    IDriver *pDriver = const_cast<IDriver *>(&vrDriver);
+    if (!pDriver->SetId(vrDriverID))
+        return MIstatus::failure;
+    if (!pDriver->DoInitialize())
+    {
+        SetErrorDescriptionn(MIRSRC(IDS_DRIVERMGR_DRIVER_ERR_INIT), pDriver->GetName().c_str(), vrDriverID.c_str(),
+                             pDriver->GetError().c_str());
+        return MIstatus::failure;
+    }
+
+    MapPairDriverIdToDriver_t pr(vrDriverID, pDriver);
+    m_mapDriverIdToDriver.insert(pr);
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Query the Driver Manager to see if *this manager has the driver already
+//          registered.
+// Type:    Method.
+// Args:    vrDriver    - (R) The driver to query.
+// Return:  True - registered.
+//          False - not registered.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::HaveDriverAlready(const IDriver &vrDriver) const
+{
+    MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
+    while (it != m_mapDriverIdToDriver.end())
+    {
+        const IDriver *pDrvr = (*it).second;
+        if (pDrvr == &vrDriver)
+            return true;
+
+        // Next
+        ++it;
+    }
+
+    return false;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Unregister a driver from the Driver Manager. Call the SetUseThisDriverToDoWork()
+//          function to define another driver to do work if the one being unregistered did
+//          the work previously.
+// Type:    Method.
+// Args:    vrDriver    - (R) The driver to unregister.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::UnregisterDriver(const IDriver &vrDriver)
+{
+    const IDriver *pDrvr = nullptr;
+    MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
+    while (it != m_mapDriverIdToDriver.end())
+    {
+        pDrvr = (*it).second;
+        if (pDrvr == &vrDriver)
+            break;
+
+        // Next
+        ++it;
+    }
+    m_mapDriverIdToDriver.erase(it);
+
+    if (m_pDriverCurrent == pDrvr)
+        m_pDriverCurrent = nullptr;
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Specify the driver to do work. The Driver Manager drives this driver. Any
+//          previous driver doing work is not called anymore (so be sure the previous
+//          driver is in a tidy state before stopping it working).
+// Type:    Method.
+// Args:    vrADriver   - (R) A lldb::SBBroadcaster/IDriver derived object.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::SetUseThisDriverToDoWork(const IDriver &vrADriver)
+{
+    m_pDriverCurrent = const_cast<IDriver *>(&vrADriver);
+
+    const CMIUtilString msg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_SAY_DRIVER_USING), m_pDriverCurrent->GetName().c_str()));
+    m_pLog->Write(msg, CMICmnLog::eLogVerbosity_Log);
+
+    m_bInMi2Mode = m_pDriverCurrent->GetDriverIsGDBMICompatibleDriver();
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Ask *this manager which driver is currently doing the work.
+// Type:    Method.
+// Args:    None.
+// Return:  IDriver * - Pointer to a driver, NULL if there is no current working driver.
+// Throws:  None.
+//--
+CMIDriverMgr::IDriver *
+CMIDriverMgr::GetUseThisDriverToDoWork(void) const
+{
+    return m_pDriverCurrent;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Call this function puts *this driver to work.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::DriverMainLoop(void)
+{
+    if (m_pDriverCurrent != nullptr)
+    {
+        if (!m_pDriverCurrent->DoMainLoop())
+        {
+            const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_MAINLOOP), m_pDriverCurrent->GetError().c_str()));
+            CMICmnStreamStdout::Instance().Write(errMsg, true);
+            return MIstatus::failure;
+        }
+    }
+    else
+    {
+        const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET)));
+        CMICmnStreamStdout::Instance().Write(errMsg, true);
+        return MIstatus::failure;
+    }
+
+    return MIstatus::success;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Call *this driver to resize the console window.
+// Type:    Method.
+// Args:    vWindowSizeWsCol  - (R) New window column size.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+void
+CMIDriverMgr::DriverResizeWindow(const uint32_t vWindowSizeWsCol)
+{
+    if (m_pDriverCurrent != nullptr)
+        return m_pDriverCurrent->DoResizeWindow(vWindowSizeWsCol);
+    else
+    {
+        const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET)));
+        CMICmnStreamStdout::Instance().Write(errMsg, true);
+    }
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get the current driver to validate executable command line arguments.
+// Type:    Method.
+// Args:    argc        - (R)   An integer that contains the count of arguments that follow in
+//                              argv. The argc parameter is always greater than or equal to 1.
+//          argv        - (R)   An array of null-terminated strings representing command-line
+//                              arguments entered by the user of the program. By convention,
+//                              argv[0] is the command with which the program is invoked.
+//          vpStdOut    - (R)   Point to a standard output stream.
+//          vwbExiting  - (W)   True = *this want to exit, false = continue to work.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::DriverParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting)
+{
+    if (m_pDriverCurrent == nullptr)
+    {
+        const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET)));
+        CMICmnStreamStdout::Instance().Write(errMsg, true);
+        return MIstatus::failure;
+    }
+
+    const lldb::SBError error(m_pDriverCurrent->DoParseArgs(argc, argv, vpStdOut, vwbExiting));
+    bool bOk = !error.Fail();
+    if (!bOk)
+    {
+        CMIUtilString errMsg;
+        const MIchar *pErrorCstr = error.GetCString();
+        if (pErrorCstr != nullptr)
+            errMsg = CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_PARSE_ARGS), m_pDriverCurrent->GetName().c_str(), pErrorCstr);
+        else
+            errMsg = CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN), m_pDriverCurrent->GetName().c_str());
+
+        bOk = CMICmnStreamStdout::Instance().Write(errMsg, true);
+    }
+
+    return bOk;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Retrieve the current driver's last error condition.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Text description.
+// Throws:  None.
+//--
+CMIUtilString
+CMIDriverMgr::DriverGetError(void) const
+{
+    if (m_pDriverCurrent != nullptr)
+        return m_pDriverCurrent->GetError();
+    else
+    {
+        const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET)));
+        CMICmnStreamStdout::Instance().Write(errMsg, true);
+    }
+
+    return CMIUtilString();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Retrieve the current driver's name.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Driver name.
+//                          Empty string = no current working driver specified.
+// Throws:  None.
+//--
+CMIUtilString
+CMIDriverMgr::DriverGetName(void) const
+{
+    if (m_pDriverCurrent != nullptr)
+        return m_pDriverCurrent->GetName();
+    else
+    {
+        const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET)));
+        CMICmnStreamStdout::Instance().Write(errMsg, true);
+    }
+
+    return CMIUtilString();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Retrieve the current driver's debugger object.
+// Type:    Method.
+// Args:    None.
+// Return:  lldb::SBDebugger * - Ptr to driver's debugger object.
+//                             - NULL = no current working driver specified.
+// Throws:  None.
+//--
+lldb::SBDebugger *
+CMIDriverMgr::DriverGetTheDebugger(void)
+{
+    lldb::SBDebugger *pDebugger = nullptr;
+    if (m_pDriverCurrent != nullptr)
+        pDebugger = &m_pDriverCurrent->GetTheDebugger();
+    else
+    {
+        const CMIUtilString errMsg(CMIUtilString::Format(MIRSRC(IDS_DRIVER_ERR_CURRENT_NOT_SET)));
+        CMICmnStreamStdout::Instance().Write(errMsg, true);
+    }
+
+    return pDebugger;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Check the arguments given on the command line. The main purpose of this
+//          function is to check for the presence of the --interpreter option. Having
+//          this option present tells *this manager to set the CMIDriver to do work. If
+//          not use the LLDB driver. The following are options that are only handled by
+//          the CMIDriverMgr are:
+//              --help or -h
+//              --interpreter
+//              --version
+//              --versionLong
+//              --noLog
+//              --executable
+//          The above arguments are not handled by any driver object except for --executable.
+//          The options --interpreter and --executable in code act very similar. The
+//          --executable is necessary to differentiate whither the MI Driver is being using
+//          by a client i.e. Eclipse or from the command line. Eclipse issues the option
+//          --interpreter and also passes additional arguments which can be interpreted as an
+//          executable if called from the command line. Using --executable tells the MI
+//          Driver is being called the command line and that the executable argument is indeed
+//          a specified executable an so actions commands to set up the executable for a
+//          debug session. Using --interpreter on the commnd line does not action additional
+//          commands to initialise a debug session and so be able to launch the process.
+// Type:    Method.
+// Args:    argc        - (R)   An integer that contains the count of arguments that follow in
+//                              argv. The argc parameter is always greater than or equal to 1.
+//          argv        - (R)   An array of null-terminated strings representing command-line
+//                              arguments entered by the user of the program. By convention,
+//                              argv[0] is the command with which the program is invoked.
+//          vwbExiting  - (W)   True = *this want to exit, Reasons: help, invalid arg(s),
+//                              version information only.
+//                              False = Continue to work, start debugger i.e. Command
+//                              interpreter.
+// Return:  lldb::SBError - LLDB current error status.
+// Throws:  None.
+//--
+bool
+CMIDriverMgr::ParseArgs(const int argc, const char *argv[], bool &vwbExiting)
+{
+    bool bOk = MIstatus::success;
+
+    vwbExiting = false;
+
+    // Print MI application path to the Log file
+    const CMIUtilString appPath(CMIUtilString::Format(MIRSRC(IDS_MI_APP_FILEPATHNAME), argv[0]));
+    bOk = m_pLog->Write(appPath, CMICmnLog::eLogVerbosity_Log);
+
+    // Print application arguments to the Log file
+    const bool bHaveArgs(argc >= 2);
+    CMIUtilString strArgs(MIRSRC(IDS_MI_APP_ARGS));
+    if (!bHaveArgs)
+    {
+        strArgs += MIRSRC(IDS_WORD_NONE);
+        bOk = bOk && m_pLog->Write(strArgs, CMICmnLog::eLogVerbosity_Log);
+    }
+    else
+    {
+        for (MIint i = 1; i < argc; i++)
+        {
+            strArgs += CMIUtilString::Format("%d:'%s' ", i, argv[i]);
+        }
+        bOk = bOk && m_pLog->Write(strArgs, CMICmnLog::eLogVerbosity_Log);
+    }
+
+    // Look for the command line options
+    bool bHaveArgInterpret = false;
+    bool bHaveArgVersion = false;
+    bool bHaveArgVersionLong = false;
+    bool bHaveArgNoLog = false;
+    bool bHaveArgHelp = false;
 
-	// Hardcode the use of the MI driver
+// Hardcode the use of the MI driver
 #if MICONFIG_DEFAULT_TO_MI_DRIVER
-	bHaveArgInterpret = true;
+    bHaveArgInterpret = true;
 #endif // MICONFIG_DEFAULT_TO_MI_DRIVER
 
-	if( bHaveArgs )
-	{
-		// CODETAG_MIDRIVE_CMD_LINE_ARG_HANDLING
-		for( MIint i = 1; i < argc; i++ ) 
-		{ 
-			// *** Add args to help in GetHelpOnCmdLineArgOptions() ***
-			const CMIUtilString strArg( argv[ i ] );
-
-			// Argument "--executable" is also check for in CMIDriver::ParseArgs()
-			if( (0 == strArg.compare( "--interpreter" )) ||	// Given by the client such as Eclipse
-				(0 == strArg.compare( "--executable" )) )	// Used to specify that there is executable argument also on the command line 
-			{												// See fn description.
-				   bHaveArgInterpret = true;
-			}
-			if( 0 == strArg.compare( "--version" ) ) 
-			{
-				   bHaveArgVersion = true;
-			}
-			if( 0 == strArg.compare( "--versionLong" ) ) 
-			{
-				   bHaveArgVersionLong = true;
-			}
-			if( 0 == strArg.compare( "--noLog" ) ) 
-			{
-				   bHaveArgNoLog = true;
-			}
-			if( (0 == strArg.compare( "--help" )) || (0 == strArg.compare( "-h" )) )
-			{
-				bHaveArgHelp = true;
-			}
-		}
-	}
-
-	if( bHaveArgNoLog )
-	{
-		CMICmnLog::Instance().SetEnabled( false );
-	}
-	
-	// Todo: Remove this output when MI is finished. It is temporary to persuade Ecllipse plugin to work.
-	//		 Eclipse reads this literally and will not work unless it gets this exact version text.
-	// Handle --version option (ignore the --interpreter option if present)
-	if( bHaveArgVersion )
-	{
-		vwbExiting = true;
-		bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse( MIRSRC( IDE_MI_VERSION_GDB ) );
-		return bOk;
-	}
-
-	// Todo: Make this the --version when the the above --version version is removed
-	// Handle --versionlong option (ignore the --interpreter option if present)
-	if( bHaveArgVersionLong )
-	{
-		vwbExiting = true;
-		bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse( GetAppVersion() );
-		return bOk;
-	}
-
-	// Both '--help' and '--intepreter' means give help for MI only. Without 
-	// '--interpreter' help the LLDB driver is working and so help is for that.
-	if( bHaveArgHelp && bHaveArgInterpret )
-	{
-		vwbExiting = true;
-		bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse( GetHelpOnCmdLineArgOptions() );
-		return bOk;
-	}
- 
-	// This makes the assumption that there is at least one MI compatible
-	// driver registered and one LLDB driver registerd and the CMIDriver 
-	// is the first one found.
-	// ToDo: Implement a better solution that handle any order, any number
-	// of drivers. Or this 'feature' may be removed if deemed not required.
-	IDriver * pLldbDriver = GetFirstNonMIDriver();
-	IDriver * pMi2Driver = GetFirstMIDriver();
-	if( bHaveArgInterpret && (pMi2Driver != nullptr) )
-		bOk = bOk && SetUseThisDriverToDoWork( *pMi2Driver );
-	else if( pLldbDriver != nullptr )
-		bOk = bOk && SetUseThisDriverToDoWork( *pLldbDriver );
-	else
-	{
-		if( bOk )
-		{
-			vwbExiting = true;
-			const CMIUtilString msg( MIRSRC( IDS_DRIVER_ERR_NON_REGISTERED ) );
-			bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse( msg );
-		}
-	}
-					
-	return bOk;
-}
-	
-//++ ------------------------------------------------------------------------------------
-// Details:	Return formatted application version and name information.
-// Type:	Method.
-// Args:	None. 
-// Return:	CMIUtilString - Text data.
-// Throws:	None.
-//--
-CMIUtilString CMIDriverMgr::GetAppVersion( void ) const
-{
-	const CMIUtilString strProj( MIRSRC( IDS_PROJNAME ) );
-	const CMIUtilString strVsn( CMIDriver::Instance().GetVersionDescription() );
-	const CMIUtilString strGdb( MIRSRC( IDE_MI_VERSION_GDB ) );
-	const CMIUtilString strVrsnInfo( CMIUtilString::Format( "%s\n%s\n%s", strProj.c_str(), strVsn.c_str(), strGdb.c_str() ) );
-
-	return strVrsnInfo;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Return formatted help information on all the MI command line options.
-// Type:	Method.
-// Args:	None. 
-// Return:	CMIUtilString - Text data.
-// Throws:	None.
-//--
-CMIUtilString CMIDriverMgr::GetHelpOnCmdLineArgOptions( void ) const
-{
-	const CMIUtilString pHelp[] = 
-	{
-		MIRSRC( IDE_MI_APP_DESCRIPTION ),
-		MIRSRC( IDE_MI_APP_INFORMATION ),
-		MIRSRC( IDE_MI_APP_ARG_USAGE ),
-		MIRSRC( IDE_MI_APP_ARG_HELP ),
-		MIRSRC( IDE_MI_APP_ARG_VERSION ),
-		MIRSRC( IDE_MI_APP_ARG_VERSION_LONG ),
-		MIRSRC( IDE_MI_APP_ARG_INTERPRETER ),
-		MIRSRC( IDE_MI_APP_ARG_EXECUTEABLE ),
-		CMIUtilString::Format( MIRSRC( IDE_MI_APP_ARG_NO_APP_LOG ), CMICmnLogMediumFile::Instance().GetFileName().c_str() ),
-		MIRSRC( IDE_MI_APP_ARG_EXECUTABLE ),
-		MIRSRC( IDS_CMD_QUIT_HELP ),
-		MIRSRC( IDE_MI_APP_ARG_EXAMPLE )
-	};
-	const MIuint nHelpItems = sizeof pHelp / sizeof pHelp[ 0 ];
-	CMIUtilString strHelp;
-	for( MIuint i = 0; i < nHelpItems; i++ )
-	{
-		strHelp += pHelp[ i ];
-		strHelp += "\n\n";
-	}
-
-	return strHelp;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Search the registered drivers and return the first driver which says it is
-//			GDB/MI compatible i.e. the CMIDriver class.
-// Type:	Method.
-// Args:	None. 
-// Return:	IDriver * - Ptr to driver, NULL = no driver found.
-// Throws:	None.
-//--
-CMIDriverMgr::IDriver * CMIDriverMgr::GetFirstMIDriver( void ) const
-{
-	IDriver * pDriver = nullptr;
-	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
-	while( it != m_mapDriverIdToDriver.end() )
-	{
-		const CMIUtilString & rDrvId = (*it).first; MIunused( rDrvId );
-		IDriver * pDvr = (*it).second;
-		if( pDvr->GetDriverIsGDBMICompatibleDriver() )
-		{
-			pDriver = pDvr;
-			break;
-		}
-
-		// Next
-		++it;
-	}
-
-	return pDriver;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Search the registered drivers and return the first driver which says it is
-//			not GDB/MI compatible i.e. the LLDB Driver class.
-// Type:	Method.
-// Args:	None. 
-// Return:	IDriver * - Ptr to driver, NULL = no driver found.
-// Throws:	None.
-//--
-CMIDriverMgr::IDriver * CMIDriverMgr::GetFirstNonMIDriver( void ) const
-{
-	IDriver * pDriver = nullptr;
-	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
-	while( it != m_mapDriverIdToDriver.end() )
-	{
-		const CMIUtilString & rDrvId = (*it).first; MIunused( rDrvId );
-		IDriver * pDvr = (*it).second;
-		if( !pDvr->GetDriverIsGDBMICompatibleDriver() )
-		{
-			pDriver = pDvr;
-			break;
-		}
-
-		// Next
-		++it;
-	}
-
-	return pDriver;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Search the registered drivers and return driver with the specified ID.
-// Type:	Method.
-// Args:	vrDriverId	- (R) ID of a driver. 
-// Return:	IDriver * - Ptr to driver, NULL = no driver found.
-// Throws:	None.
-//--
-CMIDriverMgr::IDriver * CMIDriverMgr::GetDriver( const CMIUtilString & vrDriverId ) const
-{
-	MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.find( vrDriverId );
-	if( it == m_mapDriverIdToDriver.end() )
-		return nullptr;
-
-	IDriver * pDriver = (*it).second;
-	
-	return pDriver;
+    if (bHaveArgs)
+    {
+        // CODETAG_MIDRIVE_CMD_LINE_ARG_HANDLING
+        for (MIint i = 1; i < argc; i++)
+        {
+            // *** Add args to help in GetHelpOnCmdLineArgOptions() ***
+            const CMIUtilString strArg(argv[i]);
+
+            // Argument "--executable" is also check for in CMIDriver::ParseArgs()
+            if ((0 == strArg.compare("--interpreter")) || // Given by the client such as Eclipse
+                (0 == strArg.compare("--executable")))    // Used to specify that there is executable argument also on the command line
+            {                                             // See fn description.
+                bHaveArgInterpret = true;
+            }
+            if (0 == strArg.compare("--version"))
+            {
+                bHaveArgVersion = true;
+            }
+            if (0 == strArg.compare("--versionLong"))
+            {
+                bHaveArgVersionLong = true;
+            }
+            if (0 == strArg.compare("--noLog"))
+            {
+                bHaveArgNoLog = true;
+            }
+            if ((0 == strArg.compare("--help")) || (0 == strArg.compare("-h")))
+            {
+                bHaveArgHelp = true;
+            }
+        }
+    }
+
+    if (bHaveArgNoLog)
+    {
+        CMICmnLog::Instance().SetEnabled(false);
+    }
+
+    // Todo: Remove this output when MI is finished. It is temporary to persuade Ecllipse plugin to work.
+    //       Eclipse reads this literally and will not work unless it gets this exact version text.
+    // Handle --version option (ignore the --interpreter option if present)
+    if (bHaveArgVersion)
+    {
+        vwbExiting = true;
+        bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse(MIRSRC(IDE_MI_VERSION_GDB));
+        return bOk;
+    }
+
+    // Todo: Make this the --version when the the above --version version is removed
+    // Handle --versionlong option (ignore the --interpreter option if present)
+    if (bHaveArgVersionLong)
+    {
+        vwbExiting = true;
+        bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse(GetAppVersion());
+        return bOk;
+    }
+
+    // Both '--help' and '--intepreter' means give help for MI only. Without
+    // '--interpreter' help the LLDB driver is working and so help is for that.
+    if (bHaveArgHelp && bHaveArgInterpret)
+    {
+        vwbExiting = true;
+        bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse(GetHelpOnCmdLineArgOptions());
+        return bOk;
+    }
+
+    // This makes the assumption that there is at least one MI compatible
+    // driver registered and one LLDB driver registerd and the CMIDriver
+    // is the first one found.
+    // ToDo: Implement a better solution that handle any order, any number
+    // of drivers. Or this 'feature' may be removed if deemed not required.
+    IDriver *pLldbDriver = GetFirstNonMIDriver();
+    IDriver *pMi2Driver = GetFirstMIDriver();
+    if (bHaveArgInterpret && (pMi2Driver != nullptr))
+        bOk = bOk && SetUseThisDriverToDoWork(*pMi2Driver);
+    else if (pLldbDriver != nullptr)
+        bOk = bOk && SetUseThisDriverToDoWork(*pLldbDriver);
+    else
+    {
+        if (bOk)
+        {
+            vwbExiting = true;
+            const CMIUtilString msg(MIRSRC(IDS_DRIVER_ERR_NON_REGISTERED));
+            bOk = bOk && CMICmnStreamStdout::Instance().WriteMIResponse(msg);
+        }
+    }
+
+    return bOk;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Return formatted application version and name information.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Text data.
+// Throws:  None.
+//--
+CMIUtilString
+CMIDriverMgr::GetAppVersion(void) const
+{
+    const CMIUtilString strProj(MIRSRC(IDS_PROJNAME));
+    const CMIUtilString strVsn(CMIDriver::Instance().GetVersionDescription());
+    const CMIUtilString strGdb(MIRSRC(IDE_MI_VERSION_GDB));
+    const CMIUtilString strVrsnInfo(CMIUtilString::Format("%s\n%s\n%s", strProj.c_str(), strVsn.c_str(), strGdb.c_str()));
+
+    return strVrsnInfo;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Return formatted help information on all the MI command line options.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Text data.
+// Throws:  None.
+//--
+CMIUtilString
+CMIDriverMgr::GetHelpOnCmdLineArgOptions(void) const
+{
+    const CMIUtilString pHelp[] = {
+        MIRSRC(IDE_MI_APP_DESCRIPTION),
+        MIRSRC(IDE_MI_APP_INFORMATION),
+        MIRSRC(IDE_MI_APP_ARG_USAGE),
+        MIRSRC(IDE_MI_APP_ARG_HELP),
+        MIRSRC(IDE_MI_APP_ARG_VERSION),
+        MIRSRC(IDE_MI_APP_ARG_VERSION_LONG),
+        MIRSRC(IDE_MI_APP_ARG_INTERPRETER),
+        MIRSRC(IDE_MI_APP_ARG_EXECUTEABLE),
+        CMIUtilString::Format(MIRSRC(IDE_MI_APP_ARG_NO_APP_LOG), CMICmnLogMediumFile::Instance().GetFileName().c_str()),
+        MIRSRC(IDE_MI_APP_ARG_EXECUTABLE),
+        MIRSRC(IDS_CMD_QUIT_HELP),
+        MIRSRC(IDE_MI_APP_ARG_EXAMPLE)};
+    const MIuint nHelpItems = sizeof pHelp / sizeof pHelp[0];
+    CMIUtilString strHelp;
+    for (MIuint i = 0; i < nHelpItems; i++)
+    {
+        strHelp += pHelp[i];
+        strHelp += "\n\n";
+    }
+
+    return strHelp;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Search the registered drivers and return the first driver which says it is
+//          GDB/MI compatible i.e. the CMIDriver class.
+// Type:    Method.
+// Args:    None.
+// Return:  IDriver * - Ptr to driver, NULL = no driver found.
+// Throws:  None.
+//--
+CMIDriverMgr::IDriver *
+CMIDriverMgr::GetFirstMIDriver(void) const
+{
+    IDriver *pDriver = nullptr;
+    MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
+    while (it != m_mapDriverIdToDriver.end())
+    {
+        const CMIUtilString &rDrvId = (*it).first;
+        MIunused(rDrvId);
+        IDriver *pDvr = (*it).second;
+        if (pDvr->GetDriverIsGDBMICompatibleDriver())
+        {
+            pDriver = pDvr;
+            break;
+        }
+
+        // Next
+        ++it;
+    }
+
+    return pDriver;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Search the registered drivers and return the first driver which says it is
+//          not GDB/MI compatible i.e. the LLDB Driver class.
+// Type:    Method.
+// Args:    None.
+// Return:  IDriver * - Ptr to driver, NULL = no driver found.
+// Throws:  None.
+//--
+CMIDriverMgr::IDriver *
+CMIDriverMgr::GetFirstNonMIDriver(void) const
+{
+    IDriver *pDriver = nullptr;
+    MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.begin();
+    while (it != m_mapDriverIdToDriver.end())
+    {
+        const CMIUtilString &rDrvId = (*it).first;
+        MIunused(rDrvId);
+        IDriver *pDvr = (*it).second;
+        if (!pDvr->GetDriverIsGDBMICompatibleDriver())
+        {
+            pDriver = pDvr;
+            break;
+        }
+
+        // Next
+        ++it;
+    }
+
+    return pDriver;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Search the registered drivers and return driver with the specified ID.
+// Type:    Method.
+// Args:    vrDriverId  - (R) ID of a driver.
+// Return:  IDriver * - Ptr to driver, NULL = no driver found.
+// Throws:  None.
+//--
+CMIDriverMgr::IDriver *
+CMIDriverMgr::GetDriver(const CMIUtilString &vrDriverId) const
+{
+    MapDriverIdToDriver_t::const_iterator it = m_mapDriverIdToDriver.find(vrDriverId);
+    if (it == m_mapDriverIdToDriver.end())
+        return nullptr;
+
+    IDriver *pDriver = (*it).second;
+
+    return pDriver;
 }
-	

Modified: lldb/trunk/tools/lldb-mi/MIDriverMgr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMgr.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIDriverMgr.h (original)
+++ lldb/trunk/tools/lldb-mi/MIDriverMgr.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIDriverMgr.h
+// File:        MIDriverMgr.h
 //
-// Overview:	CMIImplCmn interface.
+// Overview:    CMIImplCmn interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadme.txt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadme.txt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -32,107 +32,106 @@
 #include "MIUtilSingletonBase.h"
 
 //++ ============================================================================
-// Details:	MI Driver Manager. Register lldb::SBBroadcaster derived Driver type
-//			objects with *this manager. The manager does not own driver objects 
-//			registered with it and so will not delete when this manager is 
-//			shutdown. The Driver flagged as "use this one" will be set as current 
-//			driver and will be the one that is used. Other drivers are not 
-//			operated. A Driver can call another Driver should it not handle a 
-//			command.
-//			It also initializes other resources as part it's setup such as the
-//			Logger and Resources objects (explicit indicate *this object requires
-//			those objects (modules/components) to support it's own functionality). 
-//			The Driver manager is the first object instantiated as part of the
-//			MI code base. It is also the first thing to interpret the command
-//			line arguments passed to the executeable. Bases on options it 
-//			understands the manage will set up the appropriate driver or give
-//			help information. Other options are passed on to the driver chosen
-//			to do work.
-//			Each driver instance (the CMIDriver, LLDB::Driver) has its own
-//			LLDB::SBDebugger.
-//			Singleton class.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 28/02/2014.
-// Changes:	None.
+// Details: MI Driver Manager. Register lldb::SBBroadcaster derived Driver type
+//          objects with *this manager. The manager does not own driver objects
+//          registered with it and so will not delete when this manager is
+//          shutdown. The Driver flagged as "use this one" will be set as current
+//          driver and will be the one that is used. Other drivers are not
+//          operated. A Driver can call another Driver should it not handle a
+//          command.
+//          It also initializes other resources as part it's setup such as the
+//          Logger and Resources objects (explicit indicate *this object requires
+//          those objects (modules/components) to support it's own functionality).
+//          The Driver manager is the first object instantiated as part of the
+//          MI code base. It is also the first thing to interpret the command
+//          line arguments passed to the executeable. Bases on options it
+//          understands the manage will set up the appropriate driver or give
+//          help information. Other options are passed on to the driver chosen
+//          to do work.
+//          Each driver instance (the CMIDriver, LLDB::Driver) has its own
+//          LLDB::SBDebugger.
+//          Singleton class.
+// Gotchas: None.
+// Authors: Illya Rudkin 28/02/2014.
+// Changes: None.
 //--
-class CMIDriverMgr
-:	public CMICmnBase
-,	public MI::ISingleton< CMIDriverMgr >
+class CMIDriverMgr : public CMICmnBase, public MI::ISingleton<CMIDriverMgr>
 {
-	friend MI::ISingleton< CMIDriverMgr >;
+    friend MI::ISingleton<CMIDriverMgr>;
 
-// Class:
-public:
-	//++
-	// Description: Driver deriver objects need this interface to work with
-	//				*this manager.
-	//--
-	class IDriver
-	{
-	public:
-		virtual bool					DoInitialize( void ) = 0;
-		virtual bool					DoShutdown( void ) = 0;
-		virtual bool					DoMainLoop( void ) = 0;
-		virtual void					DoResizeWindow( const uint32_t vWindowSizeWsCol ) = 0;
-		virtual lldb::SBError			DoParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting ) = 0;
-		virtual CMIUtilString 			GetError( void ) const = 0;
-		virtual const CMIUtilString &	GetName( void ) const = 0;
-		virtual lldb::SBDebugger &		GetTheDebugger( void ) = 0;
-		virtual bool					GetDriverIsGDBMICompatibleDriver( void ) const = 0;
-		virtual bool					SetId( const CMIUtilString & vId ) = 0;
-		virtual const CMIUtilString &	GetId( void ) const = 0;
-
-		// Not part of the interface, ignore
-		/* dtor */ virtual ~IDriver( void ) {}
-	};
-	
-// Methods:
-public:
-	// MI system
-	bool			Initialize( void );
-	bool			Shutdown( void );
-	//
-	CMIUtilString	GetAppVersion( void ) const;
-	bool			RegisterDriver( const IDriver & vrADriver, const CMIUtilString & vrDriverID );
-	bool			UnregisterDriver( const IDriver & vrADriver ); 
-	bool			SetUseThisDriverToDoWork( const IDriver & vrADriver );	// Specify working main driver
-	IDriver *		GetUseThisDriverToDoWork( void ) const;
-	bool			ParseArgs( const int argc, const char * argv[], bool & vwbExiting );
-	IDriver *		GetDriver( const CMIUtilString & vrDriverId ) const;
-	//
-	// MI Proxy fn to current specified working driver
-	bool				DriverMainLoop( void );
-	void				DriverResizeWindow( const uint32_t vWindowSizeWsCol );
-	bool				DriverParseArgs( const int argc, const char * argv[], FILE * vpStdOut, bool & vwbExiting );
-	CMIUtilString 		DriverGetError( void ) const;
-	CMIUtilString 		DriverGetName( void ) const;
-	lldb::SBDebugger *	DriverGetTheDebugger( void );
-
-// Typedef:
-private:
-	typedef std::map< CMIUtilString, IDriver * >	MapDriverIdToDriver_t;
-	typedef std::pair< CMIUtilString, IDriver * >	MapPairDriverIdToDriver_t;
-
-// Methods:
-private:
-	/* ctor */	CMIDriverMgr( void );
-	/* ctor */	CMIDriverMgr( const CMIDriverMgr & );
-	void		operator=( const CMIDriverMgr & );
-	//
-	bool			HaveDriverAlready( const IDriver & vrMedium ) const;
-	bool			UnregisterDriverAll( void ); 
-	IDriver *		GetFirstMIDriver( void ) const;
-	IDriver *		GetFirstNonMIDriver( void ) const;
-	CMIUtilString	GetHelpOnCmdLineArgOptions( void ) const;
-
-// Overridden:
-private:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIDriverMgr( void );
-
-// Attributes:
-private:
-	MapDriverIdToDriver_t	m_mapDriverIdToDriver;
-	IDriver *				m_pDriverCurrent;	// This driver is used by this manager to do work. It is the main driver.
-	bool					m_bInMi2Mode;		// True = --interpreter entered on the cmd line, false = operate LLDB driver (non GDB) 
+    // Class:
+  public:
+    //++
+    // Description: Driver deriver objects need this interface to work with
+    //              *this manager.
+    //--
+    class IDriver
+    {
+      public:
+        virtual bool DoInitialize(void) = 0;
+        virtual bool DoShutdown(void) = 0;
+        virtual bool DoMainLoop(void) = 0;
+        virtual void DoResizeWindow(const uint32_t vWindowSizeWsCol) = 0;
+        virtual lldb::SBError DoParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting) = 0;
+        virtual CMIUtilString GetError(void) const = 0;
+        virtual const CMIUtilString &GetName(void) const = 0;
+        virtual lldb::SBDebugger &GetTheDebugger(void) = 0;
+        virtual bool GetDriverIsGDBMICompatibleDriver(void) const = 0;
+        virtual bool SetId(const CMIUtilString &vId) = 0;
+        virtual const CMIUtilString &GetId(void) const = 0;
+
+        // Not part of the interface, ignore
+        /* dtor */ virtual ~IDriver(void) {}
+    };
+
+    // Methods:
+  public:
+    // MI system
+    bool Initialize(void);
+    bool Shutdown(void);
+    //
+    CMIUtilString GetAppVersion(void) const;
+    bool RegisterDriver(const IDriver &vrADriver, const CMIUtilString &vrDriverID);
+    bool UnregisterDriver(const IDriver &vrADriver);
+    bool
+    SetUseThisDriverToDoWork(const IDriver &vrADriver); // Specify working main driver
+    IDriver *GetUseThisDriverToDoWork(void) const;
+    bool ParseArgs(const int argc, const char *argv[], bool &vwbExiting);
+    IDriver *GetDriver(const CMIUtilString &vrDriverId) const;
+    //
+    // MI Proxy fn to current specified working driver
+    bool DriverMainLoop(void);
+    void DriverResizeWindow(const uint32_t vWindowSizeWsCol);
+    bool DriverParseArgs(const int argc, const char *argv[], FILE *vpStdOut, bool &vwbExiting);
+    CMIUtilString DriverGetError(void) const;
+    CMIUtilString DriverGetName(void) const;
+    lldb::SBDebugger *DriverGetTheDebugger(void);
+
+    // Typedef:
+  private:
+    typedef std::map<CMIUtilString, IDriver *> MapDriverIdToDriver_t;
+    typedef std::pair<CMIUtilString, IDriver *> MapPairDriverIdToDriver_t;
+
+    // Methods:
+  private:
+    /* ctor */ CMIDriverMgr(void);
+    /* ctor */ CMIDriverMgr(const CMIDriverMgr &);
+    void operator=(const CMIDriverMgr &);
+    //
+    bool HaveDriverAlready(const IDriver &vrMedium) const;
+    bool UnregisterDriverAll(void);
+    IDriver *GetFirstMIDriver(void) const;
+    IDriver *GetFirstNonMIDriver(void) const;
+    CMIUtilString GetHelpOnCmdLineArgOptions(void) const;
+
+    // Overridden:
+  private:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIDriverMgr(void);
+
+    // Attributes:
+  private:
+    MapDriverIdToDriver_t m_mapDriverIdToDriver;
+    IDriver *m_pDriverCurrent; // This driver is used by this manager to do work. It is the main driver.
+    bool m_bInMi2Mode;         // True = --interpreter entered on the cmd line, false = operate LLDB driver (non GDB)
 };

Modified: lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilDateTimeStd.cpp
+// File:        MIUtilDateTimeStd.cpp
 //
-// Overview:	CMIUtilDateTimeStd implementation.
+// Overview:    CMIUtilDateTimeStd implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // In-house headers:
@@ -24,61 +24,62 @@
 #include "MICmnResources.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilDateTimeStd constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilDateTimeStd constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilDateTimeStd::CMIUtilDateTimeStd( void )
+CMIUtilDateTimeStd::CMIUtilDateTimeStd(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilDateTimeStd destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilDateTimeStd destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilDateTimeStd::~CMIUtilDateTimeStd( void )
+CMIUtilDateTimeStd::~CMIUtilDateTimeStd(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve system local current date. Format is MM/DD/YYYY.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Text description.
-// Throws:	None.
+// Details: Retrieve system local current date. Format is MM/DD/YYYY.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Text description.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilDateTimeStd::GetDate( void )
+CMIUtilString
+CMIUtilDateTimeStd::GetDate(void)
 {
-	CMIUtilString strDate( MIRSRC( IDS_WORD_INVALIDBRKTS ) );
-	
-	std::time( &m_rawTime );
-	const std::tm * pTi = std::localtime( &m_rawTime );
-	if( std::strftime( &m_pScratch[ 0 ], sizeof( m_pScratch ), "%d/%m/%y", pTi ) > 0 )
-		strDate = m_pScratch;
+    CMIUtilString strDate(MIRSRC(IDS_WORD_INVALIDBRKTS));
 
-	return strDate;
+    std::time(&m_rawTime);
+    const std::tm *pTi = std::localtime(&m_rawTime);
+    if (std::strftime(&m_pScratch[0], sizeof(m_pScratch), "%d/%m/%y", pTi) > 0)
+        strDate = m_pScratch;
+
+    return strDate;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve system local current time. Format is HH:MM:SS 24 hour clock.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Text description.
-// Throws:	None.
+// Details: Retrieve system local current time. Format is HH:MM:SS 24 hour clock.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Text description.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilDateTimeStd::GetTime( void ) 
+CMIUtilString
+CMIUtilDateTimeStd::GetTime(void)
 {
-	std::time( &m_rawTime );
-	const std::tm * pTi = std::localtime( &m_rawTime );
-	const CMIUtilString seconds( CMIUtilString::Format( "%d", pTi->tm_sec ) );
-	const CMIUtilString zero( (seconds.length() == 1) ? "0" : "" );
-	const CMIUtilString strTime( CMIUtilString::Format( "%d:%d:%s%s", pTi->tm_hour, pTi->tm_min, zero.c_str(), seconds.c_str() ) );
+    std::time(&m_rawTime);
+    const std::tm *pTi = std::localtime(&m_rawTime);
+    const CMIUtilString seconds(CMIUtilString::Format("%d", pTi->tm_sec));
+    const CMIUtilString zero((seconds.length() == 1) ? "0" : "");
+    const CMIUtilString strTime(CMIUtilString::Format("%d:%d:%s%s", pTi->tm_hour, pTi->tm_min, zero.c_str(), seconds.c_str()));
 
-	return strTime;
+    return strTime;
 }
-

Modified: lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDateTimeStd.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilDateTimeStd.h
+// File:        MIUtilDateTimeStd.h
 //
-// Overview:	CMIUtilDateTimeStd interface.
+// Overview:    CMIUtilDateTimeStd interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -25,31 +25,31 @@
 #include <ctime>
 
 // In-house headers:
-#include "MIUtilString.h"  
+#include "MIUtilString.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Used to retrieve system local date
-//			time.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 16/07/2014.
-// Changes:	None.
+// Details: MI common code utility class. Used to retrieve system local date
+//          time.
+// Gotchas: None.
+// Authors: Illya Rudkin 16/07/2014.
+// Changes: None.
 //--
 class CMIUtilDateTimeStd
 {
-// Methods:
-public:
-	/* ctor */	 CMIUtilDateTimeStd( void );
-	
-	CMIUtilString 	GetDate( void );
-	CMIUtilString 	GetTime( void );
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilDateTimeStd( void );
-
-// Attributes:
-private:
-	std::time_t m_rawTime;
-	MIchar		m_pScratch[ 16 ];
+    // Methods:
+  public:
+    /* ctor */ CMIUtilDateTimeStd(void);
+
+    CMIUtilString GetDate(void);
+    CMIUtilString GetTime(void);
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilDateTimeStd(void);
+
+    // Attributes:
+  private:
+    std::time_t m_rawTime;
+    MIchar m_pScratch[16];
 };

Modified: lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilDebug.h
+// File:        MIUtilDebug.h
 //
-// Overview:	Terminal setting termios functions.
+// Overview:    Terminal setting termios functions.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third party headers:
@@ -30,65 +30,67 @@
 #include "MICmnLog.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilDebug constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilDebug constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilDebug::CMIUtilDebug( void )
+CMIUtilDebug::CMIUtilDebug(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilDebug destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilDebug destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilDebug::~CMIUtilDebug( void )
+CMIUtilDebug::~CMIUtilDebug(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Show a dialog to the process/application halts. It gives the opportunity to
-//			attach a debugger.
-// Type:	Static method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Show a dialog to the process/application halts. It gives the opportunity to
+//          attach a debugger.
+// Type:    Static method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilDebug::ShowDlgWaitForDbgAttach( void )
+void
+CMIUtilDebug::ShowDlgWaitForDbgAttach(void)
 {
-	const CMIUtilString strCaption( CMIDriver::Instance().GetAppNameShort() );
+    const CMIUtilString strCaption(CMIDriver::Instance().GetAppNameShort());
 #ifdef _WIN32
-	::MessageBoxA( NULL, "Attach your debugger now", strCaption.c_str(), MB_OK );
+    ::MessageBoxA(NULL, "Attach your debugger now", strCaption.c_str(), MB_OK);
 #else
-	// ToDo: Implement other platform version of an Ok to continue dialog box
+// ToDo: Implement other platform version of an Ok to continue dialog box
 #endif // _WIN32
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Temporarily stall the process/application to give the programmer the 
-//			opportunity to attach a debugger. How to use: Put a break in the programmer
-//			where you want to visit, run the application then attach your debugger to the
-//			application. Hit the debugger's pause button and the debugger should should 
-//			show this loop. Change the i variable value to break out of the loop and 
-//			visit your break point.
-// Type:	Static method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-void CMIUtilDebug::WaitForDbgAttachInfinteLoop( void )
-{
-	MIuint i = 0;
-	while( i == 0 )
-	{
-		const std::chrono::milliseconds time( 100 );
-		std::this_thread::sleep_for( time );
-	}
+// Details: Temporarily stall the process/application to give the programmer the
+//          opportunity to attach a debugger. How to use: Put a break in the programmer
+//          where you want to visit, run the application then attach your debugger to the
+//          application. Hit the debugger's pause button and the debugger should should
+//          show this loop. Change the i variable value to break out of the loop and
+//          visit your break point.
+// Type:    Static method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+void
+CMIUtilDebug::WaitForDbgAttachInfinteLoop(void)
+{
+    MIuint i = 0;
+    while (i == 0)
+    {
+        const std::chrono::milliseconds time(100);
+        std::this_thread::sleep_for(time);
+    }
 }
 
 //---------------------------------------------------------------------------------------
@@ -96,33 +98,32 @@ void CMIUtilDebug::WaitForDbgAttachInfin
 //---------------------------------------------------------------------------------------
 
 // Instantiations:
-CMICmnLog &	CMIUtilDebugFnTrace::ms_rLog = CMICmnLog::Instance();
-MIuint			CMIUtilDebugFnTrace::ms_fnDepthCnt = 0;
+CMICmnLog &CMIUtilDebugFnTrace::ms_rLog = CMICmnLog::Instance();
+MIuint CMIUtilDebugFnTrace::ms_fnDepthCnt = 0;
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilDebugFnTrace constructor.
-// Type:	Method.
-// Args:	vFnName	- (R) The text to insert into the log.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilDebugFnTrace constructor.
+// Type:    Method.
+// Args:    vFnName - (R) The text to insert into the log.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilDebugFnTrace::CMIUtilDebugFnTrace( const CMIUtilString & vFnName )
-:	m_strFnName( vFnName )
+CMIUtilDebugFnTrace::CMIUtilDebugFnTrace(const CMIUtilString &vFnName)
+    : m_strFnName(vFnName)
 {
-	const CMIUtilString txt( CMIUtilString::Format( "%d>%s", ++ms_fnDepthCnt, m_strFnName.c_str() ) );
-	ms_rLog.Write( txt, CMICmnLog::eLogVerbosity_FnTrace ); 
+    const CMIUtilString txt(CMIUtilString::Format("%d>%s", ++ms_fnDepthCnt, m_strFnName.c_str()));
+    ms_rLog.Write(txt, CMICmnLog::eLogVerbosity_FnTrace);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilDebugFnTrace destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilDebugFnTrace destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilDebugFnTrace::~CMIUtilDebugFnTrace( void )
+CMIUtilDebugFnTrace::~CMIUtilDebugFnTrace(void)
 {
-	const CMIUtilString txt( CMIUtilString::Format( "%d<%s", ms_fnDepthCnt--, m_strFnName.c_str() ) );
-	ms_rLog.Write( txt, CMICmnLog::eLogVerbosity_FnTrace ); 
+    const CMIUtilString txt(CMIUtilString::Format("%d<%s", ms_fnDepthCnt--, m_strFnName.c_str()));
+    ms_rLog.Write(txt, CMICmnLog::eLogVerbosity_FnTrace);
 }
-

Modified: lldb/trunk/tools/lldb-mi/MIUtilDebug.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilDebug.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilDebug.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilDebug.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilDebug.h
+// File:        MIUtilDebug.h
 //
-// Overview:	CMIUtilDebug interface.
+// Overview:    CMIUtilDebug interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -30,67 +30,67 @@
 class CMICmnLog;
 
 //++ ============================================================================
-// Details:	MI debugging aid utility class.
-// Gotchas:	None.
-// Authors:	
-// Changes:	None.
+// Details: MI debugging aid utility class.
+// Gotchas: None.
+// Authors:
+// Changes: None.
 //--
-class CMIUtilDebug 
+class CMIUtilDebug
 {
-// Statics:
-public:
-	static void	ShowDlgWaitForDbgAttach( void );
-	static void	WaitForDbgAttachInfinteLoop( void );
-	
-// Methods:
-public:
-	/* ctor */	CMIUtilDebug( void );
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilDebug( void );
+    // Statics:
+  public:
+    static void ShowDlgWaitForDbgAttach(void);
+    static void WaitForDbgAttachInfinteLoop(void);
+
+    // Methods:
+  public:
+    /* ctor */ CMIUtilDebug(void);
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilDebug(void);
 };
 
 //++ ============================================================================
-// Details:	MI debug utility class. Used to indicate the current function
-//			depth in the call stack. It uses the CMIlCmnLog logger to output
-//			the current fn trace information.
-//			Use macro MI_TRACEFN( "Some fn name" ) and implement the scope of
-//			the functions you wish to build up a trace off.
-//			Use preprocessor definition MI_USE_DEBUG_TRACE_FN to turn off or on
-//			tracing code.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 07/03/2014.
-// Changes:	None.
+// Details: MI debug utility class. Used to indicate the current function
+//          depth in the call stack. It uses the CMIlCmnLog logger to output
+//          the current fn trace information.
+//          Use macro MI_TRACEFN( "Some fn name" ) and implement the scope of
+//          the functions you wish to build up a trace off.
+//          Use preprocessor definition MI_USE_DEBUG_TRACE_FN to turn off or on
+//          tracing code.
+// Gotchas: None.
+// Authors: Illya Rudkin 07/03/2014.
+// Changes: None.
 //--
 class CMIUtilDebugFnTrace
 {
-// Methods:
-public:
-	/* ctor */	CMIUtilDebugFnTrace( const CMIUtilString & vFnName );
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilDebugFnTrace( void );
-
-// Attributes:
-private:
-	const CMIUtilString m_strFnName;
-	
-	static CMICmnLog &	ms_rLog;
-	static MIuint		ms_fnDepthCnt;	// Increment count as fn depth increases, decrement count as fn stack pops off
+    // Methods:
+  public:
+    /* ctor */ CMIUtilDebugFnTrace(const CMIUtilString &vFnName);
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilDebugFnTrace(void);
+
+    // Attributes:
+  private:
+    const CMIUtilString m_strFnName;
+
+    static CMICmnLog &ms_rLog;
+    static MIuint ms_fnDepthCnt; // Increment count as fn depth increases, decrement count as fn stack pops off
 };
 
 //++ ============================================================================
-// Details:	Take the given text and send it to the server's Logger to output to the
-//			trace file.
-// Type:	Compile preprocess.
-// Args:	x	- (R) Message (may be seen by user).
+// Details: Take the given text and send it to the server's Logger to output to the
+//          trace file.
+// Type:    Compile preprocess.
+// Args:    x   - (R) Message (may be seen by user).
 //--
 #ifdef MI_USE_DEBUG_TRACE_FN
-#define MI_TRACEFN( x ) CMIUtilDebugFnTrace __MITrace( x )
+#define MI_TRACEFN(x) CMIUtilDebugFnTrace __MITrace(x)
 #else
-#define	MI_TRACEFN( x )
+#define MI_TRACEFN(x)
 #endif // MI_USE_DEBUG_TRACE_FN

Modified: lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp Mon Nov 17 12:06:21 2014
@@ -8,21 +8,21 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilFileStd.cpp
+// File:        MIUtilFileStd.cpp
 //
-// Overview:	CMIUtilFileStd implementation.
+// Overview:    CMIUtilFileStd implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third party headers
 #include <stdio.h>
 #include <assert.h>
-#include <string.h>		// For strerror()
+#include <string.h> // For strerror()
 #include <cerrno>
 
 // In-house headers:
@@ -30,261 +30,270 @@
 #include "MICmnResources.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilFileStd constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-CMIUtilFileStd::CMIUtilFileStd( void )
-:	m_fileNamePath( CMIUtilString() )
-,	m_pFileHandle( nullptr )
-#if defined( _MSC_VER )
-,	m_constCharNewLine( "\r\n" )
+// Details: CMIUtilFileStd constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilFileStd::CMIUtilFileStd(void)
+    : m_fileNamePath(CMIUtilString())
+    , m_pFileHandle(nullptr)
+#if defined(_MSC_VER)
+    , m_constCharNewLine("\r\n")
 #else
-,	m_constCharNewLine( "\n" )
+    , m_constCharNewLine("\n")
 #endif // #if defined( _MSC_VER )
-,	m_bFileError( false )
+    , m_bFileError(false)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilFileStd destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilFileStd destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilFileStd::~CMIUtilFileStd( void )
+CMIUtilFileStd::~CMIUtilFileStd(void)
 {
-	Close();
+    Close();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Open file for writing. On the first call to this function after *this object
-//			is created the file is either created or replace, from then on open only opens
-//			an existing file.
-// Type:	Method.
-// Args:	vFileNamePath	- (R) File name path.
-//			vwrbNewCreated	- (W) True - file recreated, false - file appended too.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Open file for writing. On the first call to this function after *this object
+//          is created the file is either created or replace, from then on open only opens
+//          an existing file.
+// Type:    Method.
+// Args:    vFileNamePath   - (R) File name path.
+//          vwrbNewCreated  - (W) True - file recreated, false - file appended too.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilFileStd::CreateWrite( const CMIUtilString & vFileNamePath, bool & vwrbNewCreated )
+bool
+CMIUtilFileStd::CreateWrite(const CMIUtilString &vFileNamePath, bool &vwrbNewCreated)
 {
-	// Reset
-	m_bFileError = false;
-	vwrbNewCreated = false;
-		
-	if( vFileNamePath.empty() )
-	{
-		m_bFileError = true;
-		SetErrorDescription( MIRSRC( IDS_UTIL_FILE_ERR_INVALID_PATHNAME ) );
-		return MIstatus::failure;
-	}
-	
-	// File is already open so exit
-	if( m_pFileHandle != nullptr )
-		return MIstatus::success;
+    // Reset
+    m_bFileError = false;
+    vwrbNewCreated = false;
 
-#if !defined( _MSC_VER )
-	// Open with 'write' and 'binary' mode
-	m_pFileHandle = ::fopen( vFileNamePath.c_str(), "wb" );
+    if (vFileNamePath.empty())
+    {
+        m_bFileError = true;
+        SetErrorDescription(MIRSRC(IDS_UTIL_FILE_ERR_INVALID_PATHNAME));
+        return MIstatus::failure;
+    }
+
+    // File is already open so exit
+    if (m_pFileHandle != nullptr)
+        return MIstatus::success;
+
+#if !defined(_MSC_VER)
+    // Open with 'write' and 'binary' mode
+    m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb");
 #else
-	// Open a file with exclusive write and shared read permissions
-	m_pFileHandle = ::_fsopen( vFileNamePath.c_str(), "wb", _SH_DENYWR );
+    // Open a file with exclusive write and shared read permissions
+    m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR);
 #endif // !defined( _MSC_VER )
 
-	if( m_pFileHandle == nullptr )
-	{
-		m_bFileError = true;
-		SetErrorDescriptionn( MIRSRC( IDS_UTIL_FILE_ERR_OPENING_FILE ), strerror( errno ), vFileNamePath.c_str() );
-		return MIstatus::failure;
-	}
-	
-	vwrbNewCreated = true;
-	m_fileNamePath = vFileNamePath;
+    if (m_pFileHandle == nullptr)
+    {
+        m_bFileError = true;
+        SetErrorDescriptionn(MIRSRC(IDS_UTIL_FILE_ERR_OPENING_FILE), strerror(errno), vFileNamePath.c_str());
+        return MIstatus::failure;
+    }
+
+    vwrbNewCreated = true;
+    m_fileNamePath = vFileNamePath;
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Write data to existing opened file.
-// Type:	Method.
-// Args:	vData - (R) Text data.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Write data to existing opened file.
+// Type:    Method.
+// Args:    vData - (R) Text data.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilFileStd::Write( const CMIUtilString & vData )
+bool
+CMIUtilFileStd::Write(const CMIUtilString &vData)
 {
-	if( vData.size() == 0 )
-		return MIstatus::success;
+    if (vData.size() == 0)
+        return MIstatus::success;
 
-	if( m_bFileError )
-		return MIstatus::failure;
+    if (m_bFileError)
+        return MIstatus::failure;
 
-	if( m_pFileHandle == nullptr )
-	{
-		m_bFileError = true;
-		SetErrorDescriptionn( MIRSRC( IDE_UTIL_FILE_ERR_WRITING_NOTOPEN ), m_fileNamePath.c_str() );
-		return MIstatus::failure;
-	}
+    if (m_pFileHandle == nullptr)
+    {
+        m_bFileError = true;
+        SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_NOTOPEN), m_fileNamePath.c_str());
+        return MIstatus::failure;
+    }
 
-	// Get the string size
-	MIuint size = vData.size();
-	if( ::fwrite( vData.c_str(), 1, size, m_pFileHandle ) == size )
-	{
-		// Flush the data to the file
-		::fflush( m_pFileHandle );
-		return MIstatus::success;
-	}
-	
-	// Not all of the data has been transferred
-	m_bFileError = true;
-	SetErrorDescriptionn( MIRSRC( IDE_UTIL_FILE_ERR_WRITING_FILE ), m_fileNamePath.c_str() );
-	return MIstatus::failure;
+    // Get the string size
+    MIuint size = vData.size();
+    if (::fwrite(vData.c_str(), 1, size, m_pFileHandle) == size)
+    {
+        // Flush the data to the file
+        ::fflush(m_pFileHandle);
+        return MIstatus::success;
+    }
+
+    // Not all of the data has been transferred
+    m_bFileError = true;
+    SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_FILE), m_fileNamePath.c_str());
+    return MIstatus::failure;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Write data to existing opened file.
-// Type:	Method.
-// Args:	vData		- (R) Text data.
-//			vCharCnt	- (R) Text data length.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Write data to existing opened file.
+// Type:    Method.
+// Args:    vData       - (R) Text data.
+//          vCharCnt    - (R) Text data length.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilFileStd::Write( const MIchar * vpData, const MIuint vCharCnt )
+bool
+CMIUtilFileStd::Write(const MIchar *vpData, const MIuint vCharCnt)
 {
-	if( vCharCnt == 0 )
-		return MIstatus::success;
+    if (vCharCnt == 0)
+        return MIstatus::success;
 
-	if( m_bFileError )
-		return MIstatus::failure;
+    if (m_bFileError)
+        return MIstatus::failure;
 
-	if( m_pFileHandle == nullptr )
-	{
-		m_bFileError = true;
-		SetErrorDescriptionn( MIRSRC( IDE_UTIL_FILE_ERR_WRITING_NOTOPEN ), m_fileNamePath.c_str() );
-		return MIstatus::failure;
-	}
+    if (m_pFileHandle == nullptr)
+    {
+        m_bFileError = true;
+        SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_NOTOPEN), m_fileNamePath.c_str());
+        return MIstatus::failure;
+    }
 
-	if( ::fwrite( vpData, 1, vCharCnt, m_pFileHandle ) == vCharCnt )
-	{
-		// Flush the data to the file
-		::fflush( m_pFileHandle );
-		return MIstatus::success;
-	}
+    if (::fwrite(vpData, 1, vCharCnt, m_pFileHandle) == vCharCnt)
+    {
+        // Flush the data to the file
+        ::fflush(m_pFileHandle);
+        return MIstatus::success;
+    }
 
-	// Not all of the data has been transferred
-	m_bFileError = true;
-	SetErrorDescriptionn( MIRSRC( IDE_UTIL_FILE_ERR_WRITING_FILE ), m_fileNamePath.c_str() );
-	return MIstatus::failure;
+    // Not all of the data has been transferred
+    m_bFileError = true;
+    SetErrorDescriptionn(MIRSRC(IDE_UTIL_FILE_ERR_WRITING_FILE), m_fileNamePath.c_str());
+    return MIstatus::failure;
 }
-	
+
 //++ ------------------------------------------------------------------------------------
-// Details:	Close existing opened file. Note Close() must must an open!
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Close existing opened file. Note Close() must must an open!
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilFileStd::Close( void )
+void
+CMIUtilFileStd::Close(void)
 {
-	if( m_pFileHandle == nullptr )
-		return;
-	
-	::fclose( m_pFileHandle );
-	m_pFileHandle = nullptr;
-	//m_bFileError = false; Do not reset as want to remain until next attempt at open or create
+    if (m_pFileHandle == nullptr)
+        return;
+
+    ::fclose(m_pFileHandle);
+    m_pFileHandle = nullptr;
+    // m_bFileError = false; Do not reset as want to remain until next attempt at open or create
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve state of whether the file is ok.
-// Type:	Method.
-// Args:	None.
-// Return:	True - file ok.
-//			False - file has a problem.
-// Throws:	None.
+// Details: Retrieve state of whether the file is ok.
+// Type:    Method.
+// Args:    None.
+// Return:  True - file ok.
+//          False - file has a problem.
+// Throws:  None.
 //--
-bool CMIUtilFileStd::IsOk( void ) const
+bool
+CMIUtilFileStd::IsOk(void) const
 {
-	return !m_bFileError;
+    return !m_bFileError;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Status on a file existing already.
-// Type:	Method.
-// Args:	vFileNamePath.
-// Return:	True - Exists.
-//			False - Not found.
-// Throws:	None.
+// Details: Status on a file existing already.
+// Type:    Method.
+// Args:    vFileNamePath.
+// Return:  True - Exists.
+//          False - Not found.
+// Throws:  None.
 //--
-bool CMIUtilFileStd::IsFileExist( const CMIUtilString & vFileNamePath ) const
+bool
+CMIUtilFileStd::IsFileExist(const CMIUtilString &vFileNamePath) const
 {
-	if( vFileNamePath.empty() )
-		return false;
+    if (vFileNamePath.empty())
+        return false;
 
-	FILE * pTmp = nullptr;
-	pTmp = ::fopen( vFileNamePath.c_str(), "wb" );
-	if( pTmp != nullptr )
-	{
-		::fclose( pTmp );
-		return true;
-	}
+    FILE *pTmp = nullptr;
+    pTmp = ::fopen(vFileNamePath.c_str(), "wb");
+    if (pTmp != nullptr)
+    {
+        ::fclose(pTmp);
+        return true;
+    }
 
-	return false;
+    return false;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the file current carriage line return characters used.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString & - Text.
-// Throws:	None.
+// Details: Retrieve the file current carriage line return characters used.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString & - Text.
+// Throws:  None.
 //--
-const CMIUtilString & CMIUtilFileStd::GetLineReturn( void ) const
+const CMIUtilString &
+CMIUtilFileStd::GetLineReturn(void) const
 {
-	return m_constCharNewLine;
+    return m_constCharNewLine;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Given a file name directory path, strip off the filename and return the path.
-//			It look for either backslash or forward slash.
-// Type:	Method.
-// Args:	vDirectoryPath	- (R) Text directory path.
-// Return:	CMIUtilString - Directory path.
-// Throws:	None.
+// Details: Given a file name directory path, strip off the filename and return the path.
+//          It look for either backslash or forward slash.
+// Type:    Method.
+// Args:    vDirectoryPath  - (R) Text directory path.
+// Return:  CMIUtilString - Directory path.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilFileStd::StripOffFileName( const CMIUtilString & vDirectoryPath ) const
+CMIUtilString
+CMIUtilFileStd::StripOffFileName(const CMIUtilString &vDirectoryPath) const
 {
-	const MIint nPos = vDirectoryPath.rfind( '\\' );
-	MIint nPos2 = vDirectoryPath.rfind( '/' );
-	if( (nPos == (MIint) std::string::npos) && (nPos2 == (MIint) std::string::npos) )
-		return vDirectoryPath;
+    const MIint nPos = vDirectoryPath.rfind('\\');
+    MIint nPos2 = vDirectoryPath.rfind('/');
+    if ((nPos == (MIint)std::string::npos) && (nPos2 == (MIint)std::string::npos))
+        return vDirectoryPath;
 
-	if( nPos > nPos2 )
-		nPos2 = nPos;
+    if (nPos > nPos2)
+        nPos2 = nPos;
 
-	const CMIUtilString strPath( vDirectoryPath.substr( 0, nPos2 ).c_str() );
-	return strPath;
+    const CMIUtilString strPath(vDirectoryPath.substr(0, nPos2).c_str());
+    return strPath;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Return either backslash or forward slash appropriate to the OS this applilcation
-//			is running on.
-// Type:	Static method.
-// Args:	None.
-// Return:	MIchar - '/' or '\' character.
-// Throws:	None.
+// Details: Return either backslash or forward slash appropriate to the OS this applilcation
+//          is running on.
+// Type:    Static method.
+// Args:    None.
+// Return:  MIchar - '/' or '\' character.
+// Throws:  None.
 //--
-MIchar CMIUtilFileStd::GetSlash( void )
+MIchar
+CMIUtilFileStd::GetSlash(void)
 {
-#if !defined( _MSC_VER )
-	return '/';
+#if !defined(_MSC_VER)
+    return '/';
 #else
-	return '\\';
+    return '\\';
 #endif // !defined( _MSC_VER )
 }

Modified: lldb/trunk/tools/lldb-mi/MIUtilFileStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilFileStd.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilFileStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.h Mon Nov 17 12:06:21 2014
@@ -8,58 +8,57 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilFileStd.h
+// File:        MIUtilFileStd.h
 //
-// Overview:	CMIUtilFileStd interface.
+// Overview:    CMIUtilFileStd interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
 
 // In-house headers:
-#include "MIUtilString.h"  
+#include "MIUtilString.h"
 #include "MICmnBase.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. File handling.
-// Gotchas:	None.
-// Authors:	Aidan Dodds 10/03/2014.
-// Changes:	None.
+// Details: MI common code utility class. File handling.
+// Gotchas: None.
+// Authors: Aidan Dodds 10/03/2014.
+// Changes: None.
 //--
 class CMIUtilFileStd : public CMICmnBase
 {
-// Static:
-public:
-	static MIchar	GetSlash( void );
-
-// Methods:
-public:
-	/* ctor */  CMIUtilFileStd( void );
-	//	
-	bool					CreateWrite( const CMIUtilString & vFileNamePath, bool & vwrbNewCreated );
-	bool					Write( const CMIUtilString & vData );
-	bool					Write( const MIchar * vpData, const MIuint vCharCnt );
-	void					Close( void );
-	bool					IsOk( void ) const;
-	bool					IsFileExist( const CMIUtilString & vFileNamePath ) const;
-	const CMIUtilString &	GetLineReturn( void ) const;
-	CMIUtilString 			StripOffFileName( const CMIUtilString & vDirectoryPath ) const;
-
-// Overridden:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilFileStd( void );
-	
-// Attributes:
-private:
-	CMIUtilString	m_fileNamePath;
-	FILE *			m_pFileHandle;
-	CMIUtilString	m_constCharNewLine;
-	bool			m_bFileError;		// True = have a file error ATM, false = all ok
+    // Static:
+  public:
+    static MIchar GetSlash(void);
+
+    // Methods:
+  public:
+    /* ctor */ CMIUtilFileStd(void);
+    //
+    bool CreateWrite(const CMIUtilString &vFileNamePath, bool &vwrbNewCreated);
+    bool Write(const CMIUtilString &vData);
+    bool Write(const MIchar *vpData, const MIuint vCharCnt);
+    void Close(void);
+    bool IsOk(void) const;
+    bool IsFileExist(const CMIUtilString &vFileNamePath) const;
+    const CMIUtilString &GetLineReturn(void) const;
+    CMIUtilString StripOffFileName(const CMIUtilString &vDirectoryPath) const;
+
+    // Overridden:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilFileStd(void);
+
+    // Attributes:
+  private:
+    CMIUtilString m_fileNamePath;
+    FILE *m_pFileHandle;
+    CMIUtilString m_constCharNewLine;
+    bool m_bFileError; // True = have a file error ATM, false = all ok
 };
-

Modified: lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.cpp Mon Nov 17 12:06:21 2014
@@ -8,117 +8,122 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilMapIdToVariant.cpp
+// File:        MIUtilMapIdToVariant.cpp
 //
-// Overview:	CMIUtilMapIdToVariant implementation.
+// Overview:    CMIUtilMapIdToVariant implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // In-house headers:
 #include "MIUtilMapIdToVariant.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilMapIdToVariant constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilMapIdToVariant constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilMapIdToVariant::CMIUtilMapIdToVariant( void )
+CMIUtilMapIdToVariant::CMIUtilMapIdToVariant(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilMapIdToVariant destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilMapIdToVariant destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilMapIdToVariant::~CMIUtilMapIdToVariant( void )
+CMIUtilMapIdToVariant::~CMIUtilMapIdToVariant(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Remove at the data from *this container.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Remove at the data from *this container.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilMapIdToVariant::Clear( void )
+void
+CMIUtilMapIdToVariant::Clear(void)
 {
-	m_mapKeyToVariantValue.clear();
+    m_mapKeyToVariantValue.clear();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Check an ID is present already in *this container.
-// Type:	Method.
-// Args:	vId	- (R) Unique ID i.e. GUID.
-// Return:	True - registered.
-//			False - not found.
-// Throws:	None.
+// Details: Check an ID is present already in *this container.
+// Type:    Method.
+// Args:    vId - (R) Unique ID i.e. GUID.
+// Return:  True - registered.
+//          False - not found.
+// Throws:  None.
 //--
-bool CMIUtilMapIdToVariant::HaveAlready( const CMIUtilString & vId ) const
+bool
+CMIUtilMapIdToVariant::HaveAlready(const CMIUtilString &vId) const
 {
-	const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find( vId );
-	if( it != m_mapKeyToVariantValue.end() )
-		return true;
-	
-	return false;
+    const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId);
+    if (it != m_mapKeyToVariantValue.end())
+        return true;
+
+    return false;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Determine if *this container is currently holding any data.
-// Type:	Method.
-// Args:	None.
-// Return:	bool	- True - Yes empty, false - one or more data object present.
-// Throws:	None.
+// Details: Determine if *this container is currently holding any data.
+// Type:    Method.
+// Args:    None.
+// Return:  bool    - True - Yes empty, false - one or more data object present.
+// Throws:  None.
 //--
-bool CMIUtilMapIdToVariant::IsEmpty( void ) const
+bool
+CMIUtilMapIdToVariant::IsEmpty(void) const
 {
-	return m_mapKeyToVariantValue.empty();
+    return m_mapKeyToVariantValue.empty();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Check the ID is valid to be registered.
-// Type:	Method.
-// Args:	vId	- (R) Unique ID i.e. GUID.
-// Return:	True - valid.
-//			False - not valid.
-// Throws:	None.
+// Details: Check the ID is valid to be registered.
+// Type:    Method.
+// Args:    vId - (R) Unique ID i.e. GUID.
+// Return:  True - valid.
+//          False - not valid.
+// Throws:  None.
 //--
-bool CMIUtilMapIdToVariant::IsValid( const CMIUtilString & vId ) const
+bool
+CMIUtilMapIdToVariant::IsValid(const CMIUtilString &vId) const
 {
-	bool bValid = true;
+    bool bValid = true;
+
+    if (vId.empty())
+        bValid = false;
 
-	if( vId.empty() )
-		bValid = false;
-	
-	return bValid;
+    return bValid;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Remove from *this contain a data object specified by ID. The data object
-//			when removed also calls its destructor should it have one.
-// Type:	Method.
-// Args:	vId	- (R) Unique ID i.e. GUID.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Remove from *this contain a data object specified by ID. The data object
+//          when removed also calls its destructor should it have one.
+// Type:    Method.
+// Args:    vId - (R) Unique ID i.e. GUID.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilMapIdToVariant::Remove( const CMIUtilString & vId )
+bool
+CMIUtilMapIdToVariant::Remove(const CMIUtilString &vId)
 {
-	const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find( vId );
-	if( it != m_mapKeyToVariantValue.end() )
-	{
-		m_mapKeyToVariantValue.erase( it );
-	}
+    const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId);
+    if (it != m_mapKeyToVariantValue.end())
+    {
+        m_mapKeyToVariantValue.erase(it);
+    }
 
-	return MIstatus::success;
+    return MIstatus::success;
 }

Modified: lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilMapIdToVariant.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilMapIdToVariant.h
+// File:        MIUtilMapIdToVariant.h
 //
-// Overview:	CMIUtilMapIdToVariant interface.
+// Overview:    CMIUtilMapIdToVariant interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -27,122 +27,122 @@
 // In-house headers:
 #include "MICmnBase.h"
 #include "MICmnResources.h"
-#include "MIUtilString.h"  
+#include "MIUtilString.h"
 #include "MIUtilVariant.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Map type container that hold general
-//			object types (by being wrappin an variant wrapper)
-//			objects by ID.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 19/06/2014.
-// Changes:	None.
+// Details: MI common code utility class. Map type container that hold general
+//          object types (by being wrappin an variant wrapper)
+//          objects by ID.
+// Gotchas: None.
+// Authors: Illya Rudkin 19/06/2014.
+// Changes: None.
 //--
 class CMIUtilMapIdToVariant : public CMICmnBase
 {
-// Methods:
-public:
-	/* ctor */	CMIUtilMapIdToVariant( void );
-	
-	template< typename T >
-	bool	Add( const CMIUtilString & vId, const T & vData );
-	void	Clear( void );
-	template< typename T >
-	bool	Get( const CMIUtilString & vId, T & vrwData, bool & vrwbFound ) const;
-	bool	HaveAlready( const CMIUtilString & vId ) const;
-	bool	IsEmpty( void ) const;
-	bool	Remove( const CMIUtilString & vId );
-
-// Overridden:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilMapIdToVariant( void );
-
-// Typdefs:
-private:
-	typedef std::map< CMIUtilString, CMIUtilVariant >	MapKeyToVariantValue_t;			
-	typedef std::pair< CMIUtilString, CMIUtilVariant >	MapPairKeyToVariantValue_t;
-
-// Methods:
-private:
-	bool	IsValid( const CMIUtilString & vId ) const;
+    // Methods:
+  public:
+    /* ctor */ CMIUtilMapIdToVariant(void);
+
+    template <typename T> bool Add(const CMIUtilString &vId, const T &vData);
+    void Clear(void);
+    template <typename T> bool Get(const CMIUtilString &vId, T &vrwData, bool &vrwbFound) const;
+    bool HaveAlready(const CMIUtilString &vId) const;
+    bool IsEmpty(void) const;
+    bool Remove(const CMIUtilString &vId);
+
+    // Overridden:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilMapIdToVariant(void);
+
+    // Typdefs:
+  private:
+    typedef std::map<CMIUtilString, CMIUtilVariant> MapKeyToVariantValue_t;
+    typedef std::pair<CMIUtilString, CMIUtilVariant> MapPairKeyToVariantValue_t;
+
+    // Methods:
+  private:
+    bool IsValid(const CMIUtilString &vId) const;
 
-// Attributes:
-	MapKeyToVariantValue_t	m_mapKeyToVariantValue;
+    // Attributes:
+    MapKeyToVariantValue_t m_mapKeyToVariantValue;
 };
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Add to *this container a data object of general type identified by an ID.
-//			If the data with that ID already exists in the container it is replace with
-//			the new data specified.
-// Type:	Method.
-// Args:	T		- The data object's variable type.
-//			vId		- (R) Unique ID i.e. GUID.
-//			vData	- (R) The general data object to be stored of some type.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Add to *this container a data object of general type identified by an ID.
+//          If the data with that ID already exists in the container it is replace with
+//          the new data specified.
+// Type:    Method.
+// Args:    T       - The data object's variable type.
+//          vId     - (R) Unique ID i.e. GUID.
+//          vData   - (R) The general data object to be stored of some type.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-template< typename T >
-bool CMIUtilMapIdToVariant::Add( const CMIUtilString & vId, const T & vData )
+template <typename T>
+bool
+CMIUtilMapIdToVariant::Add(const CMIUtilString &vId, const T &vData)
 {
-	if( !IsValid( vId ) )
-	{
-		SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_VARIANT_ERR_MAP_KEY_INVALID ), vId.c_str() ) );
-		return MIstatus::failure;
-	}
-
-	const bool bOk = HaveAlready( vId ) ? Remove( vId ) : MIstatus::success;
-	if( bOk )
-	{
-		CMIUtilVariant data;
-		data.Set< T >( vData );
-		MapPairKeyToVariantValue_t pr( vId, data );
-		m_mapKeyToVariantValue.insert( pr );
-	}
+    if (!IsValid(vId))
+    {
+        SetErrorDescription(CMIUtilString::Format(MIRSRC(IDS_VARIANT_ERR_MAP_KEY_INVALID), vId.c_str()));
+        return MIstatus::failure;
+    }
+
+    const bool bOk = HaveAlready(vId) ? Remove(vId) : MIstatus::success;
+    if (bOk)
+    {
+        CMIUtilVariant data;
+        data.Set<T>(vData);
+        MapPairKeyToVariantValue_t pr(vId, data);
+        m_mapKeyToVariantValue.insert(pr);
+    }
 
-	return bOk;
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve a data object from *this container identified by the specified ID.
-// Type:	Method.
-// Args:	T			- The data object's variable type.
-//			vId			- (R) Unique ID i.e. GUID.
-//			vrwData		- (W) Copy of the data object held.
-//			vrwbFound	- (W) True = data found, false = data not found.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieve a data object from *this container identified by the specified ID.
+// Type:    Method.
+// Args:    T           - The data object's variable type.
+//          vId         - (R) Unique ID i.e. GUID.
+//          vrwData     - (W) Copy of the data object held.
+//          vrwbFound   - (W) True = data found, false = data not found.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-template< typename T >
-bool CMIUtilMapIdToVariant::Get( const CMIUtilString & vId, T & vrwData, bool & vrwbFound ) const
+template <typename T>
+bool
+CMIUtilMapIdToVariant::Get(const CMIUtilString &vId, T &vrwData, bool &vrwbFound) const
 {
-	vrwbFound = false;
+    vrwbFound = false;
 
-	if( !IsValid( vId ) )
-	{
-		SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_VARIANT_ERR_MAP_KEY_INVALID ), vId.c_str() ) );
-		return MIstatus::failure;
-	}
-
-	const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find( vId );
-	if( it != m_mapKeyToVariantValue.end() )
-	{
-		const CMIUtilVariant & rData = (*it).second;
-		const T * pDataObj = rData.Get< T >();
-		if( pDataObj != nullptr )
-		{
-			vrwbFound = true;
-			vrwData = *pDataObj;
-			return MIstatus::success;
-		}
-		else
-		{
-			SetErrorDescription( MIRSRC( IDS_VARIANT_ERR_USED_BASECLASS ) );
-			return MIstatus::failure;
-		}
-	}
+    if (!IsValid(vId))
+    {
+        SetErrorDescription(CMIUtilString::Format(MIRSRC(IDS_VARIANT_ERR_MAP_KEY_INVALID), vId.c_str()));
+        return MIstatus::failure;
+    }
+
+    const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId);
+    if (it != m_mapKeyToVariantValue.end())
+    {
+        const CMIUtilVariant &rData = (*it).second;
+        const T *pDataObj = rData.Get<T>();
+        if (pDataObj != nullptr)
+        {
+            vrwbFound = true;
+            vrwData = *pDataObj;
+            return MIstatus::success;
+        }
+        else
+        {
+            SetErrorDescription(MIRSRC(IDS_VARIANT_ERR_USED_BASECLASS));
+            return MIstatus::failure;
+        }
+    }
 
-	return MIstatus::success;
+    return MIstatus::success;
 }

Modified: lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSingletonBase.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilSingletonBase.h
+// File:        MIUtilSingletonBase.h
 //
-// Overview:	MI::ISingleton interface.
+// Overview:    MI::ISingleton interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -24,48 +24,47 @@
 namespace MI
 {
 
-//	MI::ISingleton base class usage:
+//   MI::ISingleton base class usage:
 //
-//	class CMIDerivedClass
-//		: public MI::ISingleton< CMIDerivedClass >
-//	{
-//		friend MI::ISingleton< CMIDerivedClass >;
+//   class CMIDerivedClass
+//       : public MI::ISingleton< CMIDerivedClass >
+//   {
+//       friend MI::ISingleton< CMIDerivedClass >;
 //
-//	// Overridden:		
-//	public:
-//		// From MI::ISingleton
-//		virtual bool Initialize( void );
-//		virtual bool Shutdown( void );
-//	};
+//   // Overridden:
+//   public:
+//       // From MI::ISingleton
+//       virtual bool Initialize( void );
+//       virtual bool Shutdown( void );
+//   };
 
 //++ ============================================================================
-// Details:	Base class for the singleton pattern.
-// Gotchas:	Derived class must specify MI::ISingleton<> as a friend class.
-// Authors:	Aidan Dodds 17/03/2014.
-// Changes:	None.
+// Details: Base class for the singleton pattern.
+// Gotchas: Derived class must specify MI::ISingleton<> as a friend class.
+// Authors: Aidan Dodds 17/03/2014.
+// Changes: None.
 //--
-template< typename T >
-class ISingleton
+template <typename T> class ISingleton
 {
-// Statics:
-public:
-	// Return an instance of the derived class
-	static T & Instance( void )
-	{
-		// This will fail if the derived class has not
-		// declared itself to be a friend of MI::ISingleton
-		static T instance;
-
-		return instance;
-	}
-
-// Overrideable:
-public:
-	virtual bool Initialize( void ) = 0;
-	virtual bool Shutdown( void ) = 0;
-	//
-	/* dtor */ virtual ~ISingleton( void ) { };
+    // Statics:
+  public:
+    // Return an instance of the derived class
+    static T &
+    Instance(void)
+    {
+        // This will fail if the derived class has not
+        // declared itself to be a friend of MI::ISingleton
+        static T instance;
+
+        return instance;
+    }
+
+    // Overrideable:
+  public:
+    virtual bool Initialize(void) = 0;
+    virtual bool Shutdown(void) = 0;
+    //
+    /* dtor */ virtual ~ISingleton(void){};
 };
 
 } // namespace MI
-

Modified: lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSingletonHelper.h Mon Nov 17 12:06:21 2014
@@ -8,18 +8,18 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilSingletonHelper.h
+// File:        MIUtilSingletonHelper.h
 //
-// Overview:	Contains template functions to aid the initialisation and
-//				shutdown of MI modules. MI modules (or components) can 
-//				use other MI modules to help them achieve their one task
-//				(Modules only do one task).
+// Overview:    Contains template functions to aid the initialisation and
+//              shutdown of MI modules. MI modules (or components) can
+//              use other MI modules to help them achieve their one task
+//              (Modules only do one task).
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -32,64 +32,65 @@ namespace MI
 #include "MICmnResources.h"
 
 //++ ============================================================================
-// Details:	Short cut helper function to simplify repeated initialisation of
-//			MI components (singletons) required by a client module.
-// Type:	Template method.
-// Args:	vErrorResrcId	- (R)  The string resource ID error message identifier to place in errMsg.
-//			vwrbOk			- (RW) On input True = Try to initalise MI driver module.
-//								   On output True = MI driver module initialise successfully.
-//			vwrErrMsg		- (W)  MI driver module initialise error description on failure.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Authors:	Aidan Dodds 17/03/2014.
-// Changes:	None.
+// Details: Short cut helper function to simplify repeated initialisation of
+//          MI components (singletons) required by a client module.
+// Type:    Template method.
+// Args:    vErrorResrcId   - (R)  The string resource ID error message identifier to place in errMsg.
+//          vwrbOk          - (RW) On input True = Try to initalise MI driver module.
+//                                 On output True = MI driver module initialise successfully.
+//          vwrErrMsg       - (W)  MI driver module initialise error description on failure.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Authors: Aidan Dodds 17/03/2014.
+// Changes: None.
 //--
-template< typename T >
-bool ModuleInit( const MIint vErrorResrcId, bool & vwrbOk, CMIUtilString & vwrErrMsg )
+template <typename T>
+bool
+ModuleInit(const MIint vErrorResrcId, bool &vwrbOk, CMIUtilString &vwrErrMsg)
 {
-	if( vwrbOk && !T::Instance().Initialize() )
-	{
-		vwrbOk = MIstatus::failure;
-		vwrErrMsg = CMIUtilString::Format( MIRSRC( vErrorResrcId ), T::Instance().GetErrorDescription().c_str() );
-	}
+    if (vwrbOk && !T::Instance().Initialize())
+    {
+        vwrbOk = MIstatus::failure;
+        vwrErrMsg = CMIUtilString::Format(MIRSRC(vErrorResrcId), T::Instance().GetErrorDescription().c_str());
+    }
 
-	return vwrbOk;
+    return vwrbOk;
 }
 
 //++ ============================================================================
-// Details:	Short cut helper function to simplify repeated shutodown of
-//			MI components (singletons) required by a client module.
-// Type:	Template method.
-// Args:	vErrorResrcId	- (R)  The string resource ID error message identifier 
-//								   to place in errMsg.
-//			vwrbOk			- (W)  If not already false make false on module 
-//								   shutdown failure.
-//			vwrErrMsg		- (RW) Append to existing error description string MI 
-//								   driver module initialise error description on 
-//								   failure.
-// Return:	True - Module shutdown succeeded.
-//			False - Module shutdown failed.
-// Authors:	Aidan Dodds 17/03/2014.
-// Changes:	None.
+// Details: Short cut helper function to simplify repeated shutodown of
+//          MI components (singletons) required by a client module.
+// Type:    Template method.
+// Args:    vErrorResrcId   - (R)  The string resource ID error message identifier
+//                                 to place in errMsg.
+//          vwrbOk          - (W)  If not already false make false on module
+//                                 shutdown failure.
+//          vwrErrMsg       - (RW) Append to existing error description string MI
+//                                 driver module initialise error description on
+//                                 failure.
+// Return:  True - Module shutdown succeeded.
+//          False - Module shutdown failed.
+// Authors: Aidan Dodds 17/03/2014.
+// Changes: None.
 //--
-template< typename T >
-bool ModuleShutdown( const MIint vErrorResrcId, bool & vwrbOk, CMIUtilString & vwrErrMsg )
+template <typename T>
+bool
+ModuleShutdown(const MIint vErrorResrcId, bool &vwrbOk, CMIUtilString &vwrErrMsg)
 {
-	bool bOk = MIstatus::success;
+    bool bOk = MIstatus::success;
 
-	if( !T::Instance().Shutdown() )
-	{
-		const bool bMoreThanOneError( !vwrErrMsg.empty() );
-		bOk = MIstatus::failure;
-		if( bMoreThanOneError )
-			vwrErrMsg += ", ";
-		vwrErrMsg += CMIUtilString::Format( MIRSRC( vErrorResrcId ), T::Instance().GetErrorDescription().c_str() );
-	}
-	
-	vwrbOk = bOk ? vwrbOk : MIstatus::failure;
+    if (!T::Instance().Shutdown())
+    {
+        const bool bMoreThanOneError(!vwrErrMsg.empty());
+        bOk = MIstatus::failure;
+        if (bMoreThanOneError)
+            vwrErrMsg += ", ";
+        vwrErrMsg += CMIUtilString::Format(MIRSRC(vErrorResrcId), T::Instance().GetErrorDescription().c_str());
+    }
 
-	return bOk;
+    vwrbOk = bOk ? vwrbOk : MIstatus::failure;
+
+    return bOk;
 }
 
 } // namespace MI
-

Modified: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp Mon Nov 17 12:06:21 2014
@@ -8,673 +8,691 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilString.h
+// File:        MIUtilString.h
 //
-// Overview:	CMIUtilString implementation.
+// Overview:    CMIUtilString implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third party headers
-#include <memory>		// std::unique_ptr
-#include <stdarg.h>		// va_list, va_start, var_end
-#include <sstream>		// std::stringstream
-#include <string.h>		// for strcpy
-#include <limits.h>		// for ULONG_MAX
+#include <memory>   // std::unique_ptr
+#include <stdarg.h> // va_list, va_start, var_end
+#include <sstream>  // std::stringstream
+#include <string.h> // for strcpy
+#include <limits.h> // for ULONG_MAX
 
 // In-house headers:
 #include "MIUtilString.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilString constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-CMIUtilString::CMIUtilString( void )
-:	std::string()
-{
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilString constructor.
-// Type:	Method.
-// Args:	vpData	- Pointer to UTF8 text data.
-// Return:	None.
-// Throws:	None.
-//--
-CMIUtilString::CMIUtilString( const MIchar * vpData )
-:	std::string( vpData )
-{
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilString constructor.
-// Type:	Method.
-// Args:	vpData	- Pointer to UTF8 text data.
-// Return:	None.
-// Throws:	None.
-//--
-CMIUtilString::CMIUtilString( const MIchar * const * vpData )
-:	std::string( (const char *) vpData )
-{
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilString assigment operator.
-// Type:	Method.
-// Args:	vpRhs	- Pointer to UTF8 text data.
-// Return:	CMIUtilString &	- *this string.
-// Throws:	None.
-//--
-CMIUtilString & CMIUtilString::operator= ( const MIchar * vpRhs )
-{
-	if( *this == vpRhs )
-		return *this;
-
-	if( vpRhs != nullptr )
-	{
-		assign( vpRhs );
-	}
-
-	return *this;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilString assigment operator.
-// Type:	Method.
-// Args:	vrRhs	- The other string to copy from.
-// Return:	CMIUtilString &	- *this string.
-// Throws:	None.
-//--
-CMIUtilString & CMIUtilString::operator= ( const std::string & vrRhs )
-{
-	if( *this == vrRhs )
-		return *this;
-
-	assign( vrRhs );
-	
-	return *this;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilString destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-CMIUtilString::~CMIUtilString( void )
-{
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Perform a snprintf format style on a string data. A new string object is 
-//			created and returned.
-// Type:	Static method.
-// Args:	vrFormat		- (R) Format string data instruction.
-//			vArgs			- (R) Var list args of any type.
-// Return:	CMIUtilString - Number of splits found in the string data.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::FormatPriv( const CMIUtilString & vrFormat, va_list vArgs )
-{
-	CMIUtilString strResult;
-	MIint nFinal = 0;
-	MIint n = vrFormat.size();
-
-	// IOR: mysterious crash in this function on some windows builds not able to duplicate
-	// but found article which may be related. Crash occurs in vsnprintf() or va_copy()
-	// Duplicate vArgs va_list argument pointer to ensure that it can be safely used in 
-	// a new frame
-	// http://julipedia.meroh.net/2011/09/using-vacopy-to-safely-pass-ap.html
-	va_list argsDup;
-	va_copy( argsDup, vArgs );
-
-	// Create a copy va_list to reset when we spin
-	va_list argsCpy;
-	va_copy( argsCpy, argsDup );
-
-	if( n == 0 )
-		return strResult;
-	
-	n = n << 4; // Reserve 16 times as much the length of the vrFormat
-
-	std::unique_ptr< char[] > pFormatted;
-	while( 1 )
-	{
-		pFormatted.reset( new char[ n + 1 ] ); // +1 for safety margin
-		::strncpy( &pFormatted[ 0 ], vrFormat.c_str(), n );
-
-		//	We need to restore the variable argument list pointer to the start again
-		//	before running vsnprintf() more then once 
-		va_copy( argsDup, argsCpy );
-
-		nFinal = ::vsnprintf( &pFormatted[ 0 ], n, vrFormat.c_str(), argsDup );
-		if( (nFinal < 0) || (nFinal >= n) )
-			n += abs( nFinal - n + 1 );
-		else
-			break;
-	}
-
-	va_end( argsCpy );
-	va_end( argsDup );
-
-	strResult = pFormatted.get();
-	
-	return strResult;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Perform a snprintf format style on a string data. A new string object is 
-//			created and returned.
-// Type:	Static method.
-// Args:	vFormat		- (R) Format string data instruction.
-//			...			- (R) Var list args of any type.
-// Return:	CMIUtilString - Number of splits found in the string data.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::Format( const CMIUtilString vFormating, ... )
-{
-	va_list args;
-	va_start( args, vFormating );
-	CMIUtilString strResult = CMIUtilString::FormatPriv( vFormating, args );
-	va_end( args );
-
-	return strResult;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Perform a snprintf format style on a string data. A new string object is 
-//			created and returned.
-// Type:	Static method.
-// Args:	vrFormat		- (R) Format string data instruction.
-//			vArgs			- (R) Var list args of any type.
-// Return:	CMIUtilString - Number of splits found in the string data.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::FormatValist( const CMIUtilString & vrFormating, va_list vArgs )
-{
-	return CMIUtilString::FormatPriv( vrFormating, vArgs );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Splits string into array of strings using delimiter. If multiple delimiter
-//			are found in sequence then they are not added to the list of splits.
-// Type:	Method.
-// Args:	vData		- (R) String data to be split up.
-//			vDelimiter	- (R) Delimiter char or text.
-//			vwVecSplits	- (W) Container of splits found in string data.
-// Return:	MIuint - Number of splits found in the string data.
-// Throws:	None.
-//--
-MIuint CMIUtilString::Split( const CMIUtilString & vDelimiter, VecString_t & vwVecSplits ) const
-{
-	vwVecSplits.clear();
-
-	if( this->empty() || vDelimiter.empty() )
-		return 0;
-
-	MIint nPos = find( vDelimiter );
-	if( nPos == (MIint) std::string::npos )
-	{
-		vwVecSplits.push_back( *this );
-		return 1;
-	}
-	const MIint strLen( length() );
-	if( nPos == strLen )
-	{
-		vwVecSplits.push_back( *this );
-		return 1;
-	}
-
-	MIuint nAdd1( 1 );
-	if( (nPos > 0) && (substr( 0, nPos ) != vDelimiter) )
-	{
-		nPos = 0;
-		nAdd1 = 0;
-	}
-	MIint nPos2 = find( vDelimiter, nPos + 1 );
-	while( nPos2 != (MIint) std::string::npos )
-	{
-		const MIuint len( nPos2 - nPos - nAdd1 );
-		const std::string strSection( substr( nPos + nAdd1, len ) );
-		if( strSection != vDelimiter )
-			vwVecSplits.push_back( strSection.c_str() );
-		nPos += len + 1;
-		nPos2 = find( vDelimiter, nPos + 1 );
-		nAdd1 = 0;
-	}
-	const std::string strSection( substr( nPos, strLen - nPos ) );
-	if( (strSection.length() != 0) && (strSection != vDelimiter) )
-		vwVecSplits.push_back( strSection.c_str() );
-		
-	return vwVecSplits.size();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Splits string into array of strings using delimiter. However the string is
-//			also considered for text surrounded by quotes. Text with quotes including the
-//			delimiter is treated as a whole. If multiple delimiter are found in sequence 
-//			then they are not added to the list of splits. Quotes that are embedded in the
-//			the string as string formatted quotes are ignored (proceeded by a '\\') i.e.
-//			"\"MI GDB local C++.cpp\":88".
-// Type:	Method.
-// Args:	vData		- (R) String data to be split up.
-//			vDelimiter	- (R) Delimiter char or text.
-//			vwVecSplits	- (W) Container of splits found in string data.
-// Return:	MIuint - Number of splits found in the string data.
-// Throws:	None.
-//--
-MIuint CMIUtilString::SplitConsiderQuotes( const CMIUtilString & vDelimiter, VecString_t & vwVecSplits ) const
-{
-	vwVecSplits.clear();
-
-	if( this->empty() || vDelimiter.empty() )
-		return 0;
-
-	MIint nPos = find( vDelimiter );
-	if( nPos == (MIint) std::string::npos )
-	{
-		vwVecSplits.push_back( *this );
-		return 1;
-	}
-	const MIint strLen( length() );
-	if( nPos == strLen )
-	{
-		vwVecSplits.push_back( *this );
-		return 1;
-	}
-
-	// Look for more quotes
-	bool bHaveQuotes = false;
-	const MIchar cBckSlash = '\\';
-	const MIchar cQuote = '"';
-	MIint nPosQ = find( cQuote );
-	MIint nPosQ2 = (MIint) std::string::npos;
-	if( nPosQ != (MIint) std::string::npos )
-	{
-		nPosQ2 = nPosQ + 1;
-		while( nPosQ2 < strLen )
-		{
-			nPosQ2 = find( cQuote, nPosQ2 );
-			if( (nPosQ2 == (MIint) std::string::npos) || (at( nPosQ2 - 1 ) != cBckSlash) )
-				break;
-			nPosQ2++;
-		}
-		bHaveQuotes = (nPosQ2 != (MIint) std::string::npos);
-	}
-
-	MIuint nAdd1( 1 );
-	if( (nPos > 0) && (substr( 0, nPos ) != vDelimiter) )
-	{
-		nPos = 0;
-		nAdd1 = 0;
-	}
-	MIint nPos2 = find( vDelimiter, nPos + 1 );
-	while( nPos2 != (MIint) std::string::npos )
-	{
-		if( !bHaveQuotes || (bHaveQuotes && ((nPos2 > nPosQ2) || (nPos2 < nPosQ))) )
-		{
-			// Extract text or quoted text
-			const MIuint len( nPos2 - nPos - nAdd1 );
-			const std::string strSection( substr( nPos + nAdd1, len ) );
-			if( strSection != vDelimiter )
-				vwVecSplits.push_back( strSection.c_str() );
-			nPos += len + 1;
-			nPos2 = find( vDelimiter, nPos + 1 );
-			nAdd1 = 0;
-
-			if( bHaveQuotes && (nPos2 > nPosQ2) )
-			{
-				// Reset, look for more quotes
-				bHaveQuotes = false;
-				nPosQ = find( cQuote, nPos );
-				nPosQ2 = (MIint) std::string::npos;
-				if( nPosQ != (MIint) std::string::npos )
-				{
-					nPosQ2 = find( cQuote, nPosQ + 1 );
-					bHaveQuotes = (nPosQ2 != (MIint) std::string::npos);
-				}
-			}
-		}
-		else
-		{
-			// Skip passed text in quotes
-			nPos2 = find( vDelimiter, nPosQ2 + 1 );
-		}
-	}
-	const std::string strSection( substr( nPos, strLen - nPos ) );
-	if( (strSection.length() != 0) && (strSection != vDelimiter) )
-		vwVecSplits.push_back( strSection.c_str() );
-		
-	return vwVecSplits.size();
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Remove '\n' from the end of string if found. It does not alter
-//			*this string.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - New version of the string.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::StripCREndOfLine( void ) const
-{
-	const MIint nPos = rfind( '\n' );
-	if( nPos == (MIint) std::string::npos )
-		return *this;
-
-	const CMIUtilString strNew( substr( 0, nPos ).c_str() );
-	
-	return strNew;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Remove all '\n' from the string and replace with a space. It does not alter
-//			*this string.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - New version of the string.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::StripCRAll( void ) const
-{
-	return FindAndReplace( "\n", " " );
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Find and replace all matches of a sub string with another string. It does not 
-//			alter *this string.
-// Type:	Method.
-// Args:	vFind			- (R) The string to look for.
-//			vReplaceWith	- (R) The string to replace the vFind match.
-// Return:	CMIUtilString - New version of the string.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::FindAndReplace( const CMIUtilString & vFind, const CMIUtilString & vReplaceWith ) const
-{
-	if( vFind.empty() || this->empty() )
-		return *this;
-
-	MIint nPos = find( vFind );
-	if( nPos == (MIint) std::string::npos )
-		return *this;
-
-	CMIUtilString strNew( *this );
-	while( nPos != (MIint) std::string::npos )
-	{
-		strNew.replace( nPos, vFind.length(), vReplaceWith );
-		nPos += vReplaceWith.length();
-		nPos = strNew.find( vFind, nPos );
-	}
-
-	return strNew;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Check if *this string is a decimal number.
-// Type:	Method.
-// Args:	None.
-// Return:	bool - True = yes number, false not a number.
-// Throws:	None.
-//--
-bool CMIUtilString::IsNumber( void ) const
-{
-	if( empty() )
-		return false;
-
-	if( (at( 0 ) == '-') && (length() == 1) )
-		return false;
-
-	const MIint nPos = find_first_not_of( "-.0123456789" );
-	if( nPos != (MIint) std::string::npos )
-		return false;
-
-	return true;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Extract the number from the string. The number can be either a hexadecimal or
-//			natural number. It cannot contain other non-numeric characters.
-// Type:	Method.
-// Args:	vwrNumber	- (W) Number exracted from the string.
-// Return:	bool - True = yes number, false not a number.
-// Throws:	None.
-//--
-bool CMIUtilString::ExtractNumber( MIint64 & vwrNumber ) const
-{
-	vwrNumber = 0;
-	
-	if( !IsNumber() )
-	{
-		if( ExtractNumberFromHexadecimal( vwrNumber ) )
-			return true;
-
-		return false;
-	}
-
-	std::stringstream ss( const_cast< CMIUtilString & >( *this ) );
-	ss >> vwrNumber;
-
-	return true;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Extract the number from the hexadecimal string..
-// Type:	Method.
-// Args:	vwrNumber	- (W) Number exracted from the string.
-// Return:	bool - True = yes number, false not a number.
-// Throws:	None.
-//--
-bool CMIUtilString::ExtractNumberFromHexadecimal( MIint64 & vwrNumber ) const
-{
-	vwrNumber = 0;
-		
-	const MIint nPos = find_first_not_of( "x01234567890ABCDEFabcedf" );
-	if( nPos != (MIint) std::string::npos )
-		return false;
-
-	const MIint64 nNum = ::strtoul( this->c_str(), nullptr, 16 );
-	if( nNum != LONG_MAX )
-	{
-		vwrNumber = nNum;
-		return true;
-	}
-		
-	return true;
-}
-
-//++ ------------------------------------------------------------------------------------
-// Details:	Determine if the text is all valid alpha numeric characters. Letters can be
-//			either upper or lower case.
-// Type:	Static method.
-// Args:	vrText	- (R) The text data to examine.
-// Return:	bool - True = yes all alpha, false = one or more chars is non alpha.
-// Throws:	None.
-//--
-bool CMIUtilString::IsAllValidAlphaAndNumeric( const MIchar & vrText )
-{
-	const MIuint len = ::strlen( &vrText );
-	if( len == 0 )
-		return false;
-
-	MIchar * pPtr = const_cast< MIchar * >( &vrText );
-	for( MIuint i = 0; i < len; i++, pPtr++ )
-	{
-		const MIchar c = *pPtr;
-		if( ::isalnum( (int) c ) == 0 )
-			return false;
-	}
-	
-	return true;
+// Details: CMIUtilString constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilString::CMIUtilString(void)
+    : std::string()
+{
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CMIUtilString constructor.
+// Type:    Method.
+// Args:    vpData  - Pointer to UTF8 text data.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilString::CMIUtilString(const MIchar *vpData)
+    : std::string(vpData)
+{
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CMIUtilString constructor.
+// Type:    Method.
+// Args:    vpData  - Pointer to UTF8 text data.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilString::CMIUtilString(const MIchar *const *vpData)
+    : std::string((const char *)vpData)
+{
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CMIUtilString assigment operator.
+// Type:    Method.
+// Args:    vpRhs   - Pointer to UTF8 text data.
+// Return:  CMIUtilString & - *this string.
+// Throws:  None.
+//--
+CMIUtilString &CMIUtilString::operator=(const MIchar *vpRhs)
+{
+    if (*this == vpRhs)
+        return *this;
+
+    if (vpRhs != nullptr)
+    {
+        assign(vpRhs);
+    }
+
+    return *this;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CMIUtilString assigment operator.
+// Type:    Method.
+// Args:    vrRhs   - The other string to copy from.
+// Return:  CMIUtilString & - *this string.
+// Throws:  None.
+//--
+CMIUtilString &CMIUtilString::operator=(const std::string &vrRhs)
+{
+    if (*this == vrRhs)
+        return *this;
+
+    assign(vrRhs);
+
+    return *this;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: CMIUtilString destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilString::~CMIUtilString(void)
+{
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Perform a snprintf format style on a string data. A new string object is
+//          created and returned.
+// Type:    Static method.
+// Args:    vrFormat      - (R) Format string data instruction.
+//          vArgs         - (R) Var list args of any type.
+// Return:  CMIUtilString - Number of splits found in the string data.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::FormatPriv(const CMIUtilString &vrFormat, va_list vArgs)
+{
+    CMIUtilString strResult;
+    MIint nFinal = 0;
+    MIint n = vrFormat.size();
+
+    // IOR: mysterious crash in this function on some windows builds not able to duplicate
+    // but found article which may be related. Crash occurs in vsnprintf() or va_copy()
+    // Duplicate vArgs va_list argument pointer to ensure that it can be safely used in
+    // a new frame
+    // http://julipedia.meroh.net/2011/09/using-vacopy-to-safely-pass-ap.html
+    va_list argsDup;
+    va_copy(argsDup, vArgs);
+
+    // Create a copy va_list to reset when we spin
+    va_list argsCpy;
+    va_copy(argsCpy, argsDup);
+
+    if (n == 0)
+        return strResult;
+
+    n = n << 4; // Reserve 16 times as much the length of the vrFormat
+
+    std::unique_ptr<char[]> pFormatted;
+    while (1)
+    {
+        pFormatted.reset(new char[n + 1]); // +1 for safety margin
+        ::strncpy(&pFormatted[0], vrFormat.c_str(), n);
+
+        //  We need to restore the variable argument list pointer to the start again
+        //  before running vsnprintf() more then once
+        va_copy(argsDup, argsCpy);
+
+        nFinal = ::vsnprintf(&pFormatted[0], n, vrFormat.c_str(), argsDup);
+        if ((nFinal < 0) || (nFinal >= n))
+            n += abs(nFinal - n + 1);
+        else
+            break;
+    }
+
+    va_end(argsCpy);
+    va_end(argsDup);
+
+    strResult = pFormatted.get();
+
+    return strResult;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Perform a snprintf format style on a string data. A new string object is
+//          created and returned.
+// Type:    Static method.
+// Args:    vFormat       - (R) Format string data instruction.
+//          ...           - (R) Var list args of any type.
+// Return:  CMIUtilString - Number of splits found in the string data.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::Format(const CMIUtilString vFormating, ...)
+{
+    va_list args;
+    va_start(args, vFormating);
+    CMIUtilString strResult = CMIUtilString::FormatPriv(vFormating, args);
+    va_end(args);
+
+    return strResult;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Perform a snprintf format style on a string data. A new string object is
+//          created and returned.
+// Type:    Static method.
+// Args:    vrFormat      - (R) Format string data instruction.
+//          vArgs         - (R) Var list args of any type.
+// Return:  CMIUtilString - Number of splits found in the string data.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::FormatValist(const CMIUtilString &vrFormating, va_list vArgs)
+{
+    return CMIUtilString::FormatPriv(vrFormating, vArgs);
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Splits string into array of strings using delimiter. If multiple delimiter
+//          are found in sequence then they are not added to the list of splits.
+// Type:    Method.
+// Args:    vData       - (R) String data to be split up.
+//          vDelimiter  - (R) Delimiter char or text.
+//          vwVecSplits - (W) Container of splits found in string data.
+// Return:  MIuint - Number of splits found in the string data.
+// Throws:  None.
+//--
+MIuint
+CMIUtilString::Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const
+{
+    vwVecSplits.clear();
+
+    if (this->empty() || vDelimiter.empty())
+        return 0;
+
+    MIint nPos = find(vDelimiter);
+    if (nPos == (MIint)std::string::npos)
+    {
+        vwVecSplits.push_back(*this);
+        return 1;
+    }
+    const MIint strLen(length());
+    if (nPos == strLen)
+    {
+        vwVecSplits.push_back(*this);
+        return 1;
+    }
+
+    MIuint nAdd1(1);
+    if ((nPos > 0) && (substr(0, nPos) != vDelimiter))
+    {
+        nPos = 0;
+        nAdd1 = 0;
+    }
+    MIint nPos2 = find(vDelimiter, nPos + 1);
+    while (nPos2 != (MIint)std::string::npos)
+    {
+        const MIuint len(nPos2 - nPos - nAdd1);
+        const std::string strSection(substr(nPos + nAdd1, len));
+        if (strSection != vDelimiter)
+            vwVecSplits.push_back(strSection.c_str());
+        nPos += len + 1;
+        nPos2 = find(vDelimiter, nPos + 1);
+        nAdd1 = 0;
+    }
+    const std::string strSection(substr(nPos, strLen - nPos));
+    if ((strSection.length() != 0) && (strSection != vDelimiter))
+        vwVecSplits.push_back(strSection.c_str());
+
+    return vwVecSplits.size();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Splits string into array of strings using delimiter. However the string is
+//          also considered for text surrounded by quotes. Text with quotes including the
+//          delimiter is treated as a whole. If multiple delimiter are found in sequence
+//          then they are not added to the list of splits. Quotes that are embedded in the
+//          the string as string formatted quotes are ignored (proceeded by a '\\') i.e.
+//          "\"MI GDB local C++.cpp\":88".
+// Type:    Method.
+// Args:    vData       - (R) String data to be split up.
+//          vDelimiter  - (R) Delimiter char or text.
+//          vwVecSplits - (W) Container of splits found in string data.
+// Return:  MIuint - Number of splits found in the string data.
+// Throws:  None.
+//--
+MIuint
+CMIUtilString::SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const
+{
+    vwVecSplits.clear();
+
+    if (this->empty() || vDelimiter.empty())
+        return 0;
+
+    MIint nPos = find(vDelimiter);
+    if (nPos == (MIint)std::string::npos)
+    {
+        vwVecSplits.push_back(*this);
+        return 1;
+    }
+    const MIint strLen(length());
+    if (nPos == strLen)
+    {
+        vwVecSplits.push_back(*this);
+        return 1;
+    }
+
+    // Look for more quotes
+    bool bHaveQuotes = false;
+    const MIchar cBckSlash = '\\';
+    const MIchar cQuote = '"';
+    MIint nPosQ = find(cQuote);
+    MIint nPosQ2 = (MIint)std::string::npos;
+    if (nPosQ != (MIint)std::string::npos)
+    {
+        nPosQ2 = nPosQ + 1;
+        while (nPosQ2 < strLen)
+        {
+            nPosQ2 = find(cQuote, nPosQ2);
+            if ((nPosQ2 == (MIint)std::string::npos) || (at(nPosQ2 - 1) != cBckSlash))
+                break;
+            nPosQ2++;
+        }
+        bHaveQuotes = (nPosQ2 != (MIint)std::string::npos);
+    }
+
+    MIuint nAdd1(1);
+    if ((nPos > 0) && (substr(0, nPos) != vDelimiter))
+    {
+        nPos = 0;
+        nAdd1 = 0;
+    }
+    MIint nPos2 = find(vDelimiter, nPos + 1);
+    while (nPos2 != (MIint)std::string::npos)
+    {
+        if (!bHaveQuotes || (bHaveQuotes && ((nPos2 > nPosQ2) || (nPos2 < nPosQ))))
+        {
+            // Extract text or quoted text
+            const MIuint len(nPos2 - nPos - nAdd1);
+            const std::string strSection(substr(nPos + nAdd1, len));
+            if (strSection != vDelimiter)
+                vwVecSplits.push_back(strSection.c_str());
+            nPos += len + 1;
+            nPos2 = find(vDelimiter, nPos + 1);
+            nAdd1 = 0;
+
+            if (bHaveQuotes && (nPos2 > nPosQ2))
+            {
+                // Reset, look for more quotes
+                bHaveQuotes = false;
+                nPosQ = find(cQuote, nPos);
+                nPosQ2 = (MIint)std::string::npos;
+                if (nPosQ != (MIint)std::string::npos)
+                {
+                    nPosQ2 = find(cQuote, nPosQ + 1);
+                    bHaveQuotes = (nPosQ2 != (MIint)std::string::npos);
+                }
+            }
+        }
+        else
+        {
+            // Skip passed text in quotes
+            nPos2 = find(vDelimiter, nPosQ2 + 1);
+        }
+    }
+    const std::string strSection(substr(nPos, strLen - nPos));
+    if ((strSection.length() != 0) && (strSection != vDelimiter))
+        vwVecSplits.push_back(strSection.c_str());
+
+    return vwVecSplits.size();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Remove '\n' from the end of string if found. It does not alter
+//          *this string.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - New version of the string.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::StripCREndOfLine(void) const
+{
+    const MIint nPos = rfind('\n');
+    if (nPos == (MIint)std::string::npos)
+        return *this;
+
+    const CMIUtilString strNew(substr(0, nPos).c_str());
+
+    return strNew;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Remove all '\n' from the string and replace with a space. It does not alter
+//          *this string.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - New version of the string.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::StripCRAll(void) const
+{
+    return FindAndReplace("\n", " ");
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Find and replace all matches of a sub string with another string. It does not
+//          alter *this string.
+// Type:    Method.
+// Args:    vFind         - (R) The string to look for.
+//          vReplaceWith  - (R) The string to replace the vFind match.
+// Return:  CMIUtilString - New version of the string.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::FindAndReplace(const CMIUtilString &vFind, const CMIUtilString &vReplaceWith) const
+{
+    if (vFind.empty() || this->empty())
+        return *this;
+
+    MIint nPos = find(vFind);
+    if (nPos == (MIint)std::string::npos)
+        return *this;
+
+    CMIUtilString strNew(*this);
+    while (nPos != (MIint)std::string::npos)
+    {
+        strNew.replace(nPos, vFind.length(), vReplaceWith);
+        nPos += vReplaceWith.length();
+        nPos = strNew.find(vFind, nPos);
+    }
+
+    return strNew;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Check if *this string is a decimal number.
+// Type:    Method.
+// Args:    None.
+// Return:  bool - True = yes number, false not a number.
+// Throws:  None.
+//--
+bool
+CMIUtilString::IsNumber(void) const
+{
+    if (empty())
+        return false;
+
+    if ((at(0) == '-') && (length() == 1))
+        return false;
+
+    const MIint nPos = find_first_not_of("-.0123456789");
+    if (nPos != (MIint)std::string::npos)
+        return false;
+
+    return true;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Extract the number from the string. The number can be either a hexadecimal or
+//          natural number. It cannot contain other non-numeric characters.
+// Type:    Method.
+// Args:    vwrNumber   - (W) Number exracted from the string.
+// Return:  bool - True = yes number, false not a number.
+// Throws:  None.
+//--
+bool
+CMIUtilString::ExtractNumber(MIint64 &vwrNumber) const
+{
+    vwrNumber = 0;
+
+    if (!IsNumber())
+    {
+        if (ExtractNumberFromHexadecimal(vwrNumber))
+            return true;
+
+        return false;
+    }
+
+    std::stringstream ss(const_cast<CMIUtilString &>(*this));
+    ss >> vwrNumber;
+
+    return true;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Extract the number from the hexadecimal string..
+// Type:    Method.
+// Args:    vwrNumber   - (W) Number exracted from the string.
+// Return:  bool - True = yes number, false not a number.
+// Throws:  None.
+//--
+bool
+CMIUtilString::ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const
+{
+    vwrNumber = 0;
+
+    const MIint nPos = find_first_not_of("x01234567890ABCDEFabcedf");
+    if (nPos != (MIint)std::string::npos)
+        return false;
+
+    const MIint64 nNum = ::strtoul(this->c_str(), nullptr, 16);
+    if (nNum != LONG_MAX)
+    {
+        vwrNumber = nNum;
+        return true;
+    }
+
+    return true;
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Determine if the text is all valid alpha numeric characters. Letters can be
+//          either upper or lower case.
+// Type:    Static method.
+// Args:    vrText  - (R) The text data to examine.
+// Return:  bool - True = yes all alpha, false = one or more chars is non alpha.
+// Throws:  None.
+//--
+bool
+CMIUtilString::IsAllValidAlphaAndNumeric(const MIchar &vrText)
+{
+    const MIuint len = ::strlen(&vrText);
+    if (len == 0)
+        return false;
+
+    MIchar *pPtr = const_cast<MIchar *>(&vrText);
+    for (MIuint i = 0; i < len; i++, pPtr++)
+    {
+        const MIchar c = *pPtr;
+        if (::isalnum((int)c) == 0)
+            return false;
+    }
+
+    return true;
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: Check if two strings share equal contents.
-// Type:	Method.
-// Args:	vrLhs	- (R) String A.
-//			vrRhs	- (R) String B.
-// Return:	bool - True = yes equal, false - different.
-// Throws:	None.
-//--
-bool CMIUtilString::Compare( const CMIUtilString & vrLhs, const CMIUtilString & vrRhs )
-{
-	// Check the sizes match
-	if( vrLhs.size() != vrRhs.size() )
-		return false;
+// Type:    Method.
+// Args:    vrLhs   - (R) String A.
+//          vrRhs   - (R) String B.
+// Return:  bool - True = yes equal, false - different.
+// Throws:  None.
+//--
+bool
+CMIUtilString::Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs)
+{
+    // Check the sizes match
+    if (vrLhs.size() != vrRhs.size())
+        return false;
 
-	return (::strncmp( vrLhs.c_str(), vrRhs.c_str(), vrLhs.size() ) == 0);
+    return (::strncmp(vrLhs.c_str(), vrRhs.c_str(), vrLhs.size()) == 0);
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: Remove from either end of *this string the following: " \t\n\v\f\r".
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Trimmed string.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::Trim( void ) const
-{
-	CMIUtilString strNew( *this );
-	const MIchar * pWhiteSpace = " \t\n\v\f\r";
-	const MIint nPos = find_last_not_of( pWhiteSpace );
-	if( nPos != (MIint) std::string::npos )
-	{
-		strNew = substr( 0, nPos + 1 ).c_str();
-	}
-	const MIint nPos2 = strNew.find_first_not_of( pWhiteSpace );
-	if( nPos2 != (MIint) std::string::npos )
-	{
-		strNew = strNew.substr( nPos2 ).c_str();
-	}
-	
-	return strNew;
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Trimmed string.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::Trim(void) const
+{
+    CMIUtilString strNew(*this);
+    const MIchar *pWhiteSpace = " \t\n\v\f\r";
+    const MIint nPos = find_last_not_of(pWhiteSpace);
+    if (nPos != (MIint)std::string::npos)
+    {
+        strNew = substr(0, nPos + 1).c_str();
+    }
+    const MIint nPos2 = strNew.find_first_not_of(pWhiteSpace);
+    if (nPos2 != (MIint)std::string::npos)
+    {
+        strNew = strNew.substr(nPos2).c_str();
+    }
+
+    return strNew;
 }
-	
+
 //++ ------------------------------------------------------------------------------------
 // Details: Remove from either end of *this string the specified character.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Trimmed string.
-// Throws:	None.
-//--
-CMIUtilString CMIUtilString::Trim( const MIchar vChar ) const
-{
-	CMIUtilString strNew( *this );
-	const MIint nLen = strNew.length();
-	if( nLen > 1 )
-	{
-		if( (strNew[ 0 ] == vChar) && (strNew[ nLen -  1 ] == vChar) )
-			strNew = strNew.substr( 1, nLen - 2 ).c_str();
-	}
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Trimmed string.
+// Throws:  None.
+//--
+CMIUtilString
+CMIUtilString::Trim(const MIchar vChar) const
+{
+    CMIUtilString strNew(*this);
+    const MIint nLen = strNew.length();
+    if (nLen > 1)
+    {
+        if ((strNew[0] == vChar) && (strNew[nLen - 1] == vChar))
+            strNew = strNew.substr(1, nLen - 2).c_str();
+    }
 
-	return strNew;
+    return strNew;
 }
-	
+
 //++ ------------------------------------------------------------------------------------
 // Details: Do a printf equivalent for printing a number in binary i.e. "b%llB".
-// Type:	Static method.
-// Args:	vnDecimal	- (R) The number to represent in binary.
-// Return:	CMIUtilString - Binary number in text.
-// Throws:	None.
+// Type:    Static method.
+// Args:    vnDecimal   - (R) The number to represent in binary.
+// Return:  CMIUtilString - Binary number in text.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilString::FormatBinary( const MIuint64 vnDecimal )
+CMIUtilString
+CMIUtilString::FormatBinary(const MIuint64 vnDecimal)
 {
-	CMIUtilString strBinaryNumber;
+    CMIUtilString strBinaryNumber;
 
-	const MIuint nConstBits = 64;
-	MIuint nRem[ nConstBits + 1 ];
-	MIint i = 0;
-	MIuint nLen = 0;
-	MIuint64 nNum = vnDecimal;
-	while( (nNum > 0) && (nLen < nConstBits) )
-	{
-		nRem[ i++ ] = nNum % 2;
-		nNum = nNum >> 1;
-		nLen++;
-	}
-	MIchar pN[ nConstBits + 1 ];
-	MIuint j = 0;
-	for( i = nLen; i > 0; --i, j++ )
-	{
-		pN[ j ] = '0' + nRem[ i - 1 ];
-	}
-	pN[ j ] = 0; // String NUL termination
+    const MIuint nConstBits = 64;
+    MIuint nRem[nConstBits + 1];
+    MIint i = 0;
+    MIuint nLen = 0;
+    MIuint64 nNum = vnDecimal;
+    while ((nNum > 0) && (nLen < nConstBits))
+    {
+        nRem[i++] = nNum % 2;
+        nNum = nNum >> 1;
+        nLen++;
+    }
+    MIchar pN[nConstBits + 1];
+    MIuint j = 0;
+    for (i = nLen; i > 0; --i, j++)
+    {
+        pN[j] = '0' + nRem[i - 1];
+    }
+    pN[j] = 0; // String NUL termination
 
-	strBinaryNumber = CMIUtilString::Format( "0b%s", &pN[ 0 ] );
+    strBinaryNumber = CMIUtilString::Format("0b%s", &pN[0]);
 
-	return strBinaryNumber;
+    return strBinaryNumber;
 }
-	
+
 //++ ------------------------------------------------------------------------------------
-// Details:	Remove from a string doubled up characters so only one set left. Characters
-//			are only removed if the previous character is already a same character.
-// Type:	Method.
-// Args:	vChar	- (R) The character to search for and remove adjacent duplicates.
-// Return:	CMIUtilString - New version of the string.
-// Throws:	None.
+// Details: Remove from a string doubled up characters so only one set left. Characters
+//          are only removed if the previous character is already a same character.
+// Type:    Method.
+// Args:    vChar   - (R) The character to search for and remove adjacent duplicates.
+// Return:  CMIUtilString - New version of the string.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilString::RemoveRepeatedCharacters( const MIchar vChar )
+CMIUtilString
+CMIUtilString::RemoveRepeatedCharacters(const MIchar vChar)
 {
-	return RemoveRepeatedCharacters( 0, vChar );
+    return RemoveRepeatedCharacters(0, vChar);
 }
-	
+
 //++ ------------------------------------------------------------------------------------
-// Details:	Recursively remove from a string doubled up characters so only one set left. 
-//			Characters are only removed if the previous character is already a same 
-//			character.
-// Type:	Method.
-// Args:	vChar	- (R) The character to search for and remove adjacent duplicates.
-//			vnPos	- (R) Character position in the string.
-// Return:	CMIUtilString - New version of the string.
-// Throws:	None.
+// Details: Recursively remove from a string doubled up characters so only one set left.
+//          Characters are only removed if the previous character is already a same
+//          character.
+// Type:    Method.
+// Args:    vChar   - (R) The character to search for and remove adjacent duplicates.
+//          vnPos   - (R) Character position in the string.
+// Return:  CMIUtilString - New version of the string.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilString::RemoveRepeatedCharacters( const MIint vnPos, const MIchar vChar )
+CMIUtilString
+CMIUtilString::RemoveRepeatedCharacters(const MIint vnPos, const MIchar vChar)
 {
-	const MIchar cQuote = '"';
+    const MIchar cQuote = '"';
 
-	// Look for first quote of two
-	MIint nPos = find( cQuote, vnPos );
-	if( nPos == (MIint) std::string::npos )
-		return *this;
+    // Look for first quote of two
+    MIint nPos = find(cQuote, vnPos);
+    if (nPos == (MIint)std::string::npos)
+        return *this;
 
-	const MIint nPosNext = nPos + 1;
-	if( nPosNext > (MIint) length() )
-		return *this;
+    const MIint nPosNext = nPos + 1;
+    if (nPosNext > (MIint)length())
+        return *this;
 
-	if( at( nPosNext ) == cQuote )
-	{
-		*this = substr( 0, nPos ) + substr( nPosNext, length() );
-		RemoveRepeatedCharacters( nPosNext, vChar );
-	}	
+    if (at(nPosNext) == cQuote)
+    {
+        *this = substr(0, nPos) + substr(nPosNext, length());
+        RemoveRepeatedCharacters(nPosNext, vChar);
+    }
 
-	return *this;
+    return *this;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Is the text in *this string surrounded by quotes.
-// Type:	Method.
-// Args:	None.
-// Return:	bool - True = Yes string is quoted, false = no quoted.
-// Throws:	None.
+// Details: Is the text in *this string surrounded by quotes.
+// Type:    Method.
+// Args:    None.
+// Return:  bool - True = Yes string is quoted, false = no quoted.
+// Throws:  None.
 //--
-bool CMIUtilString::IsQuoted( void ) const
+bool
+CMIUtilString::IsQuoted(void) const
 {
-	const MIchar cQuote = '"';
-	
-	if( at( 0 ) != cQuote )
-		return false;
+    const MIchar cQuote = '"';
+
+    if (at(0) != cQuote)
+        return false;
 
-	const MIint nLen = length();
-	if( (nLen > 0) && (at( nLen - 1 ) != cQuote) )
-		return false;
+    const MIint nLen = length();
+    if ((nLen > 0) && (at(nLen - 1) != cQuote))
+        return false;
 
-	return true;
+    return true;
 }
-	
\ No newline at end of file

Modified: lldb/trunk/tools/lldb-mi/MIUtilString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilString.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilString.h
+// File:        MIUtilString.h
 //
-// Overview:	CMIUtilString interface.
+// Overview:    CMIUtilString interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -26,60 +26,60 @@
 #include <vector>
 
 // In-house headers:
-#include "MIDataTypes.h"  
+#include "MIDataTypes.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Used to help handle text. 
-//			Derived from std::string
-// Gotchas:	None.
-// Authors:	Illya Rudkin 02/02/2014.
-// Changes:	None.
+// Details: MI common code utility class. Used to help handle text.
+//          Derived from std::string
+// Gotchas: None.
+// Authors: Illya Rudkin 02/02/2014.
+// Changes: None.
 //--
 class CMIUtilString : public std::string
 {
-// Typdefs:
-public:
-	typedef std::vector< CMIUtilString >	VecString_t;
-
-// Static method:
-public:
-	static CMIUtilString	Format( const CMIUtilString vFormating, ... );
-	static CMIUtilString	FormatBinary( const MIuint64 vnDecimal );
-	static CMIUtilString	FormatValist( const CMIUtilString & vrFormating, va_list vArgs );
-	static bool				IsAllValidAlphaAndNumeric( const MIchar & vrText );
-	static bool             Compare( const CMIUtilString & vrLhs, const CMIUtilString & vrRhs );
-
-// Methods:
-public:
-	/* ctor */	CMIUtilString( void );
-	/* ctor */	CMIUtilString( const MIchar * vpData );
-	/* ctor */	CMIUtilString( const MIchar * const * vpData );
-	//
-	bool			ExtractNumber( MIint64 & vwrNumber ) const;
-	CMIUtilString	FindAndReplace( const CMIUtilString & vFind, const CMIUtilString & vReplaceWith ) const;
-	bool			IsNumber( void ) const;
-	bool			IsQuoted( void ) const;
-	CMIUtilString	RemoveRepeatedCharacters( const MIchar vChar );
-	MIuint			Split( const CMIUtilString & vDelimiter, VecString_t & vwVecSplits ) const;
-	MIuint			SplitConsiderQuotes( const CMIUtilString & vDelimiter, VecString_t & vwVecSplits ) const;
-	CMIUtilString	StripCREndOfLine( void ) const;
-	CMIUtilString	StripCRAll( void ) const;
-	CMIUtilString	Trim( void ) const;
-	CMIUtilString	Trim( const MIchar vChar ) const;
-	// 
-	CMIUtilString & operator= ( const MIchar * vpRhs );
-	CMIUtilString & operator= ( const std::string & vrRhs );
-	
-// Overrideable:
-public:
-	/* dtor */ virtual ~CMIUtilString( void );
-	
-// Static method:
-private:
-	static CMIUtilString	FormatPriv( const CMIUtilString & vrFormat, va_list vArgs );
-
-// Methods:
-private:
-	bool			ExtractNumberFromHexadecimal( MIint64 & vwrNumber ) const;
-	CMIUtilString	RemoveRepeatedCharacters( const MIint vnPos, const MIchar vChar );
+    // Typdefs:
+  public:
+    typedef std::vector<CMIUtilString> VecString_t;
+
+    // Static method:
+  public:
+    static CMIUtilString Format(const CMIUtilString vFormating, ...);
+    static CMIUtilString FormatBinary(const MIuint64 vnDecimal);
+    static CMIUtilString FormatValist(const CMIUtilString &vrFormating, va_list vArgs);
+    static bool IsAllValidAlphaAndNumeric(const MIchar &vrText);
+    static bool Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs);
+
+    // Methods:
+  public:
+    /* ctor */ CMIUtilString(void);
+    /* ctor */ CMIUtilString(const MIchar *vpData);
+    /* ctor */ CMIUtilString(const MIchar *const *vpData);
+    //
+    bool ExtractNumber(MIint64 &vwrNumber) const;
+    CMIUtilString FindAndReplace(const CMIUtilString &vFind, const CMIUtilString &vReplaceWith) const;
+    bool IsNumber(void) const;
+    bool IsQuoted(void) const;
+    CMIUtilString RemoveRepeatedCharacters(const MIchar vChar);
+    MIuint Split(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const;
+    MIuint SplitConsiderQuotes(const CMIUtilString &vDelimiter, VecString_t &vwVecSplits) const;
+    CMIUtilString StripCREndOfLine(void) const;
+    CMIUtilString StripCRAll(void) const;
+    CMIUtilString Trim(void) const;
+    CMIUtilString Trim(const MIchar vChar) const;
+    //
+    CMIUtilString &operator=(const MIchar *vpRhs);
+    CMIUtilString &operator=(const std::string &vrRhs);
+
+    // Overrideable:
+  public:
+    /* dtor */ virtual ~CMIUtilString(void);
+
+    // Static method:
+  private:
+    static CMIUtilString FormatPriv(const CMIUtilString &vrFormat, va_list vArgs);
+
+    // Methods:
+  private:
+    bool ExtractNumberFromHexadecimal(MIint64 &vwrNumber) const;
+    CMIUtilString RemoveRepeatedCharacters(const MIint vnPos, const MIchar vChar);
 };

Modified: lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp Mon Nov 17 12:06:21 2014
@@ -8,112 +8,116 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilSystemLinux.cpp
+// File:        MIUtilSystemLinux.cpp
 //
-// Overview:	CMIUtilSystemLinux implementation.
+// Overview:    CMIUtilSystemLinux implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
-#if defined( __FreeBSD__ ) || defined( __linux__ )
+#if defined(__FreeBSD__) || defined(__linux__)
 
 // In-house headers:
 #include "MIUtilSystemLinux.h"
 #include "MICmnResources.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilSystemLinux constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilSystemLinux constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilSystemLinux::CMIUtilSystemLinux( void )
+CMIUtilSystemLinux::CMIUtilSystemLinux(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilSystemLinux destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilSystemLinux destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilSystemLinux::~CMIUtilSystemLinux( void )
+CMIUtilSystemLinux::~CMIUtilSystemLinux(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the OS system error message for the given system error code. 
-// Type:	Method.
-// Args:	vError		- (R) OS error code value.
-//			vrwErrorMsg	- (W) The error message.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieve the OS system error message for the given system error code.
+// Type:    Method.
+// Args:    vError      - (R) OS error code value.
+//          vrwErrorMsg - (W) The error message.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemLinux::GetOSErrorMsg( const MIint vError, CMIUtilString & vrwErrorMsg  ) const
+bool
+CMIUtilSystemLinux::GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const
 {
-	// Reset
-	vrwErrorMsg.clear();
+    // Reset
+    vrwErrorMsg.clear();
 
-	bool bOk = MIstatus::failure;
-	
-	// ToDo: Implement LINUX version
-	
-	return bOk;
+    bool bOk = MIstatus::failure;
+
+    // ToDo: Implement LINUX version
+
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve if possible the OS last error description.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Error description.
-// Throws:	None.
+// Details: Retrieve if possible the OS last error description.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Error description.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilSystemLinux::GetOSLastError( void ) const
+CMIUtilString
+CMIUtilSystemLinux::GetOSLastError(void) const
 {
-	CMIUtilString errorMsg( "Error fn not implemented " );
-	
-	// ToDo: Implement LINUX version
-		
-	return errorMsg;
+    CMIUtilString errorMsg("Error fn not implemented ");
+
+    // ToDo: Implement LINUX version
+
+    return errorMsg;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieves the fully qualified path for the this application. If the function
-//			fails the string is filled with the error message.
-// Type:	Method.
-// Args:	vrwFileNamePath	- (W) The excutable's name and path or last error description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieves the fully qualified path for the this application. If the function
+//          fails the string is filled with the error message.
+// Type:    Method.
+// Args:    vrwFileNamePath - (W) The excutable's name and path or last error description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemLinux::GetExecutablesPath( CMIUtilString & vrwFileNamePath ) const
+bool
+CMIUtilSystemLinux::GetExecutablesPath(CMIUtilString &vrwFileNamePath) const
 {
-	vrwFileNamePath = CMIUtilString( "." );
-	return MIstatus::success;
+    vrwFileNamePath = CMIUtilString(".");
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieves the fully qualified path for the Log file for this application. 
-//			If the function fails the string is filled with the error message.
-//			Append a dummy file name on the end of the path. This will be stripped off
-//			later and the real log file name replaces it.
-// Type:	Method.
-// Args:	vrwFileNamePath	- (W) The Log file's name and path or last error description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieves the fully qualified path for the Log file for this application.
+//          If the function fails the string is filled with the error message.
+//          Append a dummy file name on the end of the path. This will be stripped off
+//          later and the real log file name replaces it.
+// Type:    Method.
+// Args:    vrwFileNamePath - (W) The Log file's name and path or last error description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemLinux::GetLogFilesPath( CMIUtilString & vrwFileNamePath ) const
+bool
+CMIUtilSystemLinux::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const
 {
-	vrwFileNamePath = CMIUtilString( "." );
-	return MIstatus::success;
+    vrwFileNamePath = CMIUtilString(".");
+    return MIstatus::success;
 }
 
 #endif // #if defined( __linux__ )

Modified: lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h Mon Nov 17 12:06:21 2014
@@ -8,48 +8,48 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		CMIUtilSystemLinux.h
+// File:        CMIUtilSystemLinux.h
 //
-// Overview:	CMIUtilSystemLinux interface.
+// Overview:    CMIUtilSystemLinux interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
 
-#if defined( __FreeBSD__ ) || defined( __linux__ )
+#if defined(__FreeBSD__) || defined(__linux__)
 
 // In-house headers:
-#include "MIUtilString.h"  
+#include "MIUtilString.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Used to set or retrieve information
-//			about the current system or user.
-//			*** If you change, remove or add functionality it must be replicated
-//			*** for the all platforms supported; Windows, OSX, LINUX 
-// Gotchas:	None.
-// Authors:	Illya Rudkin 29/01/2014.
-// Changes:	None.
+// Details: MI common code utility class. Used to set or retrieve information
+//          about the current system or user.
+//          *** If you change, remove or add functionality it must be replicated
+//          *** for the all platforms supported; Windows, OSX, LINUX
+// Gotchas: None.
+// Authors: Illya Rudkin 29/01/2014.
+// Changes: None.
 //--
 class CMIUtilSystemLinux
 {
-// Methods:
-public:
-	/* ctor */	CMIUtilSystemLinux( void );
-	
-	bool			GetOSErrorMsg( const MIint vError, CMIUtilString & vrwErrorMsg ) const;
-	CMIUtilString	GetOSLastError( void ) const;
-	bool			GetExecutablesPath( CMIUtilString & vrwFileNamePath ) const;
-	bool			GetLogFilesPath( CMIUtilString & vrwFileNamePath ) const;
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilSystemLinux( void );
+    // Methods:
+  public:
+    /* ctor */ CMIUtilSystemLinux(void);
+
+    bool GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const;
+    CMIUtilString GetOSLastError(void) const;
+    bool GetExecutablesPath(CMIUtilString &vrwFileNamePath) const;
+    bool GetLogFilesPath(CMIUtilString &vrwFileNamePath) const;
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilSystemLinux(void);
 };
 
 typedef CMIUtilSystemLinux CMIUtilSystem;

Modified: lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp Mon Nov 17 12:06:21 2014
@@ -8,112 +8,116 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilSystemOsx.cpp
+// File:        MIUtilSystemOsx.cpp
 //
-// Overview:	CMIUtilSystemOsx implementation.
+// Overview:    CMIUtilSystemOsx implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
-#if defined( __APPLE__ )
+#if defined(__APPLE__)
 
 // In-house headers:
 #include "MIUtilSystemOsx.h"
 #include "MICmnResources.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilSystemOsx constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilSystemOsx constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilSystemOsx::CMIUtilSystemOsx( void )
+CMIUtilSystemOsx::CMIUtilSystemOsx(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilSystemOsx destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilSystemOsx destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilSystemOsx::~CMIUtilSystemOsx( void )
+CMIUtilSystemOsx::~CMIUtilSystemOsx(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the OS system error message for the given system error code. 
-// Type:	Method.
-// Args:	vError		- (R) OS error code value.
-//			vrwErrorMsg	- (W) The error message.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieve the OS system error message for the given system error code.
+// Type:    Method.
+// Args:    vError		- (R) OS error code value.
+//          vrwErrorMsg	- (W) The error message.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemOsx::GetOSErrorMsg( const MIint vError, CMIUtilString & vrwErrorMsg  ) const
+bool
+CMIUtilSystemOsx::GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const
 {
-	// Reset
-	vrwErrorMsg.clear();
+    // Reset
+    vrwErrorMsg.clear();
 
-	bool bOk = MIstatus::failure;
-	
-	// ToDo: Implement LINUX version
-	
-	return bOk;
+    bool bOk = MIstatus::failure;
+
+    // ToDo: Implement LINUX version
+
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve if possible the OS last error description.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Error description.
-// Throws:	None.
+// Details: Retrieve if possible the OS last error description.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Error description.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilSystemOsx::GetOSLastError( void ) const
+CMIUtilString
+CMIUtilSystemOsx::GetOSLastError(void) const
 {
-	CMIUtilString errorMsg( "Error fn not implemented" );
-	
-	// ToDo: Implement LINUX version
-		
-	return errorMsg;
+    CMIUtilString errorMsg("Error fn not implemented");
+
+    // ToDo: Implement LINUX version
+
+    return errorMsg;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieves the fully qualified path for the this application. If the function
-//			fails the string is filled with the error message.
-// Type:	Method.
-// Args:	vrwFileNamePath	- (W) The excutable's name and path or last error description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieves the fully qualified path for the this application. If the function
+//          fails the string is filled with the error message.
+// Type:    Method.
+// Args:    vrwFileNamePath	- (W) The excutable's name and path or last error description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemOsx::GetExecutablesPath( CMIUtilString & vrwFileNamePath ) const
+bool
+CMIUtilSystemOsx::GetExecutablesPath(CMIUtilString &vrwFileNamePath) const
 {
-	vrwFileNamePath = CMIUtilString( "." );
-	return MIstatus::success;
+    vrwFileNamePath = CMIUtilString(".");
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieves the fully qualified path for the Log file for this application. 
-//			If the function fails the string is filled with the error message.
-//			Append a dummy file name on the end of the path. This will be stripped off
-//			later and the real log file name replaces it.
-// Type:	Method.
-// Args:	vrwFileNamePath	- (W) The Log file's name and path or last error description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieves the fully qualified path for the Log file for this application.
+//          If the function fails the string is filled with the error message.
+//          Append a dummy file name on the end of the path. This will be stripped off
+//          later and the real log file name replaces it.
+// Type:    Method.
+// Args:    vrwFileNamePath	- (W) The Log file's name and path or last error description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemOsx::GetLogFilesPath( CMIUtilString & vrwFileNamePath ) const
+bool
+CMIUtilSystemOsx::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const
 {
-	vrwFileNamePath = CMIUtilString( "." );
-	return MIstatus::success;
+    vrwFileNamePath = CMIUtilString(".");
+    return MIstatus::success;
 }
 
 #endif // #if defined( __APPLE__ )

Modified: lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h Mon Nov 17 12:06:21 2014
@@ -8,48 +8,48 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		CMIUtilSystemOsx.h
+// File:        CMIUtilSystemOsx.h
 //
-// Overview:	CMIUtilSystemOsx interface.
+// Overview:    CMIUtilSystemOsx interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
 
-#if defined( __APPLE__ )
+#if defined(__APPLE__)
 
 // In-house headers:
-#include "MIUtilString.h"  
+#include "MIUtilString.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Used to set or retrieve information
-//			about the current system or user.
-//			*** If you change, remove or add functionality it must be replicated
-//			*** for the all platforms supported; Windows, OSX, LINUX 
-// Gotchas:	None.
-// Authors:	Illya Rudkin 29/01/2014.
-// Changes:	None.
+// Details: MI common code utility class. Used to set or retrieve information
+//          about the current system or user.
+//          *** If you change, remove or add functionality it must be replicated
+//          *** for the all platforms supported; Windows, OSX, LINUX
+// Gotchas: None.
+// Authors: Illya Rudkin 29/01/2014.
+// Changes: None.
 //--
 class CMIUtilSystemOsx
 {
-// Methods:
-public:
-	/* ctor */	CMIUtilSystemOsx( void );
-	
-	bool			GetOSErrorMsg( const MIint vError, CMIUtilString & vrwErrorMsg ) const;
-	CMIUtilString	GetOSLastError( void ) const;
-	bool			GetExecutablesPath( CMIUtilString & vrwFileNamePath ) const;
-	bool			GetLogFilesPath( CMIUtilString & vrwFileNamePath ) const;
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilSystemOsx( void );
+    // Methods:
+  public:
+    /* ctor */ CMIUtilSystemOsx(void);
+
+    bool GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const;
+    CMIUtilString GetOSLastError(void) const;
+    bool GetExecutablesPath(CMIUtilString &vrwFileNamePath) const;
+    bool GetLogFilesPath(CMIUtilString &vrwFileNamePath) const;
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilSystemOsx(void);
 };
 
 typedef CMIUtilSystemOsx CMIUtilSystem;

Modified: lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp Mon Nov 17 12:06:21 2014
@@ -8,144 +8,146 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilSystemWindows.cpp
+// File:        MIUtilSystemWindows.cpp
 //
-// Overview:	CMIUtilSystemWindows implementation.
+// Overview:    CMIUtilSystemWindows implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
-#if defined( _MSC_VER )
+#if defined(_MSC_VER)
 
 // Third party headers
-#include <memory>		// std::unique_ptr
+#include <memory> // std::unique_ptr
 #include <Windows.h>
-#include <WinBase.h>	// ::FormatMessage()
+#include <WinBase.h> // ::FormatMessage()
 
 // In-house headers:
 #include "MIUtilSystemWindows.h"
 #include "MICmnResources.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilSystemWindows constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilSystemWindows constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilSystemWindows::CMIUtilSystemWindows( void )
+CMIUtilSystemWindows::CMIUtilSystemWindows(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilSystemWindows destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilSystemWindows destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilSystemWindows::~CMIUtilSystemWindows( void )
+CMIUtilSystemWindows::~CMIUtilSystemWindows(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the OS system error message for the given system error code. 
-// Type:	Method.
-// Args:	vError		- (R) OS error code value.
-//			vrwErrorMsg	- (W) The error message.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieve the OS system error message for the given system error code.
+// Type:    Method.
+// Args:    vError      - (R) OS error code value.
+//          vrwErrorMsg - (W) The error message.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemWindows::GetOSErrorMsg( const MIint vError, CMIUtilString & vrwErrorMsg  ) const
+bool
+CMIUtilSystemWindows::GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const
 {
-	// Reset
-	vrwErrorMsg.clear();
+    // Reset
+    vrwErrorMsg.clear();
 
-	const MIuint nBufLen = 1024;
-	std::unique_ptr< char[] > pBuffer;
-	pBuffer.reset( new char[ nBufLen ] ); 
-		
-	// CMIUtilString Format is not used as cannot replicate the behavior of ::FormatMessage which
-	// can take into account locality while retrieving the error message from the system.
-	const int nLength = ::FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-										nullptr, (DWORD) vError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), 
-										reinterpret_cast< LPTSTR >( &pBuffer[ 0 ] ),
-										nBufLen, nullptr );
-	bool bOk = MIstatus::success;
-	if( nLength != 0 )
-		vrwErrorMsg = &pBuffer[ 0 ];
-	else
-		bOk = MIstatus::failure;
+    const MIuint nBufLen = 1024;
+    std::unique_ptr<char[]> pBuffer;
+    pBuffer.reset(new char[nBufLen]);
 
-	return bOk;
+    // CMIUtilString Format is not used as cannot replicate the behavior of ::FormatMessage which
+    // can take into account locality while retrieving the error message from the system.
+    const int nLength = ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, (DWORD)vError,
+                                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPTSTR>(&pBuffer[0]), nBufLen, nullptr);
+    bool bOk = MIstatus::success;
+    if (nLength != 0)
+        vrwErrorMsg = &pBuffer[0];
+    else
+        bOk = MIstatus::failure;
+
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve if possible the OS last error description.
-// Type:	Method.
-// Args:	None.
-// Return:	CMIUtilString - Error description.
-// Throws:	None.
+// Details: Retrieve if possible the OS last error description.
+// Type:    Method.
+// Args:    None.
+// Return:  CMIUtilString - Error description.
+// Throws:  None.
 //--
-CMIUtilString CMIUtilSystemWindows::GetOSLastError( void ) const
+CMIUtilString
+CMIUtilSystemWindows::GetOSLastError(void) const
 {
-	CMIUtilString errorMsg;
-	const DWORD dwLastError = ::GetLastError();
-	if( dwLastError != 0 )
-	{
-		if( !GetOSErrorMsg( dwLastError, errorMsg ) )
-			errorMsg = MIRSRC( IDE_OS_ERR_RETRIEVING );
-	}
-	else
-		errorMsg = MIRSRC( IDE_OS_ERR_UNKNOWN );
-	
-	return errorMsg;
+    CMIUtilString errorMsg;
+    const DWORD dwLastError = ::GetLastError();
+    if (dwLastError != 0)
+    {
+        if (!GetOSErrorMsg(dwLastError, errorMsg))
+            errorMsg = MIRSRC(IDE_OS_ERR_RETRIEVING);
+    }
+    else
+        errorMsg = MIRSRC(IDE_OS_ERR_UNKNOWN);
+
+    return errorMsg;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieves the fully qualified path for the this application. If the function
-//			fails the string is filled with the error message.
-// Type:	Method.
-// Args:	vrwFileNamePath	- (W) The excutable's name and path or last error description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieves the fully qualified path for the this application. If the function
+//          fails the string is filled with the error message.
+// Type:    Method.
+// Args:    vrwFileNamePath   - (W) The excutable's name and path or last error description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemWindows::GetExecutablesPath( CMIUtilString & vrwFileNamePath ) const
+bool
+CMIUtilSystemWindows::GetExecutablesPath(CMIUtilString &vrwFileNamePath) const
 {
-	bool bOk = MIstatus::success;
-	HMODULE hModule = ::GetModuleHandle( nullptr );
-	char pPath[ MAX_PATH ];
-	const DWORD nLen = ::GetModuleFileName( hModule, &pPath[ 0 ], MAX_PATH );
-	const CMIUtilString strLastErr( GetOSLastError() );
-	if( (nLen != 0) && (strLastErr == "Unknown OS error") )
-		vrwFileNamePath = &pPath[ 0 ];
-	else
-	{
-		bOk = MIstatus::failure;
-		vrwFileNamePath = strLastErr;
-	}
+    bool bOk = MIstatus::success;
+    HMODULE hModule = ::GetModuleHandle(nullptr);
+    char pPath[MAX_PATH];
+    const DWORD nLen = ::GetModuleFileName(hModule, &pPath[0], MAX_PATH);
+    const CMIUtilString strLastErr(GetOSLastError());
+    if ((nLen != 0) && (strLastErr == "Unknown OS error"))
+        vrwFileNamePath = &pPath[0];
+    else
+    {
+        bOk = MIstatus::failure;
+        vrwFileNamePath = strLastErr;
+    }
 
-	return bOk;
+    return bOk;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieves the fully qualified path for the Log file for this application. 
-//			If the function fails the string is filled with the error message.
-// Type:	Method.
-// Args:	vrwFileNamePath	- (W) The Log file's name and path or last error description.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Retrieves the fully qualified path for the Log file for this application.
+//          If the function fails the string is filled with the error message.
+// Type:    Method.
+// Args:    vrwFileNamePath   - (W) The Log file's name and path or last error description.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilSystemWindows::GetLogFilesPath( CMIUtilString & vrwFileNamePath ) const
+bool
+CMIUtilSystemWindows::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const
 {
-	return GetExecutablesPath( vrwFileNamePath );
+    return GetExecutablesPath(vrwFileNamePath);
 }
 
 #endif // #if defined( _MSC_VER )

Modified: lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h Mon Nov 17 12:06:21 2014
@@ -8,47 +8,47 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilSystemWindows.h
+// File:        MIUtilSystemWindows.h
 //
-// Overview:	CMIUtilSystemWindows interface.
+// Overview:    CMIUtilSystemWindows interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 #pragma once
 
-#if defined( _MSC_VER )
+#if defined(_MSC_VER)
 
 // In-house headers:
-#include "MIUtilString.h"  
+#include "MIUtilString.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Used to set or retrieve information
-//			about the current system or user.
-//			*** If you change, remove or add functionality it must be replicated
-//			*** for the all platforms supported; Windows, OSX, LINUX 
-// Gotchas:	None.
-// Authors:	Illya Rudkin 29/01/2014.
-// Changes:	None.
+// Details: MI common code utility class. Used to set or retrieve information
+//          about the current system or user.
+//          *** If you change, remove or add functionality it must be replicated
+//          *** for the all platforms supported; Windows, OSX, LINUX
+// Gotchas: None.
+// Authors: Illya Rudkin 29/01/2014.
+// Changes: None.
 //--
 class CMIUtilSystemWindows
 {
-// Methods:
-public:
-	/* ctor */	CMIUtilSystemWindows( void );
-
-	bool			GetOSErrorMsg( const MIint vError, CMIUtilString & vrwErrorMsg ) const;
-	CMIUtilString	GetOSLastError( void ) const;
-	bool			GetExecutablesPath( CMIUtilString & vrwFileNamePath ) const;
-	bool			GetLogFilesPath( CMIUtilString & vrwFileNamePath ) const;
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilSystemWindows( void );
+    // Methods:
+  public:
+    /* ctor */ CMIUtilSystemWindows(void);
+
+    bool GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const;
+    CMIUtilString GetOSLastError(void) const;
+    bool GetExecutablesPath(CMIUtilString &vrwFileNamePath) const;
+    bool GetLogFilesPath(CMIUtilString &vrwFileNamePath) const;
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilSystemWindows(void);
 };
 
 typedef CMIUtilSystemWindows CMIUtilSystem;

Modified: lldb/trunk/tools/lldb-mi/MIUtilTermios.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilTermios.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilTermios.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilTermios.cpp Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilTermios.cpp
+// File:        MIUtilTermios.cpp
 //
-// Overview:	Terminal setting termios functions.
+// Overview:    Terminal setting termios functions.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third party headers:
@@ -29,40 +29,42 @@
 namespace MIUtilTermios
 {
 // Instantiations:
-static bool				g_bOldStdinTermiosIsValid = false;	// True = yes valid, false = no valid
-static struct termios	g_sOldStdinTermios;
+static bool g_bOldStdinTermiosIsValid = false; // True = yes valid, false = no valid
+static struct termios g_sOldStdinTermios;
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Reset the terminal settings. This function is added as an ::atexit handler
-//			to make sure we clean up. See StdinTerminosSet().
-// Type:	Global function.
-// Args:	None.	
-// Return:	None.
-// Throws:	None.
+// Details: Reset the terminal settings. This function is added as an ::atexit handler
+//          to make sure we clean up. See StdinTerminosSet().
+// Type:    Global function.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void StdinTermiosReset( void )
+void
+StdinTermiosReset(void)
 {
-	if( g_bOldStdinTermiosIsValid )
+    if (g_bOldStdinTermiosIsValid)
     {
         g_bOldStdinTermiosIsValid = false;
-        ::tcsetattr( STDIN_FILENO, TCSANOW, &g_sOldStdinTermios );
+        ::tcsetattr(STDIN_FILENO, TCSANOW, &g_sOldStdinTermios);
     }
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Set the terminal settings function. StdinTermiosReset() is called when to
-//			reset to this to before and application exit.
-// Type:	Global function.
-// Args:	None.	
-// Return:	None.
-// Throws:	None.
+// Details: Set the terminal settings function. StdinTermiosReset() is called when to
+//          reset to this to before and application exit.
+// Type:    Global function.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void StdinTermiosSet( void )
+void
+StdinTermiosSet(void)
 {
-	if( ::tcgetattr( STDIN_FILENO, &g_sOldStdinTermios ) == 0 )
+    if (::tcgetattr(STDIN_FILENO, &g_sOldStdinTermios) == 0)
     {
         g_bOldStdinTermiosIsValid = true;
-        ::atexit( StdinTermiosReset );
+        ::atexit(StdinTermiosReset);
     }
 }
 

Modified: lldb/trunk/tools/lldb-mi/MIUtilTermios.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilTermios.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilTermios.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilTermios.h Mon Nov 17 12:06:21 2014
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilTermios.h
+// File:        MIUtilTermios.h
 //
-// Overview:	Terminal setting termios functions.
+// Overview:    Terminal setting termios functions.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -24,7 +24,7 @@
 namespace MIUtilTermios
 {
 
-extern void StdinTermiosReset( void );
-extern void StdinTermiosSet( void );
+extern void StdinTermiosReset(void);
+extern void StdinTermiosSet(void);
 
 } // MIUtilTermios

Modified: lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.cpp Mon Nov 17 12:06:21 2014
@@ -8,17 +8,17 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilThreadBaseStd.cpp
+// File:        MIUtilThreadBaseStd.cpp
 //
-// Overview:	CMIUtilThread implementation.
-//				CMIUtilThreadActiveObjBase implementation.
-//				CMIUtilThreadMutex implementation.
+// Overview:    CMIUtilThread implementation.
+//              CMIUtilThreadActiveObjBase implementation.
+//              CMIUtilThreadMutex implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // Third Party Headers:
@@ -29,271 +29,282 @@
 #include "MICmnThreadMgrStd.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Constructor.
-// Type:	None.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Constructor.
+// Type:    None.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilThreadActiveObjBase::CMIUtilThreadActiveObjBase( void )
-:	m_references( 0 )
-,	m_bHasBeenKilled( false )
+CMIUtilThreadActiveObjBase::CMIUtilThreadActiveObjBase(void)
+    : m_references(0)
+    , m_bHasBeenKilled(false)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Destructor.
-// Type:	None.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Destructor.
+// Type:    None.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilThreadActiveObjBase::~CMIUtilThreadActiveObjBase( void )
+CMIUtilThreadActiveObjBase::~CMIUtilThreadActiveObjBase(void)
 {
-	// Make sure our thread is not alive before we die
-	m_thread.Join();
+    // Make sure our thread is not alive before we die
+    m_thread.Join();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Check if an object is already running.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Check if an object is already running.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThreadActiveObjBase::ThreadIsActive( void )
+bool
+CMIUtilThreadActiveObjBase::ThreadIsActive(void)
 {
-	// Create a new thread to occupy this threads Run() function
-	return m_thread.IsActive();
+    // Create a new thread to occupy this threads Run() function
+    return m_thread.IsActive();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Set up *this thread.
-// Type:	Mrthod.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Set up *this thread.
+// Type:    Mrthod.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThreadActiveObjBase::ThreadExecute( void )
+bool
+CMIUtilThreadActiveObjBase::ThreadExecute(void)
 {
-	// Create a new thread to occupy this threads Run() function
-	return m_thread.Start( ThreadEntry, this );
+    // Create a new thread to occupy this threads Run() function
+    return m_thread.Start(ThreadEntry, this);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Aquire a reference to CMIUtilThreadActiveObjBase.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Aquire a reference to CMIUtilThreadActiveObjBase.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThreadActiveObjBase::Acquire( void )
+bool
+CMIUtilThreadActiveObjBase::Acquire(void)
 {
-	// Access to this function is serial
-	CMIUtilThreadLock serial( m_mutex );
+    // Access to this function is serial
+    CMIUtilThreadLock serial(m_mutex);
 
-	// >0 == *this thread is alive
-	m_references++;
+    // >0 == *this thread is alive
+    m_references++;
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release a reference to CMIUtilThreadActiveObjBase.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Release a reference to CMIUtilThreadActiveObjBase.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThreadActiveObjBase::Release( void )
+bool
+CMIUtilThreadActiveObjBase::Release(void)
 {
-	// Access to this function is serial
-	CMIUtilThreadLock serial( m_mutex );
-		
-	// 0 == kill off *this thread
-	m_references--;
+    // Access to this function is serial
+    CMIUtilThreadLock serial(m_mutex);
 
-	return MIstatus::success;
+    // 0 == kill off *this thread
+    m_references--;
+
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Force this thread to stop, regardless of references
-// Type:	Method.
-// Args:	None.			
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Force this thread to stop, regardless of references
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThreadActiveObjBase::ThreadKill( void )
+bool
+CMIUtilThreadActiveObjBase::ThreadKill(void)
 {
-	// Access to this function is serial
-	CMIUtilThreadLock serial( m_mutex );
+    // Access to this function is serial
+    CMIUtilThreadLock serial(m_mutex);
 
-	// Set this thread to killed status
-	m_bHasBeenKilled = true;
+    // Set this thread to killed status
+    m_bHasBeenKilled = true;
 
-	return MIstatus::success;
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
 // Details: Proxy to thread join.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThreadActiveObjBase::ThreadJoin( void )
+bool
+CMIUtilThreadActiveObjBase::ThreadJoin(void)
 {
-	return m_thread.Join();
+    return m_thread.Join();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	This function is the entry point of this object thread.
-//			It is a trampoline to an instances operation manager.
-// Type:	Static method.
-// Args:	vpThisClass	- (R) From the system (our CMIUtilThreadActiveObjBase from the ctor).
-// Return:	MIuint - 0 = success.
-// Throws:	None.
+// Details: This function is the entry point of this object thread.
+//          It is a trampoline to an instances operation manager.
+// Type:    Static method.
+// Args:    vpThisClass - (R) From the system (our CMIUtilThreadActiveObjBase from the ctor).
+// Return:  MIuint - 0 = success.
+// Throws:  None.
 //--
-MIuint CMIUtilThreadActiveObjBase::ThreadEntry( void * vpThisClass )
+MIuint
+CMIUtilThreadActiveObjBase::ThreadEntry(void *vpThisClass)
 {
-	// The argument is a pointer to a CMIUtilThreadActiveObjBase class
-	// as passed from the initialize function, so we can safely cast it.
-	assert( vpThisClass != nullptr );
-	CMIUtilThreadActiveObjBase * pActive = reinterpret_cast< CMIUtilThreadActiveObjBase * >( vpThisClass );
+    // The argument is a pointer to a CMIUtilThreadActiveObjBase class
+    // as passed from the initialize function, so we can safely cast it.
+    assert(vpThisClass != nullptr);
+    CMIUtilThreadActiveObjBase *pActive = reinterpret_cast<CMIUtilThreadActiveObjBase *>(vpThisClass);
 
-	// Start the management routine of this object
-	pActive->ThreadManage();
+    // Start the management routine of this object
+    pActive->ThreadManage();
 
-	// Thread death
+    // Thread death
     return 0;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	This function forms a small management routine, to handle the thread's running.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-void CMIUtilThreadActiveObjBase::ThreadManage( void )
-{
-	bool bAlive = true;
-
-	// Infinite loop
-	while( bAlive )
-	{
-		// Scope the lock while we access m_isDying
-		{
-			// Lock down access to the interface
-			CMIUtilThreadLock serial( m_mutex );
-
-			// Quit the run loop if we are dying
-			if( m_references == 0 )
-				break;
-		}
-		// Execute the run routine
-		if( !ThreadRun( bAlive ) )
-			// Thread's run function failed (MIstatus::failure)
-			break;
-
-		// We will die if we have been signaled to die
-		bAlive &= !m_bHasBeenKilled;
-	}
-
-	// Execute the finish routine just before we die
-	// to give the object a chance to clean up
-	ThreadFinish();
+// Details: This function forms a small management routine, to handle the thread's running.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+void
+CMIUtilThreadActiveObjBase::ThreadManage(void)
+{
+    bool bAlive = true;
+
+    // Infinite loop
+    while (bAlive)
+    {
+        // Scope the lock while we access m_isDying
+        {
+            // Lock down access to the interface
+            CMIUtilThreadLock serial(m_mutex);
+
+            // Quit the run loop if we are dying
+            if (m_references == 0)
+                break;
+        }
+        // Execute the run routine
+        if (!ThreadRun(bAlive))
+            // Thread's run function failed (MIstatus::failure)
+            break;
+
+        // We will die if we have been signaled to die
+        bAlive &= !m_bHasBeenKilled;
+    }
+
+    // Execute the finish routine just before we die
+    // to give the object a chance to clean up
+    ThreadFinish();
 }
 
 //---------------------------------------------------------------------------------------
 //---------------------------------------------------------------------------------------
 //---------------------------------------------------------------------------------------
 
-// 
-CMIUtilThread::CMIUtilThread( void )
-:	m_pThread( nullptr )
+//
+CMIUtilThread::CMIUtilThread(void)
+    : m_pThread(nullptr)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilThread destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilThread destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilThread::~CMIUtilThread( void )
+CMIUtilThread::~CMIUtilThread(void)
 {
-	Join();
+    Join();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Wait for thread to stop.
-// Type:	Method.
-// Args:	None.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Wait for thread to stop.
+// Type:    Method.
+// Args:    None.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThread::Join( void )
+bool
+CMIUtilThread::Join(void)
 {
-	if( m_pThread != nullptr )
-	{
-		// Wait for this thread to die
-		m_pThread->join();
-		
-		// Scope the thread lock while we modify the pointer
-		{
-			CMIUtilThreadLock _lock( m_mutex );
-			delete m_pThread;
-			m_pThread = nullptr;
-		}
-	}
+    if (m_pThread != nullptr)
+    {
+        // Wait for this thread to die
+        m_pThread->join();
 
-	return MIstatus::success;
+        // Scope the thread lock while we modify the pointer
+        {
+            CMIUtilThreadLock _lock(m_mutex);
+            delete m_pThread;
+            m_pThread = nullptr;
+        }
+    }
+
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Is the thread doing work.
-// Type:	Method.
-// Args:	None.
-// Return:	bool - True = Yes active, false = not active.
-// Throws:	None.
+// Details: Is the thread doing work.
+// Type:    Method.
+// Args:    None.
+// Return:  bool - True = Yes active, false = not active.
+// Throws:  None.
 //--
-bool CMIUtilThread::IsActive( void )
+bool
+CMIUtilThread::IsActive(void)
 {
-	// Lock while we access the thread pointer
-	CMIUtilThreadLock _lock( m_mutex );
-	if( m_pThread == nullptr )
-		return false;
-	else
-		return true;
+    // Lock while we access the thread pointer
+    CMIUtilThreadLock _lock(m_mutex);
+    if (m_pThread == nullptr)
+        return false;
+    else
+        return true;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Set up *this thread.
-// Type:	Method.
-// Args:	vpFn	(R)	- Function pointer to thread's main function.
-//			vpArg	(R) - Pointer arguments to pass to the thread.
-// Return:	MIstatus::success - Functional succeeded.
-//			MIstatus::failure - Functional failed.
-// Throws:	None.
+// Details: Set up *this thread.
+// Type:    Method.
+// Args:    vpFn    (R) - Function pointer to thread's main function.
+//          vpArg   (R) - Pointer arguments to pass to the thread.
+// Return:  MIstatus::success - Functional succeeded.
+//          MIstatus::failure - Functional failed.
+// Throws:  None.
 //--
-bool CMIUtilThread::Start( FnThreadProc vpFn, void * vpArg )
+bool
+CMIUtilThread::Start(FnThreadProc vpFn, void *vpArg)
 {
-	// Create the std thread, which starts immediately
-	m_pThread = new std::thread( vpFn, vpArg );
-	
-	// We expect to always be able to create one
-	assert( m_pThread != nullptr );
-	
-	return MIstatus::success;
+    // Create the std thread, which starts immediately
+    m_pThread = new std::thread(vpFn, vpArg);
+
+    // We expect to always be able to create one
+    assert(m_pThread != nullptr);
+
+    return MIstatus::success;
 }
 
 //---------------------------------------------------------------------------------------
@@ -301,39 +312,41 @@ bool CMIUtilThread::Start( FnThreadProc
 //---------------------------------------------------------------------------------------
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Take resource.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Take resource.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilThreadMutex::Lock( void )
+void
+CMIUtilThreadMutex::Lock(void)
 {
-	m_mutex.lock();
+    m_mutex.lock();
 }
- 
+
 //++ ------------------------------------------------------------------------------------
-// Details:	Release resource.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Release resource.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilThreadMutex::Unlock( void )
+void
+CMIUtilThreadMutex::Unlock(void)
 {
-	m_mutex.unlock();
+    m_mutex.unlock();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Take resource if available. Immediately return in either case.
-// Type:	Method.
-// Args:	None.
-// Return:	True	- mutex has been locked. 
-//			False	- mutex could not be locked.
-// Throws:	None.
+// Details: Take resource if available. Immediately return in either case.
+// Type:    Method.
+// Args:    None.
+// Return:  True    - mutex has been locked.
+//          False   - mutex could not be locked.
+// Throws:  None.
 //--
-bool CMIUtilThreadMutex::TryLock( void )
+bool
+CMIUtilThreadMutex::TryLock(void)
 {
-	return m_mutex.try_lock();
+    return m_mutex.try_lock();
 }
-

Modified: lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilThreadBaseStd.h Mon Nov 17 12:06:21 2014
@@ -8,18 +8,18 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilThreadBaseStd.h
+// File:        MIUtilThreadBaseStd.h
 //
-// Overview:	CMIUtilThread interface.
-//				CMIUtilThreadActiveObjBase interface.
-//				CMIUtilThreadMutex interface.
-//				CMIUtilThreadLock interface.
+// Overview:    CMIUtilThread interface.
+//              CMIUtilThreadActiveObjBase interface.
+//              CMIUtilThreadMutex interface.
+//              CMIUtilThreadLock interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
@@ -36,135 +36,148 @@
 #include "MIUtilString.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. Handle thread mutual exclusion.
-//			Embed Mutexes in your Active Object and then use them through Locks.
-// Gotchas:	None.
-// Authors:	Aidan Dodds 10/03/2014.
-// Changes:	None.
+// Details: MI common code utility class. Handle thread mutual exclusion.
+//          Embed Mutexes in your Active Object and then use them through Locks.
+// Gotchas: None.
+// Authors: Aidan Dodds 10/03/2014.
+// Changes: None.
 //--
 class CMIUtilThreadMutex
 {
- // Methods:
-public:
-	/* ctor */	 CMIUtilThreadMutex( void ) { };
-	//
-	void Lock( void );		// Wait until mutex can be obtained
-    void Unlock( void );	// Release the mutex
-	bool TryLock( void );	// Gain the lock if available
-
-// Overrideable:
-public:
-	// From CMICmnBase
-	/* dtor */ virtual ~CMIUtilThreadMutex( void ) { };
-   
-// Attributes:
-private:
-	std::recursive_mutex m_mutex;
+    // Methods:
+  public:
+    /* ctor */ CMIUtilThreadMutex(void){};
+    //
+    void
+    Lock(void); // Wait until mutex can be obtained
+    void
+    Unlock(void); // Release the mutex
+    bool
+    TryLock(void); // Gain the lock if available
+
+    // Overrideable:
+  public:
+    // From CMICmnBase
+    /* dtor */ virtual ~CMIUtilThreadMutex(void){};
+
+    // Attributes:
+  private:
+    std::recursive_mutex m_mutex;
 };
 
 //++ ============================================================================
-// Details:	MI common code utility class. Thread object.
-// Gotchas:	None.
-// Authors:	Aidan Dodds 10/03/2014.
-// Changes:	None.
+// Details: MI common code utility class. Thread object.
+// Gotchas: None.
+// Authors: Aidan Dodds 10/03/2014.
+// Changes: None.
 //--
 class CMIUtilThread
 {
-// Typedef:
-public:
-	typedef MIuint (* FnThreadProc) (void * vpThisClass);
-	
-// Methods:
-public:
-	/* ctor */	CMIUtilThread( void );
-	//
-	bool Start( FnThreadProc vpFn, void * vpArg );	// Start execution of this thread
-	bool Join( void );								// Wait for this thread to stop
-	bool IsActive( void );							// Returns true if this thread is running
-
-// Overrideable:
-public:
-	/* dtor */ virtual ~CMIUtilThread( void );
-
-// Methods:
-private:
-	CMIUtilThreadMutex	m_mutex;
-	std::thread *		m_pThread;
+    // Typedef:
+  public:
+    typedef MIuint (*FnThreadProc)(void *vpThisClass);
+
+    // Methods:
+  public:
+    /* ctor */ CMIUtilThread(void);
+    //
+    bool
+    Start(FnThreadProc vpFn, void *vpArg); // Start execution of this thread
+    bool
+    Join(void); // Wait for this thread to stop
+    bool
+    IsActive(void); // Returns true if this thread is running
+
+    // Overrideable:
+  public:
+    /* dtor */ virtual ~CMIUtilThread(void);
+
+    // Methods:
+  private:
+    CMIUtilThreadMutex m_mutex;
+    std::thread *m_pThread;
 };
 
 //++ ============================================================================
-// Details:	MI common code utility class. Base class for a worker thread active 
-//			object. Runs an 'captive thread'.
-// Gotchas:	None.
-// Authors:	Aidan Dodds 10/03/2014..
-// Changes:	None.
+// Details: MI common code utility class. Base class for a worker thread active
+//          object. Runs an 'captive thread'.
+// Gotchas: None.
+// Authors: Aidan Dodds 10/03/2014..
+// Changes: None.
 //--
 class CMIUtilThreadActiveObjBase
 {
-// Methods:
-public:
-	/* ctor */	CMIUtilThreadActiveObjBase( void );
-	//
-	bool Acquire( void );			// Obtain a reference to this object
-	bool Release( void );			// Release a reference to this object
-	bool ThreadIsActive( void );	// Return true if this object is running
-	bool ThreadJoin( void );		// Wait for this thread to stop running
-	bool ThreadKill( void );		// Force this thread to stop, regardless of references
-	bool ThreadExecute( void );		// Start this objects execution in another thread
-	void ThreadManage( void );
-
-// Overrideable:
-public:
-	/* dtor */ virtual ~CMIUtilThreadActiveObjBase( void );
-	//	
-	// Each thread object must supple a unique name that can be used to locate it
-	virtual const CMIUtilString & ThreadGetName( void ) const = 0;
-
-// Statics:
-protected:
-	static MIuint ThreadEntry( void * vpThisClass );	// Thread entry point
-
-// Overrideable:
-protected:
-	virtual bool ThreadRun( bool &vrIsAlive ) = 0;	// Call the main worker method
-	virtual bool ThreadFinish( void ) = 0;			// Finish of what you were doing
-
-// Attributes:
-protected:
-	volatile MIuint		m_references;		// Stores the current lifetime state of this thread, 0 = running, > 0 = shutting down
-	volatile bool		m_bHasBeenKilled;	// Set to true when this thread has been killed
-	CMIUtilThread		m_thread;			// The execution thread
-	CMIUtilThreadMutex	m_mutex;			// This mutex allows us to safely communicate with this thread object across the interface from multiple threads
+    // Methods:
+  public:
+    /* ctor */ CMIUtilThreadActiveObjBase(void);
+    //
+    bool
+    Acquire(void); // Obtain a reference to this object
+    bool
+    Release(void); // Release a reference to this object
+    bool
+    ThreadIsActive(void); // Return true if this object is running
+    bool
+    ThreadJoin(void); // Wait for this thread to stop running
+    bool
+    ThreadKill(void); // Force this thread to stop, regardless of references
+    bool
+    ThreadExecute(void); // Start this objects execution in another thread
+    void ThreadManage(void);
+
+    // Overrideable:
+  public:
+    /* dtor */ virtual ~CMIUtilThreadActiveObjBase(void);
+    //
+    // Each thread object must supple a unique name that can be used to locate it
+    virtual const CMIUtilString &ThreadGetName(void) const = 0;
+
+    // Statics:
+  protected:
+    static MIuint
+    ThreadEntry(void *vpThisClass); // Thread entry point
+
+    // Overrideable:
+  protected:
+    virtual bool
+    ThreadRun(bool &vrIsAlive) = 0; // Call the main worker method
+    virtual bool
+    ThreadFinish(void) = 0; // Finish of what you were doing
+
+    // Attributes:
+  protected:
+    volatile MIuint m_references;   // Stores the current lifetime state of this thread, 0 = running, > 0 = shutting down
+    volatile bool m_bHasBeenKilled; // Set to true when this thread has been killed
+    CMIUtilThread m_thread;         // The execution thread
+    CMIUtilThreadMutex
+        m_mutex; // This mutex allows us to safely communicate with this thread object across the interface from multiple threads
 };
 
 //++ ============================================================================
-// Details:	MI common code utility class. Handle thread resource locking.
-//			Put Locks inside all the methods of your Active Object that access 
-//			data shared with the captive thread.
-// Gotchas:	None.
-// Authors:	Aidan Dodds 10/03/2014.
-// Changes:	None.
+// Details: MI common code utility class. Handle thread resource locking.
+//          Put Locks inside all the methods of your Active Object that access
+//          data shared with the captive thread.
+// Gotchas: None.
+// Authors: Aidan Dodds 10/03/2014.
+// Changes: None.
 //--
 class CMIUtilThreadLock
 {
-// Methods:
-public:
-	/* ctor */
-	CMIUtilThreadLock( CMIUtilThreadMutex & vMutex )
-	:	m_rMutex( vMutex )
-	{
-		m_rMutex.Lock();
-	}
-
-// Overrideable:
-public:
-	/* dtor */
-	virtual ~CMIUtilThreadLock( void )
-	{
-		m_rMutex.Unlock();
-	}
-
-// Attributes:
-private:
-    CMIUtilThreadMutex & m_rMutex;
+    // Methods:
+  public:
+    /* ctor */
+    CMIUtilThreadLock(CMIUtilThreadMutex &vMutex)
+        : m_rMutex(vMutex)
+    {
+        m_rMutex.Lock();
+    }
+
+    // Overrideable:
+  public:
+    /* dtor */
+    virtual ~CMIUtilThreadLock(void) { m_rMutex.Unlock(); }
+
+    // Attributes:
+  private:
+    CMIUtilThreadMutex &m_rMutex;
 };

Modified: lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilVariant.cpp Mon Nov 17 12:06:21 2014
@@ -8,157 +8,161 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilVariant.cpp
+// File:        MIUtilVariant.cpp
 //
-// Overview:	CMIUtilVariant implementation.
+// Overview:    CMIUtilVariant implementation.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Gotchas:		See CMIUtilVariant class description.
+// Gotchas:     See CMIUtilVariant class description.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 // In-house headers:
-#include "MIUtilVariant.h"  
+#include "MIUtilVariant.h"
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase( void )
+CMIUtilVariant::CDataObjectBase::CDataObjectBase(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase copy constructor.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase copy constructor.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase( const CDataObjectBase & vrOther )
+CMIUtilVariant::CDataObjectBase::CDataObjectBase(const CDataObjectBase &vrOther)
 {
-	MIunused( vrOther );
+    MIunused(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase copy constructor.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase copy constructor.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase( CDataObjectBase & vrOther )
+CMIUtilVariant::CDataObjectBase::CDataObjectBase(CDataObjectBase &vrOther)
 {
-	MIunused( vrOther );
+    MIunused(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase move constructor.
-// Type:	Method.
-// Args:	vrwOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase move constructor.
+// Type:    Method.
+// Args:    vrwOther    - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase::CDataObjectBase( CDataObjectBase && vrwOther )
+CMIUtilVariant::CDataObjectBase::CDataObjectBase(CDataObjectBase &&vrwOther)
 {
-	MIunused( vrwOther );
+    MIunused(vrwOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase destructor.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase destructor.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase::~CDataObjectBase( void )
+CMIUtilVariant::CDataObjectBase::~CDataObjectBase(void)
 {
-	Destroy();
+    Destroy();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase copy assignment.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase copy assignment.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase & CMIUtilVariant::CDataObjectBase::operator= ( const CDataObjectBase & vrOther )
+CMIUtilVariant::CDataObjectBase &CMIUtilVariant::CDataObjectBase::operator=(const CDataObjectBase &vrOther)
 {
-	Copy( vrOther );
-	return *this;
+    Copy(vrOther);
+    return *this;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObjectBase move assignment.
-// Type:	Method.
-// Args:	vrwOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObjectBase move assignment.
+// Type:    Method.
+// Args:    vrwOther    - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase & CMIUtilVariant::CDataObjectBase::operator= ( CDataObjectBase && vrwOther )
+CMIUtilVariant::CDataObjectBase &CMIUtilVariant::CDataObjectBase::operator=(CDataObjectBase &&vrwOther)
 {
-	Copy( vrwOther );
-	vrwOther.Destroy();
-	return *this;
+    Copy(vrwOther);
+    vrwOther.Destroy();
+    return *this;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Create a new copy of *this class.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	CDataObjectBase *	- Pointer to a new object.
-// Throws:	None.
+// Details: Create a new copy of *this class.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  CDataObjectBase *   - Pointer to a new object.
+// Throws:  None.
 //--
-CMIUtilVariant::CDataObjectBase * CMIUtilVariant::CDataObjectBase::CreateCopyOfSelf( void )
+CMIUtilVariant::CDataObjectBase *
+CMIUtilVariant::CDataObjectBase::CreateCopyOfSelf(void)
 {
-	// Override to implement copying of variant's data object
-	return new CDataObjectBase();
+    // Override to implement copying of variant's data object
+    return new CDataObjectBase();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Determine if *this object is a derived from CDataObjectBase.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	bool	- True = *this is derived from CDataObjectBase, false = *this is instance of the this base class.
-// Throws:	None.
+// Details: Determine if *this object is a derived from CDataObjectBase.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  bool    - True = *this is derived from CDataObjectBase, false = *this is instance of the this base class.
+// Throws:  None.
 //--
-bool CMIUtilVariant::CDataObjectBase::GetIsDerivedClass( void ) const
+bool
+CMIUtilVariant::CDataObjectBase::GetIsDerivedClass(void) const
 {
-	// Override to in the derived class and return true
-	return false;
+    // Override to in the derived class and return true
+    return false;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Perform a bitwise copy of *this object.
-// Type:	Overrideable.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: Perform a bitwise copy of *this object.
+// Type:    Overrideable.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilVariant::CDataObjectBase::Copy( const CDataObjectBase & vrOther )
+void
+CMIUtilVariant::CDataObjectBase::Copy(const CDataObjectBase &vrOther)
 {
-	// Override to implement
-	MIunused( vrOther );
+    // Override to implement
+    MIunused(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release any resources used by *this object.
-// Type:	Overrideable.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Release any resources used by *this object.
+// Type:    Overrideable.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilVariant::CDataObjectBase::Destroy( void )
+void
+CMIUtilVariant::CDataObjectBase::Destroy(void)
 {
-	// Do nothing - override to implement
+    // Do nothing - override to implement
 }
 
 //---------------------------------------------------------------------------------------
@@ -166,87 +170,82 @@ void CMIUtilVariant::CDataObjectBase::De
 //---------------------------------------------------------------------------------------
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject copy constructor.
-// Type:	Method.
-// Args:	T		- The object's type.
-//			vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject copy constructor.
+// Type:    Method.
+// Args:    T       - The object's type.
+//          vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T >::CDataObject( const CDataObject & vrOther )
+template <typename T> CMIUtilVariant::CDataObject<T>::CDataObject(const CDataObject &vrOther)
 {
-	if( this == &vrOther )
-		return;
-	Copy( vrOther );	
+    if (this == &vrOther)
+        return;
+    Copy(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject copy constructor.
-// Type:	Method.
-// Args:	T		- The object's type.
-//			vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject copy constructor.
+// Type:    Method.
+// Args:    T       - The object's type.
+//          vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T >::CDataObject( CDataObject & vrOther )
+template <typename T> CMIUtilVariant::CDataObject<T>::CDataObject(CDataObject &vrOther)
 {
-	if( this == &vrOther )
-		return;
-	Copy( vrOther );	
+    if (this == &vrOther)
+        return;
+    Copy(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject move constructor.
-// Type:	Method.
-// Args:	T			- The object's type.
-//			vrwOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject move constructor.
+// Type:    Method.
+// Args:    T           - The object's type.
+//          vrwOther    - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T >::CDataObject( CDataObject && vrwOther )
+template <typename T> CMIUtilVariant::CDataObject<T>::CDataObject(CDataObject &&vrwOther)
 {
-	if( this == &vrwOther )
-		return;
-	Copy( vrwOther );	
-	vrwOther.Destroy();
+    if (this == &vrwOther)
+        return;
+    Copy(vrwOther);
+    vrwOther.Destroy();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject copy assignment.
-// Type:	Method.
-// Args:	T		- The object's type.
-//			vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject copy assignment.
+// Type:    Method.
+// Args:    T       - The object's type.
+//          vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T > & CMIUtilVariant::CDataObject< T >::operator= ( const CDataObject & vrOther )
+template <typename T> CMIUtilVariant::CDataObject<T> &CMIUtilVariant::CDataObject<T>::operator=(const CDataObject &vrOther)
 {
-	if( this == &vrOther )
-		return *this;
-	Copy( vrOther );
-	return *this;
+    if (this == &vrOther)
+        return *this;
+    Copy(vrOther);
+    return *this;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject move assignment.
-// Type:	Method.
-// Args:	T			- The object's type.
-//			vrwOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject move assignment.
+// Type:    Method.
+// Args:    T           - The object's type.
+//          vrwOther    - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T > & CMIUtilVariant::CDataObject< T >::operator= ( CDataObject && vrwOther )
+template <typename T> CMIUtilVariant::CDataObject<T> &CMIUtilVariant::CDataObject<T>::operator=(CDataObject &&vrwOther)
 {
-	if( this == &vrwOther )
-		return *this;
-	Copy( vrwOther );
-	vrwOther.Destroy();
-	return *this;
+    if (this == &vrwOther)
+        return *this;
+    Copy(vrwOther);
+    vrwOther.Destroy();
+    return *this;
 }
 
 //---------------------------------------------------------------------------------------
@@ -254,139 +253,140 @@ CMIUtilVariant::CDataObject< T > & CMIUt
 //---------------------------------------------------------------------------------------
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant constructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant constructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CMIUtilVariant( void )
-:	m_pDataObject( nullptr )
+CMIUtilVariant::CMIUtilVariant(void)
+    : m_pDataObject(nullptr)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant copy constructor.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant copy constructor.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CMIUtilVariant( const CMIUtilVariant & vrOther )
-:	m_pDataObject( nullptr )
+CMIUtilVariant::CMIUtilVariant(const CMIUtilVariant &vrOther)
+    : m_pDataObject(nullptr)
 {
-	if( this == &vrOther )
-		return;
+    if (this == &vrOther)
+        return;
 
-	Copy( vrOther );
+    Copy(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant copy constructor.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant copy constructor.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CMIUtilVariant( CMIUtilVariant & vrOther )
-:	m_pDataObject( nullptr )
+CMIUtilVariant::CMIUtilVariant(CMIUtilVariant &vrOther)
+    : m_pDataObject(nullptr)
 {
-	if( this == &vrOther )
-		return;
+    if (this == &vrOther)
+        return;
 
-	Copy( vrOther );
+    Copy(vrOther);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant move constructor.
-// Type:	Method.
-// Args:	vrwOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant move constructor.
+// Type:    Method.
+// Args:    vrwOther    - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::CMIUtilVariant( CMIUtilVariant && vrwOther )
-:	m_pDataObject( nullptr )
+CMIUtilVariant::CMIUtilVariant(CMIUtilVariant &&vrwOther)
+    : m_pDataObject(nullptr)
 {
-	if( this == &vrwOther )
-		return;
+    if (this == &vrwOther)
+        return;
 
-	Copy( vrwOther );
-	vrwOther.Destroy();
+    Copy(vrwOther);
+    vrwOther.Destroy();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant destructor.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant destructor.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant::~CMIUtilVariant( void )
+CMIUtilVariant::~CMIUtilVariant(void)
 {
-	Destroy();
+    Destroy();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant copy assignment.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant copy assignment.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant & CMIUtilVariant::operator= ( const CMIUtilVariant & vrOther )
+CMIUtilVariant &CMIUtilVariant::operator=(const CMIUtilVariant &vrOther)
 {
-	if( this == &vrOther )
-		return *this;
+    if (this == &vrOther)
+        return *this;
 
-	Copy( vrOther );
-	return *this;
+    Copy(vrOther);
+    return *this;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CMIUtilVariant move assignment.
-// Type:	Method.
-// Args:	vrwOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: CMIUtilVariant move assignment.
+// Type:    Method.
+// Args:    vrwOther    - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-CMIUtilVariant & CMIUtilVariant::operator= ( CMIUtilVariant && vrwOther )
+CMIUtilVariant &CMIUtilVariant::operator=(CMIUtilVariant &&vrwOther)
 {
-	if( this == &vrwOther )
-		return *this;
+    if (this == &vrwOther)
+        return *this;
 
-	Copy( vrwOther );
-	vrwOther.Destroy();
-	return *this;
+    Copy(vrwOther);
+    vrwOther.Destroy();
+    return *this;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release the resources used by *this object.
-// Type:	Method.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
+// Details: Release the resources used by *this object.
+// Type:    Method.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilVariant::Destroy( void )
+void
+CMIUtilVariant::Destroy(void)
 {
-	if( m_pDataObject != nullptr )
-		delete m_pDataObject;
-	m_pDataObject = nullptr;
+    if (m_pDataObject != nullptr)
+        delete m_pDataObject;
+    m_pDataObject = nullptr;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Bitwise copy another data object to *this variant object.
-// Type:	Method.
-// Args:	vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
+// Details: Bitwise copy another data object to *this variant object.
+// Type:    Method.
+// Args:    vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
 //--
-void CMIUtilVariant::Copy( const CMIUtilVariant & vrOther )
+void
+CMIUtilVariant::Copy(const CMIUtilVariant &vrOther)
 {
-	Destroy();
-	
-	if( vrOther.m_pDataObject != nullptr )
-	{
-		m_pDataObject = vrOther.m_pDataObject->CreateCopyOfSelf();
-	}
-}
+    Destroy();
 
+    if (vrOther.m_pDataObject != nullptr)
+    {
+        m_pDataObject = vrOther.m_pDataObject->CreateCopyOfSelf();
+    }
+}

Modified: lldb/trunk/tools/lldb-mi/MIUtilVariant.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilVariant.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MIUtilVariant.h (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilVariant.h Mon Nov 17 12:06:21 2014
@@ -8,134 +8,131 @@
 //===----------------------------------------------------------------------===//
 
 //++
-// File:		MIUtilVariant.h
+// File:        MIUtilVariant.h
 //
-// Overview:	CMIUtilVariant interface.
+// Overview:    CMIUtilVariant interface.
 //
-// Environment:	Compilers:	Visual C++ 12.
-//							gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
-//				Libraries:	See MIReadmetxt. 
+// Environment: Compilers:  Visual C++ 12.
+//                          gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
+//              Libraries:  See MIReadmetxt.
 //
-// Gotchas:		See CMIUtilVariant class description.
+// Gotchas:     See CMIUtilVariant class description.
 //
-// Copyright:	None.
+// Copyright:   None.
 //--
 
 #pragma once
 
 // In-house headers:
-#include "MIDataTypes.h"  
+#include "MIDataTypes.h"
 
 //++ ============================================================================
-// Details:	MI common code utility class. The class implements behaviour of a 
-//			variant object which holds any data object of type T. A copy of the
-//			data object specified is made and stored in *this wrapper. When the
-//			*this object is destroyed the data object hold within calls its
-//			destructor should it have one.
-// Gotchas:	None.
-// Authors:	Illya Rudkin 18/06/2014.
-// Changes:	None.
+// Details: MI common code utility class. The class implements behaviour of a
+//          variant object which holds any data object of type T. A copy of the
+//          data object specified is made and stored in *this wrapper. When the
+//          *this object is destroyed the data object hold within calls its
+//          destructor should it have one.
+// Gotchas: None.
+// Authors: Illya Rudkin 18/06/2014.
+// Changes: None.
 //--
 class CMIUtilVariant
 {
-// Methods:
-public:
-	/* ctor */ CMIUtilVariant( void );
-	/* ctor */ CMIUtilVariant( const CMIUtilVariant & vrOther );
-	/* ctor */ CMIUtilVariant( CMIUtilVariant & vrOther );
-	/* ctor */ CMIUtilVariant( CMIUtilVariant && vrwOther );
-	/* dtor */ ~CMIUtilVariant( void );
-	
-	template< typename T >
-		void Set( const T & vArg );
-	template< typename T >
-		T * Get( void ) const;
-
-	CMIUtilVariant & operator= ( const CMIUtilVariant & vrOther );
-	CMIUtilVariant & operator= ( CMIUtilVariant && vrwOther );
-
-// Classes:
-private:
-	//++ ----------------------------------------------------------------------
-	// Details: Base class wrapper to hold the variant's data object when
-	//			assigned to it by the Set() function. Do not use the CDataObjectBase 
-	//			to create objects, use only CDataObjectBase derived objects,
-	//			see CDataObject() class.
-	//--
-	class CDataObjectBase
-	{
-	// Methods:
-	public:
-		/* ctor */ CDataObjectBase( void );
-		/* ctor */ CDataObjectBase( const CDataObjectBase & vrOther );
-		/* ctor */ CDataObjectBase( CDataObjectBase & vrOther );
-		/* ctor */ CDataObjectBase( CDataObjectBase && vrwOther );
-		//
-		CDataObjectBase & operator= ( const CDataObjectBase & vrOther ) ;
-		CDataObjectBase & operator= ( CDataObjectBase && vrwOther ) ;
-	
-	// Overrideable:
-	public:
-		virtual ~CDataObjectBase( void );
-		virtual CDataObjectBase *	CreateCopyOfSelf( void );
-		virtual bool				GetIsDerivedClass( void ) const;
-
-	// Overrideable:
-	protected:
-		virtual void Copy( const CDataObjectBase & vrOther );
-		virtual void Destroy( void );
-	};
-
-	//++ ----------------------------------------------------------------------
-	// Details: Derived from CDataObjectBase, this class is the wrapper for the
-	//			data object as it has an aggregate of type T which is a copy
-	//			of the data object assigned to the variant object.
-	//--
-	template< typename T >
-	class CDataObject : public CDataObjectBase
-	{
-	// Methods:
-	public:
-		/* ctor */ CDataObject( void );
-		/* ctor */ CDataObject( const T & vArg );
-		/* ctor */ CDataObject( const CDataObject & vrOther );
-		/* ctor */ CDataObject( CDataObject & vrOther );
-		/* ctor */ CDataObject( CDataObject && vrwOther );
-		//
-		CDataObject & operator= ( const CDataObject & vrOther );
-		CDataObject & operator= ( CDataObject && vrwOther );
-		//	
-		T &	GetDataObject( void );
-
-	// Overridden:
-	public:
-		// From CDataObjectBase
-		virtual ~CDataObject( void );
-		virtual CDataObjectBase *	CreateCopyOfSelf( void );
-		virtual bool				GetIsDerivedClass( void ) const;
-
-	// Overrideable:
-	private:
-		virtual void Duplicate( const CDataObject & vrOther );
-
-	// Overridden:
-	private:
-		// From CDataObjectBase
-		virtual void Destroy( void );
-
-	// Attributes:
-	private:
-		T	m_dataObj;
-	};
-
-// Methods
-private:
-	void Destroy( void );
-	void Copy( const CMIUtilVariant & vrOther );
-
-// Attributes:
-private:
-	CDataObjectBase *	m_pDataObject;
+    // Methods:
+  public:
+    /* ctor */ CMIUtilVariant(void);
+    /* ctor */ CMIUtilVariant(const CMIUtilVariant &vrOther);
+    /* ctor */ CMIUtilVariant(CMIUtilVariant &vrOther);
+    /* ctor */ CMIUtilVariant(CMIUtilVariant &&vrwOther);
+    /* dtor */ ~CMIUtilVariant(void);
+
+    template <typename T> void Set(const T &vArg);
+    template <typename T> T *Get(void) const;
+
+    CMIUtilVariant &operator=(const CMIUtilVariant &vrOther);
+    CMIUtilVariant &operator=(CMIUtilVariant &&vrwOther);
+
+    // Classes:
+  private:
+    //++ ----------------------------------------------------------------------
+    // Details: Base class wrapper to hold the variant's data object when
+    //          assigned to it by the Set() function. Do not use the CDataObjectBase
+    //          to create objects, use only CDataObjectBase derived objects,
+    //          see CDataObject() class.
+    //--
+    class CDataObjectBase
+    {
+        // Methods:
+      public:
+        /* ctor */ CDataObjectBase(void);
+        /* ctor */ CDataObjectBase(const CDataObjectBase &vrOther);
+        /* ctor */ CDataObjectBase(CDataObjectBase &vrOther);
+        /* ctor */ CDataObjectBase(CDataObjectBase &&vrwOther);
+        //
+        CDataObjectBase &operator=(const CDataObjectBase &vrOther);
+        CDataObjectBase &operator=(CDataObjectBase &&vrwOther);
+
+        // Overrideable:
+      public:
+        virtual ~CDataObjectBase(void);
+        virtual CDataObjectBase *CreateCopyOfSelf(void);
+        virtual bool GetIsDerivedClass(void) const;
+
+        // Overrideable:
+      protected:
+        virtual void Copy(const CDataObjectBase &vrOther);
+        virtual void Destroy(void);
+    };
+
+    //++ ----------------------------------------------------------------------
+    // Details: Derived from CDataObjectBase, this class is the wrapper for the
+    //          data object as it has an aggregate of type T which is a copy
+    //          of the data object assigned to the variant object.
+    //--
+    template <typename T> class CDataObject : public CDataObjectBase
+    {
+        // Methods:
+      public:
+        /* ctor */ CDataObject(void);
+        /* ctor */ CDataObject(const T &vArg);
+        /* ctor */ CDataObject(const CDataObject &vrOther);
+        /* ctor */ CDataObject(CDataObject &vrOther);
+        /* ctor */ CDataObject(CDataObject &&vrwOther);
+        //
+        CDataObject &operator=(const CDataObject &vrOther);
+        CDataObject &operator=(CDataObject &&vrwOther);
+        //
+        T &GetDataObject(void);
+
+        // Overridden:
+      public:
+        // From CDataObjectBase
+        virtual ~CDataObject(void);
+        virtual CDataObjectBase *CreateCopyOfSelf(void);
+        virtual bool GetIsDerivedClass(void) const;
+
+        // Overrideable:
+      private:
+        virtual void Duplicate(const CDataObject &vrOther);
+
+        // Overridden:
+      private:
+        // From CDataObjectBase
+        virtual void Destroy(void);
+
+        // Attributes:
+      private:
+        T m_dataObj;
+    };
+
+    // Methods
+  private:
+    void Destroy(void);
+    void Copy(const CMIUtilVariant &vrOther);
+
+    // Attributes:
+  private:
+    CDataObjectBase *m_pDataObject;
 };
 
 //---------------------------------------------------------------------------------------
@@ -143,112 +140,114 @@ private:
 //---------------------------------------------------------------------------------------
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject constructor.
-// Type:	Method.
-// Args:	T	- The object's type.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject constructor.
+// Type:    Method.
+// Args:    T   - The object's type.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T >::CDataObject( void )
+template <typename T> CMIUtilVariant::CDataObject<T>::CDataObject(void)
 {
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject constructor.
-// Type:	Method.
-// Args:	T		- The object's type.
-//			vArg	- (R) The data object to be stored in the variant object.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject constructor.
+// Type:    Method.
+// Args:    T       - The object's type.
+//          vArg    - (R) The data object to be stored in the variant object.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T >::CDataObject( const T & vArg )
+template <typename T> CMIUtilVariant::CDataObject<T>::CDataObject(const T &vArg)
 {
-	m_dataObj = vArg;
+    m_dataObj = vArg;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	CDataObject destructor.
-// Type:	Overridden.
-// Args:	T	- The object's type.
-// Return:	None.
-// Throws:	None.
+// Details: CDataObject destructor.
+// Type:    Overridden.
+// Args:    T   - The object's type.
+// Return:  None.
+// Throws:  None.
 //--
-template< typename T >
-CMIUtilVariant::CDataObject< T >::~CDataObject( void )
+template <typename T> CMIUtilVariant::CDataObject<T>::~CDataObject(void)
 {
-	Destroy();
+    Destroy();
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the data object hold by *this object wrapper.
-// Type:	Method.
-// Args:	T	- The object's type.
-// Return:	T &	- Reference to the data object.
-// Throws:	None.
-//--
-template< typename T >
-T & CMIUtilVariant::CDataObject< T >::GetDataObject( void )
+// Details: Retrieve the data object hold by *this object wrapper.
+// Type:    Method.
+// Args:    T   - The object's type.
+// Return:  T & - Reference to the data object.
+// Throws:  None.
+//--
+template <typename T>
+T &
+CMIUtilVariant::CDataObject<T>::GetDataObject(void)
 {
-	return m_dataObj;
+    return m_dataObj;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Create a new copy of *this class.
-// Type:	Overridden.
-// Args:	T	- The object's type.
-// Return:	CDataObjectBase *	- Pointer to a new object.
-// Throws:	None.
-//--
-template< typename T >
-CMIUtilVariant::CDataObjectBase * CMIUtilVariant::CDataObject< T >::CreateCopyOfSelf( void )
-{
-	CDataObject * pCopy = new CDataObject< T >( m_dataObj );
-	
-	return pCopy;
+// Details: Create a new copy of *this class.
+// Type:    Overridden.
+// Args:    T   - The object's type.
+// Return:  CDataObjectBase *   - Pointer to a new object.
+// Throws:  None.
+//--
+template <typename T>
+CMIUtilVariant::CDataObjectBase *
+CMIUtilVariant::CDataObject<T>::CreateCopyOfSelf(void)
+{
+    CDataObject *pCopy = new CDataObject<T>(m_dataObj);
+
+    return pCopy;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Determine if *this object is a derived from CDataObjectBase.
-// Type:	Overridden.
-// Args:	T	- The object's type.
-// Return:	bool	- True = *this is derived from CDataObjectBase
-//					- False = *this is an instance of the base class.
-// Throws:	None.
-//--
-template< typename T >
-bool CMIUtilVariant::CDataObject< T >::GetIsDerivedClass( void ) const
+// Details: Determine if *this object is a derived from CDataObjectBase.
+// Type:    Overridden.
+// Args:    T   - The object's type.
+// Return:  bool    - True = *this is derived from CDataObjectBase
+//                  - False = *this is an instance of the base class.
+// Throws:  None.
+//--
+template <typename T>
+bool
+CMIUtilVariant::CDataObject<T>::GetIsDerivedClass(void) const
 {
-	return true;
+    return true;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Perform a bitwise copy of *this object.
-// Type:	Overrideable.
-// Args:	T		- The object's type.
-//			vrOther	- (R) The other object.
-// Return:	None.
-// Throws:	None.
-//--
-template< typename T >
-void CMIUtilVariant::CDataObject< T >::Duplicate( const CDataObject & vrOther )
+// Details: Perform a bitwise copy of *this object.
+// Type:    Overrideable.
+// Args:    T       - The object's type.
+//          vrOther - (R) The other object.
+// Return:  None.
+// Throws:  None.
+//--
+template <typename T>
+void
+CMIUtilVariant::CDataObject<T>::Duplicate(const CDataObject &vrOther)
 {
-	CDataObjectBase::Copy( vrOther );
-	m_dataObj = vrOther.m_dataObj;
+    CDataObjectBase::Copy(vrOther);
+    m_dataObj = vrOther.m_dataObj;
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Release any resources used by *this object.
-// Type:	Overridden.
-// Args:	None.
-// Return:	None.
-// Throws:	None.
-//--
-template< typename T >
-void CMIUtilVariant::CDataObject< T >::Destroy( void )
+// Details: Release any resources used by *this object.
+// Type:    Overridden.
+// Args:    None.
+// Return:  None.
+// Throws:  None.
+//--
+template <typename T>
+void
+CMIUtilVariant::CDataObject<T>::Destroy(void)
 {
-	CDataObjectBase::Destroy();
+    CDataObjectBase::Destroy();
 }
 
 //---------------------------------------------------------------------------------------
@@ -256,36 +255,37 @@ void CMIUtilVariant::CDataObject< T >::D
 //---------------------------------------------------------------------------------------
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Assign to the variant an object of a specified type.
-// Type:	Template method.
-// Args:	T		- The object's type.
-//			vArg	- (R) The object to store.
-// Return:	None.
-// Throws:	None.
-//--
-template< typename T >
-void CMIUtilVariant::Set( const T & vArg )
+// Details: Assign to the variant an object of a specified type.
+// Type:    Template method.
+// Args:    T       - The object's type.
+//          vArg    - (R) The object to store.
+// Return:  None.
+// Throws:  None.
+//--
+template <typename T>
+void
+CMIUtilVariant::Set(const T &vArg)
 {
-	m_pDataObject = new CDataObject< T >(  vArg );
+    m_pDataObject = new CDataObject<T>(vArg);
 }
 
 //++ ------------------------------------------------------------------------------------
-// Details:	Retrieve the data object from *this variant.
-// Type:	Template method.
-// Args:	T	- The object's type.
-// Return:	T *	- Pointer the data object, NULL = data object not assigned to *this variant.
-// Throws:	None.
-//--
-template< typename T >
-T * CMIUtilVariant::Get( void ) const
-{
-	if( (m_pDataObject != nullptr) && m_pDataObject->GetIsDerivedClass() )
-	{
-		CDataObject< T > * pDataObj = static_cast< CDataObject< T > * >( m_pDataObject );
-		return &pDataObj->GetDataObject();
-	}
+// Details: Retrieve the data object from *this variant.
+// Type:    Template method.
+// Args:    T   - The object's type.
+// Return:  T * - Pointer the data object, NULL = data object not assigned to *this variant.
+// Throws:  None.
+//--
+template <typename T>
+T *
+CMIUtilVariant::Get(void) const
+{
+    if ((m_pDataObject != nullptr) && m_pDataObject->GetIsDerivedClass())
+    {
+        CDataObject<T> *pDataObj = static_cast<CDataObject<T> *>(m_pDataObject);
+        return &pDataObj->GetDataObject();
+    }
 
-	// Do not use a CDataObjectBase object, use only CDataObjectBase derived objects
-	return nullptr;
+    // Do not use a CDataObjectBase object, use only CDataObjectBase derived objects
+    return nullptr;
 }
-

Modified: lldb/trunk/tools/lldb-mi/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/Platform.cpp?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/Platform.cpp (original)
+++ lldb/trunk/tools/lldb-mi/Platform.cpp Mon Nov 17 12:06:21 2014
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // this file is only relevant for Visual C++
-#if defined( _MSC_VER )
+#if defined(_MSC_VER)
 
 #include <process.h>
 #include <assert.h>
@@ -19,89 +19,88 @@
 static sighandler_t _ctrlHandler = NULL;
 
 // the default console control handler
-BOOL
-WINAPI CtrlHandler (DWORD ctrlType)
+BOOL WINAPI CtrlHandler(DWORD ctrlType)
 {
-    if ( _ctrlHandler != NULL )
+    if (_ctrlHandler != NULL)
     {
-        _ctrlHandler( 0 );
+        _ctrlHandler(0);
         return TRUE;
     }
     return FALSE;
 }
 
 int
-ioctl (int d, int request, ...)
+ioctl(int d, int request, ...)
 {
-    switch ( request )
+    switch (request)
     {
-    // request the console windows size
-    case ( TIOCGWINSZ ):
+        // request the console windows size
+        case (TIOCGWINSZ):
         {
             va_list vl;
-            va_start(vl,request);
-	    // locate the window size structure on stack
-	    winsize *ws = va_arg(vl, winsize*);
+            va_start(vl, request);
+            // locate the window size structure on stack
+            winsize *ws = va_arg(vl, winsize *);
             // get screen buffer information
             CONSOLE_SCREEN_BUFFER_INFO info;
-            if ( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &info ) == TRUE )
+            if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info) == TRUE)
                 // fill in the columns
                 ws->ws_col = info.dwMaximumWindowSize.X;
             va_end(vl);
             return 0;
         }
         break;
-    default:
-        assert( !"Not implemented!" );
+        default:
+            assert(!"Not implemented!");
     }
     return -1;
 }
 
 int
-kill (pid_t pid, int sig)
+kill(pid_t pid, int sig)
 {
     // is the app trying to kill itself
-    if ( pid == getpid( ) )
-        exit( sig );
+    if (pid == getpid())
+        exit(sig);
     //
-    assert( !"Not implemented!" );
+    assert(!"Not implemented!");
     return -1;
 }
 
 int
-tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
+tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
 {
-    assert( !"Not implemented!" );
+    assert(!"Not implemented!");
     return -1;
 }
 
 int
-tcgetattr (int fildes, struct termios *termios_p)
+tcgetattr(int fildes, struct termios *termios_p)
 {
-//  assert( !"Not implemented!" );
+    //  assert( !"Not implemented!" );
     // error return value (0=success)
     return -1;
 }
 
 sighandler_t
-signal (int sig, sighandler_t sigFunc)
+signal(int sig, sighandler_t sigFunc)
 {
-    switch ( sig )
+    switch (sig)
     {
-    case ( SIGINT ):
+        case (SIGINT):
         {
             _ctrlHandler = sigFunc;
-            SetConsoleCtrlHandler( CtrlHandler, TRUE );
+            SetConsoleCtrlHandler(CtrlHandler, TRUE);
         }
         break;
-    case ( SIGPIPE  ):
-    case ( SIGWINCH ):
-    case ( SIGTSTP  ):
-    case ( SIGCONT  ):
-        // ignore these for now
-        break;
-    default:
-        assert( !"Not implemented!" );
+        case (SIGPIPE):
+        case (SIGWINCH):
+        case (SIGTSTP):
+        case (SIGCONT):
+            // ignore these for now
+            break;
+        default:
+            assert(!"Not implemented!");
     }
     return 0;
 }

Modified: lldb/trunk/tools/lldb-mi/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/Platform.h?rev=222150&r1=222149&r2=222150&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/Platform.h (original)
+++ lldb/trunk/tools/lldb-mi/Platform.h Mon Nov 17 12:06:21 2014
@@ -8,102 +8,102 @@
 //===----------------------------------------------------------------------===//
 #pragma once
 
-#if defined( _MSC_VER )
+#if defined(_MSC_VER)
 
-    // this will stop signal.h being included
-    #define _INC_SIGNAL
+// this will stop signal.h being included
+#define _INC_SIGNAL
 
-    #include <io.h>
-    #include <eh.h>
-    #include <inttypes.h>
-    #include <lldb/Host/windows/Windows.h>
-    #include <lldb/Host/HostGetOpt.h>
-
-	// This is not used by MI
-    struct timeval
-    {
-        long tv_sec;
-        long tv_usec;
-    };
-
-    struct winsize
-    {
-        long ws_col;
-    };
-
-    typedef unsigned char   cc_t;
-    typedef unsigned int    speed_t;
-    typedef unsigned int    tcflag_t;
-
-    // fcntl.h // This is not used by MI
-    #define O_NOCTTY 0400
-
-    // ioctls.h
-    #define TIOCGWINSZ 0x5413
-
-    // tcsetattr arguments
-    #define TCSANOW 0
-
-    #define NCCS 32
-    struct termios
-    {
-        tcflag_t c_iflag;  // input mode flags
-        tcflag_t c_oflag;  // output mode flags
-        tcflag_t c_cflag;  // control mode flags
-        tcflag_t c_lflag;  // local mode flags
-        cc_t c_line;       // line discipline
-        cc_t c_cc[NCCS];   // control characters
-        speed_t c_ispeed;  // input speed
-        speed_t c_ospeed;  // output speed
-    };
-
-	typedef long pid_t;
-
-    #define STDIN_FILENO 0
-	#define PATH_MAX MAX_PATH
-    #define snprintf _snprintf
-
-    extern int  ioctl( int d, int request, ... );
-    extern int  kill ( pid_t pid, int sig      );
-    extern int  tcsetattr( int fd, int optional_actions, const struct termios *termios_p );
-    extern int  tcgetattr( int fildes, struct termios *termios_p );
-
-    // signal handler function pointer type
-    typedef void (*sighandler_t)(int);
-
-	// CODETAG_IOR_SIGNALS
-    // signal.h
-    #define SIGINT		2						// Terminal interrupt signal
-	#define SIGQUIT		3						// Terminal quit signal	
-	#define	SIGKILL		9						// Kill (cannot be caught or ignored)
-	#define SIGPIPE		13						// Write on a pipe with no one to read it
-    #define SIGCONT		18						// Continue executing, if stopped.
-    #define SIGTSTP		20						// Terminal stop signal
-    #define SIGSTOP		23						// Stop executing (cannot be caught or ignored)
-    #define SIGWINCH	28						// (== SIGVTALRM)
-    #define SIG_DFL		( (sighandler_t) -1 )	// Default handler
-    #define SIG_IGN		( (sighandler_t) -2 )	// Ignored
+#include <io.h>
+#include <eh.h>
+#include <inttypes.h>
+#include <lldb/Host/windows/Windows.h>
+#include <lldb/Host/HostGetOpt.h>
+
+// This is not used by MI
+struct timeval
+{
+    long tv_sec;
+    long tv_usec;
+};
+
+struct winsize
+{
+    long ws_col;
+};
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+// fcntl.h // This is not used by MI
+#define O_NOCTTY 0400
+
+// ioctls.h
+#define TIOCGWINSZ 0x5413
+
+// tcsetattr arguments
+#define TCSANOW 0
+
+#define NCCS 32
+struct termios
+{
+    tcflag_t c_iflag; // input mode flags
+    tcflag_t c_oflag; // output mode flags
+    tcflag_t c_cflag; // control mode flags
+    tcflag_t c_lflag; // local mode flags
+    cc_t c_line;      // line discipline
+    cc_t c_cc[NCCS];  // control characters
+    speed_t c_ispeed; // input speed
+    speed_t c_ospeed; // output speed
+};
+
+typedef long pid_t;
+
+#define STDIN_FILENO 0
+#define PATH_MAX MAX_PATH
+#define snprintf _snprintf
+
+extern int ioctl(int d, int request, ...);
+extern int kill(pid_t pid, int sig);
+extern int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
+extern int tcgetattr(int fildes, struct termios *termios_p);
+
+// signal handler function pointer type
+typedef void (*sighandler_t)(int);
+
+// CODETAG_IOR_SIGNALS
+// signal.h
+#define SIGINT 2                   // Terminal interrupt signal
+#define SIGQUIT 3                  // Terminal quit signal
+#define SIGKILL 9                  // Kill (cannot be caught or ignored)
+#define SIGPIPE 13                 // Write on a pipe with no one to read it
+#define SIGCONT 18                 // Continue executing, if stopped.
+#define SIGTSTP 20                 // Terminal stop signal
+#define SIGSTOP 23                 // Stop executing (cannot be caught or ignored)
+#define SIGWINCH 28                // (== SIGVTALRM)
+#define SIG_DFL ((sighandler_t)-1) // Default handler
+#define SIG_IGN ((sighandler_t)-2) // Ignored
 
-	extern sighandler_t signal( int sig, sighandler_t );
+extern sighandler_t signal(int sig, sighandler_t);
 
 #else
 
-    #include <inttypes.h>
+#include <inttypes.h>
 
-    #include <getopt.h>
-    #include <libgen.h>
-    #include <sys/ioctl.h>
-    #include <termios.h>
-    #include <unistd.h>
-
-    #include <histedit.h>
-    #include <pthread.h>
-    #include <sys/time.h>
-
-    #if defined(__FreeBSD__)
-        #include <readline/readline.h>
-    #else
-        #include <editline/readline.h>
-    #endif
+#include <getopt.h>
+#include <libgen.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include <histedit.h>
+#include <pthread.h>
+#include <sys/time.h>
+
+#if defined(__FreeBSD__)
+#include <readline/readline.h>
+#else
+#include <editline/readline.h>
+#endif
 
 #endif





More information about the lldb-commits mailing list