[Lldb-commits] [lldb] r170174 - in /lldb/trunk: include/lldb/Core/Module.h include/lldb/Symbol/SymbolVendor.h include/lldb/lldb-private-interfaces.h source/Commands/CommandObjectTarget.cpp source/Core/Module.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h source/Symbol/SymbolVendor.cpp

Greg Clayton gclayton at apple.com
Thu Dec 13 18:15:00 PST 2012


Author: gclayton
Date: Thu Dec 13 20:15:00 2012
New Revision: 170174

URL: http://llvm.org/viewvc/llvm-project?rev=170174&view=rev
Log:
Cleaned up the UUID mismatch just printing itself whenever it wants to by allowing an optional feedback stream to be passed along when getting the symbol vendor.


Modified:
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Symbol/SymbolVendor.h
    lldb/trunk/include/lldb/lldb-private-interfaces.h
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
    lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
    lldb/trunk/source/Symbol/SymbolVendor.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Dec 13 20:15:00 2012
@@ -603,7 +603,8 @@
     ///     object and remains valid as long as the object is around.
     //------------------------------------------------------------------
     virtual SymbolVendor*
-    GetSymbolVendor(bool can_create = true);
+    GetSymbolVendor(bool can_create = true,
+                    lldb_private::Stream *feedback_strm = NULL);
 
     //------------------------------------------------------------------
     /// Get accessor the type list for this module.

Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Thu Dec 13 20:15:00 2012
@@ -46,7 +46,8 @@
 
 
     static SymbolVendor*
-    FindPlugin (const lldb::ModuleSP &module_sp);
+    FindPlugin (const lldb::ModuleSP &module_sp,
+                lldb_private::Stream *feedback_strm);
 
     //------------------------------------------------------------------
     // Constructors and Destructors

Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Thu Dec 13 20:15:00 2012
@@ -29,7 +29,7 @@
     typedef Platform* (*PlatformCreateInstance) (bool force, const ArchSpec *arch);
     typedef lldb::ProcessSP (*ProcessCreateInstance) (Target &target, Listener &listener, const FileSpec *crash_file_path);
     typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file);
