<div dir="ltr">Hi Jason,<div><br></div><div>This commit caused a regression in disassembling thumb code when the architecture is specified explicitly for the disassemble because we try to create an alternative thumb disassembler even when the primary disassembler is already thumb.</div><div><br></div><div>I committed in a fix as <a href="http://llvm.org/viewvc/llvm-project?rev=246649&view=rev">http://llvm.org/viewvc/llvm-project?rev=246649&view=rev</a> but please check that it don't break the original functionality you tried to implement.</div><div><br></div><div>Thanks,</div><div>Tamas</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Aug 21, 2015 at 1:14 AM Jason Molenda via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jmolenda<br>
Date: Thu Aug 20 19:13:37 2015<br>
New Revision: 245645<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=245645&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=245645&view=rev</a><br>
Log:<br>
The llvm Triple for an armv6m now comes back as llvm::Triple::thumb.<br>
This was breaking disassembly for arm machines that we force to be<br>
thumb mode all the time because we were only checking for llvm::Triple::arm.<br>
i.e.<br>
<br>
armv6m (ARM Cortex-M0)<br>
armv7m (ARM Cortex-M3)<br>
armv7em (ARM Cortex-M4)<br>
<br>
<rdar://problem/22334522><br>
<br>
<br>
Modified:<br>
lldb/trunk/source/Core/Disassembler.cpp<br>
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp<br>
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp<br>
lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp<br>
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp<br>
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br>
<br>
Modified: lldb/trunk/source/Core/Disassembler.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=245645&r1=245644&r2=245645&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=245645&r1=245644&r2=245645&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Core/Disassembler.cpp (original)<br>
+++ lldb/trunk/source/Core/Disassembler.cpp Thu Aug 20 19:13:37 2015<br>
@@ -1264,7 +1264,7 @@ Disassembler::Disassembler(const ArchSpe<br>
// If this is an arm variant that can only include thumb (T16, T32)<br>
// instructions, force the arch triple to be "thumbv.." instead of<br>
// "armv..."<br>
- if (arch.GetTriple().getArch() == llvm::Triple::arm<br>
+ if ((arch.GetTriple().getArch() == llvm::Triple::arm || arch.GetTriple().getArch() == llvm::Triple::thumb)<br>
&& (arch.GetCore() == ArchSpec::Core::eCore_arm_armv7m<br>
|| arch.GetCore() == ArchSpec::Core::eCore_arm_armv7em<br>
|| arch.GetCore() == ArchSpec::Core::eCore_arm_armv6m))<br>
<br>
Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=245645&r1=245644&r2=245645&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=245645&r1=245644&r2=245645&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Thu Aug 20 19:13:37 2015<br>
@@ -604,7 +604,7 @@ DisassemblerLLVMC::DisassemblerLLVMC (co<br>
}<br>
<br>
ArchSpec thumb_arch(arch);<br>
- if (arch.GetTriple().getArch() == llvm::Triple::arm)<br>
+ if (arch.GetTriple().getArch() == llvm::Triple::arm || arch.GetTriple().getArch() == llvm::Triple::thumb)<br>
{<br>
std::string thumb_arch_name (thumb_arch.GetTriple().getArchName().str());<br>
// Replace "arm" with "thumb" so we get all thumb variants correct<br>
@@ -626,7 +626,7 @@ DisassemblerLLVMC::DisassemblerLLVMC (co<br>
// Handle the Cortex-M0 (armv6m) the same; the ISA is a subset of the T and T32<br>
// instructions defined in ARMv7-A.<br>
<br>
- if (arch.GetTriple().getArch() == llvm::Triple::arm<br>
+ if ((arch.GetTriple().getArch() == llvm::Triple::arm || arch.GetTriple().getArch() == llvm::Triple::thumb)<br>
&& (arch.GetCore() == ArchSpec::Core::eCore_arm_armv7m<br>
|| arch.GetCore() == ArchSpec::Core::eCore_arm_armv7em<br>
|| arch.GetCore() == ArchSpec::Core::eCore_arm_armv6m))<br>
@@ -698,7 +698,7 @@ DisassemblerLLVMC::DisassemblerLLVMC (co<br>
}<br>
<br>
// For arm CPUs that can execute arm or thumb instructions, also create a thumb instruction disassembler.<br>
- if (arch.GetTriple().getArch() == llvm::Triple::arm)<br>
+ if (arch.GetTriple().getArch() == llvm::Triple::arm || arch.GetTriple().getArch() == llvm::Triple::thumb)<br>
{<br>
std::string thumb_triple(thumb_arch.GetTriple().getTriple());<br>
m_alternate_disasm_ap.reset(new LLVMCDisassembler(thumb_triple.c_str(), "", "", flavor, *this));<br>
<br>
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=245645&r1=245644&r2=245645&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=245645&r1=245644&r2=245645&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)<br>
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Aug 20 19:13:37 2015<br>
@@ -5721,6 +5721,7 @@ ObjectFileMachO::SaveCore (const lldb::P<br>
{<br>
case llvm::Triple::aarch64:<br>
case llvm::Triple::arm:<br>
+ case llvm::Triple::thumb:<br>
case llvm::Triple::x86:<br>
case llvm::Triple::x86_64:<br>
make_core = true;<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=245645&r1=245644&r2=245645&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=245645&r1=245644&r2=245645&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Thu Aug 20 19:13:37 2015<br>
@@ -58,6 +58,7 @@ StopInfoMachException::GetDescription ()<br>
}<br>
break;<br>
case llvm::Triple::arm:<br>
+ case llvm::Triple::thumb:<br>
switch (m_exc_code)<br>
{<br>
case 0x101: code_desc = "EXC_ARM_DA_ALIGN"; break;<br>
@@ -104,6 +105,7 @@ StopInfoMachException::GetDescription ()<br>
break;<br>
<br>
case llvm::Triple::arm:<br>
+ case llvm::Triple::thumb:<br>
if (m_exc_code == 1)<br>
code_desc = "EXC_ARM_UNDEFINED";<br>
break;<br>
@@ -188,6 +190,7 @@ StopInfoMachException::GetDescription ()<br>
break;<br>
<br>
case llvm::Triple::arm:<br>
+ case llvm::Triple::thumb:<br>
switch (m_exc_code)<br>
{<br>
case 0x101: code_desc = "EXC_ARM_DA_ALIGN"; break;<br>
@@ -408,6 +411,7 @@ StopInfoMachException::CreateStopReasonW<br>
break;<br>
<br>
case llvm::Triple::arm:<br>
+ case llvm::Triple::thumb:<br>
if (exc_code == 0x102) // EXC_ARM_DA_DEBUG<br>
{<br>
// It's a watchpoint, then, if the exc_sub_code indicates a known/enabled<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=245645&r1=245644&r2=245645&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=245645&r1=245644&r2=245645&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Thu Aug 20 19:13:37 2015<br>
@@ -1209,6 +1209,7 @@ GDBRemoteCommunicationServerCommon::Crea<br>
switch (proc_triple.getArch ())<br>
{<br>
case llvm::Triple::arm:<br>
+ case llvm::Triple::thumb:<br>
case llvm::Triple::aarch64:<br>
ostype = "ios";<br>
break;<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=245645&r1=245644&r2=245645&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=245645&r1=245644&r2=245645&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Aug 20 19:13:37 2015<br>
@@ -735,11 +735,12 @@ ProcessGDBRemote::BuildDynamicRegisterIn<br>
if (!target_arch.IsValid())<br>
{<br>
if (remote_arch.IsValid()<br>
- && remote_arch.GetMachine() == llvm::Triple::arm<br>
+ && (remote_arch.GetMachine() == llvm::Triple::arm || remote_arch.GetMachine() == llvm::Triple::thumb)<br>
&& remote_arch.GetTriple().getVendor() == llvm::Triple::Apple)<br>
m_register_info.HardcodeARMRegisters(from_scratch);<br>
}<br>
- else if (target_arch.GetMachine() == llvm::Triple::arm)<br>
+ else if (target_arch.GetMachine() == llvm::Triple::arm<br>
+ || target_arch.GetMachine() == llvm::Triple::thumb)<br>
{<br>
m_register_info.HardcodeARMRegisters(from_scratch);<br>
}<br>
@@ -1250,8 +1251,8 @@ ProcessGDBRemote::DidLaunchOrAttach (Arc<br>
// it has, so we really need to take the remote host architecture as our<br>
// defacto architecture in this case.<br>
<br>
- if (process_arch.GetMachine() == llvm::Triple::arm &&<br>
- process_arch.GetTriple().getVendor() == llvm::Triple::Apple)<br>
+ if ((process_arch.GetMachine() == llvm::Triple::arm || process_arch.GetMachine() == llvm::Triple::thumb)<br>
+ && process_arch.GetTriple().getVendor() == llvm::Triple::Apple)<br>
{<br>
GetTarget().SetArchitecture (process_arch);<br>
if (log)<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div></div>