From ad587ae4ca143d388c0ec4ef2faa1b5eddedbf67 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 28 Jul 2014 16:44:49 +0000 Subject: Fix supported architectures on PlatformWindows. i386, i486, i486sx, and i686 are all indistinguishable as far as PE/COFF files are concerned. This patch adds support for all of these architectures to PlatformWindows. Differential Revision: http://reviews.llvm.org/D4658 llvm-svn: 214092 --- .../Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 6 +++++- .../Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h | 25 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'lldb/source/Plugins/ObjectFile') diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 512656aefcf..43661987127 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -129,7 +129,11 @@ ObjectFilePECOFF::GetModuleSpecifications (const lldb_private::FileSpec& file, if (ParseCOFFHeader(data, &offset, coff_header)) { ArchSpec spec; - spec.SetArchitecture(eArchTypeCOFF, coff_header.machine, LLDB_INVALID_CPUTYPE); + llvm::Triple::ArchType archType = llvm::Triple::UnknownArch; + if (coff_header.machine == MachineAmd64) + spec.SetTriple("x86_64-pc-windows"); + else if (coff_header.machine == MachineX86) + spec.SetTriple("i386-pc-windows"); specs.Append(ModuleSpec(file, spec)); } } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 87d8e6a5de2..4be026aa630 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -18,6 +18,31 @@ class ObjectFilePECOFF : public lldb_private::ObjectFile { public: + typedef enum MachineType + { + MachineUnknown = 0x0, + MachineAm33 = 0x1d3, + MachineAmd64 = 0x8664, + MachineArm = 0x1c0, + MachineArmNt = 0x1c4, + MachineArm64 = 0xaa64, + MachineEbc = 0xebc, + MachineX86 = 0x14c, + MachineIA64 = 0x200, + MachineM32R = 0x9041, + MachineMips16 = 0x266, + MachineMipsFpu = 0x366, + MachineMipsFpu16 = 0x466, + MachinePowerPc = 0x1f0, + MachinePowerPcfp = 0x1f1, + MachineR4000 = 0x166, + MachineSh3 = 0x1a2, + MachineSh3dsp = 0x1a3, + MachineSh4 = 0x1a6, + MachineSh5 = 0x1a8, + MachineThumb = 0x1c2, + MachineWcemIpsv2 = 0x169 + }; //------------------------------------------------------------------ // Static Functions -- cgit v1.2.3