[Lldb-commits] [lldb] r152152 - in /lldb/trunk: include/lldb/API/SBTarget.h include/lldb/Core/Disassembler.h lldb.xcodeproj/project.pbxproj scripts/Python/interface/SBTarget.i source/API/SBTarget.cpp source/Core/Disassembler.cpp source/Symbol/UnwindTable.cpp

Greg Clayton gclayton at apple.com
Tue Mar 6 14:24:44 PST 2012


Author: gclayton
Date: Tue Mar  6 16:24:44 2012
New Revision: 152152

URL: http://llvm.org/viewvc/llvm-project?rev=152152&view=rev
Log:
Added the ability to disassembly "count" instructions given a SBAddress. 
This was done in SBTarget:

lldb::SBInstructionList
lldb::SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count);

Also cleaned up a few files in the LLDB.framework settings.


Modified:
    lldb/trunk/include/lldb/API/SBTarget.h
    lldb/trunk/include/lldb/Core/Disassembler.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/scripts/Python/interface/SBTarget.i
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Symbol/UnwindTable.cpp

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Tue Mar  6 16:24:44 2012
@@ -713,6 +713,9 @@
     GetSourceManager();
     
     lldb::SBInstructionList
+    ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
+
+    lldb::SBInstructionList
     GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
     
     lldb::SBInstructionList

Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Tue Mar  6 16:24:44 2012
@@ -258,7 +258,8 @@
                       const char *plugin_name,
                       const Address &start,
                       const void *bytes,
-                      size_t length);
+                      size_t length,
+                      uint32_t num_instructions = UINT32_MAX);
 
     static bool
     Disassemble (Debugger &debugger,

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Mar  6 16:24:44 2012
@@ -445,7 +445,6 @@
 		49DA65031485C92A005FF180 /* AppleObjCSymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA65021485C92A005FF180 /* AppleObjCSymbolVendor.cpp */; };
 		4C6649A014EEE7F100B0316F /* StreamCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C66499F14EEE7F100B0316F /* StreamCallback.h */; };
 		4C6649A314EEE81000B0316F /* StreamCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6649A214EEE81000B0316F /* StreamCallback.cpp */; };
-		4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CAA56121422D96A001FFA01 /* BreakpointResolverFileRegex.h */; };
 		4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CAA56141422D986001FFA01 /* BreakpointResolverFileRegex.cpp */; };
 		4CABA9E0134A8BCD00539BDD /* ValueObjectMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CABA9DF134A8BCD00539BDD /* ValueObjectMemory.cpp */; };
 		4CCA644D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */; };
@@ -508,7 +507,6 @@
 		B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; };
 		ED236E0814F84F6800153F6F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
-		EDB919B314F6EC85008FF64B /* LauncherXPCService.h in Headers */ = {isa = PBXBuildFile; fileRef = EDB919B214F6EC85008FF64B /* LauncherXPCService.h */; };
 		EDB919B714F6F22D008FF64B /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; };
 		EDC6D4AA14E5C49E001B75F8 /* LauncherXPCService.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC6D49414E5C15C001B75F8 /* LauncherXPCService.mm */; };
 		EDE274E414EDCE1F005B0F75 /* LauncherXPCService.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC6D49414E5C15C001B75F8 /* LauncherXPCService.mm */; };
@@ -3103,10 +3101,8 @@
 				26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */,
 				26D265BC136B4269002EEE45 /* lldb-public.h in Headers */,
 				4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */,
-				4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */,
 				26B8283D142D01E9002DBC64 /* SBSection.h in Headers */,
 				B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */,
-				EDB919B314F6EC85008FF64B /* LauncherXPCService.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Tue Mar  6 16:24:44 2012
@@ -669,6 +669,9 @@
     GetBroadcaster () const;
     
     lldb::SBInstructionList
+    ReadInstructions (lldb::SBAddress base_addr, uint32_t count);    
+
+    lldb::SBInstructionList
     GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
     
     bool

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Tue Mar  6 16:24:44 2012
@@ -1993,6 +1993,35 @@
 }
 
 lldb::SBInstructionList
+SBTarget::ReadInstructions (lldb::SBAddress base_addr, uint32_t count)
+{
+    SBInstructionList sb_instructions;
+    
+    TargetSP target_sp(GetSP());
+    if (target_sp)
+    {
+        Address *addr_ptr = base_addr.get();
+        
+        if (addr_ptr)
+        {
+            DataBufferHeap data (target_sp->GetArchitecture().GetMaximumOpcodeByteSize() * count, 0);
+            bool prefer_file_cache = false;
+            lldb_private::Error error;
+            const size_t bytes_read = target_sp->ReadMemory(*addr_ptr, prefer_file_cache, data.GetBytes(), data.GetByteSize(), error);
+            sb_instructions.SetDisassembler (Disassembler::DisassembleBytes (target_sp->GetArchitecture(),
+                                                                             NULL,
+                                                                             *addr_ptr,
+                                                                             data.GetBytes(),
+                                                                             bytes_read,
+                                                                             count));
+        }
+    }
+    
+    return sb_instructions;
+    
+}
+
+lldb::SBInstructionList
 SBTarget::GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size)
 {
     SBInstructionList sb_instructions;

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Mar  6 16:24:44 2012
@@ -240,7 +240,8 @@
     const char *plugin_name,
     const Address &start,
     const void *bytes,
-    size_t length
+    size_t length,
+    uint32_t num_instructions
 )
 {
     lldb::DisassemblerSP disasm_sp;
@@ -256,7 +257,7 @@
             (void)disasm_sp->DecodeInstructions (start,
                                                  data,
                                                  0,
-                                                 UINT32_MAX,
+                                                 num_instructions,
                                                  false);
         }
     }

Modified: lldb/trunk/source/Symbol/UnwindTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=152152&r1=152151&r2=152152&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindTable.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindTable.cpp Tue Mar  6 16:24:44 2012
@@ -115,7 +115,7 @@
     const_iterator end = m_unwinds.end();
     for (const_iterator pos = begin; pos != end; ++pos)
     {
-        s.Printf ("[%zu] 0x%16.16llx\n", std::distance (begin, pos), pos->first);
+        s.Printf ("[%u] 0x%16.16llx\n", (unsigned)std::distance (begin, pos), pos->first);
     }
     s.EOL();
 }





More information about the lldb-commits mailing list