[Lldb-commits] [lldb] r335163 - Remove some instances of manual UUID pretty-printing
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 20 13:13:04 PDT 2018
Author: labath
Date: Wed Jun 20 13:13:04 2018
New Revision: 335163
URL: http://llvm.org/viewvc/llvm-project?rev=335163&view=rev
Log:
Remove some instances of manual UUID pretty-printing
Identical functionality is already offered by the UUID::getAsString
method.
Modified:
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=335163&r1=335162&r2=335163&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Wed Jun 20 13:13:04 2018
@@ -1403,30 +1403,12 @@ bool DynamicLoaderDarwinKernel::ReadAllK
// Dump an image info structure to the file handle provided.
//----------------------------------------------------------------------
void DynamicLoaderDarwinKernel::KextImageInfo::PutToLog(Log *log) const {
- if (log == NULL)
- return;
- const uint8_t *u = static_cast<const uint8_t *>(m_uuid.GetBytes());
-
if (m_load_address == LLDB_INVALID_ADDRESS) {
- if (u) {
- log->Printf("\tuuid=%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 name=\"%s\" (UNLOADED)",
- 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], m_name.c_str());
- } else
- log->Printf("\tname=\"%s\" (UNLOADED)", m_name.c_str());
+ LLDB_LOG(log, "uuid={0} name=\"{1}\" (UNLOADED)", m_uuid.GetAsString(),
+ m_name);
} else {
- if (u) {
- log->Printf("\taddr=0x%16.16" PRIx64 " size=0x%16.16" 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 name=\"%s\"",
- m_load_address, m_size, 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], m_name.c_str());
- } else {
- log->Printf("\t[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ") name=\"%s\"",
- m_load_address, m_load_address + m_size, m_name.c_str());
- }
+ LLDB_LOG(log, "addr={0:x+16} size={1:x+16} uuid={2} name=\"{3}\"",
+ m_load_address, m_size, m_uuid.GetAsString(), m_name);
}
}
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=335163&r1=335162&r2=335163&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Wed Jun 20 13:13:04 2018
@@ -747,35 +747,14 @@ DynamicLoaderDarwin::ImageInfo::FindSegm
// Dump an image info structure to the file handle provided.
//----------------------------------------------------------------------
void DynamicLoaderDarwin::ImageInfo::PutToLog(Log *log) const {
- if (log == NULL)
+ if (!log)
return;
- const uint8_t *u = (const uint8_t *)uuid.GetBytes();
-
if (address == LLDB_INVALID_ADDRESS) {
- 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' (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.GetPath().c_str());
- } else
- log->Printf("\t modtime=0x%8.8" PRIx64
- " path='%s' (UNLOADED)",
- mod_date, file_spec.GetPath().c_str());
+ LLDB_LOG(log, "modtime={0:x+8} uuid={1} path='{2}' (UNLOADED)", mod_date,
+ uuid.GetAsString(), file_spec.GetPath());
} 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'",
- 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.GetPath().c_str());
- } else {
- log->Printf("\taddress=0x%16.16" PRIx64 " modtime=0x%8.8" PRIx64
- " path='%s'",
- address, mod_date, file_spec.GetPath().c_str());
- }
+ LLDB_LOG(log, "address={0:x+16} modtime={1:x+8} uuid={2} path='{3}'",
+ address, mod_date, uuid.GetAsString(), file_spec.GetPath());
for (uint32_t i = 0; i < segments.size(); ++i)
segments[i].PutToLog(log, slide);
}
More information about the lldb-commits
mailing list