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
This commit is contained in:
Johnny Chen 2011-05-20 17:27:37 +00:00
parent 6ab2fa8f78
commit 02cefc2c23
1 changed files with 24 additions and 0 deletions

View File

@ -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())