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

Ewan Crawford ewan at codeplay.com
Fri Apr 10 03:01:58 PDT 2015


Hi ki.stfu,

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

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8964

Files:
  tools/lldb-mi/MICmdCmdData.cpp

Index: tools/lldb-mi/MICmdCmdData.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdData.cpp
+++ tools/lldb-mi/MICmdCmdData.cpp
@@ -410,6 +410,10 @@
         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("\t\t; %s", pStrComment);
         lldb::SBAddress address = instrt.GetAddress();
         lldb::addr_t addr = address.GetLoadAddress(sbTarget);
         const MIchar *pFnName = address.GetFunction().GetName();
@@ -432,7 +436,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);

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8964.23582.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150410/8f528cca/attachment.bin>


More information about the lldb-commits mailing list