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

Johnny Chen johnny.chen at apple.com
Fri May 20 10:27:37 PDT 2011


Author: johnny
Date: Fri May 20 12:27:37 2011
New Revision: 131738

URL: http://llvm.org/viewvc/llvm-project?rev=131738&view=rev
Log:
Workaround the issue of llvm:tB (A8.6.16 B Encoding T2) not being processed as
a branch instruction and therefore the symbolic information is not being dumped for
non-raw mode.

The problem is that the ARMAsmParser is not recognizing the "#274" in "b	#274"
as a valid operand when doing disassembly in non-raw mode.

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=131738&r1=131737&r2=131738&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Fri May 20 12:27:37 2011
@@ -310,6 +310,30 @@
                 }
             } // for (tokenIndex)
 
+            // FIXME!!!
+            // Workaround for llvm::tB's operands not properly parsed by ARMAsmParser.
+            if (m_arch_type == llvm::Triple::thumb && opcode.GetString() == "b") {
+                const char *inst_str;
+                char *pos = NULL;
+                if (EDGetInstString(&inst_str, m_inst) == 0 && (pos = strstr(inst_str, "#")) != NULL) {
+                    uint64_t operand_value = PC + atoi(++pos);
+                    operands.Printf("0x%llx ", operand_value);
+
+                    lldb_private::Address so_addr;
+                    if (exe_ctx && exe_ctx->target && !exe_ctx->target->GetSectionLoadList().IsEmpty()) {
+                        if (exe_ctx->target->GetSectionLoadList().ResolveLoadAddress (operand_value, so_addr))
+                            so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
+                    } else {
+                        Module *module = GetAddress().GetModule();
+                        if (module) {
+                            if (module->ResolveFileAddress (operand_value, so_addr))
+                                so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
+                        }
+                    }
+                }
+            }
+            // END of workaround.
+
             // If both operands and comment are empty, we will just print out
             // the raw disassembly.
             if (operands.GetString().empty() && comment.GetString().empty())





More information about the lldb-commits mailing list