Cleanup logging to use the new "std::string FileSpec::GetPath()" function. Also added a similar function for modules:
std::string
Module::GetSpecificationDescription () const;
This returns the module as "/usr/lib/libfoo.dylib" for normal files (calls "std::string FileSpec::GetPath()" on m_file) but it also might include the object name in case the module is for a .o file in a BSD archive ("/usr/lib/libfoo.a(bar.o)"). Cleaned up necessary logging code to use it.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180717 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index a713543..759477d 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -40,9 +40,8 @@
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 @@
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 @@
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 @@
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);
}