Index: tools/lldb-mi/MICmdCmdData.cpp =================================================================== --- tools/lldb-mi/MICmdCmdData.cpp +++ tools/lldb-mi/MICmdCmdData.cpp @@ -410,6 +410,13 @@ lldb::SBInstruction instrt = instructions.GetInstructionAtIndex(i); const MIchar *pStrMnemonic = instrt.GetMnemonic(sbTarget); pStrMnemonic = (pStrMnemonic != nullptr) ? pStrMnemonic : pUnknown; + const MIchar *pStrComment = instrt.GetComment(sbTarget); + pStrComment = (pStrComment != nullptr) ? pStrComment : ""; + CMIUtilString strComment(""); + if(*pStrComment != '\0') + { + strComment = CMIUtilString::Format("\t\t; %s",pStrComment); + } lldb::SBAddress address = instrt.GetAddress(); lldb::addr_t addr = address.GetLoadAddress(sbTarget); const MIchar *pFnName = address.GetFunction().GetName(); @@ -432,7 +439,7 @@ const CMICmnMIValueConst miValueConst4(CMIUtilString::Format("%d", instrtSize)); const CMICmnMIValueResult miValueResult4("size", miValueConst4); miValueTuple.Add(miValueResult4); - const CMICmnMIValueConst miValueConst5(CMIUtilString::Format("%s %s", pStrMnemonic, pStrOperands)); + const CMICmnMIValueConst miValueConst5(CMIUtilString::Format("%s %s%s", pStrMnemonic, pStrOperands,strComment.c_str())); const CMICmnMIValueResult miValueResult5("inst", miValueConst5); miValueTuple.Add(miValueResult5); Index: tools/lldb-mi/MICmdCmdVar.cpp =================================================================== --- tools/lldb-mi/MICmdCmdVar.cpp +++ tools/lldb-mi/MICmdCmdVar.cpp @@ -177,13 +177,23 @@ lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread(); m_nThreadId = thread.GetIndexID(); lldb::SBFrame frame = bCurrentFrame ? thread.GetSelectedFrame() : thread.GetFrameAtIndex(nFrame); + lldb::SBValue value; - const bool bArgs = true; - const bool bLocals = true; - const bool bStatics = true; - const bool bInScopeOnly = false; - const lldb::SBValueList valueList = frame.GetVariables(bArgs, bLocals, bStatics, bInScopeOnly); - lldb::SBValue value = valueList.GetFirstValueByName(rStrExpression.c_str()); + if(rStrExpression[0] == '$') + { + CMIUtilString rStrRegister(rStrExpression.substr(1,std::string::npos).c_str()); + value = frame.FindRegister(rStrRegister.c_str()); + } + else + { + const bool bArgs = true; + const bool bLocals = true; + const bool bStatics = true; + const bool bInScopeOnly = false; + const lldb::SBValueList valueList = frame.GetVariables(bArgs, bLocals, bStatics, bInScopeOnly); + value = valueList.GetFirstValueByName(rStrExpression.c_str()); + } + if (!value.IsValid()) value = frame.EvaluateExpression(rStrExpression.c_str()); 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-log") , 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.txt", 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.txt", 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 @@ -135,7 +135,19 @@ bool CMIUtilSystemWindows::GetLogFilesPath(CMIUtilString &vrwFileNamePath) const { - return GetExecutablesPath(vrwFileNamePath); + bool bOk = MIstatus::success; + char pPath[MAX_PATH]; + const DWORD nLen = ::GetTempPath(MAX_PATH, &pPath[0]); + const CMIUtilString strLastErr(GetOSLastError()); + if ((nLen != 0) && (strLastErr == "Unknown OS error")) + vrwFileNamePath = &pPath[0]; + else + { + bOk = MIstatus::failure; + vrwFileNamePath = strLastErr; + } + + return bOk; } #endif // #if defined( _MSC_VER )