[Lldb-commits] [lldb] r367231 - SymbolVendor: Make SectionAddressesChanged a passthrough

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 29 08:53:36 PDT 2019


Author: labath
Date: Mon Jul 29 08:53:36 2019
New Revision: 367231

URL: http://llvm.org/viewvc/llvm-project?rev=367231&view=rev
Log:
SymbolVendor: Make SectionAddressesChanged a passthrough

Summary:
This moves the implementation of the function into the SymbolFile class,
making it possible to excise the SymbolVendor passthrough functions in
follow-up patches.

Reviewers: clayborg, jingham, JDevlieghere

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D65266

Modified:
    lldb/trunk/include/lldb/Symbol/SymbolFile.h
    lldb/trunk/source/Symbol/SymbolFile.cpp
    lldb/trunk/source/Symbol/SymbolVendor.cpp

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=367231&r1=367230&r2=367231&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Mon Jul 29 08:53:36 2019
@@ -212,6 +212,7 @@ public:
 
   ObjectFile *GetObjectFile() { return m_obj_file; }
   const ObjectFile *GetObjectFile() const { return m_obj_file; }
+  ObjectFile *GetMainObjectFile();
 
   virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
     return {};
@@ -221,7 +222,7 @@ public:
 
   /// Notify the SymbolFile that the file addresses in the Sections
   /// for this module have been changed.
-  virtual void SectionFileAddressesChanged() {}
+  virtual void SectionFileAddressesChanged();
 
   struct RegisterInfoResolver {
     virtual ~RegisterInfoResolver(); // anchor

Modified: lldb/trunk/source/Symbol/SymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolFile.cpp?rev=367231&r1=367230&r2=367231&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolFile.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolFile.cpp Mon Jul 29 08:53:36 2019
@@ -31,6 +31,9 @@ void SymbolFile::PreloadSymbols() {
 std::recursive_mutex &SymbolFile::GetModuleMutex() const {
   return GetObjectFile()->GetModule()->GetMutex();
 }
+ObjectFile *SymbolFile::GetMainObjectFile() {
+  return m_obj_file->GetModule()->GetObjectFile();
+}
 
 SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) {
   std::unique_ptr<SymbolFile> best_symfile_up;
@@ -206,7 +209,7 @@ Symtab *SymbolFile::GetSymtab() {
     return m_symtab;
 
   // Fetch the symtab from the main object file.
-  m_symtab = m_obj_file->GetModule()->GetObjectFile()->GetSymtab();
+  m_symtab = GetMainObjectFile()->GetSymtab();
 
   // Then add our symbols to it.
   if (m_symtab)
@@ -215,6 +218,15 @@ Symtab *SymbolFile::GetSymtab() {
   return m_symtab;
 }
 
+void SymbolFile::SectionFileAddressesChanged() {
+  ObjectFile *module_objfile = GetMainObjectFile();
+  ObjectFile *symfile_objfile = GetObjectFile();
+  if (symfile_objfile != module_objfile)
+    symfile_objfile->SectionFileAddressesChanged();
+  if (m_symtab)
+    m_symtab->SectionFileAddressesChanged();
+}
+
 void SymbolFile::Dump(Stream &s) {
   s.PutCString("Types:\n");
   m_type_list.Dump(&s, /*show_context*/ false);

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=367231&r1=367230&r2=367231&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Mon Jul 29 08:53:36 2019
@@ -390,19 +390,8 @@ Symtab *SymbolVendor::GetSymtab() {
 }
 
 void SymbolVendor::SectionFileAddressesChanged() {
-  ModuleSP module_sp(GetModule());
-  if (module_sp) {
-    ObjectFile *module_objfile = module_sp->GetObjectFile();
-    if (m_sym_file_up) {
-      ObjectFile *symfile_objfile = m_sym_file_up->GetObjectFile();
-      if (symfile_objfile != module_objfile)
-        symfile_objfile->SectionFileAddressesChanged();
-    }
-    Symtab *symtab = GetSymtab();
-    if (symtab) {
-      symtab->SectionFileAddressesChanged();
-    }
-  }
+  if (m_sym_file_up)
+    m_sym_file_up->SectionFileAddressesChanged();
 }
 
 // PluginInterface protocol




More information about the lldb-commits mailing list