From 8b4000f13b303cc154136abc74c55670673e2a96 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 8 May 2017 17:13:54 +0000 Subject: Vendor import of lldb trunk r302418: https://llvm.org/svn/llvm-project/lldb/trunk@302418 --- source/API/SBProcess.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source/API/SBProcess.cpp') diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp index 5614cb468a69b..0348113a9873e 100644 --- a/source/API/SBProcess.cpp +++ b/source/API/SBProcess.cpp @@ -1157,22 +1157,34 @@ uint32_t SBProcess::LoadImage(lldb::SBFileSpec &sb_remote_image_spec, uint32_t SBProcess::LoadImage(const lldb::SBFileSpec &sb_local_image_spec, const lldb::SBFileSpec &sb_remote_image_spec, lldb::SBError &sb_error) { + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); ProcessSP process_sp(GetSP()); if (process_sp) { Process::StopLocker stop_locker; if (stop_locker.TryLock(&process_sp->GetRunLock())) { + if (log) + log->Printf("SBProcess(%p)::LoadImage() => calling Platform::LoadImage" + "for: %s", + static_cast(process_sp.get()), + sb_local_image_spec.GetFilename()); + std::lock_guard guard( - process_sp->GetTarget().GetAPIMutex()); + process_sp->GetTarget().GetAPIMutex()); PlatformSP platform_sp = process_sp->GetTarget().GetPlatform(); return platform_sp->LoadImage(process_sp.get(), *sb_local_image_spec, *sb_remote_image_spec, sb_error.ref()); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (log) log->Printf("SBProcess(%p)::LoadImage() => error: process is running", static_cast(process_sp.get())); sb_error.SetErrorString("process is running"); } + } else { + if (log) + log->Printf("SBProcess(%p)::LoadImage() => error: called with invalid" + " process", + static_cast(process_sp.get())); + sb_error.SetErrorString("process is invalid"); } return LLDB_INVALID_IMAGE_TOKEN; } -- cgit v1.3