summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-05-23 19:41:31 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-05-23 19:41:31 +0000
commit54dc30065356210601c2f03a5f2372253b24ee35 (patch)
tree9b71f2513f9c452b77095d678d60c15a4a1f2caf /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
parentb66b5cef00f265caed3db9e9a99cd92cbb22cfb1 (diff)
downloadbcm5719-llvm-54dc30065356210601c2f03a5f2372253b24ee35.tar.gz
bcm5719-llvm-54dc30065356210601c2f03a5f2372253b24ee35.zip
Add more workarounds for "bl #..." and "blx #..." where the ARMAsmParser fails to parse/recognize
the (PC-relative) immediate operand. llvm-svn: 131913
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp')
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index 4b5d1dca975..b5020fd52c3 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -328,6 +328,7 @@ InstructionLLVM::Dump
if (m_arch_type == llvm::Triple::thumb && opcode.GetString() == "b") {
const char *inst_str;
const char *pos = NULL;
+ operands.Clear(); comment.Clear();
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);
@@ -345,6 +346,33 @@ InstructionLLVM::Dump
}
}
}
+ // Yet more workaround for "bl #..." and "blx #...".
+ if ((m_arch_type == llvm::Triple::arm || m_arch_type == llvm::Triple::thumb) &&
+ (opcode.GetString() == "bl" || opcode.GetString() == "blx")) {
+ const char *inst_str;
+ const char *pos = NULL;
+ operands.Clear(); comment.Clear();
+ if (EDGetInstString(&inst_str, m_inst) == 0 && (pos = strstr(inst_str, "#")) != NULL) {
+ uint64_t operand_value = PC + atoi(++pos);
+ // Put the address value into the comment
+ comment.Printf("0x%llx ", operand_value);
+ llvm::StringRef string_ref(pos - 1);
+ llvm::StringRef operand_string_ref = string_ref.split('\n').first;
+ operands.PutCString(operand_string_ref.str().c_str());
+
+ 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
OpenPOWER on IntegriCloud