Author: brucem Date: Thu Sep 10 23:50:44 2015 New Revision: 247388 URL: http://llvm.org/viewvc/llvm-project?rev=247388&view=rev Log: [lldb-mi] Remove MIUtilSystem*.
Summary: This platform-specific code wasn't fully implemented and wasn't actually needed. There was one call for the log file path and that has been addressed. This lets us also remove an error message from MICmnLogMediumFile as it is no longer used. Reviewers: ki.stfu, domipheus, abidh Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12764 Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/tools/lldb-mi/CMakeLists.txt lldb/trunk/tools/lldb-mi/MICmnLogMediumFile.cpp lldb/trunk/tools/lldb-mi/MICmnResources.cpp lldb/trunk/tools/lldb-mi/MICmnResources.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=247388&r1=247387&r2=247388&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Sep 10 23:50:44 2015 @@ -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 */, Modified: lldb/trunk/tools/lldb-mi/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/CMakeLists.txt?rev=247388&r1=247387&r2=247388&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/CMakeLists.txt (original) +++ lldb/trunk/tools/lldb-mi/CMakeLists.txt Thu Sep 10 23:50:44 2015 @@ -70,9 +70,6 @@ set(LLDB_MI_SOURCES MIUtilFileStd.cpp MIUtilMapIdToVariant.cpp MIUtilString.cpp - MIUtilSystemLinux.cpp - MIUtilSystemOsx.cpp - MIUtilSystemWindows.cpp MIUtilThreadBaseStd.cpp MIUtilVariant.cpp Platform.cpp Modified: lldb/trunk/tools/lldb-mi/MICmnLogMediumFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLogMediumFile.cpp?rev=247388&r1=247387&r2=247388&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnLogMediumFile.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnLogMediumFile.cpp Thu Sep 10 23:50:44 2015 @@ -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 @@ CMICmnLogMediumFile::CMICmnLogMediumFile : 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 @@ CMICmnLogMediumFile::Instance() bool CMICmnLogMediumFile::Initialize() { - m_bInitialized = CMIUtilSystem().GetLogFilesPath(m_strMediumFileDirectory); - m_bInitialized &= FileFormFileNamePath(); - - return m_bInitialized; + return FileFormFileNamePath(); } //++ ------------------------------------------------------------------------------------ @@ -216,23 +206,16 @@ CMICmnLogMediumFile::FileFormFileNamePat 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; } //++ ------------------------------------------------------------------------------------ Modified: lldb/trunk/tools/lldb-mi/MICmnResources.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.cpp?rev=247388&r1=247387&r2=247388&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnResources.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnResources.cpp Thu Sep 10 23:50:44 2015 @@ -45,7 +45,6 @@ const CMICmnResources::SRsrcTextData CMI {IDS_MEDIUMFILE_ERR_INVALID_PATH, "<Invalid - not set>"}, {IDS_MEDIUMFILE_ERR_FILE_HEADER, "<Invalid - header not set>"}, {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"}, Modified: lldb/trunk/tools/lldb-mi/MICmnResources.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.h?rev=247388&r1=247387&r2=247388&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnResources.h (original) +++ lldb/trunk/tools/lldb-mi/MICmnResources.h Thu Sep 10 23:50:44 2015 @@ -50,7 +50,6 @@ enum 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, Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp?rev=247387&view=auto ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.cpp (removed) @@ -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__ ) Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h?rev=247387&view=auto ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h (original) +++ lldb/trunk/tools/lldb-mi/MIUtilSystemLinux.h (removed) @@ -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__ ) Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp?rev=247387&view=auto ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.cpp (removed) @@ -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__ ) Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h?rev=247387&view=auto ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h (original) +++ lldb/trunk/tools/lldb-mi/MIUtilSystemOsx.h (removed) @@ -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__ ) Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp?rev=247387&view=auto ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.cpp (removed) @@ -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 <memory> // std::unique_ptr -#include <Windows.h> -#include <WinBase.h> // ::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<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; - - 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 ) Removed: lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h?rev=247387&view=auto ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h (original) +++ lldb/trunk/tools/lldb-mi/MIUtilSystemWindows.h (removed) @@ -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 ) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits