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.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170174 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 028bce5..d154e28 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -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();
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index 6442699..62a6ab6 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -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;
}
}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 8d7dcbb..0999b44 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -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
diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index d643664..8396d01 100644
--- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -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)))
diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
index 22e7235..2c16148 100644
--- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
+++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
@@ -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
diff --git a/source/Symbol/SymbolVendor.cpp b/source/Symbol/SymbolVendor.cpp
index 32b0285..a71fc67 100644
--- a/source/Symbol/SymbolVendor.cpp
+++ b/source/Symbol/SymbolVendor.cpp
@@ -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())
{