diff options
-rw-r--r-- | lldb/include/lldb/Core/ArchSpec.h | 1 | ||||
-rw-r--r-- | lldb/source/Core/ArchSpec.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/DataExtractor.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Host/macosx/Host.mm | 6 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp | 45 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp | 34 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp | 1 | ||||
-rw-r--r-- | lldb/tools/debugserver/source/DNB.cpp | 2 |
10 files changed, 81 insertions, 19 deletions
diff --git a/lldb/include/lldb/Core/ArchSpec.h b/lldb/include/lldb/Core/ArchSpec.h index 893917d610a..4ec8e06c8b3 100644 --- a/lldb/include/lldb/Core/ArchSpec.h +++ b/lldb/include/lldb/Core/ArchSpec.h @@ -91,6 +91,7 @@ public: eCore_x86_32_i486sx, eCore_x86_64_x86_64, + eCore_x86_64_x86_64h, // Haswell enabled x86_64 eCore_uknownMach32, eCore_uknownMach64, kNumCores, diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp index f39367e65e5..f4fa22437a9 100644 --- a/lldb/source/Core/ArchSpec.cpp +++ b/lldb/source/Core/ArchSpec.cpp @@ -104,6 +104,7 @@ static const CoreDefinition g_core_definitions[ArchSpec::kNumCores] = { eByteOrderLittle, 4, 1, 15, llvm::Triple::x86 , ArchSpec::eCore_x86_32_i486sx , "i486sx" }, { eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64 , ArchSpec::eCore_x86_64_x86_64 , "x86_64" }, + { eByteOrderLittle, 8, 1, 15, llvm::Triple::x86_64 , ArchSpec::eCore_x86_64_x86_64h , "x86_64h" }, { eByteOrderLittle, 4, 4, 4 , llvm::Triple::UnknownArch , ArchSpec::eCore_uknownMach32 , "unknown-mach-32" }, { eByteOrderLittle, 8, 4, 4 , llvm::Triple::UnknownArch , ArchSpec::eCore_uknownMach64 , "unknown-mach-64" } }; @@ -205,10 +206,11 @@ static const ArchDefinitionEntry g_macho_arch_entries[] = { ArchSpec::eCore_x86_32_i386 , llvm::MachO::CPU_TYPE_I386 , 3 , UINT32_MAX , SUBTYPE_MASK }, { ArchSpec::eCore_x86_32_i486 , llvm::MachO::CPU_TYPE_I386 , 4 , UINT32_MAX , SUBTYPE_MASK }, { ArchSpec::eCore_x86_32_i486sx , llvm::MachO::CPU_TYPE_I386 , 0x84 , UINT32_MAX , SUBTYPE_MASK }, - { ArchSpec::eCore_x86_32_i386 , llvm::MachO::CPU_TYPE_I386 , CPU_ANY, UINT32_MAX , UINT32_MAX }, + { ArchSpec::eCore_x86_32_i386 , llvm::MachO::CPU_TYPE_I386 , CPU_ANY, UINT32_MAX , UINT32_MAX }, { ArchSpec::eCore_x86_64_x86_64 , llvm::MachO::CPU_TYPE_X86_64 , 3 , UINT32_MAX , SUBTYPE_MASK }, { ArchSpec::eCore_x86_64_x86_64 , llvm::MachO::CPU_TYPE_X86_64 , 4 , UINT32_MAX , SUBTYPE_MASK }, - { ArchSpec::eCore_x86_64_x86_64 , llvm::MachO::CPU_TYPE_X86_64 , CPU_ANY, UINT32_MAX , UINT32_MAX }, + { ArchSpec::eCore_x86_64_x86_64h , llvm::MachO::CPU_TYPE_X86_64 , 8 , UINT32_MAX , SUBTYPE_MASK }, + { ArchSpec::eCore_x86_64_x86_64 , llvm::MachO::CPU_TYPE_X86_64 , CPU_ANY, UINT32_MAX , UINT32_MAX }, // Catch any unknown mach architectures so we can always use the object and symbol mach-o files { ArchSpec::eCore_uknownMach32 , 0 , 0 , 0xFF000000u, 0x00000000u }, { ArchSpec::eCore_uknownMach64 , llvm::MachO::CPU_ARCH_ABI64 , 0 , 0xFF000000u, 0x00000000u } @@ -894,7 +896,7 @@ cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_in if (core2 == ArchSpec::kCore_arm_any) return true; break; - + case ArchSpec::kCore_x86_32_any: if ((core2 >= ArchSpec::kCore_x86_32_first && core2 <= ArchSpec::kCore_x86_32_last) || (core2 == ArchSpec::kCore_x86_32_any)) return true; diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 819a414733d..e121979b41e 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -1809,6 +1809,7 @@ DataExtractor::Dump (Stream *s, case ArchSpec::eCore_x86_32_i486: case ArchSpec::eCore_x86_32_i486sx: case ArchSpec::eCore_x86_64_x86_64: + case ArchSpec::eCore_x86_64_x86_64h: // clang will assert when contructing the apfloat if we use a 16 byte integer value if (GetAPInt (*this, &offset, 10, apint)) { diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index 2c680c18fb8..5729a7375d3 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -1625,9 +1625,11 @@ LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, : // to set which CPU subtype to launch... const ArchSpec &arch_spec = launch_info.GetArchitecture(); cpu_type_t cpu = arch_spec.GetMachOCPUType(); - if (cpu != 0 && + cpu_type_t sub = arch_spec.GetMachOCPUSubType(); + if (cpu != 0 && cpu != UINT32_MAX && - cpu != LLDB_INVALID_CPUTYPE) + cpu != LLDB_INVALID_CPUTYPE && + !(cpu == 0x01000007 && sub == 8)) // If haswell is specified, don't try to set the CPU type or we will fail { size_t ocount = 0; error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX); diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 10449ff9aa6..a10c04f60b0 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -312,6 +312,7 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite case ArchSpec::eCore_x86_32_i386: case ArchSpec::eCore_x86_64_x86_64: + case ArchSpec::eCore_x86_64_x86_64h: { static const uint8_t g_i386_opcode[] = { 0xCC }; trap_opcode = g_i386_opcode; diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index be3b0a981f0..c30211c886a 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -390,6 +390,7 @@ PlatformLinux::GetSoftwareBreakpointTrapOpcode (Target &target, case ArchSpec::eCore_x86_32_i386: case ArchSpec::eCore_x86_64_x86_64: + case ArchSpec::eCore_x86_64_x86_64h: { static const uint8_t g_i386_breakpoint_opcode[] = { 0xCC }; trap_opcode = g_i386_breakpoint_opcode; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 1ca314d9815..5e2d8c31349 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -978,23 +978,46 @@ PlatformDarwin::GetQueueIDForThreadQAddress (Process *process, lldb::addr_t disp bool PlatformDarwin::x86GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) { - if (idx == 0) + ArchSpec host_arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture); + if (host_arch.GetCore() == ArchSpec::eCore_x86_64_x86_64h) { - arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture); - return arch.IsValid(); + switch (idx) + { + case 0: + arch = host_arch; + return true; + + case 1: + arch.SetTriple("x86_64-apple-macosx"); + return true; + + case 2: + arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32); + return true; + + default: return false; + } } - else if (idx == 1) + else { - ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture)); - ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64)); - if (platform_arch.IsExactMatch(platform_arch64)) + if (idx == 0) { - // This macosx platform supports both 32 and 64 bit. Since we already - // returned the 64 bit arch for idx == 0, return the 32 bit arch - // for idx == 1 - arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32); + arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture); return arch.IsValid(); } + else if (idx == 1) + { + ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture)); + ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64)); + if (platform_arch.IsExactMatch(platform_arch64)) + { + // This macosx platform supports both 32 and 64 bit. Since we already + // returned the 64 bit arch for idx == 0, return the 32 bit arch + // for idx == 1 + arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32); + return arch.IsValid(); + } + } } return false; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 74b4f354ecc..fe84e5f0a2e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -22,11 +22,12 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/Error.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamString.h" #include "lldb/Host/FileSpec.h" @@ -325,5 +326,34 @@ PlatformMacOSX::GetSharedModule (const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - return GetSharedModuleWithLocalCache(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); + Error error = GetSharedModuleWithLocalCache(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); + + if (module_sp) + { + if (module_spec.GetArchitecture().GetCore() == ArchSpec::eCore_x86_64_x86_64h) + { + ObjectFile *objfile = module_sp->GetObjectFile(); + if (objfile == NULL) + { + // We didn't find an x86_64h slice, fall back to a x86_64 slice + ModuleSpec module_spec_x86_64 (module_spec); + module_spec_x86_64.GetArchitecture() = ArchSpec("x86_64-apple-macosx"); + lldb::ModuleSP x86_64_module_sp; + lldb::ModuleSP old_x86_64_module_sp; + bool did_create = false; + Error x86_64_error = GetSharedModuleWithLocalCache(module_spec_x86_64, x86_64_module_sp, module_search_paths_ptr, &old_x86_64_module_sp, &did_create); + if (x86_64_module_sp && x86_64_module_sp->GetObjectFile()) + { + module_sp = x86_64_module_sp; + if (old_module_sp_ptr) + *old_module_sp_ptr = old_x86_64_module_sp; + if (did_create_ptr) + *did_create_ptr = did_create; + return x86_64_error; + } + } + } + } + return error; } + diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index a362ffa3c4c..888a159ff34 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -283,6 +283,7 @@ PlatformWindows::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite { case ArchSpec::eCore_x86_32_i386: case ArchSpec::eCore_x86_64_x86_64: + case ArchSpec::eCore_x86_64_x86_64h: { static const uint8_t g_i386_opcode[] = { 0xCC }; trap_opcode = g_i386_opcode; diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp index b7feeb3a249..6c725d58335 100644 --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -2067,7 +2067,7 @@ DNBSetArchitecture (const char *arch) { if (strcasecmp (arch, "i386") == 0) return DNBArchProtocol::SetArchitecture (CPU_TYPE_I386); - else if (strcasecmp (arch, "x86_64") == 0) + else if ((strcasecmp (arch, "x86_64") == 0) || (strcasecmp (arch, "x86_64h") == 0)) return DNBArchProtocol::SetArchitecture (CPU_TYPE_X86_64); else if (strstr (arch, "arm") == arch) return DNBArchProtocol::SetArchitecture (CPU_TYPE_ARM); |