[Lldb-commits] [lldb] r231849 - Add SymbolVendor::GetMainFileSpec and simplify CommandObjectTargetModulesList::PrintModule

Ilia K ki.stfu at gmail.com
Tue Mar 10 14:18:59 PDT 2015


Author: ki.stfu
Date: Tue Mar 10 16:18:59 2015
New Revision: 231849

URL: http://llvm.org/viewvc/llvm-project?rev=231849&view=rev
Log:
Add SymbolVendor::GetMainFileSpec and simplify CommandObjectTargetModulesList::PrintModule

Summary:
Add SymbolVendor::GetMainFileSpec and simplify CommandObjectTargetModulesList::PrintModule.

All tests pass on OS X.

Reviewers: abidh, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, abidh

Differential Revision: http://reviews.llvm.org/D8002

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

Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=231849&r1=231848&r2=231849&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Tue Mar 10 16:18:59 2015
@@ -164,6 +164,9 @@ public:
         return m_sym_file_ap.get();
     }
 
+    FileSpec
+    GetMainFileSpec() const;
+
     // Get module unified section list symbol table.
     virtual Symtab *
     GetSymtab ();

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=231849&r1=231848&r2=231849&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Mar 10 16:18:59 2015
@@ -3467,28 +3467,24 @@ protected:
                 case 's':
                 case 'S':
                     {
-                        SymbolVendor *symbol_vendor = module->GetSymbolVendor();
+                        const SymbolVendor *symbol_vendor = module->GetSymbolVendor();
                         if (symbol_vendor)
                         {
-                            SymbolFile *symbol_file = symbol_vendor->GetSymbolFile();
-                            if (symbol_file)
+                            const FileSpec symfile_spec = symbol_vendor->GetMainFileSpec();
+                            if (format_char == 'S')
                             {
-                                if (format_char == 'S')
+                                // Dump symbol file only if different from module file
+                                if (!symfile_spec || symfile_spec == module->GetFileSpec())
                                 {
-                                    FileSpec &symfile_spec = symbol_file->GetObjectFile()->GetFileSpec();
-                                    // Dump symbol file only if different from module file
-                                    if (!symfile_spec || symfile_spec == module->GetFileSpec())
-                                    {
-                                        print_space = false;
-                                        break;
-                                    }
-                                    // Add a newline and indent past the index
-                                    strm.Printf ("\n%*s", indent, "");
+                                    print_space = false;
+                                    break;
                                 }
-                                DumpFullpath (strm, &symbol_file->GetObjectFile()->GetFileSpec(), width);
-                                dump_object_name = true;
-                                break;
+                                // Add a newline and indent past the index
+                                strm.Printf ("\n%*s", indent, "");
                             }
+                            DumpFullpath (strm, &symfile_spec, width);
+                            dump_object_name = true;
+                            break;
                         }
                         strm.Printf("%.*s", width, "<NONE>");
                     }

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=231849&r1=231848&r2=231849&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Tue Mar 10 16:18:59 2015
@@ -437,6 +437,19 @@ SymbolVendor::GetCompileUnitAtIndex(size
     return cu_sp;
 }
 
+FileSpec
+SymbolVendor::GetMainFileSpec() const
+{
+    if (m_sym_file_ap.get())
+    {
+        const ObjectFile *symfile_objfile = m_sym_file_ap->GetObjectFile();
+        if (symfile_objfile)
+            return symfile_objfile->GetFileSpec();
+    }
+
+    return FileSpec();
+}
+
 Symtab *
 SymbolVendor::GetSymtab ()
 {





More information about the lldb-commits mailing list