[Lldb-commits] [lldb] r143254 - in /lldb/trunk/source: Commands/CommandObjectMemory.cpp Core/DataExtractor.cpp

Greg Clayton gclayton at apple.com
Fri Oct 28 16:44:55 PDT 2011


Author: gclayton
Date: Fri Oct 28 18:44:55 2011
New Revision: 143254

URL: http://llvm.org/viewvc/llvm-project?rev=143254&view=rev
Log:
Fixed the continuation dumping of instructions to properly advance the 
previous address only by the number of bytes consumed by the disassembly:

(lldb) x/4i 0x0000000100000ea9
0x100000ea9:  66 c7 45 fa 10 00     movw   $16, -6(%rbp)
0x100000eaf:  c7 45 f4 20 00 00 00  movl   $32, -12(%rbp)
0x100000eb6:  e8 47 00 00 00        callq  0x0000000100000f02       ; void f<nullptr_t>(nullptr_t)
0x100000ebb:  8b 45 fc              movl   -4(%rbp), %eax
(lldb) 
0x100000ebe:  48 83 c4 10  addq   $16, %rsp
0x100000ec2:  5d           popq   %rbp
0x100000ec3:  c3           ret    
0x100000ec4:  90           nop    
(lldb) 
0x100000ec5:  90  nop    
0x100000ec6:  90  nop    
0x100000ec7:  90  nop    
0x100000ec8:  90  nop    
(lldb) 
0x100000ec9:  90  nop    
0x100000eca:  90  nop    
0x100000ecb:  90  nop    
0x100000ecc:  90  nop    
(lldb) 
0x100000ecd:  90  nop    
0x100000ece:  90  nop    
0x100000ecf:  90  nop    
0x100000ed0:  55  pushq  %rbp



Modified:
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Core/DataExtractor.cpp

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=143254&r1=143253&r2=143254&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Oct 28 18:44:55 2011
@@ -726,16 +726,17 @@
 
 
         assert (output_stream);
-        data.Dump (output_stream,
-                   0,
-                   m_format_options.GetFormat(),
-                   item_byte_size,
-                   item_count,
-                   num_per_line,
-                   addr,
-                   0,
-                   0,
-                   exe_scope);
+        uint32_t bytes_dumped = data.Dump (output_stream,
+                                           0,
+                                           m_format_options.GetFormat(),
+                                           item_byte_size,
+                                           item_count,
+                                           num_per_line,
+                                           addr,
+                                           0,
+                                           0,
+                                           exe_scope);
+        m_next_addr = addr + bytes_dumped;
         output_stream->EOL();
         return true;
     }

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=143254&r1=143253&r2=143254&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Fri Oct 28 18:44:55 2011
@@ -1319,16 +1319,14 @@
     if (s == NULL)
         return start_offset;
 
-    uint32_t offset;
-    uint32_t count;
-    uint32_t line_start_offset;
-
     if (item_format == eFormatPointer)
     {
         if (item_byte_size != 4 && item_byte_size != 8)
             item_byte_size = s->GetAddressByteSize();
     }
     
+    uint32_t offset = start_offset;
+
     if (item_format == eFormatInstruction)
     {
         Target *target = NULL;
@@ -1347,8 +1345,11 @@
                     so_addr.SetSection(NULL);
                 }
 
-                if (disassembler_sp->DecodeInstructions (so_addr, *this, start_offset, item_count, false))
+                size_t bytes_consumed = disassembler_sp->DecodeInstructions (so_addr, *this, start_offset, item_count, false);
+                
+                if (bytes_consumed)
                 {
+                    offset += bytes_consumed;
                     const bool show_address = base_addr != LLDB_INVALID_ADDRESS;
                     const bool show_bytes = true;
                     ExecutionContext exe_ctx;
@@ -1366,8 +1367,8 @@
     if ((item_format == eFormatOSType || item_format == eFormatAddressInfo) && item_byte_size > 8)
         item_format = eFormatHex;
 
-    
-    for (offset = start_offset, line_start_offset = start_offset, count = 0; ValidOffset(offset) && count < item_count; ++count)
+    uint32_t line_start_offset = start_offset;
+    for (uint32_t count = 0; ValidOffset(offset) && count < item_count; ++count)
     {
         if ((count % num_per_line) == 0)
         {





More information about the lldb-commits mailing list