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.

llvm-svn: 170174
This commit is contained in:
Greg Clayton
2012-12-14 02:15:00 +00:00
parent fff17252a1
commit 136dff8725
9 changed files with 34 additions and 29 deletions

View File

@@ -603,7 +603,8 @@ public:
/// 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.

View File

@@ -46,7 +46,8 @@ public:
static SymbolVendor*
FindPlugin (const lldb::ModuleSP &module_sp);
FindPlugin (const lldb::ModuleSP &module_sp,
lldb_private::Stream *feedback_strm);
//------------------------------------------------------------------
// Constructors and Destructors

View File

@@ -29,7 +29,7 @@ namespace lldb_private
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);

View File

@@ -4309,7 +4309,7 @@ protected:
// 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();

View File

@@ -768,7 +768,7 @@ Module::FindTypes (const SymbolContext& sc,
//}
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 @@ Module::GetSymbolVendor (bool can_create)
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;
}
}

View File

@@ -223,7 +223,7 @@ public:
}
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 @@ public:
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

View File

@@ -45,7 +45,7 @@ SymbolVendorMacOSX::~SymbolVendorMacOSX()
static bool
UUIDsMatch(Module *module, ObjectFile *ofile)
UUIDsMatch(Module *module, ObjectFile *ofile, lldb_private::Stream *feedback_strm)
{
if (module && ofile)
{
@@ -54,9 +54,12 @@ UUIDsMatch(Module *module, ObjectFile *ofile)
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 @@ UUIDsMatch(Module *module, ObjectFile *ofile)
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 @@ SymbolVendorMacOSX::GetPluginDescriptionStatic()
// 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 @@ SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp)
{
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)))

View File

@@ -32,7 +32,7 @@ public:
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

View File

@@ -32,7 +32,7 @@ using namespace lldb_private;
// 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 @@ SymbolVendor::FindPlugin (const lldb::ModuleSP &module_sp)
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())
{