[Lldb-commits] [lldb] r235017 - Add comments to LLDB-MI disassembly.

Ilia K ki.stfu at gmail.com
Wed Apr 15 09:17:50 PDT 2015


Author: ki.stfu
Date: Wed Apr 15 11:17:50 2015
New Revision: 235017

URL: http://llvm.org/viewvc/llvm-project?rev=235017&view=rev
Log:
Add comments to LLDB-MI disassembly.

Summary:
This patch adds the comments which are included in LLDB disassembly, but are currently missing in MI, e.g.

 ^done,asm_insns=[...,{address="0x00000000004004ff",func-name="main",offset="18",size="2",inst="jmp 0x40050b ; <+30> at main.c:7"}]

 instead of

 ^done,asm_insns=[...,{address="0x00000000004004ff",func-name="main",offset="18",size="2",inst="jmp 0x40050b"}]

Thanks, Ewan

Patch from ewan at codeplay.com

Reviewers: abidh, EwanCrawford

Subscribers: ted, lldb-commits, deepak2427

Differential Revision: http://reviews.llvm.org/D8964

Modified:
    lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=235017&r1=235016&r2=235017&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Wed Apr 15 11:17:50 2015
@@ -410,6 +410,10 @@ CMICmdCmdDataDisassemble::Execute(void)
         lldb::SBInstruction instrt = instructions.GetInstructionAtIndex(i);
         const MIchar *pStrMnemonic = instrt.GetMnemonic(sbTarget);
         pStrMnemonic = (pStrMnemonic != nullptr) ? pStrMnemonic : pUnknown;
+        const MIchar *pStrComment = instrt.GetComment(sbTarget);
+        CMIUtilString strComment;
+        if (pStrComment != nullptr && *pStrComment != '\0')
+            strComment = CMIUtilString::Format("; %s", pStrComment);
         lldb::SBAddress address = instrt.GetAddress();
         lldb::addr_t addr = address.GetLoadAddress(sbTarget);
         const MIchar *pFnName = address.GetFunction().GetName();
@@ -432,7 +436,7 @@ CMICmdCmdDataDisassemble::Execute(void)
         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);
 





More information about the lldb-commits mailing list