diff options
Diffstat (limited to 'lldb/source/Plugins')
5 files changed, 59 insertions, 129 deletions
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; |