-    typedef SymbolVendor* (*SymbolVendorCreateInstance) (const lldb::ModuleSP &module_sp);   // Module can be NULL for default system symbol vendor
+    typedef SymbolVendor* (*SymbolVendorCreateInstance) (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm);   // Module can be NULL for default system symbol vendor
     typedef bool (*BreakpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
     typedef bool (*WatchpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id);
     typedef ThreadPlan * (*ThreadPlanShouldStopHereCallback) (ThreadPlan *current_plan, Flags &flags, void *baton);

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Dec 13 20:15:00 2012
@@ -4309,7 +4309,7 @@
                 // when it decides to create it!
                 module_sp->SetSymbolFileFileSpec (symbol_fspec);
                 
-                SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor();
+                SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(true, &result.GetErrorStream());
                 if (symbol_vendor)
                 {
                     SymbolFile *symbol_file = symbol_vendor->GetSymbolFile();

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Thu Dec 13 20:15:00 2012
@@ -768,7 +768,7 @@
 //}
 
 SymbolVendor*
-Module::GetSymbolVendor (bool can_create)
+Module::GetSymbolVendor (bool can_create, lldb_private::Stream *feedback_strm)
 {
     Mutex::Locker locker (m_mutex);
     if (m_did_load_symbol_vendor == false && can_create)
@@ -777,7 +777,7 @@
         if (obj_file != NULL)
         {
             Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
-            m_symfile_ap.reset(SymbolVendor::FindPlugin(shared_from_this()));
+            m_symfile_ap.reset(SymbolVendor::FindPlugin(shared_from_this(), feedback_strm));
             m_did_load_symbol_vendor = true;
         }
     }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Thu Dec 13 20:15:00 2012
@@ -223,7 +223,7 @@
     }
     
     virtual SymbolVendor*
-    GetSymbolVendor(bool can_create = true)
+    GetSymbolVendor(bool can_create = true, lldb_private::Stream *feedback_strm = NULL)
     {
         // Scope for locker
         if (m_symfile_ap.get() || can_create == false)
@@ -237,7 +237,7 @@
             if (oso_objfile)
             {
                 Mutex::Locker locker (m_mutex);
-                SymbolVendor* symbol_vendor = Module::GetSymbolVendor(can_create);
+                SymbolVendor* symbol_vendor = Module::GetSymbolVendor(can_create, feedback_strm);
                 if (symbol_vendor)
                 {
                     // Set a a pointer to this class to set our OSO DWARF file know

Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Thu Dec 13 20:15:00 2012
@@ -45,7 +45,7 @@
 
 
 static bool
-UUIDsMatch(Module *module, ObjectFile *ofile)
+UUIDsMatch(Module *module, ObjectFile *ofile, lldb_private::Stream *feedback_strm)
 {
     if (module && ofile)
     {
@@ -54,9 +54,12 @@
 
         if (!ofile->GetUUID(&dsym_uuid))
         {
-            Host::SystemLog (Host::eSystemLogWarning, 
-                             "warning: failed to get the uuid for object file: '%s'\n", 
-                             ofile->GetFileSpec().GetFilename().GetCString());
+            if (feedback_strm)
+            {
+                feedback_strm->PutCString("warning: failed to get the uuid for object file: '");
+                ofile->GetFileSpec().Dump(feedback_strm);
+                feedback_strm->PutCString("\n");
+            }
             return false;
         }
 
@@ -64,18 +67,18 @@
             return true;
 
         // Emit some warning messages since the UUIDs do not match!
-        const FileSpec &m_file_spec = module->GetFileSpec();
-        const FileSpec &o_file_spec = ofile->GetFileSpec();
-        StreamString ss_m_path, ss_o_path;
-        m_file_spec.Dump(&ss_m_path);
-        o_file_spec.Dump(&ss_o_path);
-
-        StreamString ss_m_uuid, ss_o_uuid;
-        module->GetUUID().Dump(&ss_m_uuid);
-        dsym_uuid.Dump(&ss_o_uuid);
-        Host::SystemLog (Host::eSystemLogWarning, 
-                         "warning: UUID mismatch detected between module '%s' (%s) and:\n\t'%s' (%s)\n", 
-                         ss_m_path.GetData(), ss_m_uuid.GetData(), ss_o_path.GetData(), ss_o_uuid.GetData());
+        if (feedback_strm)
+        {
+            feedback_strm->PutCString("warning: UUID mismatch detected between modules:\n    ");
+            module->GetUUID().Dump(feedback_strm);
+            feedback_strm->PutChar(' ');
+            module->GetFileSpec().Dump(feedback_strm);
+            feedback_strm->PutCString("\n    ");
+            dsym_uuid.Dump(feedback_strm);
+            feedback_strm->PutChar(' ');
+            ofile->GetFileSpec().Dump(feedback_strm);
+            feedback_strm->EOL();
+        }
     }
     return false;
 }
@@ -150,7 +153,7 @@
 // also allow for finding separate debug information files.
 //----------------------------------------------------------------------
 SymbolVendor*
-SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp)
+SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
 {
     if (!module_sp)
         return NULL;
@@ -198,7 +201,7 @@
             {
                 DataBufferSP dsym_file_data_sp;
                 dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp);
-                if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get()))
+                if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm))
                 {
                     char dsym_path[PATH_MAX];
                     if (module_sp->GetSourceMappingList().IsEmpty() && dsym_fspec.GetPath(dsym_path, sizeof(dsym_path)))

Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h Thu Dec 13 20:15:00 2012
@@ -32,7 +32,7 @@
     GetPluginDescriptionStatic();
 
     static lldb_private::SymbolVendor*
-    CreateInstance (const lldb::ModuleSP &module_sp);
+    CreateInstance (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm);
 
     //------------------------------------------------------------------
     // Constructors and Destructors

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=170174&r1=170173&r2=170174&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Thu Dec 13 20:15:00 2012
@@ -32,7 +32,7 @@
 // also allow for finding separate debug information files.
 //----------------------------------------------------------------------
 SymbolVendor*
-SymbolVendor::FindPlugin (const lldb::ModuleSP &module_sp)
+SymbolVendor::FindPlugin (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
 {
     std::auto_ptr<SymbolVendor> instance_ap;
     //----------------------------------------------------------------------
@@ -41,7 +41,7 @@
     SymbolVendorCreateInstance create_callback;
     for (uint32_t idx = 0; (create_callback = PluginManager::GetSymbolVendorCreateCallbackAtIndex(idx)) != NULL; ++idx)
     {
-        instance_ap.reset(create_callback(module_sp));
+        instance_ap.reset(create_callback(module_sp, feedback_strm));
 
         if (instance_ap.get())
         {





More information about the lldb-commits mailing list