diff options
author | Greg Clayton <gclayton@apple.com> | 2014-07-08 21:45:21 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-07-08 21:45:21 +0000 |
commit | 389be9558fdd632bcc460da265db9d30484f3ced (patch) | |
tree | e75a92b83e191d8d0b3e489afc4052d84fbd0969 /lldb/tools/debugserver/source | |
parent | fd068271e6a15819fb5727710baf4f213b40f9ba (diff) | |
download | bcm5719-llvm-389be9558fdd632bcc460da265db9d30484f3ced.tar.gz bcm5719-llvm-389be9558fdd632bcc460da265db9d30484f3ced.zip |
Make sure that qProcessInfo packet returns correct cpu type/subtype for processes on Haswell machines with a Haswell enabled kernel.
<rdar://problem/17332107>
llvm-svn: 212567
Diffstat (limited to 'lldb/tools/debugserver/source')
-rw-r--r-- | lldb/tools/debugserver/source/RNBRemote.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index 0dc514f69d2..407f2e781e9 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -4379,20 +4379,25 @@ RNBRemote::HandlePacket_qProcessInfo (const char *p) size_t cpusubtype_len = sizeof(cpusubtype); if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &cpusubtype_len, NULL, 0) == 0) { - if (cputype == CPU_TYPE_X86_64 && cpusubtype == CPU_SUBTYPE_486) + // If a process is CPU_TYPE_X86, then ignore the cpusubtype that we detected + // from the host and use CPU_SUBTYPE_I386_ALL because we don't want the + // CPU_SUBTYPE_X86_ARCH1 or CPU_SUBTYPE_X86_64_H to be used as the cpu subtype + // for i386... + if (host_cpu_is_64bit) { - cpusubtype = CPU_SUBTYPE_X86_64_ALL; - } - - // We can query a process' cputype but we cannot query a process' cpusubtype. - // If the process has cputype CPU_TYPE_ARM, then it is an armv7 (32-bit process) and we - // need to override the host cpusubtype (which is in the CPU_SUBTYPE_ARM64 subtype namespace) - // with a reasonable CPU_SUBTYPE_ARMV7 subtype. - if (host_cpu_is_64bit && cputype == CPU_TYPE_ARM) - { - cpusubtype = 11; //CPU_SUBTYPE_ARM_V7S; + if (cputype == CPU_TYPE_X86) + { + cpusubtype = 3; // CPU_SUBTYPE_I386_ALL + } + else if (cputype == CPU_TYPE_ARM) + { + // We can query a process' cputype but we cannot query a process' cpusubtype. + // If the process has cputype CPU_TYPE_ARM, then it is an armv7 (32-bit process) and we + // need to override the host cpusubtype (which is in the CPU_SUBTYPE_ARM64 subtype namespace) + // with a reasonable CPU_SUBTYPE_ARMV7 subtype. + cpusubtype = 11; // CPU_SUBTYPE_ARM_V7S + } } - rep << "cpusubtype:" << std::hex << cpusubtype << ';'; } |