Author: jmolenda Date: Thu Jul 28 17:43:10 2016 New Revision: 277065 URL: http://llvm.org/viewvc/llvm-project?rev=277065&view=rev Log: Small refinement on the memory segment support in core files that Greg added in r272276 -- when working with a non-user-process mach-o core file, force the permissions to readable + executable, else the unwinder can stop backtracing early if it gets a pc value in a segment that it thinks is non-executable. <rdar://problem/27138456> <rdar://problem/27462904>
Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=277065&r1=277064&r2=277065&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original) +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Thu Jul 28 17:43:10 2016 @@ -418,6 +418,23 @@ ProcessMachCore::DoLoadCore () } } + if (m_dyld_plugin_name != DynamicLoaderMacOSXDYLD::GetPluginNameStatic()) + { + // For non-user process core files, the permissions on the core file segments are usually + // meaningless, they may be just "read", because we're dealing with kernel coredumps or + // early startup coredumps and the dumper is grabbing pages of memory without knowing + // what they are. If they aren't marked as "exeuctable", that can break the unwinder + // which will check a pc value to see if it is in an executable segment and stop the + // backtrace early if it is not ("executable" and "unknown" would both be fine, but + // "not executable" will break the unwinder). + size_t core_range_infos_size = m_core_range_infos.GetSize(); + for (size_t i = 0; i < core_range_infos_size; i++) + { + VMRangeToPermissions::Entry *ent = m_core_range_infos.GetMutableEntryAtIndex (i); + ent->data = lldb::ePermissionsReadable | lldb::ePermissionsExecutable; + } + } + // Even if the architecture is set in the target, we need to override // it to match the core file which is always single arch. ArchSpec arch (m_core_module_sp->GetArchitecture()); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits