summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp')
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index a027201f6b8..03c39898430 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -132,6 +132,13 @@ static inline void RStrip(llvm::StringRef &Str, char c)
if (!Str.empty() && Str.back() == c)
Str = Str.substr(0, Str.size()-1);
}
+static inline void RStripNumber(llvm::StringRef &Str)
+{
+ while (!Str.empty() && isnumber(Str.back()))
+ Str = Str.substr(0, Str.size()-1);
+ if (!Str.empty() && Str.back() == '-')
+ Str = Str.substr(0, Str.size()-1);
+}
// Aligns the raw disassembly (passed as 'str') with the rest of edis'ed disassembly output.
// This is called from non-raw mode when edis of the current m_inst fails for some reason.
static void
@@ -146,6 +153,19 @@ Align(Stream *s, const char *str, size_t opcodeColWidth, size_t operandColWidth)
PadString(s, p.second, operandColWidth);
}
+static bool
+apply_workaround(const char *str)
+{
+ llvm::StringRef Str(str);
+ StripSpaces(Str);
+ if (Str.startswith("mov.w")) {
+ RStripNumber(Str);
+ if (Str.endswith("#"))
+ return true;
+ }
+ return false;
+}
+
#define AlignPC(pc_val) (pc_val & 0xFFFFFFFC)
void
InstructionLLVM::Dump
@@ -212,7 +232,16 @@ InstructionLLVM::Dump
*/
/* .... when we fix the edis for arm/thumb. */
- if (!raw)
+ const char *lookahead;
+ bool workaround = false;
+ if (EDGetInstString(&lookahead, m_inst)) // 0 on success
+ return;
+ else if (m_arch_type == llvm::Triple::thumb) {
+ if (apply_workaround(lookahead))
+ workaround = true;
+ }
+
+ if (!raw && !workaround)
numTokens = EDNumTokens(m_inst);
int currentOpIndex = -1;
OpenPOWER on IntegriCloud