Index: lldb.xcodeproj/project.pbxproj =================================================================== --- lldb.xcodeproj/project.pbxproj +++ lldb.xcodeproj/project.pbxproj @@ -282,9 +282,6 @@ 266942431A6DC2AC0063BE93 /* MIUtilFileStd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941E81A6DC2AC0063BE93 /* MIUtilFileStd.cpp */; }; 266942441A6DC2AC0063BE93 /* MIUtilMapIdToVariant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941EA1A6DC2AC0063BE93 /* MIUtilMapIdToVariant.cpp */; }; 266942451A6DC2AC0063BE93 /* MIUtilString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941EE1A6DC2AC0063BE93 /* MIUtilString.cpp */; }; - 266942461A6DC2AC0063BE93 /* MIUtilSystemLinux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941F01A6DC2AC0063BE93 /* MIUtilSystemLinux.cpp */; }; - 266942471A6DC2AC0063BE93 /* MIUtilSystemOsx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941F21A6DC2AC0063BE93 /* MIUtilSystemOsx.cpp */; }; - 266942481A6DC2AC0063BE93 /* MIUtilSystemWindows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941F41A6DC2AC0063BE93 /* MIUtilSystemWindows.cpp */; }; 2669424A1A6DC2AC0063BE93 /* MIUtilThreadBaseStd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941F81A6DC2AC0063BE93 /* MIUtilThreadBaseStd.cpp */; }; 2669424B1A6DC2AC0063BE93 /* MIUtilVariant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941FA1A6DC2AC0063BE93 /* MIUtilVariant.cpp */; }; 2669424C1A6DC2AC0063BE93 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266941FC1A6DC2AC0063BE93 /* Platform.cpp */; }; @@ -1622,12 +1619,6 @@ 266941ED1A6DC2AC0063BE93 /* MIUtilSingletonHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MIUtilSingletonHelper.h; path = "tools/lldb-mi/MIUtilSingletonHelper.h"; sourceTree = SOURCE_ROOT; }; 266941EE1A6DC2AC0063BE93 /* MIUtilString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MIUtilString.cpp; path = "tools/lldb-mi/MIUtilString.cpp"; sourceTree = SOURCE_ROOT; }; 266941EF1A6DC2AC0063BE93 /* MIUtilString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MIUtilString.h; path = "tools/lldb-mi/MIUtilString.h"; sourceTree = SOURCE_ROOT; }; - 266941F01A6DC2AC0063BE93 /* MIUtilSystemLinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MIUtilSystemLinux.cpp; path = "tools/lldb-mi/MIUtilSystemLinux.cpp"; sourceTree = SOURCE_ROOT; }; - 266941F11A6DC2AC0063BE93 /* MIUtilSystemLinux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MIUtilSystemLinux.h; path = "tools/lldb-mi/MIUtilSystemLinux.h"; sourceTree = SOURCE_ROOT; }; - 266941F21A6DC2AC0063BE93 /* MIUtilSystemOsx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MIUtilSystemOsx.cpp; path = "tools/lldb-mi/MIUtilSystemOsx.cpp"; sourceTree = SOURCE_ROOT; }; - 266941F31A6DC2AC0063BE93 /* MIUtilSystemOsx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MIUtilSystemOsx.h; path = "tools/lldb-mi/MIUtilSystemOsx.h"; sourceTree = SOURCE_ROOT; }; - 266941F41A6DC2AC0063BE93 /* MIUtilSystemWindows.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MIUtilSystemWindows.cpp; path = "tools/lldb-mi/MIUtilSystemWindows.cpp"; sourceTree = SOURCE_ROOT; }; - 266941F51A6DC2AC0063BE93 /* MIUtilSystemWindows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MIUtilSystemWindows.h; path = "tools/lldb-mi/MIUtilSystemWindows.h"; sourceTree = SOURCE_ROOT; }; 266941F81A6DC2AC0063BE93 /* MIUtilThreadBaseStd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MIUtilThreadBaseStd.cpp; path = "tools/lldb-mi/MIUtilThreadBaseStd.cpp"; sourceTree = SOURCE_ROOT; }; 266941F91A6DC2AC0063BE93 /* MIUtilThreadBaseStd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MIUtilThreadBaseStd.h; path = "tools/lldb-mi/MIUtilThreadBaseStd.h"; sourceTree = SOURCE_ROOT; }; 266941FA1A6DC2AC0063BE93 /* MIUtilVariant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MIUtilVariant.cpp; path = "tools/lldb-mi/MIUtilVariant.cpp"; sourceTree = SOURCE_ROOT; }; @@ -3794,12 +3785,6 @@ 266941ED1A6DC2AC0063BE93 /* MIUtilSingletonHelper.h */, 266941EE1A6DC2AC0063BE93 /* MIUtilString.cpp */, 266941EF1A6DC2AC0063BE93 /* MIUtilString.h */, - 266941F01A6DC2AC0063BE93 /* MIUtilSystemLinux.cpp */, - 266941F11A6DC2AC0063BE93 /* MIUtilSystemLinux.h */, - 266941F21A6DC2AC0063BE93 /* MIUtilSystemOsx.cpp */, - 266941F31A6DC2AC0063BE93 /* MIUtilSystemOsx.h */, - 266941F41A6DC2AC0063BE93 /* MIUtilSystemWindows.cpp */, - 266941F51A6DC2AC0063BE93 /* MIUtilSystemWindows.h */, 266941F81A6DC2AC0063BE93 /* MIUtilThreadBaseStd.cpp */, 266941F91A6DC2AC0063BE93 /* MIUtilThreadBaseStd.h */, 266941FA1A6DC2AC0063BE93 /* MIUtilVariant.cpp */, @@ -6700,7 +6685,6 @@ 266942171A6DC2AC0063BE93 /* MICmdCmdStack.cpp in Sources */, 266942121A6DC2AC0063BE93 /* MICmdCmdFile.cpp in Sources */, 2669424B1A6DC2AC0063BE93 /* MIUtilVariant.cpp in Sources */, - 266942471A6DC2AC0063BE93 /* MIUtilSystemOsx.cpp in Sources */, 2669421E1A6DC2AC0063BE93 /* MICmdCommands.cpp in Sources */, 266942161A6DC2AC0063BE93 /* MICmdCmdMiscellanous.cpp in Sources */, 266942281A6DC2AC0063BE93 /* MICmnLLDBDebuggerHandleEvents.cpp in Sources */, @@ -6708,7 +6692,6 @@ 266942261A6DC2AC0063BE93 /* MICmnLLDBBroadcaster.cpp in Sources */, 266942141A6DC2AC0063BE93 /* MICmdCmdGdbSet.cpp in Sources */, 2669423F1A6DC2AC0063BE93 /* MIDriverMain.cpp in Sources */, - 266942481A6DC2AC0063BE93 /* MIUtilSystemWindows.cpp in Sources */, 266942041A6DC2AC0063BE93 /* MICmdArgValFile.cpp in Sources */, 2669422D1A6DC2AC0063BE93 /* MICmnLog.cpp in Sources */, 2669420E1A6DC2AC0063BE93 /* MICmdCmdBreak.cpp in Sources */, @@ -6740,7 +6723,6 @@ 2669422B1A6DC2AC0063BE93 /* MICmnLLDBProxySBValue.cpp in Sources */, 2669423E1A6DC2AC0063BE93 /* MIDriverBase.cpp in Sources */, 2669424C1A6DC2AC0063BE93 /* Platform.cpp in Sources */, - 266942461A6DC2AC0063BE93 /* MIUtilSystemLinux.cpp in Sources */, 266942021A6DC2AC0063BE93 /* MICmdArgValBase.cpp in Sources */, 266942091A6DC2AC0063BE93 /* MICmdArgValOptionShort.cpp in Sources */, 266942291A6DC2AC0063BE93 /* MICmnLLDBDebugSessionInfo.cpp in Sources */, Index: tools/lldb-mi/CMakeLists.txt =================================================================== --- tools/lldb-mi/CMakeLists.txt +++ tools/lldb-mi/CMakeLists.txt @@ -70,9 +70,6 @@ MIUtilFileStd.cpp MIUtilMapIdToVariant.cpp MIUtilString.cpp - MIUtilSystemLinux.cpp - MIUtilSystemOsx.cpp - MIUtilSystemWindows.cpp MIUtilThreadBaseStd.cpp MIUtilVariant.cpp Platform.cpp Index: tools/lldb-mi/MICmnLogMediumFile.cpp =================================================================== --- tools/lldb-mi/MICmnLogMediumFile.cpp +++ tools/lldb-mi/MICmnLogMediumFile.cpp @@ -10,13 +10,6 @@ // In-house headers: #include "MICmnLogMediumFile.h" #include "MICmnResources.h" -#if defined(_MSC_VER) -#include "MIUtilSystemWindows.h" -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__linux__) -#include "MIUtilSystemLinux.h" -#elif defined(__APPLE__) -#include "MIUtilSystemOsx.h" -#endif // defined( _MSC_VER ) //++ ------------------------------------------------------------------------------------ // Details: CMICmnLogMediumFile constructor. @@ -29,7 +22,7 @@ : m_constThisMediumName(MIRSRC(IDS_MEDIUMFILE_NAME)) , m_constMediumFileNameFormat("lldb-mi-%s.log") , m_strMediumFileName(MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH)) - , m_strMediumFileDirectory(MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH)) + , m_strMediumFileDirectory(".") , m_fileNamePath(MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH)) , m_eVerbosityType(CMICmnLog::eLogVerbosity_Log) , m_strDate(CMIUtilDateTimeStd().GetDate()) @@ -74,10 +67,7 @@ bool CMICmnLogMediumFile::Initialize() { - m_bInitialized = CMIUtilSystem().GetLogFilesPath(m_strMediumFileDirectory); - m_bInitialized &= FileFormFileNamePath(); - - return m_bInitialized; + return FileFormFileNamePath(); } //++ ------------------------------------------------------------------------------------ @@ -216,23 +206,16 @@ m_fileNamePath = MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH); - if (m_strMediumFileDirectory.compare(MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH)) != 0) - { - CMIUtilDateTimeStd date; - m_strMediumFileName = CMIUtilString::Format(m_constMediumFileNameFormat.c_str(), date.GetDateTimeLogFilename().c_str()); + CMIUtilDateTimeStd date; + m_strMediumFileName = CMIUtilString::Format(m_constMediumFileNameFormat.c_str(), date.GetDateTimeLogFilename().c_str()); #if defined(_MSC_VER) - m_fileNamePath = CMIUtilString::Format("%s\\%s", m_strMediumFileDirectory.c_str(), m_strMediumFileName.c_str()); + m_fileNamePath = CMIUtilString::Format("%s\\%s", m_strMediumFileDirectory.c_str(), m_strMediumFileName.c_str()); #else - m_fileNamePath = CMIUtilString::Format("%s/%s", m_strMediumFileDirectory.c_str(), m_strMediumFileName.c_str()); + m_fileNamePath = CMIUtilString::Format("%s/%s", m_strMediumFileDirectory.c_str(), m_strMediumFileName.c_str()); #endif // defined ( _MSC_VER ) - return MIstatus::success; - } - - SetErrorDescription(MIRSRC(IDE_MEDIUMFILE_ERR_GET_FILE_PATHNAME_SYS)); - - return MIstatus::failure; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ Index: tools/lldb-mi/MICmnResources.h =================================================================== --- tools/lldb-mi/MICmnResources.h +++ tools/lldb-mi/MICmnResources.h @@ -50,7 +50,6 @@ IDS_LOG_MEDIUM_ERR_INIT, IDS_LOG_MEDIUM_ERR_WRITE_ANY, IDS_LOG_MEDIUM_ERR_WRITE_MEDIUMFAIL, - IDE_MEDIUMFILE_ERR_GET_FILE_PATHNAME_SYS, IDS_MEDIUMFILE_NAME, IDS_MEDIUMFILE_ERR_INVALID_PATH, Index: tools/lldb-mi/MICmnResources.cpp =================================================================== --- tools/lldb-mi/MICmnResources.cpp +++ tools/lldb-mi/MICmnResources.cpp @@ -45,7 +45,6 @@ {IDS_MEDIUMFILE_ERR_INVALID_PATH, ""}, {IDS_MEDIUMFILE_ERR_FILE_HEADER, ""}, {IDS_MEDIUMFILE_NAME_LOG, "File medium. %s"}, - {IDE_MEDIUMFILE_ERR_GET_FILE_PATHNAME_SYS, "File Medium. Failed to retrieve the system/executable path for the Log file"}, {IDE_OS_ERR_UNKNOWN, "Unknown OS error"}, {IDE_OS_ERR_RETRIEVING, "Unabled to retrieve OS error message"}, {IDS_DRIVERMGR_DRIVER_ERR_INIT, "Driver Manager. Driver '%s' (ID:'%s') initialise failed. %s"}, Index: tools/lldb-mi/MIUtilSystemLinux.h =================================================================== --- tools/lldb-mi/MIUtilSystemLinux.h +++ /dev/null @@ -1,42 +0,0 @@ -//===-- CMIUtilSystemLinux.h ------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#pragma once - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__linux__) - -// In-house headers: -#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 -//-- -class CMIUtilSystemLinux -{ - // Methods: - public: - /* ctor */ CMIUtilSystemLinux(); - - bool GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const; - CMIUtilString GetOSLastError() const; - bool GetExecutablesPath(CMIUtilString &vrwFileNamePath) const; - bool GetLogFilesPath(CMIUtilString &vrwFileNamePath) const; - - // Overrideable: - public: - // From CMICmnBase - /* dtor */ virtual ~CMIUtilSystemLinux(); -}; - -typedef CMIUtilSystemLinux CMIUtilSystem; - -#endif // #if defined( __linux__ ) Index: tools/lldb-mi/MIUtilSystemLinux.cpp =================================================================== --- tools/lldb-mi/MIUtilSystemLinux.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//===-- MIUtilSystemLinux.cpp -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__linux__) - -// In-house headers: -#include "MIUtilSystemLinux.h" -#include "MICmnResources.h" - -//++ ------------------------------------------------------------------------------------ -// Details: CMIUtilSystemLinux constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. -//-- -CMIUtilSystemLinux::CMIUtilSystemLinux() -{ -} - -//++ ------------------------------------------------------------------------------------ -// Details: CMIUtilSystemLinux destructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. -//-- -CMIUtilSystemLinux::~CMIUtilSystemLinux() -{ -} - -//++ ------------------------------------------------------------------------------------ -// 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 -{ - // Reset - vrwErrorMsg.clear(); - - 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. -//-- -CMIUtilString -CMIUtilSystemLinux::GetOSLastError() const -{ - 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 executable'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 -{ - 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. -//-- -bool -CMIUtilSystemLinux::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const -{ - vrwFileNamePath = CMIUtilString("."); - return MIstatus::success; -} - -#endif // #if defined( __linux__ ) Index: tools/lldb-mi/MIUtilSystemOsx.h =================================================================== --- tools/lldb-mi/MIUtilSystemOsx.h +++ /dev/null @@ -1,42 +0,0 @@ -//===-- MICmnConfig.h -------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#pragma once - -#if defined(__APPLE__) - -// In-house headers: -#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 -//-- -class CMIUtilSystemOsx -{ - // Methods: - public: - /* ctor */ CMIUtilSystemOsx(); - - bool GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const; - CMIUtilString GetOSLastError() const; - bool GetExecutablesPath(CMIUtilString &vrwFileNamePath) const; - bool GetLogFilesPath(CMIUtilString &vrwFileNamePath) const; - - // Overrideable: - public: - // From CMICmnBase - /* dtor */ virtual ~CMIUtilSystemOsx(); -}; - -typedef CMIUtilSystemOsx CMIUtilSystem; - -#endif // #if defined( __APPLE__ ) Index: tools/lldb-mi/MIUtilSystemOsx.cpp =================================================================== --- tools/lldb-mi/MIUtilSystemOsx.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//===-- MIUtilSystemOsx.cpp -------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#if defined(__APPLE__) - -// In-house headers: -#include "MIUtilSystemOsx.h" -#include "MICmnResources.h" - -//++ ------------------------------------------------------------------------------------ -// Details: CMIUtilSystemOsx constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. -//-- -CMIUtilSystemOsx::CMIUtilSystemOsx() -{ -} - -//++ ------------------------------------------------------------------------------------ -// Details: CMIUtilSystemOsx destructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. -//-- -CMIUtilSystemOsx::~CMIUtilSystemOsx() -{ -} - -//++ ------------------------------------------------------------------------------------ -// 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 -{ - // Reset - vrwErrorMsg.clear(); - - 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. -//-- -CMIUtilString -CMIUtilSystemOsx::GetOSLastError() const -{ - 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 executable'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 -{ - 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. -//-- -bool -CMIUtilSystemOsx::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const -{ - vrwFileNamePath = CMIUtilString("."); - return MIstatus::success; -} - -#endif // #if defined( __APPLE__ ) Index: tools/lldb-mi/MIUtilSystemWindows.h =================================================================== --- tools/lldb-mi/MIUtilSystemWindows.h +++ /dev/null @@ -1,41 +0,0 @@ -//===-- MIUtilSystemWindows.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#pragma once - -#if defined(_MSC_VER) - -// In-house headers: -#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 -//-- -class CMIUtilSystemWindows -{ - // Methods: - public: - /* ctor */ CMIUtilSystemWindows(); - - bool GetOSErrorMsg(const MIint vError, CMIUtilString &vrwErrorMsg) const; - CMIUtilString GetOSLastError() const; - bool GetExecutablesPath(CMIUtilString &vrwFileNamePath) const; - bool GetLogFilesPath(CMIUtilString &vrwFileNamePath) const; - - // Overrideable: - public: - // From CMICmnBase - /* dtor */ virtual ~CMIUtilSystemWindows(); -}; - -typedef CMIUtilSystemWindows CMIUtilSystem; - -#endif // #if defined( _MSC_VER ) Index: tools/lldb-mi/MIUtilSystemWindows.cpp =================================================================== --- tools/lldb-mi/MIUtilSystemWindows.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//===-- MIUtilSystemWindows.cpp ---------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#if defined(_MSC_VER) - -// Third party headers -#include // std::unique_ptr -#include -#include // ::FormatMessage() - -// In-house headers: -#include "MIUtilSystemWindows.h" -#include "MICmnResources.h" -#include "MIUtilFileStd.h" - -//++ ------------------------------------------------------------------------------------ -// Details: CMIUtilSystemWindows constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. -//-- -CMIUtilSystemWindows::CMIUtilSystemWindows() -{ -} - -//++ ------------------------------------------------------------------------------------ -// Details: CMIUtilSystemWindows destructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. -//-- -CMIUtilSystemWindows::~CMIUtilSystemWindows() -{ -} - -//++ ------------------------------------------------------------------------------------ -// 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 -{ - // Reset - vrwErrorMsg.clear(); - - const MIuint nBufLen = 1024; - std::unique_ptr 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(&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. -//-- -CMIUtilString -CMIUtilSystemWindows::GetOSLastError() 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; -} - -//++ ------------------------------------------------------------------------------------ -// 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 executable'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 bOk = MIstatus::success; - HMODULE hModule = ::GetModuleHandle(nullptr); - char pPath[MAX_PATH]; - if (!::GetModuleFileName(hModule, &pPath[0], MAX_PATH)) - { - bOk = MIstatus::failure; - vrwFileNamePath = GetOSLastError(); - } - else - vrwFileNamePath = &pPath[0]; - - 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. -//-- -bool -CMIUtilSystemWindows::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const -{ - vrwFileNamePath = CMIUtilString("."); - return MIstatus::success; -} - -#endif // #if defined( _MSC_VER )