summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2015-02-07 06:03:49 +0000
committerJason Molenda <jmolenda@apple.com>2015-02-07 06:03:49 +0000
commit75452e8c5c75706e7ee1094b83f2698db7d64500 (patch)
tree1acff5d631d1a86a08f890e5cee11f19ba0beb6f
parent2b5605751786a85f05da3b0a344aa832e582080f (diff)
downloadbcm5719-llvm-75452e8c5c75706e7ee1094b83f2698db7d64500.tar.gz
bcm5719-llvm-75452e8c5c75706e7ee1094b83f2698db7d64500.zip
When creating a disassembler for one of the arm variants that can
only execute thumb instructions, force the arch triple string to be "thumbv..." instead of "armv..." so we do the right thing by default when disassembling arbitrary chunks of code. <rdar://problem/15126397> llvm-svn: 228486
-rw-r--r--lldb/include/lldb/Core/Disassembler.h2
-rw-r--r--lldb/source/Core/Disassembler.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h
index 00f1848f567..64d35e67bfd 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -457,7 +457,7 @@ protected:
//------------------------------------------------------------------
// Classes that inherit from Disassembler can see and modify these
//------------------------------------------------------------------
- const ArchSpec m_arch;
+ ArchSpec m_arch;
InstructionList m_instruction_list;
lldb::addr_t m_base_addr;
std::string m_flavor;
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 169d0ba969b..14fbee149a5 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -1172,6 +1172,24 @@ Disassembler::Disassembler(const ArchSpec& arch, const char *flavor) :
m_flavor.assign("default");
else
m_flavor.assign(flavor);
+
+ // If this is an arm variant that can only include thumb (T16, T32)
+ // instructions, force the arch triple to be "thumbv.." instead of
+ // "armv..."
+ if (arch.GetTriple().getArch() == llvm::Triple::arm
+ && (arch.GetCore() == ArchSpec::Core::eCore_arm_armv7m
+ || arch.GetCore() == ArchSpec::Core::eCore_arm_armv7em
+ || arch.GetCore() == ArchSpec::Core::eCore_arm_armv6m))
+ {
+ std::string thumb_arch_name (arch.GetTriple().getArchName().str());
+ // Replace "arm" with "thumb" so we get all thumb variants correct
+ if (thumb_arch_name.size() > 3)
+ {
+ thumb_arch_name.erase(0, 3);
+ thumb_arch_name.insert(0, "thumb");
+ }
+ m_arch.SetTriple (thumb_arch_name.c_str());
+ }
}
//----------------------------------------------------------------------
OpenPOWER on IntegriCloud