[Lldb-commits] [PATCH] Include comments in LLDB-MI disassembly, and other MI changes

Ilia K ki.stfu at gmail.com
Thu Apr 9 09:35:52 PDT 2015


Create a separate review for each of these changes and take into account the following comments please:


REPOSITORY
  rL LLVM

================
Comment at: tools/lldb-mi/MICmdCmdData.cpp:413-419
@@ -412,2 +412,9 @@
         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();
----------------
minor fix:
```
const MIchar *pStrComment = instrt.GetComment(sbTarget);
CMIUtilString strComment;
if (pStrComment != nullptr && *pStrComment != '\0')
    strComment = CMIUtilString::Format("\t\t; %s", pStrComment);
```

================
Comment at: tools/lldb-mi/MICmdCmdData.cpp:442
@@ -434,3 +441,3 @@
         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);
----------------
```
const CMICmnMIValueConst miValueConst5(CMIUtilString::Format("%s %s%s", pStrMnemonic, pStrOperands, strComment.c_str()))
```

================
Comment at: tools/lldb-mi/MICmdCmdVar.cpp:182-186
@@ -180,7 +181,7 @@
 
-    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
----------------
```
if (rStrExpression[0] == '$')
{
    const CMIUtilString rStrRegister(rStrExpression.substr(1).c_str());
    value = frame.FindRegister(rStrRegister.c_str());
}
```

================
Comment at: tools/lldb-mi/MICmnLogMediumFile.cpp:30
@@ -29,3 +29,3 @@
     : 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))
----------------
why? add any ext back, please.

================
Comment at: tools/lldb-mi/MIUtilDateTimeStd.cpp:85-88
@@ +84,6 @@
+{
+    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));
+
----------------
```
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));
```

================
Comment at: tools/lldb-mi/MIUtilSystemLinux.cpp:107
@@ -106,3 +106,3 @@
 {
-    vrwFileNamePath = CMIUtilString(".");
+    vrwFileNamePath = CMIUtilString(P_tmpdir);
     return MIstatus::success;
----------------
Does it work on Windows?

================
Comment at: tools/lldb-mi/MIUtilSystemWindows.cpp:139
@@ +138,3 @@
+    bool bOk = MIstatus::success;
+    char pPath[MAX_PATH];
+    const DWORD nLen = ::GetTempPath(MAX_PATH, &pPath[0]);
----------------
Use dynamic memory

http://reviews.llvm.org/D8923

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list