diff options
Diffstat (limited to 'lldb/tools/debugserver/source/RNBRemote.cpp')
-rw-r--r-- | lldb/tools/debugserver/source/RNBRemote.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index 3a4035b0b9b..ad7e65b351a 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -1287,6 +1287,9 @@ static cpu_type_t best_guess_cpu_type() { if (sizeof(char *) == 8) { return CPU_TYPE_ARM64; } else { +#if defined (__ARM64_ARCH_8_32__) + return CPU_TYPE_ARM64_32; +#endif return CPU_TYPE_ARM; } #elif defined(__i386__) || defined(__x86_64__) @@ -4557,6 +4560,8 @@ static const char *GetArchName(const uint32_t cputype, break; case CPU_TYPE_ARM64: return "arm64"; + case CPU_TYPE_ARM64_32: + return "arm64_32"; case CPU_TYPE_I386: return "i386"; case CPU_TYPE_X86_64: @@ -4590,6 +4595,10 @@ static bool GetHostCPUType(uint32_t &cputype, uint32_t &cpusubtype, g_host_cputype |= CPU_ARCH_ABI64; } } +#if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 + if (g_host_cputype == CPU_TYPE_ARM64 && sizeof (void*) == 4) + g_host_cputype = CPU_TYPE_ARM64_32; +#endif } len = sizeof(uint32_t); @@ -4599,6 +4608,16 @@ static bool GetHostCPUType(uint32_t &cputype, uint32_t &cpusubtype, g_host_cpusubtype == CPU_SUBTYPE_486) g_host_cpusubtype = CPU_SUBTYPE_X86_64_ALL; } +#if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 + // on arm64_32 devices, the machine's native cpu type is + // CPU_TYPE_ARM64 and subtype is 2 indicating arm64e. + // But we change the cputype to CPU_TYPE_ARM64_32 because + // the user processes are all ILP32 processes today. + // We also need to rewrite the cpusubtype so we vend + // a valid cputype + cpusubtype combination. + if (g_host_cputype == CPU_TYPE_ARM64_32) + g_host_cpusubtype = CPU_SUBTYPE_ARM64_32_V8; +#endif } cputype = g_host_cputype; @@ -4623,7 +4642,8 @@ rnb_err_t RNBRemote::HandlePacket_qHostInfo(const char *p) { // The OS in the triple should be "ios" or "macosx" which doesn't match our // "Darwin" which gets returned from "kern.ostype", so we need to hardcode // this for now. - if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64) { + if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64 + || cputype == CPU_TYPE_ARM64_32) { #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1 strm << "ostype:tvos;"; #elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 @@ -4660,6 +4680,12 @@ rnb_err_t RNBRemote::HandlePacket_qHostInfo(const char *p) { strm << ";"; } + std::string maccatalyst_version = DNBGetMacCatalystVersionString(); + if (!maccatalyst_version.empty() && + std::all_of(maccatalyst_version.begin(), maccatalyst_version.end(), + [](char c) { return (c >= '0' && c <= '9') || c == '.'; })) + strm << "maccatalyst_version:" << maccatalyst_version << ";"; + #if defined(__LITTLE_ENDIAN__) strm << "endian:little;"; #elif defined(__BIG_ENDIAN__) @@ -6034,6 +6060,17 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) { cpusubtype = 12; // CPU_SUBTYPE_ARM_V7K } } +#if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 + // on arm64_32 devices, the machine's native cpu type is + // CPU_TYPE_ARM64 and subtype is 2 indicating arm64e. + // But we change the cputype to CPU_TYPE_ARM64_32 because + // the user processes are all ILP32 processes today. + // We also need to rewrite the cpusubtype so we vend + // a valid cputype + cpusubtype combination. + if (cputype == CPU_TYPE_ARM64_32 && cpusubtype == 2) + cpusubtype = CPU_SUBTYPE_ARM64_32_V8; +#endif + rep << "cpusubtype:" << std::hex << cpusubtype << ';'; } @@ -6080,7 +6117,8 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) { // The OS in the triple should be "ios" or "macosx" which doesn't match our // "Darwin" which gets returned from "kern.ostype", so we need to hardcode // this for now. - if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64) { + if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64 + || cputype == CPU_TYPE_ARM64_32) { #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1 rep << "ostype:tvos;"; #elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 |