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

Johnny Chen johnny.chen at apple.com
Tue Aug 2 21:50:37 PDT 2011


Author: johnny
Date: Tue Aug  2 23:50:37 2011
New Revision: 136766

URL: http://llvm.org/viewvc/llvm-project?rev=136766&view=rev
Log:
Fixed an issue of wrong (by +2) branch target calculation in the disassembler's symbolic information output.

A8.6.23 BLX (immediate T2)
Target Address = Align(PC, 4) + offset value

rdar://problem/9885678

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=136766&r1=136765&r2=136766&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Tue Aug  2 23:50:37 2011
@@ -146,6 +146,7 @@
         PadString(s, p.second, operandColWidth);
 }
 
+#define AlignPC(pc_val) (pc_val & 0xFFFFFFFC)
 void
 InstructionLLVM::Dump
 (
@@ -355,6 +356,11 @@
                 const char *pos = NULL;
                 operands.Clear(); comment.Clear();
                 if (EDGetInstString(&inst_str, m_inst) == 0 && (pos = strstr(inst_str, "#")) != NULL) {
+                    if (m_arch_type == llvm::Triple::thumb && opcode.GetString() == "blx") {
+                        // A8.6.23 BLX (immediate)
+                        // Target Address = Align(PC,4) + offset value
+                        PC = AlignPC(PC);
+                    }
                     uint64_t operand_value = PC + atoi(++pos);
                     // Put the address value into the comment.
                     comment.Printf("0x%llx ", operand_value);





More information about the lldb-commits mailing list