diff options
33 files changed, 185 insertions, 275 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8cfe36e6c57..9b59703135a 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -151,6 +151,29 @@ public: lldb::DescriptionLevel level = lldb::eDescriptionLevelFull); //------------------------------------------------------------------ + /// Get the module path and object name. + /// + /// Modules can refer to object files. In this case the specification + /// is simple and would return the path to the file: + /// + /// "/usr/lib/foo.dylib" + /// + /// Modules can be .o files inside of a BSD archive (.a file). In + /// this case, the object specification will look like: + /// + /// "/usr/lib/foo.a(bar.o)" + /// + /// There are many places where logging wants to log this fully + /// qualified specification, so we centralize this functionality + /// here. + /// + /// @return + /// The object path + object name if there is one. + //------------------------------------------------------------------ + std::string + GetSpecificationDescription () const; + + //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index e673a0aa4ed..85bece89996 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -139,12 +139,10 @@ SBModule::SetPlatformFileSpec (const lldb::SBFileSpec &platform_file) if (log) { - log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s%s%s)) => %i", + log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i", module_sp.get(), platform_file.get(), - platform_file->GetDirectory().GetCString(), - platform_file->GetDirectory() ? "/" : "", - platform_file->GetFilename().GetCString(), + platform_file->GetPath().c_str(), result); } return result; diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index a0b25c400cb..62343789007 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -721,24 +721,20 @@ protected: { if (sc.comp_unit) { - s.Printf ("Global variables for %s/%s in %s/%s:\n", - sc.comp_unit->GetDirectory().GetCString(), - sc.comp_unit->GetFilename().GetCString(), - sc.module_sp->GetFileSpec().GetDirectory().GetCString(), - sc.module_sp->GetFileSpec().GetFilename().GetCString()); + s.Printf ("Global variables for %s in %s:\n", + sc.comp_unit->GetPath().c_str(), + sc.module_sp->GetFileSpec().GetPath().c_str()); } else { - s.Printf ("Global variables for %s/%s\n", - sc.module_sp->GetFileSpec().GetDirectory().GetCString(), - sc.module_sp->GetFileSpec().GetFilename().GetCString()); + s.Printf ("Global variables for %s\n", + sc.module_sp->GetFileSpec().GetPath().c_str()); } } else if (sc.comp_unit) { - s.Printf ("Global variables for %s/%s\n", - sc.comp_unit->GetDirectory().GetCString(), - sc.comp_unit->GetFilename().GetCString()); + s.Printf ("Global variables for %s\n", + sc.comp_unit->GetPath().c_str()); } for (uint32_t i=0; i<count; ++i) @@ -858,9 +854,8 @@ protected: if (frame) { if (comp_unit) - result.AppendErrorWithFormat ("no global variables in current compile unit: %s/%s\n", - comp_unit->GetDirectory().GetCString(), - comp_unit->GetFilename().GetCString()); + result.AppendErrorWithFormat ("no global variables in current compile unit: %s\n", + comp_unit->GetPath().c_str()); else result.AppendErrorWithFormat ("no debug information for frame %u\n", frame->GetFrameIndex()); } @@ -899,10 +894,8 @@ protected: else { // Didn't find matching shlib/module in target... - result.AppendErrorWithFormat ("target doesn't contain the specified shared library: %s%s%s\n", - module_file.GetDirectory().GetCString(), - module_file.GetDirectory() ? "/" : "", - module_file.GetFilename().GetCString()); + result.AppendErrorWithFormat ("target doesn't contain the specified shared library: %s\n", + module_file.GetPath().c_str()); } } } @@ -1469,11 +1462,9 @@ DumpModuleSections (CommandInterpreter &interpreter, Stream &strm, Module *modul SectionList *section_list = objfile->GetSectionList(); if (section_list) { - strm.PutCString ("Sections for '"); - strm << module->GetFileSpec(); - if (module->GetObjectName()) - strm << '(' << module->GetObjectName() << ')'; - strm.Printf ("' (%s):\n", module->GetArchitecture().GetArchitectureName()); + strm.Printf ("Sections for '%s' (%s):\n", + module->GetSpecificationDescription().c_str(), + module->GetArchitecture().GetArchitectureName()); strm.IndentMore(); section_list->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), true, UINT32_MAX); strm.IndentLess(); @@ -2645,19 +2636,16 @@ protected: { if (module_spec.GetSymbolFileSpec()) { - result.AppendErrorWithFormat ("Unable to create the executable or symbol file with UUID %s with path %s/%s and symbol file %s/%s", + result.AppendErrorWithFormat ("Unable to create the executable or symbol file with UUID %s with path %s and symbol file %s", strm.GetString().c_str(), - module_spec.GetFileSpec().GetDirectory().GetCString(), - module_spec.GetFileSpec().GetFilename().GetCString(), - module_spec.GetSymbolFileSpec().GetDirectory().GetCString(), - module_spec.GetSymbolFileSpec().GetFilename().GetCString()); + module_spec.GetFileSpec().GetPath().c_str(), + module_spec.GetSymbolFileSpec().GetPath().c_str()); } else { - result.AppendErrorWithFormat ("Unable to create the executable or symbol file with UUID %s with path %s/%s", + result.AppendErrorWithFormat ("Unable to create the executable or symbol file with UUID %s with path %s", strm.GetString().c_str(), - module_spec.GetFileSpec().GetDirectory().GetCString(), - module_spec.GetFileSpec().GetFilename().GetCString()); + module_spec.GetFileSpec().GetPath().c_str()); } } else @@ -4333,10 +4321,9 @@ protected: { // Provide feedback that the symfile has been successfully added. const FileSpec &module_fs = module_sp->GetFileSpec(); - result.AppendMessageWithFormat("symbol file '%s' has been added to '%s/%s'\n", + result.AppendMessageWithFormat("symbol file '%s' has been added to '%s'\n", symfile_path, - module_fs.GetDirectory().AsCString(), - module_fs.GetFilename().AsCString()); + module_fs.GetPath().c_str()); // Let clients know something changed in the module // if it is currently loaded diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp index f52072bd27a..a4382a0c67e 100644 --- a/lldb/source/Core/DataBufferMemoryMap.cpp +++ b/lldb/source/Core/DataBufferMemoryMap.cpp @@ -113,9 +113,8 @@ DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* filespec, Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_MMAP)); if (log) { - log->Printf("DataBufferMemoryMap::MemoryMapFromFileSpec(file=\"%s/%s\", offset=0x%" PRIx64 ", length=0x%" PRIx64 ", writeable=%i", - filespec->GetDirectory().GetCString(), - filespec->GetFilename().GetCString(), + log->Printf("DataBufferMemoryMap::MemoryMapFromFileSpec(file=\"%s\", offset=0x%" PRIx64 ", length=0x%" PRIx64 ", writeable=%i", + filespec->GetPath().c_str(), offset, length, writeable); diff --git a/lldb/source/Core/FileLineResolver.cpp b/lldb/source/Core/FileLineResolver.cpp index 59a875cf68b..15cbbe6ff9e 100644 --- a/lldb/source/Core/FileLineResolver.cpp +++ b/lldb/source/Core/FileLineResolver.cpp @@ -90,10 +90,8 @@ FileLineResolver::GetDepth() void FileLineResolver::GetDescription (Stream *s) { - s->Printf ("File and line resolver for file: \"%s%s%s\" line: %u", - m_file_spec.GetDirectory().GetCString(), - m_file_spec.GetDirectory() ? "/" : "", - m_file_spec.GetFilename().GetCString(), + s->Printf ("File and line resolver for file: \"%s\" line: %u", + m_file_spec.GetPath().c_str(), m_line_number); } diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 3408d7f714c..7f403472cda 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -156,11 +156,10 @@ Module::Module (const ModuleSpec &module_spec) : Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) - log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')", + log->Printf ("%p Module::Module((%s) '%s%s%s%s')", this, m_arch.GetArchitectureName(), - m_file.GetDirectory().AsCString(""), - m_file.GetFilename().AsCString(""), + m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(", m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")"); @@ -201,11 +200,10 @@ Module::Module(const FileSpec& file_spec, m_object_name = *object_name; Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) - log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')", + log->Printf ("%p Module::Module((%s) '%s%s%s%s')", this, m_arch.GetArchitectureName(), - m_file.GetDirectory().AsCString(""), - m_file.GetFilename().AsCString(""), + m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(", m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")"); @@ -224,11 +222,10 @@ Module::~Module() } Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) - log->Printf ("%p Module::~Module((%s) '%s/%s%s%s%s')", + log->Printf ("%p Module::~Module((%s) '%s%s%s%s')", this, m_arch.GetArchitectureName(), - m_file.GetDirectory().AsCString(""), - m_file.GetFilename().AsCString(""), + m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(", m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")"); @@ -511,10 +508,8 @@ Module::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t li { Mutex::Locker locker (m_mutex); Timer scoped_timer(__PRETTY_FUNCTION__, - "Module::ResolveSymbolContextForFilePath (%s%s%s:%u, check_inlines = %s, resolve_scope = 0x%8.8x)", - file_spec.GetDirectory().AsCString(""), - file_spec.GetDirectory() ? "/" : "", - file_spec.GetFilename().AsCString(""), + "Module::ResolveSymbolContextForFilePath (%s:%u, check_inlines = %s, resolve_scope = 0x%8.8x)", + file_spec.GetPath().c_str(), line, check_inlines ? "yes" : "no", resolve_scope); @@ -844,6 +839,19 @@ Module::GetArchitecture () const return m_arch; } +std::string +Module::GetSpecificationDescription () const +{ + std::string spec(GetFileSpec().GetPath()); + if (m_object_name) + { + spec += '('; + spec += m_object_name.GetCString(); + spec += ')'; + } + return spec; +} + void Module::GetDescription (Stream *s, lldb::DescriptionLevel level) { @@ -1007,9 +1015,8 @@ Module::Dump(Stream *s) Mutex::Locker locker (m_mutex); //s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); s->Indent(); - s->Printf("Module %s/%s%s%s%s\n", - m_file.GetDirectory().AsCString(), - m_file.GetFilename().AsCString(), + s->Printf("Module %s%s%s%s\n", + m_file.GetPath().c_str(), m_object_name ? "(" : "", m_object_name ? m_object_name.GetCString() : "", m_object_name ? ")" : ""); diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 23cad43ff67..ff5d22537c4 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -658,13 +658,12 @@ ModuleList::LogUUIDAndPaths (Log *log, const char *prefix_cstr) Module *module = pos->get(); module->GetUUID().GetAsCString (uuid_cstr, sizeof(uuid_cstr)); const FileSpec &module_file_spec = module->GetFileSpec(); - log->Printf ("%s[%u] %s (%s) \"%s/%s\"", + log->Printf ("%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr : "", (uint32_t)std::distance (begin, pos), uuid_cstr, module->GetArchitecture().GetArchitectureName(), - module_file_spec.GetDirectory().GetCString(), - module_file_spec.GetFilename().GetCString()); + module_file_spec.GetPath().c_str()); } } } diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index f5298098024..fda84e7656c 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -494,18 +494,14 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, if (module) { if (variable) - error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " for variable '%s' in %s%s%s", + error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " for variable '%s' in %s", address, variable->GetName().AsCString(""), - module->GetFileSpec().GetDirectory().GetCString(), - module->GetFileSpec().GetDirectory() ? "/" : "", - module->GetFileSpec().GetFilename().GetCString()); + module->GetFileSpec().GetPath().c_str()); else - error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " in %s%s%s", + error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " in %s", address, - module->GetFileSpec().GetDirectory().GetCString(), - module->GetFileSpec().GetDirectory() ? "/" : "", - module->GetFileSpec().GetFilename().GetCString()); + module->GetFileSpec().GetPath().c_str()); } else { diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index ef9348edf3b..b60dd214184 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -502,9 +502,8 @@ LaunchInNewTerminalWithAppleScript (const char *exe_path, ProcessLaunchInfo &lau if (!darwin_debug_file_spec.Exists()) { - error.SetErrorStringWithFormat ("the 'darwin-debug' executable doesn't exists at %s/%s", - darwin_debug_file_spec.GetDirectory().GetCString(), - darwin_debug_file_spec.GetFilename().GetCString()); + error.SetErrorStringWithFormat ("the 'darwin-debug' executable doesn't exists at '%s'", + darwin_debug_file_spec.GetPath().c_str()); return error; } diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index c1bcae2fc6c..e56b48b5579 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -64,17 +64,7 @@ OptionValueFileSpec::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, u if (m_current_value) { - if (m_current_value.GetDirectory()) - { - strm << '"' << m_current_value.GetDirectory(); - if (m_current_value.GetFilename()) - strm << '/' << m_current_value.GetFilename(); - strm << '"'; - } - else - { - strm << '"' << m_current_value.GetFilename() << '"'; - } + strm << '"' << m_current_value.GetPath().c_str() << '"'; } } } diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index a05e9e09d01..12e2174feeb 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -955,15 +955,9 @@ DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule (Process *p s->Printf ("Kernel slid 0x%" PRIx64 " in memory.\n", m_load_address - file_address); } } - if (m_module_sp->GetFileSpec().GetDirectory().IsEmpty()) { - s->Printf ("Loaded kernel file %s\n", m_module_sp->GetFileSpec().GetFilename().AsCString()); - } - else - { - s->Printf ("Loaded kernel file %s/%s\n", - m_module_sp->GetFileSpec().GetDirectory().AsCString(), - m_module_sp->GetFileSpec().GetFilename().AsCString()); + s->Printf ("Loaded kernel file %s\n", + m_module_sp->GetFileSpec().GetPath().c_str()); } s->Flush (); } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index bef86ae2ffa..94c824a8a05 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -493,11 +493,10 @@ DynamicLoaderMacOSXDYLD::UpdateImageLoadAddress (Module *module, DYLDImageInfo& else { Host::SystemLog (Host::eSystemLogWarning, - "warning: unable to find and load segment named '%s' at 0x%" PRIx64 " in '%s/%s' in macosx dynamic loader plug-in.\n", + "warning: unable to find and load segment named '%s' at 0x%" PRIx64 " in '%s' in macosx dynamic loader plug-in.\n", info.segments[i].name.AsCString("<invalid>"), (uint64_t)new_section_load_addr, - image_object_file->GetFileSpec().GetDirectory().AsCString(), - image_object_file->GetFileSpec().GetFilename().AsCString()); + image_object_file->GetFileSpec().GetPath().c_str()); } } } @@ -573,10 +572,9 @@ DynamicLoaderMacOSXDYLD::UnloadImageLoadAddress (Module *module, DYLDImageInfo& else { Host::SystemLog (Host::eSystemLogWarning, - "warning: unable to find and unload segment named '%s' in '%s/%s' in macosx dynamic loader plug-in.\n", + "warning: unable to find and unload segment named '%s' in '%s' in macosx dynamic loader plug-in.\n", info.segments[i].name.AsCString("<invalid>"), - image_object_file->GetFileSpec().GetDirectory().AsCString(), - image_object_file->GetFileSpec().GetFilename().AsCString()); + image_object_file->GetFileSpec().GetPath().c_str()); } } } @@ -1440,42 +1438,38 @@ DynamicLoaderMacOSXDYLD::DYLDImageInfo::PutToLog (Log *log) const { if (u) { - log->Printf("\t modtime=0x%8.8" PRIx64 " uuid=%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X path='%s/%s' (UNLOADED)", + log->Printf("\t modtime=0x%8.8" PRIx64 " uuid=%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X path='%s' (UNLOADED)", mod_date, u[ 0], u[ 1], u[ 2], u[ 3], u[ 4], u[ 5], u[ 6], u[ 7], u[ 8], u[ 9], u[10], u[11], u[12], u[13], u[14], u[15], - file_spec.GetDirectory().AsCString(), - file_spec.GetFilename().AsCString()); + file_spec.GetPath().c_str()); } else - log->Printf("\t modtime=0x%8.8" PRIx64 " path='%s/%s' (UNLOADED)", + log->Printf("\t modtime=0x%8.8" PRIx64 " path='%s' (UNLOADED)", mod_date, - file_spec.GetDirectory().AsCString(), - file_spec.GetFilename().AsCString()); + file_spec.GetPath().c_str()); } else { if (u) { - log->Printf("\taddress=0x%16.16" PRIx64 " modtime=0x%8.8" PRIx64 " uuid=%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X path='%s/%s'", + log->Printf("\taddress=0x%16.16" PRIx64 " modtime=0x%8.8" PRIx64 " uuid=%2.2X%2.2X%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X path='%s'", address, mod_date, u[ 0], u[ 1], u[ 2], u[ 3], u[ 4], u[ 5], u[ 6], u[ 7], u[ 8], u[ 9], u[10], u[11], u[12], u[13], u[14], u[15], - file_spec.GetDirectory().AsCString(), - file_spec.GetFilename().AsCString()); + file_spec.GetPath().c_str()); } else { - log->Printf("\taddress=0x%16.16" PRIx64 " modtime=0x%8.8" PRIx64 " path='%s/%s'", + log->Printf("\taddress=0x%16.16" PRIx64 " modtime=0x%8.8" PRIx64 " path='%s'", address, mod_date, - file_spec.GetDirectory().AsCString(), - file_spec.GetFilename().AsCString()); + file_spec.GetPath().c_str()); } for (uint32_t i=0; i<segments.size(); ++i) diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index 2ca17e506be..a5e87fc358d 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -286,9 +286,8 @@ ObjectContainerBSDArchive::CreateInstance if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) { Timer scoped_timer (__PRETTY_FUNCTION__, - "ObjectContainerBSDArchive::CreateInstance (module = %s/%s, file = %p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", - module_sp->GetFileSpec().GetDirectory().AsCString(), - module_sp->GetFileSpec().GetFilename().AsCString(), + "ObjectContainerBSDArchive::CreateInstance (module = %s, file = %p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", + module_sp->GetFileSpec().GetPath().c_str(), file, (uint64_t) file_offset, (uint64_t) length); // Map the entire .a file to be sure that we don't lose any data if the file diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 7bd6020f1e6..b94ebca297d 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1916,11 +1916,10 @@ ObjectFileMachO::ParseSymtab (bool minimize) // string values should have an offset zero which points // to an empty C-string Host::SystemLog (Host::eSystemLogError, - "error: DSC unmapped local symbol[%u] has invalid string table offset 0x%x in %s/%s, ignoring symbol\n", + "error: DSC unmapped local symbol[%u] has invalid string table offset 0x%x in %s, ignoring symbol\n", entry_index, nlist.n_strx, - module_sp->GetFileSpec().GetDirectory().GetCString(), - module_sp->GetFileSpec().GetFilename().GetCString()); + module_sp->GetFileSpec().GetPath().c_str()); continue; } if (symbol_name[0] == '\0') @@ -2653,11 +2652,10 @@ ObjectFileMachO::ParseSymtab (bool minimize) // string values should have an offset zero which points // to an empty C-string Host::SystemLog (Host::eSystemLogError, - "error: symbol[%u] has invalid string table offset 0x%x in %s/%s, ignoring symbol\n", + "error: symbol[%u] has invalid string table offset 0x%x in %s, ignoring symbol\n", nlist_idx, nlist.n_strx, - module_sp->GetFileSpec().GetDirectory().GetCString(), - module_sp->GetFileSpec().GetFilename().GetCString()); + module_sp->GetFileSpec().GetPath().c_str()); continue; } if (symbol_name[0] == '\0') diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index f6cd4c2c684..07846c81cc7 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -232,10 +232,8 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, if (!exe_module_sp || exe_module_sp->GetObjectFile() == NULL) { exe_module_sp.reset(); - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s", + exe_file.GetPath().c_str(), exe_arch.GetArchitectureName()); } } @@ -269,10 +267,8 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, if (error.Fail() || !exe_module_sp) { - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", + exe_file.GetPath().c_str(), GetShortPluginName(), arch_names.GetString().c_str()); } @@ -280,10 +276,8 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, } else { - error.SetErrorStringWithFormat ("'%s%s%s' does not exist", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString("")); + error.SetErrorStringWithFormat ("'%s' does not exist", + exe_file.GetPath().c_str()); } return error; diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index f3886365b9e..1078a23443f 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -206,10 +206,8 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file, if (!exe_module_sp || exe_module_sp->GetObjectFile() == NULL) { exe_module_sp.reset(); - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s", + exe_file.GetPath().c_str(), exe_arch.GetArchitectureName()); } } @@ -242,10 +240,8 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file, if (error.Fail() || !exe_module_sp) { - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", + exe_file.GetPath().c_str(), GetShortPluginName(), arch_names.GetString().c_str()); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index fc3788529f4..b3775d410ae 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -196,10 +196,8 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file, if (error.Fail() || exe_module_sp.get() == NULL || exe_module_sp->GetObjectFile() == NULL) { exe_module_sp.reset(); - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s", + exe_file.GetPath().c_str(), exe_arch.GetArchitectureName()); } } @@ -232,10 +230,8 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file, if (error.Fail() || !exe_module_sp) { - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", + exe_file.GetPath().c_str(), GetShortPluginName(), arch_names.GetString().c_str()); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 48a25c4d258..fe6d358e6fc 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -205,10 +205,9 @@ PlatformRemoteiOS::GetStatus (Stream &strm) for (uint32_t i=0; i<num_sdk_infos; ++i) { const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i]; - strm.Printf (" SDK Roots: [%2u] \"%s/%s\"\n", + strm.Printf (" SDK Roots: [%2u] \"%s\"\n", i, - sdk_dir_info.directory.GetDirectory().GetCString(), - sdk_dir_info.directory.GetFilename().GetCString()); + sdk_dir_info.directory.GetPath().c_str()); } } @@ -278,20 +277,16 @@ PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file, if (error.Fail() || !exe_module_sp) { - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", + exe_file.GetPath().c_str(), GetShortPluginName(), arch_names.GetString().c_str()); } } else { - error.SetErrorStringWithFormat ("'%s%s%s' does not exist", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString("")); + error.SetErrorStringWithFormat ("'%s' does not exist", + exe_file.GetPath().c_str()); } return error; @@ -712,7 +707,7 @@ PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec, { if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, local_file)) { - //printf ("sdk[%u] last: '%s/%s'\n", m_last_module_sdk_idx, local_file.GetDirectory().GetCString(), local_file.GetFilename().GetCString()); + //printf ("sdk[%u] last: '%s'\n", m_last_module_sdk_idx, local_file.GetPath().c_str()); module_sp.reset(); error = ResolveExecutable (local_file, module_spec.GetArchitecture(), @@ -738,7 +733,7 @@ PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec, } if (GetFileInSDK (platform_file_path, sdk_idx, local_file)) { - //printf ("sdk[%u]: '%s/%s'\n", sdk_idx, local_file.GetDirectory().GetCString(), local_file.GetFilename().GetCString()); + //printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str()); error = ResolveExecutable (local_file, module_spec.GetArchitecture(), diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 90032259603..5f1cfc8dc86 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -240,20 +240,16 @@ PlatformiOSSimulator::ResolveExecutable (const FileSpec &exe_file, if (error.Fail() || !exe_module_sp) { - error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString(""), + error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", + exe_file.GetPath().c_str(), GetShortPluginName(), arch_names.GetString().c_str()); } } else { - error.SetErrorStringWithFormat ("'%s%s%s' does not exist", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString("")); + error.SetErrorStringWithFormat ("'%s' does not exist", + exe_file.GetPath().c_str()); } return error; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp index 40300922713..4c76eed8166 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -61,18 +61,16 @@ DWARFDebugInfo::GetCompileUnitAranges () if (debug_aranges_data.GetByteSize() > 0) { if (log) - log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s/%s\" from .debug_aranges", - m_dwarf2Data->GetObjectFile()->GetFileSpec().GetDirectory().GetCString(), - m_dwarf2Data->GetObjectFile()->GetFileSpec().GetFilename().GetCString()); + log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s\" from .debug_aranges", + m_dwarf2Data->GetObjectFile()->GetFileSpec().GetPath().c_str()); m_cu_aranges_ap->Extract (debug_aranges_data); } else { if (log) - log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s/%s\" by parsing", - m_dwarf2Data->GetObjectFile()->GetFileSpec().GetDirectory().GetCString(), - m_dwarf2Data->GetObjectFile()->GetFileSpec().GetFilename().GetCString()); + log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s\" by parsing", + m_dwarf2Data->GetObjectFile()->GetFileSpec().GetPath().c_str()); const size_t num_compile_units = GetNumCompileUnits(); const bool clear_dies_if_already_not_parsed = true; for (size_t idx = 0; idx < num_compile_units; ++idx) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 6bb8fd17f8d..cbed4f22407 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2799,9 +2799,8 @@ SymbolFileDWARF::Index () #if defined (ENABLE_DEBUG_PRINTF) StreamFile s(stdout, false); - s.Printf ("DWARF index for '%s/%s':", - GetObjectFile()->GetFileSpec().GetDirectory().AsCString(), - GetObjectFile()->GetFileSpec().GetFilename().AsCString()); + s.Printf ("DWARF index for '%s':", + GetObjectFile()->GetFileSpec().GetPath().c_str()); s.Printf("\nFunction basenames:\n"); m_function_basename_index.Dump (&s); s.Printf("\nFunction fullnames:\n"); m_function_fullname_index.Dump (&s); s.Printf("\nFunction methods:\n"); m_function_method_index.Dump (&s); @@ -6478,12 +6477,11 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, { clang::CXXMethodDecl *cxx_method_decl; // REMOVE THE CRASH DESCRIPTION BELOW - Host::SetCrashDescriptionWithFormat ("SymbolFileDWARF::ParseType() is adding a method %s to class %s in DIE 0x%8.8" PRIx64 " from %s/%s", + Host::SetCrashDescriptionWithFormat ("SymbolFileDWARF::ParseType() is adding a method %s to class %s in DIE 0x%8.8" PRIx64 " from %s", type_name_cstr, class_type->GetName().GetCString(), MakeUserID(die->GetOffset()), - m_obj_file->GetFileSpec().GetDirectory().GetCString(), - m_obj_file->GetFileSpec().GetFilename().GetCString()); + m_obj_file->GetFileSpec().GetPath().c_str()); const bool is_attr_used = false; @@ -7568,10 +7566,9 @@ SymbolFileDWARF::DumpIndexes () { StreamFile s(stdout, false); - s.Printf ("DWARF index for (%s) '%s/%s':", + s.Printf ("DWARF index for (%s) '%s':", GetObjectFile()->GetModule()->GetArchitecture().GetArchitectureName(), - GetObjectFile()->GetFileSpec().GetDirectory().AsCString(), - GetObjectFile()->GetFileSpec().GetFilename().AsCString()); + GetObjectFile()->GetFileSpec().GetPath().c_str()); s.Printf("\nFunction basenames:\n"); m_function_basename_index.Dump (&s); s.Printf("\nFunction fullnames:\n"); m_function_fullname_index.Dump (&s); s.Printf("\nFunction methods:\n"); m_function_method_index.Dump (&s); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 096b5fc0717..941484ea3a5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -59,13 +59,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa if (log) { ConstString object_name (oso_module->GetObjectName()); - log->Printf("%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s/%s%s%s%s')", + log->Printf("%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')", this, - oso_module->GetFileSpec().GetDirectory().GetCString(), - oso_module->GetFileSpec().GetFilename().GetCString(), - object_name ? "(" : "", - object_name ? object_name.GetCString() : "", - object_name ? ")" : ""); + oso_module->GetSpecificationDescription().c_str()); } @@ -1415,10 +1411,9 @@ SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (CompileUnitInfo *cu_info) #if defined(DEBUG_OSO_DMAP) const FileRangeMap &oso_file_range_map = cu_info->GetFileRangeMap(this); const size_t n = oso_file_range_map.GetSize(); - printf ("SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p) %s/%s\n", + printf ("SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p) %s\n", cu_info, - cu_info->oso_sp->module_sp->GetFileSpec().GetDirectory().GetCString(), - cu_info->oso_sp->module_sp->GetFileSpec().GetFilename().GetCString()); + cu_info->oso_sp->module_sp->GetFileSpec().GetPath().c_str()); for (size_t i=0; i<n; ++i) { const FileRangeMap::Entry &entry = oso_file_range_map.GetEntryRef(i); diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 032fa0a1b61..c04ad78a283 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -159,9 +159,8 @@ SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp, lldb_privat return NULL; Timer scoped_timer (__PRETTY_FUNCTION__, - "SymbolVendorMacOSX::CreateInstance (module = %s/%s)", - module_sp->GetFileSpec().GetDirectory().AsCString(), - module_sp->GetFileSpec().GetFilename().AsCString()); + "SymbolVendorMacOSX::CreateInstance (module = %s)", + module_sp->GetFileSpec().GetPath().c_str()); SymbolVendorMacOSX* symbol_vendor = new SymbolVendorMacOSX(module_sp); if (symbol_vendor) { @@ -173,9 +172,8 @@ SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp, lldb_privat if (obj_file) { Timer scoped_timer2 ("SymbolVendorMacOSX::CreateInstance () locate dSYM", - "SymbolVendorMacOSX::CreateInstance (module = %s/%s) locate dSYM", - module_sp->GetFileSpec().GetDirectory().AsCString(), - module_sp->GetFileSpec().GetFilename().AsCString()); + "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM", + module_sp->GetFileSpec().GetPath().c_str()); // First check to see if the module has a symbol file in mind already. // If it does, then we MUST use that. diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp index f410bd62de3..4ab86e54bf6 100644 --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -408,9 +408,8 @@ Block::AddRange (const Range& range) const Declaration &func_decl = func_type->GetDeclaration(); if (func_decl.GetLine()) { - log->Printf ("warning: %s/%s:%u block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 ") which is not contained in parent block {0x%8.8" PRIx64 "} in function {0x%8.8" PRIx64 "} from %s/%s", - func_decl.GetFile().GetDirectory().GetCString(), - func_decl.GetFile().GetFilename().GetCString(), + log->Printf ("warning: %s:%u block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 ") which is not contained in parent block {0x%8.8" PRIx64 "} in function {0x%8.8" PRIx64 "} from %s", + func_decl.GetFile().GetPath().c_str(), func_decl.GetLine(), GetID(), (uint32_t)m_ranges.GetSize(), @@ -418,20 +417,18 @@ Block::AddRange (const Range& range) block_end_addr, parent_block->GetID(), function->GetID(), - module_sp->GetFileSpec().GetDirectory().GetCString(), - module_sp->GetFileSpec().GetFilename().GetCString()); + module_sp->GetFileSpec().GetPath().c_str()); } else { - log->Printf ("warning: block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 ") which is not contained in parent block {0x%8.8" PRIx64 "} in function {0x%8.8" PRIx64 "} from %s/%s", + log->Printf ("warning: block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 ") which is not contained in parent block {0x%8.8" PRIx64 "} in function {0x%8.8" PRIx64 "} from %s", GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr, block_end_addr, parent_block->GetID(), function->GetID(), - module_sp->GetFileSpec().GetDirectory().GetCString(), - module_sp->GetFileSpec().GetFilename().GetCString()); + module_sp->GetFileSpec().GetPath().c_str()); } } parent_block->AddRange (range); diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index 64c22efa784..c42b0cfd770 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -315,11 +315,9 @@ Function::GetBlock (bool can_create) else { Host::SystemLog (Host::eSystemLogError, - "error: unable to find module shared pointer for function '%s' in %s%s%s\n", + "error: unable to find module shared pointer for function '%s' in %s\n", GetName().GetCString(), - m_comp_unit->GetDirectory().GetCString(), - m_comp_unit->GetDirectory() ? "/" : "", - m_comp_unit->GetFilename().GetCString()); + m_comp_unit->GetPath().c_str()); } m_block.SetBlockInfoHasBeenParsed (true, true); } diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index a713543b25d..759477dbe32 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -40,9 +40,8 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, if (module_sp) { Timer scoped_timer (__PRETTY_FUNCTION__, - "ObjectFile::FindPlugin (module = %s/%s, file = %p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", - module_sp->GetFileSpec().GetDirectory().AsCString(), - module_sp->GetFileSpec().GetFilename().AsCString(), + "ObjectFile::FindPlugin (module = %s, file = %p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")", + module_sp->GetFileSpec().GetPath().c_str(), file, (uint64_t) file_offset, (uint64_t) file_size); if (file) { @@ -162,9 +161,8 @@ ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, if (module_sp) { Timer scoped_timer (__PRETTY_FUNCTION__, - "ObjectFile::FindPlugin (module = %s/%s, process = %p, header_addr = 0x%" PRIx64 ")", - module_sp->GetFileSpec().GetDirectory().AsCString(), - module_sp->GetFileSpec().GetFilename().AsCString(), + "ObjectFile::FindPlugin (module = %s, process = %p, header_addr = 0x%" PRIx64 ")", + module_sp->GetFileSpec().GetPath().c_str(), process_sp.get(), header_addr); uint32_t idx; @@ -255,30 +253,22 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp, Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) { - const ConstString object_name (module_sp->GetObjectName()); if (m_file) { - log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s%s%s%s), file = %s/%s, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, + log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, this, module_sp.get(), - module_sp->GetFileSpec().GetFilename().AsCString(), - object_name ? "(" : "", - object_name ? object_name.GetCString() : "", - object_name ? ")" : "", - m_file.GetDirectory().AsCString(), - m_file.GetFilename().AsCString(), + module_sp->GetSpecificationDescription().c_str(), + m_file.GetPath().c_str(), m_file_offset, m_length); } else { - log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s%s%s%s), file = <NULL>, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, + log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), file = <NULL>, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, this, module_sp.get(), - module_sp->GetFileSpec().GetFilename().AsCString(), - object_name ? "(" : "", - object_name ? object_name.GetCString() : "", - object_name ? ")" : "", + module_sp->GetSpecificationDescription().c_str(), m_file_offset, m_length); } @@ -308,14 +298,10 @@ ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp, Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) { - const ConstString object_name (module_sp->GetObjectName()); - log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s%s%s%s), process = %p, header_addr = 0x%" PRIx64, + log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s), process = %p, header_addr = 0x%" PRIx64, this, module_sp.get(), - module_sp->GetFileSpec().GetFilename().AsCString(), - object_name ? "(" : "", - object_name ? object_name.GetCString() : "", - object_name ? ")" : "", + module_sp->GetSpecificationDescription().c_str(), process_sp.get(), m_memory_addr); } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 49cb1c4f3fc..7c83778ccb3 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -517,11 +517,10 @@ SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, if (objfile) { Host::SystemLog (Host::eSystemLogWarning, - "warning: inlined block 0x%8.8" PRIx64 " doesn't have a range that contains file address 0x%" PRIx64 " in %s/%s\n", + "warning: inlined block 0x%8.8" PRIx64 " doesn't have a range that contains file address 0x%" PRIx64 " in %s\n", curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress(), - objfile->GetFileSpec().GetDirectory().GetCString(), - objfile->GetFileSpec().GetFilename().GetCString()); + objfile->GetFileSpec().GetPath().c_str()); } else { diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 3f407b92665..c0f241ec953 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -90,9 +90,8 @@ Symtab::Dump (Stream *s, Target *target, SortOrder sort_order) object_name = m_objfile->GetModule()->GetObjectName().GetCString(); if (file_spec) - s->Printf("Symtab, file = %s/%s%s%s%s, num_symbols = %lu", - file_spec.GetDirectory().AsCString(), - file_spec.GetFilename().AsCString(), + s->Printf("Symtab, file = %s%s%s%s, num_symbols = %lu", + file_spec.GetPath().c_str(), object_name ? "(" : "", object_name ? object_name : "", object_name ? ")" : "", diff --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp index f128066684f..c77628bf7dd 100644 --- a/lldb/source/Symbol/UnwindTable.cpp +++ b/lldb/source/Symbol/UnwindTable.cpp @@ -135,7 +135,7 @@ UnwindTable::GetUncachedFuncUnwindersContainingAddress (const Address& addr, Sym void UnwindTable::Dump (Stream &s) { - s.Printf("UnwindTable for %s/%s:\n", m_object_file.GetFileSpec().GetDirectory().GetCString(), m_object_file.GetFileSpec().GetFilename().GetCString()); + s.Printf("UnwindTable for '%s':\n", m_object_file.GetFileSpec().GetPath().c_str()); const_iterator begin = m_unwinds.begin(); const_iterator end = m_unwinds.end(); for (const_iterator pos = begin; pos != end; ++pos) diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index ed98fb26286..c1834d2bd87 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -510,10 +510,8 @@ Platform::ResolveExecutable (const FileSpec &exe_file, } else { - error.SetErrorStringWithFormat ("'%s%s%s' does not exist", - exe_file.GetDirectory().AsCString(""), - exe_file.GetDirectory() ? "/" : "", - exe_file.GetFilename().AsCString("")); + error.SetErrorStringWithFormat ("'%s' does not exist", + exe_file.GetPath().c_str()); } return error; } diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp index 9b4bdd0838f..af5636555ae 100644 --- a/lldb/source/Target/SectionLoadList.cpp +++ b/lldb/source/Target/SectionLoadList.cpp @@ -64,12 +64,10 @@ SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP §ion, addr_t l if (log) { const FileSpec &module_file_spec (section->GetModule()->GetFileSpec()); - log->Printf ("SectionLoadList::%s (section = %p (%s%s%s.%s), load_addr = 0x%16.16" PRIx64 ")", + log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ")", __FUNCTION__, section.get(), - module_file_spec.GetDirectory().AsCString(), - module_file_spec.GetDirectory() ? "/" : "", - module_file_spec.GetFilename().AsCString(), + module_file_spec.GetPath().c_str(), section->GetName().AsCString(), load_addr); } @@ -141,12 +139,10 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP §ion_sp) if (log) { const FileSpec &module_file_spec (section_sp->GetModule()->GetFileSpec()); - log->Printf ("SectionLoadList::%s (section = %p (%s%s%s.%s))", + log->Printf ("SectionLoadList::%s (section = %p (%s.%s))", __FUNCTION__, section_sp.get(), - module_file_spec.GetDirectory().AsCString(), - module_file_spec.GetDirectory() ? "/" : "", - module_file_spec.GetFilename().AsCString(), + module_file_spec.GetPath().c_str(), section_sp->GetName().AsCString()); } @@ -175,12 +171,10 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP §ion_sp, addr_t l if (log) { const FileSpec &module_file_spec (section_sp->GetModule()->GetFileSpec()); - log->Printf ("SectionLoadList::%s (section = %p (%s%s%s.%s), load_addr = 0x%16.16" PRIx64 ")", + log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ")", __FUNCTION__, section_sp.get(), - module_file_spec.GetDirectory().AsCString(), - module_file_spec.GetDirectory() ? "/" : "", - module_file_spec.GetFilename().AsCString(), + module_file_spec.GetPath().c_str(), section_sp->GetName().AsCString(), load_addr); } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index f07cfdd7cda..c54cc15ca46 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -1004,9 +1004,8 @@ Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) if (executable_sp.get()) { Timer scoped_timer (__PRETTY_FUNCTION__, - "Target::SetExecutableModule (executable = '%s/%s')", - executable_sp->GetFileSpec().GetDirectory().AsCString(), - executable_sp->GetFileSpec().GetFilename().AsCString()); + "Target::SetExecutableModule (executable = '%s')", + executable_sp->GetFileSpec().GetPath().c_str()); m_images.Append(executable_sp); // The first image is our exectuable file diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 1bc32946ca5..a4411b06d08 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -105,12 +105,10 @@ TargetList::CreateTarget (Debugger &debugger, { if (!platform_arch.IsCompatibleMatch(matching_module_spec.GetArchitecture())) { - error.SetErrorStringWithFormat("the specified architecture '%s' is not compatible with '%s' in '%s%s%s'", + error.SetErrorStringWithFormat("the specified architecture '%s' is not compatible with '%s' in '%s'", platform_arch.GetTriple().str().c_str(), matching_module_spec.GetArchitecture().GetTriple().str().c_str(), - module_spec.GetFileSpec().GetDirectory() ? module_spec.GetFileSpec().GetDirectory().GetCString() : "", - module_spec.GetFileSpec().GetDirectory() ? "/" : "", - module_spec.GetFileSpec().GetFilename().GetCString()); + module_spec.GetFileSpec().GetPath().c_str()); return error; } } @@ -266,18 +264,14 @@ TargetList::CreateTarget (Debugger &debugger, { if (arch.IsValid()) { - error.SetErrorStringWithFormat("\"%s%s%s\" doesn't contain architecture %s", - file.GetDirectory().AsCString(), - file.GetDirectory() ? "/" : "", - file.GetFilename().AsCString(), + error.SetErrorStringWithFormat("\"%s\" doesn't contain architecture %s", + file.GetPath().c_str(), arch.GetArchitectureName()); } else { - error.SetErrorStringWithFormat("unsupported file type \"%s%s%s\"", - file.GetDirectory().AsCString(), - file.GetDirectory() ? "/" : "", - file.GetFilename().AsCString()); + error.SetErrorStringWithFormat("unsupported file type \"%s\"", + file.GetPath().c_str()); } return error; } |