Author: Fred Riss Date: 2021-04-14T12:14:25-07:00 New Revision: 87183b1a7511f1726b0b19a2a217ed249ef3c5b9
URL: https://github.com/llvm/llvm-project/commit/87183b1a7511f1726b0b19a2a217ed249ef3c5b9 DIFF: https://github.com/llvm/llvm-project/commit/87183b1a7511f1726b0b19a2a217ed249ef3c5b9.diff LOG: [lldb] Only override target arch if it is compatible It looks like the goal of this code is to provide a more precise architecture definition for the target when attaching to a process. When attaching to a foreign debugserver, you might get into a situation where the active (host) platform will give you bogus information on the target process. This change allows the platform to override the target arch only with a compatible architecture. This fixes TestTargetXMLArch.py on Apple Silicon. Another alternative would be to just fail in this scenario and update the test(s). Added: Modified: lldb/source/Target/Process.cpp Removed: ################################################################################ diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 4e01c3bbbf4f7..986df94e73beb 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2865,8 +2865,10 @@ void Process::CompleteAttach() { ProcessInstanceInfo process_info; GetProcessInfo(process_info); const ArchSpec &process_arch = process_info.GetArchitecture(); + const ArchSpec &target_arch = GetTarget().GetArchitecture(); if (process_arch.IsValid() && - !GetTarget().GetArchitecture().IsExactMatch(process_arch)) { + target_arch.IsCompatibleMatch(process_arch) && + !target_arch.IsExactMatch(process_arch)) { GetTarget().SetArchitecture(process_arch); LLDB_LOGF(log, "Process::%s switching architecture to %s based on info " _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits