summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBBroadcaster.cpp20
-rw-r--r--lldb/source/API/SBEvent.cpp10
-rw-r--r--lldb/source/Core/DataBufferMemoryMap.cpp22
-rw-r--r--lldb/source/Core/Logging.cpp9
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp37
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp34
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp34
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp47
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp36
-rw-r--r--lldb/source/Target/Memory.cpp46
-rw-r--r--lldb/source/Target/SectionLoadList.cpp26
-rw-r--r--lldb/source/Target/ThreadPlanCallFunction.cpp5
-rw-r--r--lldb/source/Utility/ConstString.cpp6
13 files changed, 109 insertions, 223 deletions
diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp
index 5189dd7bb27..68968534745 100644
--- a/lldb/source/API/SBBroadcaster.cpp
+++ b/lldb/source/API/SBBroadcaster.cpp
@@ -22,25 +22,15 @@ SBBroadcaster::SBBroadcaster() : m_opaque_sp(), m_opaque_ptr(NULL) {}
SBBroadcaster::SBBroadcaster(const char *name)
: m_opaque_sp(new Broadcaster(NULL, name)), m_opaque_ptr(NULL) {
m_opaque_ptr = m_opaque_sp.get();
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API |
- LIBLLDB_LOG_VERBOSE));
-
- if (log)
- log->Printf(
- "SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)", name,
- static_cast<void *>(m_opaque_ptr));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_LOGV(log, "(name=\"{0}\") => SBBroadcaster({1})", name, m_opaque_ptr);
}
SBBroadcaster::SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns)
: m_opaque_sp(owns ? broadcaster : NULL), m_opaque_ptr(broadcaster) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API |
- LIBLLDB_LOG_VERBOSE));
-
- if (log)
- log->Printf("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) "
- "=> SBBroadcaster(%p)",
- static_cast<void *>(broadcaster), owns,
- static_cast<void *>(m_opaque_ptr));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_LOGV(log, "(broadcaster={0}, owns={1}) => SBBroadcaster({2})",
+ broadcaster, owns, m_opaque_ptr);
}
SBBroadcaster::SBBroadcaster(const SBBroadcaster &rhs)
diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp
index 13928fc51b6..17a16ffd048 100644
--- a/lldb/source/API/SBEvent.cpp
+++ b/lldb/source/API/SBEvent.cpp
@@ -109,13 +109,9 @@ bool SBEvent::BroadcasterMatchesRef(const SBBroadcaster &broadcaster) {
// For logging, this gets a little chatty so only enable this when verbose
// logging is on
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API |
- LIBLLDB_LOG_VERBOSE));
- if (log)
- log->Printf(
- "SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
- static_cast<void *>(get()), static_cast<void *>(broadcaster.get()),
- broadcaster.GetName(), success);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_LOGV(log, "({0}) (SBBroadcaster({1}): {2}) => {3}", get(),
+ broadcaster.get(), broadcaster.GetName(), success);
return success;
}
diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp
index 5ea4b4f5a3a..be571a45a90 100644
--- a/lldb/source/Core/DataBufferMemoryMap.cpp
+++ b/lldb/source/Core/DataBufferMemoryMap.cpp
@@ -175,14 +175,11 @@ size_t DataBufferMemoryMap::MemoryMapFromFileDescriptor(int fd,
bool fd_is_file) {
Clear();
if (fd >= 0) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MMAP |
- LIBLLDB_LOG_VERBOSE));
- if (log) {
- log->Printf("DataBufferMemoryMap::MemoryMapFromFileDescriptor(fd=%i, "
- "offset=0x%" PRIx64 ", length=0x%" PRIx64
- ", writeable=%i, fd_is_file=%i)",
- fd, offset, (uint64_t)length, writeable, fd_is_file);
- }
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MMAP));
+ LLDB_LOGV(log,
+ "(fd={0}, offset={1:x}, length={2:x}, "
+ "writeable={3}, fd_is_file={4})",
+ fd, offset, length, writeable, fd_is_file);
#ifdef _WIN32
HANDLE handle = (HANDLE)_get_osfhandle(fd);
DWORD file_size_low, file_size_high;
@@ -291,13 +288,8 @@ size_t DataBufferMemoryMap::MemoryMapFromFileDescriptor(int fd,
m_data = m_mmap_addr;
m_size = length;
}
-
- if (log) {
- log->Printf(
- "DataBufferMemoryMap::MemoryMapFromFileSpec() m_mmap_addr = "
- "%p, m_mmap_size = %" PRIu64 ", error = %s",
- (void *)m_mmap_addr, (uint64_t)m_mmap_size, error.AsCString());
- }
+ LLDB_LOGV(log, "m_mmap_addr = {0}, m_mmap_size = {1}, error = {2}",
+ m_mmap_addr, m_mmap_size, error);
}
}
}
diff --git a/lldb/source/Core/Logging.cpp b/lldb/source/Core/Logging.cpp
index 4d63b60eecc..1d42df111a4 100644
--- a/lldb/source/Core/Logging.cpp
+++ b/lldb/source/Core/Logging.cpp
@@ -44,11 +44,6 @@ uint32_t lldb_private::GetLogMask() {
return 0;
}
-bool lldb_private::IsLogVerbose() {
- uint32_t mask = GetLogMask();
- return (mask & LIBLLDB_LOG_VERBOSE);
-}
-
Log *lldb_private::GetLogIfAllCategoriesSet(uint32_t mask) {
Log *log(GetLog());
if (log && mask) {
@@ -130,8 +125,6 @@ void lldb_private::DisableLog(const char **categories, Stream *feedback_strm) {
flag_bits &= ~LIBLLDB_LOG_THREAD;
else if (0 == ::strcasecmp(arg, "target"))
flag_bits &= ~LIBLLDB_LOG_TARGET;
- else if (0 == ::strcasecmp(arg, "verbose"))
- flag_bits &= ~LIBLLDB_LOG_VERBOSE;
else if (0 == ::strncasecmp(arg, "watch", 5))
flag_bits &= ~LIBLLDB_LOG_WATCHPOINTS;
else if (0 == ::strncasecmp(arg, "temp", 4))
@@ -257,8 +250,6 @@ Log *lldb_private::EnableLog(StreamSP &log_stream_sp, uint32_t log_options,
flag_bits |= LIBLLDB_LOG_TYPES;
else if (0 == ::strncasecmp(arg, "unwind", 6))
flag_bits |= LIBLLDB_LOG_UNWIND;
- else if (0 == ::strcasecmp(arg, "verbose"))
- flag_bits |= LIBLLDB_LOG_VERBOSE;
else if (0 == ::strncasecmp(arg, "watch", 5))
flag_bits |= LIBLLDB_LOG_WATCHPOINTS;
else if (0 == ::strcasecmp(arg, "jit"))
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
index 131f31f69a9..c9b7d60f6ca 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
@@ -501,10 +501,8 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
if (m_filled)
return;
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
- if (log)
- log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s",
- descriptor.GetClassName().AsCString("<unknown"));
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
+ LLDB_LOGV(log, "class_name = {0}", descriptor.GetClassName());
m_filled = true;
ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(
runtime.GetEncodingToType());
@@ -519,19 +517,15 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
uint64_t size) -> bool {
const bool for_expression = false;
const bool stop_loop = false;
- if (log)
- log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding "
- "= %s, offset_ptr = %" PRIx64 ", size = %" PRIu64,
- name, type, offset_ptr, size);
+ LLDB_LOGV(log, "name = {0}, encoding = {1}, offset_ptr = {2:x}, size = {3}",
+ name, type, offset_ptr, size);
CompilerType ivar_type =
encoding_to_type_sp->RealizeType(type, for_expression);
if (ivar_type) {
- if (log)
- log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, "
- "encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64
- " , type_size = %" PRIu64,
- name, type, offset_ptr, size,
- ivar_type.GetByteSize(nullptr));
+ LLDB_LOGV(log,
+ "name = {0}, encoding = {1}, offset_ptr = {2:x}, size = "
+ "{3}, type_size = {4}",
+ name, type, offset_ptr, size, ivar_type.GetByteSize(nullptr));
Scalar offset_scalar;
Error error;
const int offset_ptr_size = 4;
@@ -539,18 +533,13 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
size_t read = process->ReadScalarIntegerFromMemory(
offset_ptr, offset_ptr_size, is_signed, offset_scalar, error);
if (error.Success() && 4 == read) {
- if (log)
- log->Printf(
- "[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64
- " --> %" PRIu32,
- offset_ptr, offset_scalar.SInt());
+ LLDB_LOGV(log, "offset_ptr = {0:x} --> {1}", offset_ptr,
+ offset_scalar.SInt());
m_ivars.push_back(
{ConstString(name), ivar_type, size, offset_scalar.SInt()});
- } else if (log)
- log->Printf(
- "[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64
- " --> read fail, read = %zu",
- offset_ptr, read);
+ } else
+ LLDB_LOGV(log, "offset_ptr = {0:x} --> read fail, read = %{1}",
+ offset_ptr, read);
}
return stop_loop;
});
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 9f20832d50e..67b2b95bfef 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -497,18 +497,15 @@ const char *PlatformRemoteAppleTV::GetDeviceSupportDirectoryForOSVersion() {
uint32_t
PlatformRemoteAppleTV::FindFileInAllSDKs(const char *platform_file_path,
FileSpecList &file_list) {
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
if (platform_file_path && platform_file_path[0] &&
UpdateSDKDirectoryInfosIfNeeded()) {
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
lldb_private::FileSpec local_file;
// First try for an exact match of major, minor and update
for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file_path,
+ m_sdk_directory_infos[sdk_idx].directory);
if (GetFileInSDK(platform_file_path, sdk_idx, local_file)) {
file_list.Append(local_file);
}
@@ -619,8 +616,7 @@ Error PlatformRemoteAppleTV::GetSharedModule(
// then we attempt to get a shared module for the right architecture
// with the right UUID.
const FileSpec &platform_file = module_spec.GetFileSpec();
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Error error;
char platform_file_path[PATH_MAX];
@@ -637,12 +633,8 @@ Error PlatformRemoteAppleTV::GetSharedModule(
// using the OS build.
const uint32_t connected_sdk_idx = GetConnectedSDKIndex();
if (connected_sdk_idx < num_sdk_infos) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[connected_sdk_idx]
- .directory.GetPath()
- .c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[connected_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, connected_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -658,12 +650,8 @@ Error PlatformRemoteAppleTV::GetSharedModule(
// Try the last SDK index if it is set as most files from an SDK
// will tend to be valid in that same SDK.
if (m_last_module_sdk_idx < num_sdk_infos) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[m_last_module_sdk_idx]
- .directory.GetPath()
- .c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file_path,
+ m_sdk_directory_infos[m_last_module_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, m_last_module_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -682,10 +670,8 @@ Error PlatformRemoteAppleTV::GetSharedModule(
// it above
continue;
}
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file_path,
+ m_sdk_directory_infos[sdk_idx].directory);
if (GetFileInSDK(platform_file_path, sdk_idx,
platform_module_spec.GetFileSpec())) {
// printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index 1cbaa02c6c5..037c183f916 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -511,18 +511,15 @@ const char *PlatformRemoteAppleWatch::GetDeviceSupportDirectoryForOSVersion() {
uint32_t
PlatformRemoteAppleWatch::FindFileInAllSDKs(const char *platform_file_path,
FileSpecList &file_list) {
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
if (platform_file_path && platform_file_path[0] &&
UpdateSDKDirectoryInfosIfNeeded()) {
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
lldb_private::FileSpec local_file;
// First try for an exact match of major, minor and update
for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file_path,
+ m_sdk_directory_infos[sdk_idx].directory);
if (GetFileInSDK(platform_file_path, sdk_idx, local_file)) {
file_list.Append(local_file);
}
@@ -633,8 +630,7 @@ Error PlatformRemoteAppleWatch::GetSharedModule(
// then we attempt to get a shared module for the right architecture
// with the right UUID.
const FileSpec &platform_file = module_spec.GetFileSpec();
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Error error;
char platform_file_path[PATH_MAX];
@@ -651,12 +647,8 @@ Error PlatformRemoteAppleWatch::GetSharedModule(
// using the OS build.
const uint32_t connected_sdk_idx = GetConnectedSDKIndex();
if (connected_sdk_idx < num_sdk_infos) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[connected_sdk_idx]
- .directory.GetPath()
- .c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[connected_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, connected_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -672,12 +664,8 @@ Error PlatformRemoteAppleWatch::GetSharedModule(
// Try the last SDK index if it is set as most files from an SDK
// will tend to be valid in that same SDK.
if (m_last_module_sdk_idx < num_sdk_infos) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[m_last_module_sdk_idx]
- .directory.GetPath()
- .c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[m_last_module_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, m_last_module_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -696,10 +684,8 @@ Error PlatformRemoteAppleWatch::GetSharedModule(
// it above
continue;
}
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[sdk_idx].directory);
if (GetFileInSDK(platform_file_path, sdk_idx,
platform_module_spec.GetFileSpec())) {
// printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 10a782afd2d..4ff767bee69 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -481,18 +481,15 @@ const char *PlatformRemoteiOS::GetDeviceSupportDirectoryForOSVersion() {
uint32_t PlatformRemoteiOS::FindFileInAllSDKs(const char *platform_file_path,
FileSpecList &file_list) {
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
if (platform_file_path && platform_file_path[0] &&
UpdateSDKDirectoryInfosIfNeeded()) {
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
lldb_private::FileSpec local_file;
// First try for an exact match of major, minor and update
for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file_path,
+ m_sdk_directory_infos[sdk_idx].directory);
if (GetFileInSDK(platform_file_path, sdk_idx, local_file)) {
file_list.Append(local_file);
}
@@ -605,8 +602,7 @@ Error PlatformRemoteiOS::GetSharedModule(
// then we attempt to get a shared module for the right architecture
// with the right UUID.
const FileSpec &platform_file = module_spec.GetFileSpec();
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
+ Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
Error error;
char platform_file_path[PATH_MAX];
@@ -623,12 +619,8 @@ Error PlatformRemoteiOS::GetSharedModule(
// using the OS build.
const uint32_t connected_sdk_idx = GetConnectedSDKIndex();
if (connected_sdk_idx < num_sdk_infos) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[connected_sdk_idx]
- .directory.GetPath()
- .c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[connected_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, connected_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -644,12 +636,8 @@ Error PlatformRemoteiOS::GetSharedModule(
// Try the last SDK index if it is set as most files from an SDK
// will tend to be valid in that same SDK.
if (m_last_module_sdk_idx < num_sdk_infos) {
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[m_last_module_sdk_idx]
- .directory.GetPath()
- .c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[m_last_module_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, m_last_module_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -670,11 +658,8 @@ Error PlatformRemoteiOS::GetSharedModule(
GetSDKIndexBySDKDirectoryInfo(current_sdk_info);
if (current_sdk_idx < num_sdk_infos &&
current_sdk_idx != m_last_module_sdk_idx) {
- if (log) {
- log->Printf(
- "Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[current_sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[current_sdk_idx].directory);
if (GetFileInSDK(platform_file_path, current_sdk_idx,
platform_module_spec.GetFileSpec())) {
module_sp.reset();
@@ -694,10 +679,8 @@ Error PlatformRemoteiOS::GetSharedModule(
// it above
continue;
}
- if (log) {
- log->Printf("Searching for %s in sdk path %s", platform_file_path,
- m_sdk_directory_infos[sdk_idx].directory.GetPath().c_str());
- }
+ LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file,
+ m_sdk_directory_infos[sdk_idx].directory);
if (GetFileInSDK(platform_file_path, sdk_idx,
platform_module_spec.GetFileSpec())) {
// printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
@@ -749,10 +732,8 @@ Error PlatformRemoteiOS::GetSharedModule(
size_t num_module_search_paths = module_search_paths_ptr->GetSize();
for (size_t i = 0; i < num_module_search_paths; ++i) {
- Log *log_verbose = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST |
- LIBLLDB_LOG_VERBOSE);
- if (log_verbose)
- log_verbose->Printf ("PlatformRemoteiOS::GetSharedModule searching for binary in search-path %s", module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str());
+ LLDB_LOGV(log, "searching for binary in search-path {0}",
+ module_search_paths_ptr->GetFileSpecAtIndex(i));
// Create a new FileSpec with this module_search_paths_ptr
// plus just the filename ("UIFoundation"), then the parent
// dir plus filename ("UIFoundation.framework/UIFoundation")
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 357b48e53c4..56ddae14bcb 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -142,14 +142,9 @@ public:
~InitializePythonRAII() {
if (m_was_already_initialized) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT |
- LIBLLDB_LOG_VERBOSE));
-
- if (log) {
- log->Printf("Releasing PyGILState. Returning to state = %slocked\n",
- m_was_already_initialized == PyGILState_UNLOCKED ? "un"
- : "");
- }
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
+ LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
+ m_was_already_initialized == PyGILState_UNLOCKED ? "un" : "");
PyGILState_Release(m_gil_state);
} else {
// We initialized the threads in this function, just unlock the GIL.
@@ -174,15 +169,12 @@ private:
void InitializeThreadsPrivate() {
if (PyEval_ThreadsInitialized()) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT |
- LIBLLDB_LOG_VERBOSE));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
m_was_already_initialized = true;
m_gil_state = PyGILState_Ensure();
- if (log) {
- log->Printf("Ensured PyGILState. Previous state = %slocked\n",
- m_gil_state == PyGILState_UNLOCKED ? "un" : "");
- }
+ LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked\n",
+ m_gil_state == PyGILState_UNLOCKED ? "un" : "");
return;
}
@@ -212,12 +204,10 @@ ScriptInterpreterPython::Locker::Locker(ScriptInterpreterPython *py_interpreter,
}
bool ScriptInterpreterPython::Locker::DoAcquireLock() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT |
- LIBLLDB_LOG_VERBOSE));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
m_GILState = PyGILState_Ensure();
- if (log)
- log->Printf("Ensured PyGILState. Previous state = %slocked\n",
- m_GILState == PyGILState_UNLOCKED ? "un" : "");
+ LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked",
+ m_GILState == PyGILState_UNLOCKED ? "un" : "");
// we need to save the thread state when we first start the command
// because we might decide to interrupt it while some action is taking
@@ -239,11 +229,9 @@ bool ScriptInterpreterPython::Locker::DoInitSession(uint16_t on_entry_flags,
}
bool ScriptInterpreterPython::Locker::DoFreeLock() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT |
- LIBLLDB_LOG_VERBOSE));
- if (log)
- log->Printf("Releasing PyGILState. Returning to state = %slocked\n",
- m_GILState == PyGILState_UNLOCKED ? "un" : "");
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
+ LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked",
+ m_GILState == PyGILState_UNLOCKED ? "un" : "");
PyGILState_Release(m_GILState);
m_python_interpreter->DecrementLockCount();
return true;
diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp
index 775d0b305f2..808d671ff4f 100644
--- a/lldb/source/Target/Memory.cpp
+++ b/lldb/source/Target/Memory.cpp
@@ -263,16 +263,16 @@ AllocatedBlock::~AllocatedBlock() {}
lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) {
addr_t addr = LLDB_INVALID_ADDRESS;
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
if (size <= m_byte_size) {
const uint32_t needed_chunks = CalculateChunksNeededForSize(size);
if (m_offset_to_chunk_size.empty()) {
m_offset_to_chunk_size[0] = needed_chunks;
- if (log)
- log->Printf("[1] AllocatedBlock::ReserveBlock(%p) (size = %u (0x%x)) "
- "=> offset = 0x%x, %u %u bit chunks",
- (void *)this, size, size, 0, needed_chunks, m_chunk_size);
+ LLDB_LOGV(log,
+ "[1] ({0}) (size = {1} ({1:x})) => offset = {2:x}, {3} "
+ "{4} bit chunks",
+ this, size, 0, needed_chunks, m_chunk_size);
addr = m_addr;
} else {
uint32_t last_offset = 0;
@@ -285,12 +285,11 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) {
CalculateChunksNeededForSize(bytes_available);
if (num_chunks >= needed_chunks) {
m_offset_to_chunk_size[last_offset] = needed_chunks;
- if (log)
- log->Printf("[2] AllocatedBlock::ReserveBlock(%p) (size = %u "
- "(0x%x)) => offset = 0x%x, %u %u bit chunks - "
- "num_chunks %zu",
- (void *)this, size, size, last_offset, needed_chunks,
- m_chunk_size, m_offset_to_chunk_size.size());
+ LLDB_LOGV(log,
+ "[2] ({0}) (size = {1} ({1:x})) => offset = {2:x}, "
+ "{3} {4} bit chunks- num_chunks {5}",
+ this, size, last_offset, needed_chunks, m_chunk_size,
+ m_offset_to_chunk_size.size());
addr = m_addr + last_offset;
break;
}
@@ -304,12 +303,11 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) {
CalculateChunksNeededForSize(m_byte_size - last_offset);
if (chunks_left >= needed_chunks) {
m_offset_to_chunk_size[last_offset] = needed_chunks;
- if (log)
- log->Printf("[3] AllocatedBlock::ReserveBlock(%p) (size = %u "
- "(0x%x)) => offset = 0x%x, %u %u bit chunks - "
- "num_chunks %zu",
- (void *)this, size, size, last_offset, needed_chunks,
- m_chunk_size, m_offset_to_chunk_size.size());
+ LLDB_LOGV(log,
+ "[3] ({0}) (size = {1} ({1:x})) => offset = {2:x}, "
+ "{3} {4} bit chunks- num_chunks {5}",
+ this, size, last_offset, needed_chunks, m_chunk_size,
+ m_offset_to_chunk_size.size());
addr = m_addr + last_offset;
break;
}
@@ -371,10 +369,7 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) {
// }
}
- if (log)
- log->Printf("AllocatedBlock::ReserveBlock(%p) (size = %u (0x%x)) => "
- "0x%16.16" PRIx64,
- (void *)this, size, size, (uint64_t)addr);
+ LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size, addr);
return addr;
}
@@ -386,12 +381,9 @@ bool AllocatedBlock::FreeBlock(addr_t addr) {
m_offset_to_chunk_size.erase(pos);
success = true;
}
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
- if (log)
- log->Printf("AllocatedBlock::FreeBlock(%p) (addr = 0x%16.16" PRIx64
- ") => %i, num_chunks: %zu",
- (void *)this, (uint64_t)addr, success,
- m_offset_to_chunk_size.size());
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ LLDB_LOGV(log, "({0}) (addr = {1:x}) => {2}, num_chunks: {3}", this, addr,
+ success, m_offset_to_chunk_size.size());
return success;
}
diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp
index 0ac5cfac7f2..3dc39443566 100644
--- a/lldb/source/Target/SectionLoadList.cpp
+++ b/lldb/source/Target/SectionLoadList.cpp
@@ -67,21 +67,13 @@ SectionLoadList::GetSectionLoadAddress(const lldb::SectionSP &section) const {
bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP &section,
addr_t load_addr,
bool warn_multiple) {
- Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER |
- LIBLLDB_LOG_VERBOSE));
-
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
ModuleSP module_sp(section->GetModule());
if (module_sp) {
- if (log) {
- const FileSpec &module_file_spec(module_sp->GetFileSpec());
- log->Printf("SectionLoadList::%s (section = %p (%s.%s), load_addr = "
- "0x%16.16" PRIx64 ") module = %p",
- __FUNCTION__, static_cast<void *>(section.get()),
- module_file_spec.GetPath().c_str(),
- section->GetName().AsCString(), load_addr,
- static_cast<void *>(module_sp.get()));
- }
+ LLDB_LOGV(log, "(section = {0} ({1}.{2}), load_addr = {3:x}) module = {4}",
+ section.get(), module_sp->GetFileSpec(), section->GetName(),
+ load_addr, module_sp.get());
if (section->GetByteSize() == 0)
return false; // No change
@@ -147,10 +139,9 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp) {
size_t unload_count = 0;
if (section_sp) {
- Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER |
- LIBLLDB_LOG_VERBOSE));
+ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
- if (log) {
+ if (log && log->GetVerbose()) {
ModuleSP module_sp = section_sp->GetModule();
std::string module_name("<Unknown>");
if (module_sp) {
@@ -183,10 +174,9 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp) {
bool SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp,
addr_t load_addr) {
- Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER |
- LIBLLDB_LOG_VERBOSE));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
- if (log) {
+ if (log && log->GetVerbose()) {
ModuleSP module_sp = section_sp->GetModule();
std::string module_name("<Unknown>");
if (module_sp) {
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index 0a0bee3787b..7f9f918ae22 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -174,9 +174,8 @@ ThreadPlanCallFunction::~ThreadPlanCallFunction() {
}
void ThreadPlanCallFunction::ReportRegisterState(const char *message) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP |
- LIBLLDB_LOG_VERBOSE));
- if (log) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
+ if (log && log->GetVerbose()) {
StreamString strm;
RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
diff --git a/lldb/source/Utility/ConstString.cpp b/lldb/source/Utility/ConstString.cpp
index eb515102420..73726c87335 100644
--- a/lldb/source/Utility/ConstString.cpp
+++ b/lldb/source/Utility/ConstString.cpp
@@ -334,3 +334,9 @@ size_t ConstString::StaticMemorySize() {
// Get the size of the static string pool
return StringPool().MemorySize();
}
+
+void llvm::format_provider<ConstString>::format(const ConstString &CS,
+ llvm::raw_ostream &OS,
+ llvm::StringRef Options) {
+ format_provider<StringRef>::format(CS.AsCString(), OS, Options);
+}
OpenPOWER on IntegriCloud