[Lldb-commits] [lldb] r123094 - /lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp

Greg Clayton gclayton at apple.com
Sat Jan 8 14:55:04 PST 2011


Author: gclayton
Date: Sat Jan  8 16:55:04 2011
New Revision: 123094

URL: http://llvm.org/viewvc/llvm-project?rev=123094&view=rev
Log:
Fixed the "-b" option on disassembly to always pad out the bytes with for
i386 and for x86_64 to allow 15 byte opcodes to be displayed. This outputs
clean looking disassembly when the bytes are shown.


Modified:
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=123094&r1=123093&r2=123094&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Sat Jan  8 16:55:04 2011
@@ -129,11 +129,14 @@
     if (bytes)
     {
         uint32_t bytes_dumped = bytes->Dump(s, bytes_offset, eFormatBytes, 1, EDInstByteSize(m_inst), UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0) - bytes_offset;
-        // Allow for 8 bytes of opcodes normally
-        const uint32_t default_num_opcode_bytes = 9;
+        // Allow for 15 bytes of opcodes since this is the max for x86_64.
+        // TOOD: We need to taylor this better for different architectures. For 
+        // ARM we would want to show 16 bit opcodes for Thumb as properly byte
+        // swapped uint16_t values, or 32 bit values swapped values for ARM.
+        const uint32_t default_num_opcode_bytes = 15;
         if (bytes_dumped * 3 < (default_num_opcode_bytes*3))
         {
-            uint32_t indent_level = (default_num_opcode_bytes*3) - (bytes_dumped * 3);
+            uint32_t indent_level = (default_num_opcode_bytes*3) - (bytes_dumped * 3) + 1;
             s->Printf("%*.*s", indent_level, indent_level, "");
         }
     }





More information about the lldb-commits mailing list