From 02cefc2c237d0d8ae15a4915f0386543dc191fca Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 20 May 2011 17:27:37 +0000 Subject: 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. llvm-svn: 131738 --- .../Plugins/Disassembler/llvm/DisassemblerLLVM.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp') diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp index 9be65dc11ee..90e6413795e 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp @@ -310,6 +310,30 @@ InstructionLLVM::Dump } } // 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()) -- cgit v1.2.3