paulmaybee created this revision.
paulmaybee added reviewers: abidh, ki.stfu, ChuckR.
paulmaybee added subscribers: lldb-commits, greggm.

(This revision supersedes the abandon: http://reviews.llvm.org/D9716)
Size field is used to let the debugger attribute an address to a specific 
library when symbols are not available. 
For example:
        OpenGLESApp4.app!Cube_draw() Line 74    C
        OpenGLESApp4.app!-[GameViewController 
glkView:drawInRect:](GameViewController * self, SEL _cmd, GLKView * view, 
CGRect rect) Line 89    C++
        GLKit!<redacted>        
        QuartzCore!<redacted>   
        QuartzCore!<redacted>   
        QuartzCore!<redacted>   
        QuartzCore!<redacted>   
        QuartzCore!<redacted>   
        UIKit!<redacted>        
        UIKit!<redacted>        
        UIKit!<redacted>        
        UIKit!<redacted>        
        FrontBoardServices!<redacted>   
        CoreFoundation!<redacted>       


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
@@ -720,7 +720,7 @@
             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,14 @@
         const CMICmnMIValueConst miValueConst6(strLoadedAddr);
         const CMICmnMIValueResult miValueResult6("loaded_addr", miValueConst6);
         vwrMiOutOfBandRecord.Add(miValueResult6);
+        bOk = bOk && 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);
+        bOk = bOk && vwrMiOutOfBandRecord.Add(miValueResult7);
     }
 
     return bOk;
Index: test/tools/lldb-mi/TestMiLibraryLoaded.py
===================================================================
--- test/tools/lldb-mi/TestMiLibraryLoaded.py
+++ test/tools/lldb-mi/TestMiLibraryLoaded.py
@@ -28,7 +28,7 @@
         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)
+                
"=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\""
 % (path, path, path)
             ], exactly = True)
 
 if __name__ == '__main__':


Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -720,7 +720,7 @@
             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,14 @@
         const CMICmnMIValueConst miValueConst6(strLoadedAddr);
         const CMICmnMIValueResult miValueResult6("loaded_addr", miValueConst6);
         vwrMiOutOfBandRecord.Add(miValueResult6);
+        bOk = bOk && 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);
+        bOk = bOk && vwrMiOutOfBandRecord.Add(miValueResult7);
     }
 
     return bOk;
Index: test/tools/lldb-mi/TestMiLibraryLoaded.py
===================================================================
--- test/tools/lldb-mi/TestMiLibraryLoaded.py
+++ test/tools/lldb-mi/TestMiLibraryLoaded.py
@@ -28,7 +28,7 @@
         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)
+                "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\"" % (path, path, path)
             ], exactly = True)
 
 if __name__ == '__main__':
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to