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() Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp =================================================================== --- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -688,17 +688,17 @@ std::unique_ptr 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;