[Lldb-commits] [PATCH] D11574: Add size field to library load event

Paul Maybee paulmay at microsoft.com
Wed Jul 29 11:03:48 PDT 2015


paulmaybee updated this revision to Diff 30924.
paulmaybee marked 4 inline comments as done.
paulmaybee added a comment.

Escape paths in library-loaded event and fix test case.


http://reviews.llvm.org/D11574

Files:
  test/tools/lldb-mi/TestMiLibraryLoaded.py
  tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp

Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -688,17 +688,17 @@
     std::unique_ptr<char[]> apPath(new char[PATH_MAX]);
     vModule.GetFileSpec().GetPath(apPath.get(), PATH_MAX);
     const CMIUtilString strTargetPath(apPath.get());
-    const CMICmnMIValueConst miValueConst(strTargetPath);
+    const CMICmnMIValueConst miValueConst(strTargetPath.Escape(true /* vbEscapeQuotes */));
     const CMICmnMIValueResult miValueResult("id", miValueConst);
     vwrMiOutOfBandRecord.Add(miValueResult);
     // Build "target-name" field
-    const CMICmnMIValueConst miValueConst2(strTargetPath);
+    const CMICmnMIValueConst miValueConst2(strTargetPath.Escape(true /* vbEscapeQuotes */));
     const CMICmnMIValueResult miValueResult2("target-name", miValueConst2);
     vwrMiOutOfBandRecord.Add(miValueResult2);
     // Build "host-name" field
     vModule.GetPlatformFileSpec().GetPath(apPath.get(), PATH_MAX);
     const CMIUtilString strHostPath(apPath.get());
-    const CMICmnMIValueConst miValueConst3(strHostPath);
+    const CMICmnMIValueConst miValueConst3(strHostPath.Escape(true /* vbEscapeQuotes */));
     const CMICmnMIValueResult miValueResult3("host-name", miValueConst3);
     vwrMiOutOfBandRecord.Add(miValueResult3);
 
@@ -715,12 +715,12 @@
         // Build "symbols-path" field
         if (bSymbolsLoaded)
         {
-            const CMICmnMIValueConst miValueConst5(strSymbolsPath);
+            const CMICmnMIValueConst miValueConst5(strSymbolsPath.Escape(true /* vbEscapeQuotes */));
             const CMICmnMIValueResult miValueResult5("symbols-path", miValueConst5);
             vwrMiOutOfBandRecord.Add(miValueResult5);
         }
         // Build "loaded_addr" field
-        const lldb::SBAddress sbAddress(vModule.GetObjectFileHeaderAddress());
+        lldb::SBAddress sbAddress(vModule.GetObjectFileHeaderAddress());
         CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
         const lldb::addr_t nLoadAddress(sbAddress.GetLoadAddress(rSessionInfo.GetTarget()));
         const CMIUtilString strLoadedAddr(nLoadAddress != LLDB_INVALID_ADDRESS ?
@@ -728,6 +728,13 @@
         const CMICmnMIValueConst miValueConst6(strLoadedAddr);
         const CMICmnMIValueResult miValueResult6("loaded_addr", miValueConst6);
         vwrMiOutOfBandRecord.Add(miValueResult6);
+        
+        // Build "size" field
+        lldb::SBSection sbSection = sbAddress.GetSection();
+        const CMIUtilString strSize(CMIUtilString::Format("%" PRIu64, sbSection.GetByteSize()));
+        const CMICmnMIValueConst miValueConst7(strSize);
+        const CMICmnMIValueResult miValueResult7("size", miValueConst7);
+        vwrMiOutOfBandRecord.Add(miValueResult7);
     }
 
     return bOk;
Index: test/tools/lldb-mi/TestMiLibraryLoaded.py
===================================================================
--- test/tools/lldb-mi/TestMiLibraryLoaded.py
+++ test/tools/lldb-mi/TestMiLibraryLoaded.py
@@ -27,9 +27,9 @@
         path = os.path.join(os.getcwd(), self.myexe)
         symbols_path = os.path.join(path + ".dSYM", "Contents", "Resources", "DWARF", self.myexe)
         self.expect([
-                "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\"" % (path, path, path, symbols_path),
-                "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\"" % (path, path, path)
-            ], exactly = True)
+                "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\",size=\"[0-9]+\"" % (path, path, path, symbols_path),
+                "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\"" % (path, path, path)
+            ])
 
 if __name__ == '__main__':
     unittest2.main()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11574.30924.patch
Type: text/x-patch
Size: 4101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150729/52dd04f3/attachment.bin>


More information about the lldb-commits mailing list