summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-10-16 00:05:06 +0300
committerMartin Storsjö <martin@martin.st>2019-11-28 11:27:00 +0200
commitf5c54f40327b1680bf7e55d358b43a92395ae669 (patch)
treecc0210c4b72b8b724c2136ac7f8b0023c260b5c8
parent934c025e9bdd28db544dfd57783d0fb8907a92d3 (diff)
downloadbcm5719-llvm-f5c54f40327b1680bf7e55d358b43a92395ae669.tar.gz
bcm5719-llvm-f5c54f40327b1680bf7e55d358b43a92395ae669.zip
[LLDB] Always interpret arm instructions as thumb on windows
Windows on ARM always uses thumb mode, and doesn't have most of the mechanisms that are used in e.g. ELF for distinguishing between arm and thumb. Differential Revision: https://reviews.llvm.org/D70796
-rw-r--r--lldb/source/Utility/ArchSpec.cpp3
-rw-r--r--lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml92
2 files changed, 95 insertions, 0 deletions
diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index 62d9d246255..38f6752b034 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -1443,6 +1443,9 @@ bool ArchSpec::IsAlwaysThumbInstructions() const {
GetCore() == ArchSpec::Core::eCore_thumbv6m) {
return true;
}
+ // Windows on ARM is always thumb.
+ if (GetTriple().isOSWindows())
+ return true;
}
return false;
}
diff --git a/lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml b/lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml
new file mode 100644
index 00000000000..dec23575969
--- /dev/null
+++ b/lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml
@@ -0,0 +1,92 @@
+# RUN: yaml2obj %s > %t.exe
+# RUN: %lldb %t.exe -o "disassemble -b -n entry" -b | FileCheck %s
+
+# CHECK: {{.*}}.exe[0x401000] <+0>: 0x0040 lsls r0, r0, #0x1
+# CHECK: {{.*}}.exe[0x401002] <+2>: 0x4770 bx lr
+
+--- !COFF
+OptionalHeader:
+ AddressOfEntryPoint: 4097
+ ImageBase: 4194304
+ SectionAlignment: 4096
+ FileAlignment: 512
+ MajorOperatingSystemVersion: 6
+ MinorOperatingSystemVersion: 0
+ MajorImageVersion: 0
+ MinorImageVersion: 0
+ MajorSubsystemVersion: 6
+ MinorSubsystemVersion: 0
+ Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
+ DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+ SizeOfStackReserve: 1048576
+ SizeOfStackCommit: 4096
+ SizeOfHeapReserve: 1048576
+ SizeOfHeapCommit: 4096
+ ExportTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ImportTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ResourceTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ExceptionTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ CertificateTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ BaseRelocationTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ Debug:
+ RelativeVirtualAddress: 0
+ Size: 0
+ Architecture:
+ RelativeVirtualAddress: 0
+ Size: 0
+ GlobalPtr:
+ RelativeVirtualAddress: 0
+ Size: 0
+ TlsTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ LoadConfigTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ BoundImport:
+ RelativeVirtualAddress: 0
+ Size: 0
+ IAT:
+ RelativeVirtualAddress: 0
+ Size: 0
+ DelayImportDescriptor:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ClrRuntimeHeader:
+ RelativeVirtualAddress: 0
+ Size: 0
+header:
+ Machine: IMAGE_FILE_MACHINE_ARMNT
+ Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ VirtualAddress: 4096
+ VirtualSize: 4
+ SectionData: '40007047'
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ - Name: entry
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
OpenPOWER on IntegriCloud