diff options
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/include/lldb/Core/Module.h | 12 | ||||
| -rw-r--r-- | lldb/include/lldb/Symbol/ObjectFile.h | 10 | ||||
| -rw-r--r-- | lldb/include/lldb/Symbol/SymbolFile.h | 10 | ||||
| -rw-r--r-- | lldb/include/lldb/Symbol/SymbolVendor.h | 7 | ||||
| -rw-r--r-- | lldb/include/lldb/Symbol/Symtab.h | 1 | ||||
| -rw-r--r-- | lldb/source/Core/Module.cpp | 11 | ||||
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 12 | ||||
| -rw-r--r-- | lldb/source/Symbol/SymbolVendor.cpp | 21 | ||||
| -rw-r--r-- | lldb/source/Symbol/Symtab.cpp | 7 |
9 files changed, 91 insertions, 0 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index fe5de649ebf..bfde7cbc5db 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -704,6 +704,18 @@ public: virtual SectionList * GetSectionList (); + //------------------------------------------------------------------ + /// Notify the module that the file addresses for the Sections have + /// been updated. + /// + /// If the Section file addresses for a module are updated, this + /// method should be called. Any parts of the module, object file, + /// or symbol file that has cached those file addresses must invalidate + /// or update its cache. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged (); + uint32_t GetVersion (uint32_t *versions, uint32_t num_versions); diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 54cb762b1fc..bdc6ae8c9e8 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -374,6 +374,16 @@ public: virtual void CreateSections (SectionList &unified_section_list) = 0; + + //------------------------------------------------------------------ + /// Notify the ObjectFile that the file addresses in the Sections + /// for this module have been changed. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged () + { + } + //------------------------------------------------------------------ /// Gets the symbol table for the currently selected architecture /// (and object for archives). diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 22f41bd0fd0..6df3d49fc46 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -152,6 +152,16 @@ public: ObjectFile* GetObjectFile() { return m_obj_file; } const ObjectFile* GetObjectFile() const { return m_obj_file; } + + //------------------------------------------------------------------ + /// Notify the SymbolFile that the file addresses in the Sections + /// for this module have been changed. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged () + { + } + protected: ObjectFile* m_obj_file; // The object file that symbols can be extracted from. diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h index 0eeea4eb466..82f902d4e07 100644 --- a/lldb/include/lldb/Symbol/SymbolVendor.h +++ b/lldb/include/lldb/Symbol/SymbolVendor.h @@ -173,6 +173,13 @@ public: ClearSymtab (); //------------------------------------------------------------------ + /// Notify the SymbolVendor that the file addresses in the Sections + /// for this module have been changed. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged (); + + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ virtual ConstString diff --git a/lldb/include/lldb/Symbol/Symtab.h b/lldb/include/lldb/Symbol/Symtab.h index 5dfb1c822d5..dc08333e22f 100644 --- a/lldb/include/lldb/Symbol/Symtab.h +++ b/lldb/include/lldb/Symbol/Symtab.h @@ -46,6 +46,7 @@ public: Symbol * Resize (size_t count); uint32_t AddSymbol(const Symbol& symbol); size_t GetNumSymbols() const; + void SectionFileAddressesChanged (); void Dump(Stream *s, Target *target, SortOrder sort_type); void Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const; uint32_t GetIndexForSymbol (const Symbol *symbol) const; diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 225bb6d516a..6f16ada4982 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -1327,6 +1327,17 @@ Module::GetSectionList() return m_sections_ap.get(); } +void +Module::SectionFileAddressesChanged () +{ + ObjectFile *obj_file = GetObjectFile (); + if (obj_file) + obj_file->SectionFileAddressesChanged (); + SymbolVendor* sym_vendor = GetSymbolVendor(); + if (sym_vendor) + sym_vendor->SectionFileAddressesChanged (); +} + SectionList * Module::GetUnifiedSectionList() { 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(); + } } } diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index 91cb94cdc06..a3f4104016e 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -468,6 +468,27 @@ SymbolVendor::ClearSymtab() } } +void +SymbolVendor::SectionFileAddressesChanged () +{ + ModuleSP module_sp(GetModule()); + if (module_sp) + { + ObjectFile *module_objfile = module_sp->GetObjectFile (); + if (m_sym_file_ap.get()) + { + ObjectFile *symfile_objfile = m_sym_file_ap->GetObjectFile (); + if (symfile_objfile != module_objfile) + symfile_objfile->SectionFileAddressesChanged (); + } + Symtab *symtab = GetSymtab (); + if (symtab) + { + symtab->SectionFileAddressesChanged (); + } + } +} + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 507271f64eb..907072c0d90 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -78,6 +78,13 @@ Symtab::GetNumSymbols() const } void +Symtab::SectionFileAddressesChanged () +{ + m_name_to_index.Clear(); + m_file_addr_to_index_computed = false; +} + +void Symtab::Dump (Stream *s, Target *target, SortOrder sort_order) { Mutex::Locker locker (m_mutex); |

