From 05a09c67da39911785aba17cb24db99801eccc5a Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 22 Aug 2014 02:46:46 +0000 Subject: When adding a dSYM to an existing ObjectFile, we can have a situation with binaries in the dyld shared cache (esp on iOS) where the file address for the executable binary (maybe from memory, maybe from an expanded copy of the dyld shared cache) is different from the file address in the dSYM. In that case, ObjectFileMachO replaces the file addresses from the original binary with the dSYM file addresses (usually 0-based) -- lldb doesn't have a notion of two file addresses for a given module so they need to agree. There was a cache of file addresses over in the Symtab so I added a method to the Module and the objects within to clear any file address caches if they exist, and added an implementation in the Symtab module to do that. llvm-svn: 216258 --- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp') diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index fda38ea3bf1..8d7fe047544 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1249,6 +1249,8 @@ ObjectFileMachO::CreateSections (SectionList &unified_section_list) offset = load_cmd_offset + encryption_cmd.cmdsize; } + bool section_file_addresses_changed = false; + offset = MachHeaderSizeFromMagic(m_header.magic); struct segment_command_64 load_cmd; @@ -1377,6 +1379,10 @@ ObjectFileMachO::CreateSections (SectionList &unified_section_list) // where this code path will be taken will not have eh_frame sections. unified_section_sp->SetFileAddress(load_cmd.vmaddr); + + // Notify the module that the section addresses have been changed once + // we're done so any file-address caches can be updated. + section_file_addresses_changed = true; } } m_sections_ap->AddSection(unified_section_sp); @@ -1669,6 +1675,12 @@ ObjectFileMachO::CreateSections (SectionList &unified_section_list) offset = load_cmd_offset + load_cmd.cmdsize; } + + + if (section_file_addresses_changed && module_sp.get()) + { + module_sp->SectionFileAddressesChanged(); + } } } -- cgit v1.2.3