[Lldb-commits] [lldb] r361255 - [lldb-mi] Include full path in the -data-disassemble response

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 06:22:46 PDT 2019


Author: tkrasnukha
Date: Tue May 21 06:22:46 2019
New Revision: 361255

URL: http://llvm.org/viewvc/llvm-project?rev=361255&view=rev
Log:
[lldb-mi] Include full path in the -data-disassemble response

Differential Revision: https://reviews.llvm.org/D59015

Patch by Anton Kolesov <Anton.Kolesov at synopsys.com>

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
    lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py?rev=361255&r1=361254&r2=361255&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py Tue May 21 06:22:46 2019
@@ -56,6 +56,14 @@ class MiDataTestCase(lldbmi_testcase.MiT
             "\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," %
             addr)
 
+        # Test -data-disassemble with source line information
+        self.runCmd("-data-disassemble -s %#x -e %#x -- 1" % (addr, addr + 0x10))
+        self.expect(
+            '\^done,asm_insns=\[src_and_asm_line={line="\d+",file="main.cpp",'
+            'line_asm_insn=\[{address="0x0*%x",func-name="main",offset="0",size="[1-9]+",inst=".+?"}\],'
+            'fullname="%s"}' %
+            (addr, os.path.abspath("main.cpp")) )
+
         # Run to hello_world
         self.runCmd("-break-insert -f hello_world")
         self.expect("\^done,bkpt={number=\"2\"")

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=361255&r1=361254&r2=361255&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Tue May 21 06:22:46 2019
@@ -401,8 +401,12 @@ bool CMICmdCmdDataDisassemble::Execute()
       const MIuint nLine = lineEntry.GetLine();
       const char *pFileName = lineEntry.GetFileSpec().GetFilename();
       pFileName = (pFileName != nullptr) ? pFileName : pUnknown;
+      // Get a full path to the file.
+      char pathBuffer[PATH_MAX];
+      lineEntry.GetFileSpec().GetPath(pathBuffer, PATH_MAX);
 
-      // MI "src_and_asm_line={line=\"%u\",file=\"%s\",line_asm_insn=[ ]}"
+      // MI "src_and_asm_line={line=\"%u\",file=\"%s\",line_asm_insn=[ ],
+      // fullname=\"%s\"}"
       const CMICmnMIValueConst miValueConst(
           CMIUtilString::Format("%u", nLine));
       const CMICmnMIValueResult miValueResult("line", miValueConst);
@@ -413,6 +417,9 @@ bool CMICmdCmdDataDisassemble::Execute()
       const CMICmnMIValueList miValueList(miValueTuple);
       const CMICmnMIValueResult miValueResult3("line_asm_insn", miValueList);
       miValueTuple2.Add(miValueResult3);
+      const CMICmnMIValueConst miValueConst5(pathBuffer);
+      const CMICmnMIValueResult miValueResult5("fullname", miValueConst5);
+      miValueTuple2.Add(miValueResult5);
       const CMICmnMIValueResult miValueResult4("src_and_asm_line",
                                                miValueTuple2);
       m_miValueList.Add(miValueResult4);




More information about the lldb-commits mailing list