Skip to content

Commit 542eceb

Browse files
authored
Merge pull request #3624 from apple/🍒/FBI/fddafa110d86
Simplify logic to identify dyld_sim in Simulator debugging on macos
2 parents 3547076 + 5897a27 commit 542eceb

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -540,35 +540,18 @@ void DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos(
540540
const size_t image_infos_size = image_infos.size();
541541
for (size_t i = 0; i < image_infos_size; i++) {
542542
if (image_infos[i].header.filetype == llvm::MachO::MH_DYLINKER) {
543-
// In a "simulator" process (an x86 process that is
544-
// ios/tvos/watchos/bridgeos) we will have two dyld modules --
543+
// In a "simulator" process we will have two dyld modules --
545544
// a "dyld" that we want to keep track of, and a "dyld_sim" which
546-
// we don't need to keep track of here. If the target is an x86
547-
// system and the OS of the dyld binary is ios/tvos/watchos/bridgeos,
548-
// then we are looking at dyld_sym.
549-
550-
// debugserver has only recently (late 2016) started sending up the os
551-
// type for each binary it sees -- so if we don't have an os type, use a
552-
// filename check as our next best guess.
553-
if (image_infos[i].os_type == llvm::Triple::OSType::UnknownOS) {
554-
if (image_infos[i].file_spec.GetFilename() != g_dyld_sim_filename) {
555-
dyld_idx = i;
556-
}
557-
} else if (target_arch.GetTriple().getArch() == llvm::Triple::x86 ||
558-
target_arch.GetTriple().getArch() == llvm::Triple::x86_64) {
559-
if (image_infos[i].os_type != llvm::Triple::OSType::IOS &&
560-
image_infos[i].os_type != llvm::Triple::TvOS &&
561-
image_infos[i].os_type != llvm::Triple::WatchOS) {
562-
// NEED_BRIDGEOS_TRIPLE image_infos[i].os_type != llvm::Triple::BridgeOS) {
563-
dyld_idx = i;
564-
}
545+
// we don't need to keep track of here. dyld_sim will have a non-macosx
546+
// OS.
547+
if (target_arch.GetTriple().getEnvironment() == llvm::Triple::Simulator &&
548+
image_infos[i].os_type != llvm::Triple::OSType::MacOSX) {
549+
continue;
565550
}
566-
else {
567-
// catch-all for any other environment -- trust that dyld is actually
568-
// dyld
569-
dyld_idx = i;
570-
}
571-
} else if (image_infos[i].header.filetype == llvm::MachO::MH_EXECUTE) {
551+
552+
dyld_idx = i;
553+
}
554+
if (image_infos[i].header.filetype == llvm::MachO::MH_EXECUTE) {
572555
exe_idx = i;
573556
}
574557
}

0 commit comments

Comments
 (0)