Index: tools/lldb-mi/MICmnLogMediumFile.cpp =================================================================== --- tools/lldb-mi/MICmnLogMediumFile.cpp +++ tools/lldb-mi/MICmnLogMediumFile.cpp @@ -27,7 +27,7 @@ //-- CMICmnLogMediumFile::CMICmnLogMediumFile(void) : m_constThisMediumName(MIRSRC(IDS_MEDIUMFILE_NAME)) - , m_constMediumFileName("lldb-mi-log.txt") + , m_constMediumFileName("lldb-mi") , m_fileNamePath(MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH)) , m_eVerbosityType(CMICmnLog::eLogVerbosity_Log) , m_strDate(CMIUtilDateTimeStd().GetDate()) @@ -213,21 +213,15 @@ m_fileNamePath = MIRSRC(IDS_MEDIUMFILE_ERR_INVALID_PATH); - CMIUtilString strPathName; - if (CMIUtilSystem().GetLogFilesPath(strPathName)) + CMIUtilString strPath; + if (CMIUtilSystem().GetLogFilesPath(strPath)) { - const CMIUtilString strPath = CMIUtilFileStd::StripOffFileName(strPathName); + CMIUtilDateTimeStd date; -// ToDo: Review this LINUX log file quick fix so not hidden -// AD: -// Linux was creating a log file here called '.\log.txt'. The '.' on linux -// signifies that this file is 'hidden' and not normally visible. A quick fix -// is to remove the path component all together. Linux also normally uses '/' -// as directory separators, again leading to the problem of the hidden log. #if defined(_MSC_VER) - m_fileNamePath = CMIUtilString::Format("%s\\%s", strPath.c_str(), m_constMediumFileName.c_str()); + m_fileNamePath = CMIUtilString::Format("%s\\%s-%s.log", strPath.c_str(), m_constMediumFileName.c_str(), date.GetDateTimeLogFilename().c_str()); #else - m_fileNamePath = CMIUtilString::Format("%s", m_constMediumFileName.c_str()); + m_fileNamePath = CMIUtilString::Format("%s/%s-%s.log", strPath.c_str(), m_constMediumFileName.c_str(), date.GetDateTimeLogFilename().c_str()); #endif // defined ( _MSC_VER ) return MIstatus::success; Index: tools/lldb-mi/MIUtilDateTimeStd.h =================================================================== --- tools/lldb-mi/MIUtilDateTimeStd.h +++ tools/lldb-mi/MIUtilDateTimeStd.h @@ -30,6 +30,7 @@ CMIUtilString GetDate(void); CMIUtilString GetTime(void); + CMIUtilString GetDateTimeLogFilename(void); // Overrideable: public: Index: tools/lldb-mi/MIUtilDateTimeStd.cpp =================================================================== --- tools/lldb-mi/MIUtilDateTimeStd.cpp +++ tools/lldb-mi/MIUtilDateTimeStd.cpp @@ -71,3 +71,21 @@ return strTime; } + +//++ ------------------------------------------------------------------------------------ +// Details: Retrieve system local current date and time in yyyy-MM-dd--HH-mm-ss format for log file names. +// Type: Method. +// Args: None. +// Return: CMIUtilString - Text description. +// Throws: None. +//-- +CMIUtilString +CMIUtilDateTimeStd::GetDateTimeLogFilename(void) +{ + std::time(&m_rawTime); + const std::tm *pTi = std::localtime(&m_rawTime); + const CMIUtilString strTime(CMIUtilString::Format("%d%02d%02d%02d%02d%02d", pTi->tm_year + 1900, pTi->tm_mon, + pTi->tm_mday, pTi->tm_hour, pTi->tm_min, pTi->tm_sec)); + + return strTime; +} Index: tools/lldb-mi/MIUtilSystemLinux.cpp =================================================================== --- tools/lldb-mi/MIUtilSystemLinux.cpp +++ tools/lldb-mi/MIUtilSystemLinux.cpp @@ -104,7 +104,7 @@ bool CMIUtilSystemLinux::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const { - vrwFileNamePath = CMIUtilString("."); + vrwFileNamePath = CMIUtilString(P_tmpdir); return MIstatus::success; } Index: tools/lldb-mi/MIUtilSystemWindows.cpp =================================================================== --- tools/lldb-mi/MIUtilSystemWindows.cpp +++ tools/lldb-mi/MIUtilSystemWindows.cpp @@ -17,6 +17,7 @@ // In-house headers: #include "MIUtilSystemWindows.h" #include "MICmnResources.h" +#include "Platform.h" //++ ------------------------------------------------------------------------------------ // Details: CMIUtilSystemWindows constructor. @@ -135,7 +136,19 @@ bool CMIUtilSystemWindows::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const { - return GetExecutablesPath(vrwFileNamePath); + bool bOk = MIstatus::success; + std::unique_ptr apPath(new char[PATH_MAX]); + const DWORD nLen = ::GetTempPath(PATH_MAX, apPath.get()); + const CMIUtilString strLastErr(GetOSLastError()); + if ((nLen != 0) && (strLastErr == "Unknown OS error")) + vrwFileNamePath = apPath.get(); + else + { + bOk = MIstatus::failure; + vrwFileNamePath = strLastErr; + } + + return bOk; } #endif // #if defined( _MSC_VER ) Index: tools/lldb-mi/Platform.h =================================================================== --- tools/lldb-mi/Platform.h +++ tools/lldb-mi/Platform.h @@ -19,13 +19,6 @@ #include #include -// This is not used by MI -struct timeval -{ - long tv_sec; - long tv_usec; -}; - struct winsize { long ws_col;