[Lldb-commits] [PATCH] D59015: [lldb-mi] Include full path in the -data-disassemble response

Phabricator via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 06:20:40 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL361255: [lldb-mi] Include full path in the -data-disassemble response (authored by tkrasnukha, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59015?vs=197117&id=200483#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59015/new/

https://reviews.llvm.org/D59015

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


Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
@@ -56,6 +56,14 @@
             "\^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\"")
Index: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
@@ -401,8 +401,12 @@
       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 @@
       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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59015.200483.patch
Type: text/x-patch
Size: 2484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190521/b037b74d/attachment.bin>


More information about the lldb-commits mailing list