summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-05-23 18:00:40 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-05-23 18:00:40 +0000
commitfeb961b86a260009a241a2c4ff742fe8c8384bcb (patch)
treeadc67592fb6c0a7316d9ca0f23e61aae74b3bf89 /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
parent9987d3098b373d4d88aa3c367bc60006731cf7d0 (diff)
downloadbcm5719-llvm-feb961b86a260009a241a2c4ff742fe8c8384bcb.tar.gz
bcm5719-llvm-feb961b86a260009a241a2c4ff742fe8c8384bcb.zip
Fix the Align() utility which tries to align the raw disassembly with the edis'ed disassembly
so that both the opcode and the operands are aligned with the rest of output. Comment out the code related to force_raw mode when disassembling arm or thumb for now. It testing goes ok, we will remove the section of code related to force_raw. llvm-svn: 131910
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp')
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index ea31a82798c..4b5d1dca975 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -109,11 +109,15 @@ StripSpaces(llvm::StringRef &Str)
Str = Str.substr(0, Str.size()-1);
}
static void
-Align(Stream *s, const char *str)
+Align(Stream *s, const char *str, size_t opcodeColWidth, size_t operandColWidth)
{
llvm::StringRef raw_disasm(str);
StripSpaces(raw_disasm);
- s->PutCString(raw_disasm.str().c_str());
+ // Split the raw disassembly into opcode and operands.
+ std::pair<llvm::StringRef, llvm::StringRef> p = raw_disasm.split('\t');
+ PadString(s, p.first, opcodeColWidth);
+ if (!p.second.empty())
+ PadString(s, p.second, operandColWidth);
}
void
@@ -173,10 +177,12 @@ InstructionLLVM::Dump
// FIXME!!!
/* Remove the following section of code related to force_raw .... */
+ /*
bool force_raw = m_arch_type == llvm::Triple::arm ||
m_arch_type == llvm::Triple::thumb;
if (!raw)
raw = force_raw;
+ */
/* .... when we fix the edis for arm/thumb. */
if (!raw)
@@ -349,7 +355,7 @@ InstructionLLVM::Dump
if (EDGetInstString(&str, m_inst))
return;
- Align(s, str);
+ Align(s, str, opcodeColumnWidth, operandColumnWidth);
}
else
{
@@ -380,7 +386,7 @@ InstructionLLVM::Dump
{
// EDis fails to parse the tokens of this inst. Need to align this
// raw disassembly's opcode with the rest of output.
- Align(s, str);
+ Align(s, str, opcodeColumnWidth, operandColumnWidth);
}
}
}
OpenPOWER on IntegriCloud