summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Memory.cpp28
-rw-r--r--lldb/source/Target/ModuleCache.cpp5
-rw-r--r--lldb/source/Target/Platform.cpp98
-rw-r--r--lldb/source/Target/Process.cpp680
-rw-r--r--lldb/source/Target/SectionLoadList.cpp12
-rw-r--r--lldb/source/Target/StackFrameList.cpp13
-rw-r--r--lldb/source/Target/StopInfo.cpp109
-rw-r--r--lldb/source/Target/Target.cpp146
-rw-r--r--lldb/source/Target/Thread.cpp192
-rw-r--r--lldb/source/Target/ThreadList.cpp55
-rw-r--r--lldb/source/Target/ThreadPlan.cpp3
-rw-r--r--lldb/source/Target/ThreadPlanBase.cpp40
-rw-r--r--lldb/source/Target/ThreadPlanCallFunction.cpp101
-rw-r--r--lldb/source/Target/ThreadPlanCallUserExpression.cpp5
-rw-r--r--lldb/source/Target/ThreadPlanPython.cpp30
-rw-r--r--lldb/source/Target/ThreadPlanRunToAddress.cpp3
-rw-r--r--lldb/source/Target/ThreadPlanShouldStopHere.cpp17
-rw-r--r--lldb/source/Target/ThreadPlanStepInRange.cpp47
-rw-r--r--lldb/source/Target/ThreadPlanStepInstruction.cpp24
-rw-r--r--lldb/source/Target/ThreadPlanStepOut.cpp4
-rw-r--r--lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp16
-rw-r--r--lldb/source/Target/ThreadPlanStepOverRange.cpp14
-rw-r--r--lldb/source/Target/ThreadPlanStepRange.cpp57
-rw-r--r--lldb/source/Target/ThreadPlanStepThrough.cpp16
-rw-r--r--lldb/source/Target/ThreadPlanStepUntil.cpp3
25 files changed, 806 insertions, 912 deletions
diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp
index 31a378069ce..7c77cc06eb0 100644
--- a/lldb/source/Target/Memory.cpp
+++ b/lldb/source/Target/Memory.cpp
@@ -348,10 +348,11 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions,
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
if (log) {
- log->Printf("Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32
- ", permissions = %s) => 0x%16.16" PRIx64,
- (uint32_t)page_byte_size, GetPermissionsAsCString(permissions),
- (uint64_t)addr);
+ LLDB_LOGF(log,
+ "Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32
+ ", permissions = %s) => 0x%16.16" PRIx64,
+ (uint32_t)page_byte_size, GetPermissionsAsCString(permissions),
+ (uint64_t)addr);
}
if (addr != LLDB_INVALID_ADDRESS) {
@@ -385,12 +386,11 @@ lldb::addr_t AllocatedMemoryCache::AllocateMemory(size_t byte_size,
addr = block_sp->ReserveBlock(byte_size);
}
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8" PRIx32
- ", permissions = %s) => 0x%16.16" PRIx64,
- (uint32_t)byte_size, GetPermissionsAsCString(permissions),
- (uint64_t)addr);
+ LLDB_LOGF(log,
+ "AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8" PRIx32
+ ", permissions = %s) => 0x%16.16" PRIx64,
+ (uint32_t)byte_size, GetPermissionsAsCString(permissions),
+ (uint64_t)addr);
return addr;
}
@@ -406,9 +406,9 @@ bool AllocatedMemoryCache::DeallocateMemory(lldb::addr_t addr) {
}
}
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64
- ") => %i",
- (uint64_t)addr, success);
+ LLDB_LOGF(log,
+ "AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64
+ ") => %i",
+ (uint64_t)addr, success);
return success;
}
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp
index 444c9806f98..cd3f211b81c 100644
--- a/lldb/source/Target/ModuleCache.cpp
+++ b/lldb/source/Target/ModuleCache.cpp
@@ -94,9 +94,8 @@ void DeleteExistingModule(const FileSpec &root_dir_spec,
Status error;
ModuleLock lock(root_dir_spec, module_uuid, error);
if (error.Fail()) {
- if (log)
- log->Printf("Failed to lock module %s: %s",
- module_uuid.GetAsString().c_str(), error.AsCString());
+ LLDB_LOGF(log, "Failed to lock module %s: %s",
+ module_uuid.GetAsString().c_str(), error.AsCString());
}
namespace fs = llvm::sys::fs;
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 710f82eaefa..3eb8ba62bd7 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -386,8 +386,7 @@ Platform::Platform(bool is_host)
m_calculated_trap_handlers(false),
m_module_cache(llvm::make_unique<ModuleCache>()) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
- if (log)
- log->Printf("%p Platform::Platform()", static_cast<void *>(this));
+ LLDB_LOGF(log, "%p Platform::Platform()", static_cast<void *>(this));
}
/// Destructor.
@@ -396,8 +395,7 @@ Platform::Platform(bool is_host)
/// inherited from by the plug-in instance.
Platform::~Platform() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
- if (log)
- log->Printf("%p Platform::~Platform()", static_cast<void *>(this));
+ LLDB_LOGF(log, "%p Platform::~Platform()", static_cast<void *>(this));
}
void Platform::GetStatus(Stream &strm) {
@@ -637,9 +635,8 @@ Status Platform::Install(const FileSpec &src, const FileSpec &dst) {
Status error;
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
- if (log)
- log->Printf("Platform::Install (src='%s', dst='%s')", src.GetPath().c_str(),
- dst.GetPath().c_str());
+ LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s')",
+ src.GetPath().c_str(), dst.GetPath().c_str());
FileSpec fixed_dst(dst);
if (!fixed_dst.GetFilename())
@@ -690,10 +687,9 @@ Status Platform::Install(const FileSpec &src, const FileSpec &dst) {
}
}
- if (log)
- log->Printf("Platform::Install (src='%s', dst='%s') fixed_dst='%s'",
- src.GetPath().c_str(), dst.GetPath().c_str(),
- fixed_dst.GetPath().c_str());
+ LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s') fixed_dst='%s'",
+ src.GetPath().c_str(), dst.GetPath().c_str(),
+ fixed_dst.GetPath().c_str());
if (GetSupportsRSync()) {
error = PutFile(src, dst);
@@ -821,9 +817,8 @@ ConstString Platform::GetFullNameForDylib(ConstString basename) {
bool Platform::SetRemoteWorkingDirectory(const FileSpec &working_dir) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
- if (log)
- log->Printf("Platform::SetRemoteWorkingDirectory('%s')",
- working_dir.GetCString());
+ LLDB_LOGF(log, "Platform::SetRemoteWorkingDirectory('%s')",
+ working_dir.GetCString());
m_working_dir = working_dir;
return true;
}
@@ -1010,8 +1005,7 @@ uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info,
Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) {
Status error;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
- if (log)
- log->Printf("Platform::%s()", __FUNCTION__);
+ LLDB_LOGF(log, "Platform::%s()", __FUNCTION__);
// Take care of the host case so that each subclass can just call this
// function to get the host functionality.
@@ -1027,10 +1021,10 @@ Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) {
if (log) {
const FileSpec &shell = launch_info.GetShell();
std::string shell_str = (shell) ? shell.GetPath() : "<null>";
- log->Printf(
- "Platform::%s GetResumeCountForLaunchInfo() returned %" PRIu32
- ", shell is '%s'",
- __FUNCTION__, num_resumes, shell_str.c_str());
+ LLDB_LOGF(log,
+ "Platform::%s GetResumeCountForLaunchInfo() returned %" PRIu32
+ ", shell is '%s'",
+ __FUNCTION__, num_resumes, shell_str.c_str());
}
if (!launch_info.ConvertArgumentsForLaunchingInShell(
@@ -1048,9 +1042,8 @@ Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) {
}
}
- if (log)
- log->Printf("Platform::%s final launch_info resume count: %" PRIu32,
- __FUNCTION__, launch_info.GetResumeCount());
+ LLDB_LOGF(log, "Platform::%s final launch_info resume count: %" PRIu32,
+ __FUNCTION__, launch_info.GetResumeCount());
error = Host::LaunchProcess(launch_info);
} else
@@ -1067,8 +1060,7 @@ Status Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
Status Platform::KillProcess(const lldb::pid_t pid) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
- if (log)
- log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
+ LLDB_LOGF(log, "Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
// Try to find a process plugin to handle this Kill request. If we can't,
// fall back to the default OS implementation.
@@ -1098,9 +1090,8 @@ Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
// new target, else use existing one
Status &error) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
- if (log)
- log->Printf("Platform::%s entered (target %p)", __FUNCTION__,
- static_cast<void *>(target));
+ LLDB_LOGF(log, "Platform::%s entered (target %p)", __FUNCTION__,
+ static_cast<void *>(target));
ProcessSP process_sp;
// Make sure we stop at the entry point
@@ -1124,10 +1115,10 @@ Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
// Give this ProcessLaunchInfo filter a chance to adjust the launch info.
error = (*filter_callback)(launch_info, target);
if (!error.Success()) {
- if (log)
- log->Printf("Platform::%s() StructuredDataPlugin launch "
- "filter failed.",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "Platform::%s() StructuredDataPlugin launch "
+ "filter failed.",
+ __FUNCTION__);
return process_sp;
}
}
@@ -1135,17 +1126,15 @@ Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
error = LaunchProcess(launch_info);
if (error.Success()) {
- if (log)
- log->Printf("Platform::%s LaunchProcess() call succeeded (pid=%" PRIu64
- ")",
- __FUNCTION__, launch_info.GetProcessID());
+ LLDB_LOGF(log,
+ "Platform::%s LaunchProcess() call succeeded (pid=%" PRIu64 ")",
+ __FUNCTION__, launch_info.GetProcessID());
if (launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID) {
ProcessAttachInfo attach_info(launch_info);
process_sp = Attach(attach_info, debugger, target, error);
if (process_sp) {
- if (log)
- log->Printf("Platform::%s Attach() succeeded, Process plugin: %s",
- __FUNCTION__, process_sp->GetPluginName().AsCString());
+ LLDB_LOGF(log, "Platform::%s Attach() succeeded, Process plugin: %s",
+ __FUNCTION__, process_sp->GetPluginName().AsCString());
launch_info.SetHijackListener(attach_info.GetHijackListener());
// Since we attached to the process, it will think it needs to detach
@@ -1163,20 +1152,18 @@ Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
process_sp->SetSTDIOFileDescriptor(pty_fd);
}
} else {
- if (log)
- log->Printf("Platform::%s Attach() failed: %s", __FUNCTION__,
- error.AsCString());
+ LLDB_LOGF(log, "Platform::%s Attach() failed: %s", __FUNCTION__,
+ error.AsCString());
}
} else {
- if (log)
- log->Printf("Platform::%s LaunchProcess() returned launch_info with "
- "invalid process id",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "Platform::%s LaunchProcess() returned launch_info with "
+ "invalid process id",
+ __FUNCTION__);
}
} else {
- if (log)
- log->Printf("Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
- error.AsCString());
+ LLDB_LOGF(log, "Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
+ error.AsCString());
}
return process_sp;
@@ -1231,8 +1218,7 @@ bool Platform::IsCompatibleArchitecture(const ArchSpec &arch,
Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
uint32_t uid, uint32_t gid) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
- if (log)
- log->Printf("[PutFile] Using block by block transfer....\n");
+ LLDB_LOGF(log, "[PutFile] Using block by block transfer....\n");
uint32_t source_open_options =
File::eOpenOptionRead | File::eOpenOptionCloseOnExec;
@@ -1253,8 +1239,7 @@ Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite |
File::eOpenOptionTruncate | File::eOpenOptionCloseOnExec,
permissions, error);
- if (log)
- log->Printf("dest_file = %" PRIu64 "\n", dest_file);
+ LLDB_LOGF(log, "dest_file = %" PRIu64 "\n", dest_file);
if (error.Fail())
return error;
@@ -1630,10 +1615,9 @@ bool Platform::GetCachedSharedModule(const ModuleSpec &module_spec,
if (error.Success())
return true;
- if (log)
- log->Printf("Platform::%s - module %s not found in local cache: %s",
- __FUNCTION__, module_spec.GetUUID().GetAsString().c_str(),
- error.AsCString());
+ LLDB_LOGF(log, "Platform::%s - module %s not found in local cache: %s",
+ __FUNCTION__, module_spec.GetUUID().GetAsString().c_str(),
+ error.AsCString());
return false;
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 6c634dba00c..88882628cdb 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -544,8 +544,7 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp,
CheckInWithManager();
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
- if (log)
- log->Printf("%p Process::Process()", static_cast<void *>(this));
+ LLDB_LOGF(log, "%p Process::Process()", static_cast<void *>(this));
if (!m_unix_signals_sp)
m_unix_signals_sp = std::make_shared<UnixSignals>();
@@ -593,8 +592,7 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp,
Process::~Process() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
- if (log)
- log->Printf("%p Process::~Process()", static_cast<void *>(this));
+ LLDB_LOGF(log, "%p Process::~Process()", static_cast<void *>(this));
StopPrivateStateThread();
// ThreadList::Clear() will try to acquire this process's mutex, so
@@ -781,10 +779,10 @@ StateType Process::WaitForProcessToStop(const Timeout<std::micro> &timeout,
if (!wait_always && StateIsStoppedState(state, true) &&
StateIsStoppedState(GetPrivateState(), true)) {
- if (log)
- log->Printf("Process::%s returning without waiting for events; process "
- "private and public states are already 'stopped'.",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "Process::%s returning without waiting for events; process "
+ "private and public states are already 'stopped'.",
+ __FUNCTION__);
// We need to toggle the run lock as this won't get done in
// SetPublicState() if the process is hijacked.
if (hijack_listener_sp && use_run_lock)
@@ -1073,19 +1071,17 @@ StateType Process::GetStateChangedEvents(EventSP &event_sp,
Event *Process::PeekAtStateChangedEvents() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::%s...", __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s...", __FUNCTION__);
Event *event_ptr;
event_ptr = m_listener_sp->PeekAtNextEventForBroadcasterWithType(
this, eBroadcastBitStateChanged);
if (log) {
if (event_ptr) {
- log->Printf(
- "Process::%s (event_ptr) => %s", __FUNCTION__,
- StateAsCString(ProcessEventData::GetStateFromEvent(event_ptr)));
+ LLDB_LOGF(log, "Process::%s (event_ptr) => %s", __FUNCTION__,
+ StateAsCString(ProcessEventData::GetStateFromEvent(event_ptr)));
} else {
- log->Printf("Process::%s no events found", __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s no events found", __FUNCTION__);
}
}
return event_ptr;
@@ -1149,17 +1145,14 @@ bool Process::SetExitStatus(int status, const char *cstr) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)",
- status, status, cstr ? "\"" : "", cstr ? cstr : "NULL",
- cstr ? "\"" : "");
+ LLDB_LOGF(
+ log, "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)",
+ status, status, cstr ? "\"" : "", cstr ? cstr : "NULL", cstr ? "\"" : "");
// We were already in the exited state
if (m_private_state.GetValue() == eStateExited) {
- if (log)
- log->Printf("Process::SetExitStatus () ignoring exit status because "
- "state was already set to eStateExited");
+ LLDB_LOGF(log, "Process::SetExitStatus () ignoring exit status because "
+ "state was already set to eStateExited");
return false;
}
@@ -1207,10 +1200,10 @@ bool Process::SetProcessExitStatus(
int exit_status // Exit value of process if signal is zero
) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::SetProcessExitStatus (pid=%" PRIu64
- ", exited=%i, signal=%i, exit_status=%i)\n",
- pid, exited, signo, exit_status);
+ LLDB_LOGF(log,
+ "Process::SetProcessExitStatus (pid=%" PRIu64
+ ", exited=%i, signal=%i, exit_status=%i)\n",
+ pid, exited, signo, exit_status);
if (exited) {
TargetSP target_sp(Debugger::FindTargetWithProcessID(pid));
@@ -1353,9 +1346,8 @@ StateType Process::GetState() {
void Process::SetPublicState(StateType new_state, bool restarted) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::SetPublicState (state = %s, restarted = %i)",
- StateAsCString(new_state), restarted);
+ LLDB_LOGF(log, "Process::SetPublicState (state = %s, restarted = %i)",
+ StateAsCString(new_state), restarted);
const StateType old_state = m_public_state.GetValue();
m_public_state.SetValue(new_state);
@@ -1364,19 +1356,17 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
// program to run.
if (!StateChangedIsExternallyHijacked()) {
if (new_state == eStateDetached) {
- if (log)
- log->Printf(
- "Process::SetPublicState (%s) -- unlocking run lock for detach",
- StateAsCString(new_state));
+ LLDB_LOGF(log,
+ "Process::SetPublicState (%s) -- unlocking run lock for detach",
+ StateAsCString(new_state));
m_public_run_lock.SetStopped();
} else {
const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
const bool new_state_is_stopped = StateIsStoppedState(new_state, false);
if ((old_state_is_stopped != new_state_is_stopped)) {
if (new_state_is_stopped && !restarted) {
- if (log)
- log->Printf("Process::SetPublicState (%s) -- unlocking run lock",
- StateAsCString(new_state));
+ LLDB_LOGF(log, "Process::SetPublicState (%s) -- unlocking run lock",
+ StateAsCString(new_state));
m_public_run_lock.SetStopped();
}
}
@@ -1387,12 +1377,10 @@ void Process::SetPublicState(StateType new_state, bool restarted) {
Status Process::Resume() {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::Resume -- locking run lock");
+ LLDB_LOGF(log, "Process::Resume -- locking run lock");
if (!m_public_run_lock.TrySetRunning()) {
Status error("Resume request failed - process still running.");
- if (log)
- log->Printf("Process::Resume: -- TrySetRunning failed, not resuming.");
+ LLDB_LOGF(log, "Process::Resume: -- TrySetRunning failed, not resuming.");
return error;
}
Status error = PrivateResume();
@@ -1408,12 +1396,10 @@ static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack";
Status Process::ResumeSynchronous(Stream *stream) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::ResumeSynchronous -- locking run lock");
+ LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock");
if (!m_public_run_lock.TrySetRunning()) {
Status error("Resume request failed - process still running.");
- if (log)
- log->Printf("Process::Resume: -- TrySetRunning failed, not resuming.");
+ LLDB_LOGF(log, "Process::Resume: -- TrySetRunning failed, not resuming.");
return error;
}
@@ -1472,8 +1458,7 @@ void Process::SetPrivateState(StateType new_state) {
LIBLLDB_LOG_PROCESS));
bool state_changed = false;
- if (log)
- log->Printf("Process::SetPrivateState (%s)", StateAsCString(new_state));
+ LLDB_LOGF(log, "Process::SetPrivateState (%s)", StateAsCString(new_state));
std::lock_guard<std::recursive_mutex> thread_guard(m_thread_list.GetMutex());
std::lock_guard<std::recursive_mutex> guard(m_private_state.GetMutex());
@@ -1512,9 +1497,8 @@ void Process::SetPrivateState(StateType new_state) {
if (!m_mod_id.IsLastResumeForUserExpression())
m_mod_id.SetStopEventForLastNaturalStopID(event_sp);
m_memory_cache.Clear();
- if (log)
- log->Printf("Process::SetPrivateState (%s) stop_id = %u",
- StateAsCString(new_state), m_mod_id.GetStopID());
+ LLDB_LOGF(log, "Process::SetPrivateState (%s) stop_id = %u",
+ StateAsCString(new_state), m_mod_id.GetStopID());
}
// Use our target to get a shared pointer to ourselves...
@@ -1523,10 +1507,9 @@ void Process::SetPrivateState(StateType new_state) {
else
m_private_state_broadcaster.BroadcastEvent(event_sp);
} else {
- if (log)
- log->Printf(
- "Process::SetPrivateState (%s) state didn't change. Ignoring...",
- StateAsCString(new_state));
+ LLDB_LOGF(log,
+ "Process::SetPrivateState (%s) state didn't change. Ignoring...",
+ StateAsCString(new_state));
}
}
@@ -1816,16 +1799,15 @@ Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) {
assert(bp_site != nullptr);
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
const addr_t bp_addr = bp_site->GetLoadAddress();
- if (log)
- log->Printf(
- "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64,
- bp_site->GetID(), (uint64_t)bp_addr);
+ LLDB_LOGF(
+ log, "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64,
+ bp_site->GetID(), (uint64_t)bp_addr);
if (bp_site->IsEnabled()) {
- if (log)
- log->Printf(
- "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
- " -- already enabled",
- bp_site->GetID(), (uint64_t)bp_addr);
+ LLDB_LOGF(
+ log,
+ "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
+ " -- already enabled",
+ bp_site->GetID(), (uint64_t)bp_addr);
return error;
}
@@ -1864,10 +1846,10 @@ Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) {
bp_opcode_size) == 0) {
bp_site->SetEnabled(true);
bp_site->SetType(BreakpointSite::eSoftware);
- if (log)
- log->Printf("Process::EnableSoftwareBreakpoint (site_id = %d) "
- "addr = 0x%" PRIx64 " -- SUCCESS",
- bp_site->GetID(), (uint64_t)bp_addr);
+ LLDB_LOGF(log,
+ "Process::EnableSoftwareBreakpoint (site_id = %d) "
+ "addr = 0x%" PRIx64 " -- SUCCESS",
+ bp_site->GetID(), (uint64_t)bp_addr);
} else
error.SetErrorString(
"failed to verify the breakpoint trap in memory.");
@@ -1880,7 +1862,8 @@ Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) {
error.SetErrorString("Unable to read memory at breakpoint address.");
}
if (log && error.Fail())
- log->Printf(
+ LLDB_LOGF(
+ log,
"Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
" -- FAILED: %s",
bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
@@ -1893,10 +1876,10 @@ Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
addr_t bp_addr = bp_site->GetLoadAddress();
lldb::user_id_t breakID = bp_site->GetID();
- if (log)
- log->Printf("Process::DisableSoftwareBreakpoint (breakID = %" PRIu64
- ") addr = 0x%" PRIx64,
- breakID, (uint64_t)bp_addr);
+ LLDB_LOGF(log,
+ "Process::DisableSoftwareBreakpoint (breakID = %" PRIu64
+ ") addr = 0x%" PRIx64,
+ breakID, (uint64_t)bp_addr);
if (bp_site->IsHardware()) {
error.SetErrorString("Breakpoint site is a hardware breakpoint.");
@@ -1943,10 +1926,10 @@ Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) {
break_op_size) == 0) {
// SUCCESS
bp_site->SetEnabled(false);
- if (log)
- log->Printf("Process::DisableSoftwareBreakpoint (site_id = %d) "
- "addr = 0x%" PRIx64 " -- SUCCESS",
- bp_site->GetID(), (uint64_t)bp_addr);
+ LLDB_LOGF(log,
+ "Process::DisableSoftwareBreakpoint (site_id = %d) "
+ "addr = 0x%" PRIx64 " -- SUCCESS",
+ bp_site->GetID(), (uint64_t)bp_addr);
return error;
} else {
if (break_op_found)
@@ -1961,19 +1944,19 @@ Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) {
"Unable to read memory that should contain the breakpoint trap.");
}
} else {
- if (log)
- log->Printf(
- "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
- " -- already disabled",
- bp_site->GetID(), (uint64_t)bp_addr);
+ LLDB_LOGF(
+ log,
+ "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
+ " -- already disabled",
+ bp_site->GetID(), (uint64_t)bp_addr);
return error;
}
- if (log)
- log->Printf(
- "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
- " -- FAILED: %s",
- bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
+ LLDB_LOGF(
+ log,
+ "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
+ " -- FAILED: %s",
+ bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
return error;
}
@@ -2371,13 +2354,13 @@ addr_t Process::AllocateMemory(size_t size, uint32_t permissions,
#else
addr_t allocated_addr = DoAllocateMemory(size, permissions, error);
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::AllocateMemory(size=%" PRIu64
- ", permissions=%s) => 0x%16.16" PRIx64
- " (m_stop_id = %u m_memory_id = %u)",
- (uint64_t)size, GetPermissionsAsCString(permissions),
- (uint64_t)allocated_addr, m_mod_id.GetStopID(),
- m_mod_id.GetMemoryID());
+ LLDB_LOGF(log,
+ "Process::AllocateMemory(size=%" PRIu64
+ ", permissions=%s) => 0x%16.16" PRIx64
+ " (m_stop_id = %u m_memory_id = %u)",
+ (uint64_t)size, GetPermissionsAsCString(permissions),
+ (uint64_t)allocated_addr, m_mod_id.GetStopID(),
+ m_mod_id.GetMemoryID());
return allocated_addr;
#endif
}
@@ -2403,16 +2386,16 @@ bool Process::CanJIT() {
if (err.Success()) {
m_can_jit = eCanJITYes;
- if (log)
- log->Printf("Process::%s pid %" PRIu64
- " allocation test passed, CanJIT () is true",
- __FUNCTION__, GetID());
+ LLDB_LOGF(log,
+ "Process::%s pid %" PRIu64
+ " allocation test passed, CanJIT () is true",
+ __FUNCTION__, GetID());
} else {
m_can_jit = eCanJITNo;
- if (log)
- log->Printf("Process::%s pid %" PRIu64
- " allocation test failed, CanJIT () is false: %s",
- __FUNCTION__, GetID(), err.AsCString());
+ LLDB_LOGF(log,
+ "Process::%s pid %" PRIu64
+ " allocation test failed, CanJIT () is false: %s",
+ __FUNCTION__, GetID(), err.AsCString());
}
DeallocateMemory(allocated_memory);
@@ -2441,11 +2424,11 @@ Status Process::DeallocateMemory(addr_t ptr) {
error = DoDeallocateMemory(ptr);
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::DeallocateMemory(addr=0x%16.16" PRIx64
- ") => err = %s (m_stop_id = %u, m_memory_id = %u)",
- ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
- m_mod_id.GetMemoryID());
+ LLDB_LOGF(log,
+ "Process::DeallocateMemory(addr=0x%16.16" PRIx64
+ ") => err = %s (m_stop_id = %u, m_memory_id = %u)",
+ ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
+ m_mod_id.GetMemoryID());
#endif
return error;
}
@@ -2455,8 +2438,9 @@ ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec,
size_t size_to_read) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
if (log) {
- log->Printf("Process::ReadModuleFromMemory reading %s binary from memory",
- file_spec.GetPath().c_str());
+ LLDB_LOGF(log,
+ "Process::ReadModuleFromMemory reading %s binary from memory",
+ file_spec.GetPath().c_str());
}
ModuleSP module_sp(new Module(file_spec, ArchSpec()));
if (module_sp) {
@@ -2691,9 +2675,8 @@ Status Process::LoadCore() {
if (!StateIsStoppedState(state, false)) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::Halt() failed to stop, state is: %s",
- StateAsCString(state));
+ LLDB_LOGF(log, "Process::Halt() failed to stop, state is: %s",
+ StateAsCString(state));
error.SetErrorString(
"Did not get stopped event after loading the core file.");
}
@@ -2728,10 +2711,10 @@ Process::AttachCompletionHandler::AttachCompletionHandler(Process *process,
uint32_t exec_count)
: NextEventAction(process), m_exec_count(exec_count) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "Process::AttachCompletionHandler::%s process=%p, exec_count=%" PRIu32,
- __FUNCTION__, static_cast<void *>(process), exec_count);
+ LLDB_LOGF(
+ log,
+ "Process::AttachCompletionHandler::%s process=%p, exec_count=%" PRIu32,
+ __FUNCTION__, static_cast<void *>(process), exec_count);
}
Process::NextEventAction::EventActionResult
@@ -2739,10 +2722,9 @@ Process::AttachCompletionHandler::PerformAction(lldb::EventSP &event_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
StateType state = ProcessEventData::GetStateFromEvent(event_sp.get());
- if (log)
- log->Printf(
- "Process::AttachCompletionHandler::%s called with state %s (%d)",
- __FUNCTION__, StateAsCString(state), static_cast<int>(state));
+ LLDB_LOGF(log,
+ "Process::AttachCompletionHandler::%s called with state %s (%d)",
+ __FUNCTION__, StateAsCString(state), static_cast<int>(state));
switch (state) {
case eStateAttaching:
@@ -2764,18 +2746,18 @@ Process::AttachCompletionHandler::PerformAction(lldb::EventSP &event_sp) {
if (m_exec_count > 0) {
--m_exec_count;
- if (log)
- log->Printf("Process::AttachCompletionHandler::%s state %s: reduced "
- "remaining exec count to %" PRIu32 ", requesting resume",
- __FUNCTION__, StateAsCString(state), m_exec_count);
+ LLDB_LOGF(log,
+ "Process::AttachCompletionHandler::%s state %s: reduced "
+ "remaining exec count to %" PRIu32 ", requesting resume",
+ __FUNCTION__, StateAsCString(state), m_exec_count);
RequestResume();
return eEventActionRetry;
} else {
- if (log)
- log->Printf("Process::AttachCompletionHandler::%s state %s: no more "
- "execs expected to start, continuing with attach",
- __FUNCTION__, StateAsCString(state));
+ LLDB_LOGF(log,
+ "Process::AttachCompletionHandler::%s state %s: no more "
+ "execs expected to start, continuing with attach",
+ __FUNCTION__, StateAsCString(state));
m_process->CompleteAttach();
return eEventActionSuccess;
@@ -2932,8 +2914,7 @@ Status Process::Attach(ProcessAttachInfo &attach_info) {
void Process::CompleteAttach() {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS |
LIBLLDB_LOG_TARGET));
- if (log)
- log->Printf("Process::%s()", __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s()", __FUNCTION__);
// Let the process subclass figure out at much as it can about the process
// before we go looking for a dynamic loader plug-in.
@@ -2944,9 +2925,10 @@ void Process::CompleteAttach() {
GetTarget().SetArchitecture(process_arch);
if (log) {
const char *triple_str = process_arch.GetTriple().getTriple().c_str();
- log->Printf("Process::%s replacing process architecture with DidAttach() "
- "architecture: %s",
- __FUNCTION__, triple_str ? triple_str : "<null>");
+ LLDB_LOGF(log,
+ "Process::%s replacing process architecture with DidAttach() "
+ "architecture: %s",
+ __FUNCTION__, triple_str ? triple_str : "<null>");
}
}
@@ -2965,11 +2947,11 @@ void Process::CompleteAttach() {
if (platform_sp) {
GetTarget().SetPlatform(platform_sp);
GetTarget().SetArchitecture(platform_arch);
- if (log)
- log->Printf("Process::%s switching platform to %s and architecture "
- "to %s based on info from attach",
- __FUNCTION__, platform_sp->GetName().AsCString(""),
- platform_arch.GetTriple().getTriple().c_str());
+ LLDB_LOGF(log,
+ "Process::%s switching platform to %s and architecture "
+ "to %s based on info from attach",
+ __FUNCTION__, platform_sp->GetName().AsCString(""),
+ platform_arch.GetTriple().getTriple().c_str());
}
} else if (!process_arch.IsValid()) {
ProcessInstanceInfo process_info;
@@ -2978,11 +2960,11 @@ void Process::CompleteAttach() {
if (process_arch.IsValid() &&
!GetTarget().GetArchitecture().IsExactMatch(process_arch)) {
GetTarget().SetArchitecture(process_arch);
- if (log)
- log->Printf("Process::%s switching architecture to %s based on info "
- "the platform retrieved for pid %" PRIu64,
- __FUNCTION__,
- process_arch.GetTriple().getTriple().c_str(), GetID());
+ LLDB_LOGF(log,
+ "Process::%s switching architecture to %s based on info "
+ "the platform retrieved for pid %" PRIu64,
+ __FUNCTION__, process_arch.GetTriple().getTriple().c_str(),
+ GetID());
}
}
}
@@ -2994,12 +2976,13 @@ void Process::CompleteAttach() {
dyld->DidAttach();
if (log) {
ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
- log->Printf("Process::%s after DynamicLoader::DidAttach(), target "
- "executable is %s (using %s plugin)",
- __FUNCTION__,
- exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
- : "<none>",
- dyld->GetPluginName().AsCString("<unnamed>"));
+ LLDB_LOGF(log,
+ "Process::%s after DynamicLoader::DidAttach(), target "
+ "executable is %s (using %s plugin)",
+ __FUNCTION__,
+ exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
+ : "<none>",
+ dyld->GetPluginName().AsCString("<unnamed>"));
}
}
@@ -3010,12 +2993,13 @@ void Process::CompleteAttach() {
system_runtime->DidAttach();
if (log) {
ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
- log->Printf("Process::%s after SystemRuntime::DidAttach(), target "
- "executable is %s (using %s plugin)",
- __FUNCTION__,
- exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
- : "<none>",
- system_runtime->GetPluginName().AsCString("<unnamed>"));
+ LLDB_LOGF(log,
+ "Process::%s after SystemRuntime::DidAttach(), target "
+ "executable is %s (using %s plugin)",
+ __FUNCTION__,
+ exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
+ : "<none>",
+ system_runtime->GetPluginName().AsCString("<unnamed>"));
}
}
@@ -3048,7 +3032,8 @@ void Process::CompleteAttach() {
eLoadDependentsNo);
if (log) {
ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
- log->Printf(
+ LLDB_LOGF(
+ log,
"Process::%s after looping through modules, target executable is %s",
__FUNCTION__,
exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
@@ -3092,11 +3077,11 @@ Status Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) {
Status Process::PrivateResume() {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS |
LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Process::PrivateResume() m_stop_id = %u, public state: %s "
- "private state: %s",
- m_mod_id.GetStopID(), StateAsCString(m_public_state.GetValue()),
- StateAsCString(m_private_state.GetValue()));
+ LLDB_LOGF(log,
+ "Process::PrivateResume() m_stop_id = %u, public state: %s "
+ "private state: %s",
+ m_mod_id.GetStopID(), StateAsCString(m_public_state.GetValue()),
+ StateAsCString(m_private_state.GetValue()));
// If signals handing status changed we might want to update our signal
// filters before resuming.
@@ -3123,12 +3108,9 @@ Status Process::PrivateResume() {
if (error.Success()) {
DidResume();
m_thread_list.DidResume();
- if (log)
- log->Printf("Process thinks the process has resumed.");
+ LLDB_LOGF(log, "Process thinks the process has resumed.");
} else {
- if (log)
- log->Printf(
- "Process::PrivateResume() DoResume failed.");
+ LLDB_LOGF(log, "Process::PrivateResume() DoResume failed.");
return error;
}
}
@@ -3137,16 +3119,15 @@ Status Process::PrivateResume() {
// from one frame of a set of inlined frames that share the same PC to
// another.) So generate a continue & a stopped event, and let the world
// handle them.
- if (log)
- log->Printf(
- "Process::PrivateResume() asked to simulate a start & stop.");
+ LLDB_LOGF(log,
+ "Process::PrivateResume() asked to simulate a start & stop.");
SetPrivateState(eStateRunning);
SetPrivateState(eStateStopped);
}
- } else if (log)
- log->Printf("Process::PrivateResume() got an error \"%s\".",
- error.AsCString("<unknown error>"));
+ } else
+ LLDB_LOGF(log, "Process::PrivateResume() got an error \"%s\".",
+ error.AsCString("<unknown error>"));
return error;
}
@@ -3199,8 +3180,7 @@ Status Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) {
if (m_public_state.GetValue() == eStateRunning ||
m_private_state.GetValue() == eStateRunning) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::%s() About to stop.", __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s() About to stop.", __FUNCTION__);
ListenerSP listener_sp(
Listener::MakeListener("lldb.Process.StopForDestroyOrDetach.hijack"));
@@ -3220,17 +3200,15 @@ Status Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) {
// anymore...
if (state == eStateExited || m_private_state.GetValue() == eStateExited) {
- if (log)
- log->Printf("Process::%s() Process exited while waiting to stop.",
- __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s() Process exited while waiting to stop.",
+ __FUNCTION__);
return error;
} else
exit_event_sp.reset(); // It is ok to consume any non-exit stop events
if (state != eStateStopped) {
- if (log)
- log->Printf("Process::%s() failed to stop, state is: %s", __FUNCTION__,
- StateAsCString(state));
+ LLDB_LOGF(log, "Process::%s() failed to stop, state is: %s", __FUNCTION__,
+ StateAsCString(state));
// If we really couldn't stop the process then we should just error out
// here, but if the lower levels just bobbled sending the event and we
// really are stopped, then continue on.
@@ -3475,10 +3453,10 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) {
m_stdio_communication.SynchronizeWithReadThread();
RefreshStateAfterStop();
if (ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
- if (log)
- log->Printf("Process::ShouldBroadcastEvent (%p) stopped due to an "
- "interrupt, state: %s",
- static_cast<void *>(event_ptr), StateAsCString(state));
+ LLDB_LOGF(log,
+ "Process::ShouldBroadcastEvent (%p) stopped due to an "
+ "interrupt, state: %s",
+ static_cast<void *>(event_ptr), StateAsCString(state));
// Even though we know we are going to stop, we should let the threads
// have a look at the stop, so they can properly set their state.
m_thread_list.ShouldStop(event_ptr);
@@ -3496,11 +3474,11 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) {
if (was_restarted || should_resume || m_resume_requested) {
Vote stop_vote = m_thread_list.ShouldReportStop(event_ptr);
- if (log)
- log->Printf("Process::ShouldBroadcastEvent: should_resume: %i state: "
- "%s was_restarted: %i stop_vote: %d.",
- should_resume, StateAsCString(state), was_restarted,
- stop_vote);
+ LLDB_LOGF(log,
+ "Process::ShouldBroadcastEvent: should_resume: %i state: "
+ "%s was_restarted: %i stop_vote: %d.",
+ should_resume, StateAsCString(state), was_restarted,
+ stop_vote);
switch (stop_vote) {
case eVoteYes:
@@ -3513,10 +3491,10 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) {
}
if (!was_restarted) {
- if (log)
- log->Printf("Process::ShouldBroadcastEvent (%p) Restarting process "
- "from state: %s",
- static_cast<void *>(event_ptr), StateAsCString(state));
+ LLDB_LOGF(log,
+ "Process::ShouldBroadcastEvent (%p) Restarting process "
+ "from state: %s",
+ static_cast<void *>(event_ptr), StateAsCString(state));
ProcessEventData::SetRestartedInEvent(event_ptr, true);
PrivateResume();
}
@@ -3543,12 +3521,12 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) {
if (return_value)
m_last_broadcast_state = state;
- if (log)
- log->Printf("Process::ShouldBroadcastEvent (%p) => new state: %s, last "
- "broadcast state: %s - %s",
- static_cast<void *>(event_ptr), StateAsCString(state),
- StateAsCString(m_last_broadcast_state),
- return_value ? "YES" : "NO");
+ LLDB_LOGF(log,
+ "Process::ShouldBroadcastEvent (%p) => new state: %s, last "
+ "broadcast state: %s - %s",
+ static_cast<void *>(event_ptr), StateAsCString(state),
+ StateAsCString(m_last_broadcast_state),
+ return_value ? "YES" : "NO");
return return_value;
}
@@ -3556,10 +3534,9 @@ bool Process::StartPrivateStateThread(bool is_secondary_thread) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
bool already_running = PrivateStateThreadIsValid();
- if (log)
- log->Printf("Process::%s()%s ", __FUNCTION__,
- already_running ? " already running"
- : " starting private state thread");
+ LLDB_LOGF(log, "Process::%s()%s ", __FUNCTION__,
+ already_running ? " already running"
+ : " starting private state thread");
if (!is_secondary_thread && already_running)
return true;
@@ -3617,9 +3594,9 @@ void Process::StopPrivateStateThread() {
ControlPrivateStateThread(eBroadcastInternalStateControlStop);
else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "Went to stop the private state thread, but it was already invalid.");
+ LLDB_LOGF(
+ log,
+ "Went to stop the private state thread, but it was already invalid.");
}
}
@@ -3630,8 +3607,7 @@ void Process::ControlPrivateStateThread(uint32_t signal) {
signal == eBroadcastInternalStateControlPause ||
signal == eBroadcastInternalStateControlResume);
- if (log)
- log->Printf("Process::%s (signal = %d)", __FUNCTION__, signal);
+ LLDB_LOGF(log, "Process::%s (signal = %d)", __FUNCTION__, signal);
// Signal the private state thread
if (m_private_state_thread.IsJoinable()) {
@@ -3640,8 +3616,7 @@ void Process::ControlPrivateStateThread(uint32_t signal) {
// possible that the thread state is invalid but that the thread is waiting
// on a control event instead of simply being on its way out (this should
// not happen, but it apparently can).
- if (log)
- log->Printf("Sending control event of type: %d.", signal);
+ LLDB_LOGF(log, "Sending control event of type: %d.", signal);
std::shared_ptr<EventDataReceipt> event_receipt_sp(new EventDataReceipt());
m_private_state_control_broadcaster.BroadcastEvent(signal,
event_receipt_sp);
@@ -3669,9 +3644,9 @@ void Process::ControlPrivateStateThread(uint32_t signal) {
m_private_state_thread.Reset();
}
} else {
- if (log)
- log->Printf(
- "Private state thread already dead, no need to signal it to stop.");
+ LLDB_LOGF(
+ log,
+ "Private state thread already dead, no need to signal it to stop.");
}
}
@@ -3694,8 +3669,7 @@ void Process::HandlePrivateEvent(EventSP &event_sp) {
if (m_next_event_action_up) {
NextEventAction::EventActionResult action_result =
m_next_event_action_up->PerformAction(event_sp);
- if (log)
- log->Printf("Ran next event action, result was %d.", action_result);
+ LLDB_LOGF(log, "Ran next event action, result was %d.", action_result);
switch (action_result) {
case NextEventAction::eEventActionSuccess:
@@ -3726,11 +3700,12 @@ void Process::HandlePrivateEvent(EventSP &event_sp) {
if (should_broadcast) {
const bool is_hijacked = IsHijackedForEvent(eBroadcastBitStateChanged);
if (log) {
- log->Printf("Process::%s (pid = %" PRIu64
- ") broadcasting new state %s (old state %s) to %s",
- __FUNCTION__, GetID(), StateAsCString(new_state),
- StateAsCString(GetState()),
- is_hijacked ? "hijacked" : "public");
+ LLDB_LOGF(log,
+ "Process::%s (pid = %" PRIu64
+ ") broadcasting new state %s (old state %s) to %s",
+ __FUNCTION__, GetID(), StateAsCString(new_state),
+ StateAsCString(GetState()),
+ is_hijacked ? "hijacked" : "public");
}
Process::ProcessEventData::SetUpdateStateOnRemoval(event_sp.get());
if (StateIsRunningState(new_state)) {
@@ -3742,9 +3717,8 @@ void Process::HandlePrivateEvent(EventSP &event_sp) {
PushProcessIOHandler();
m_iohandler_sync.SetValue(m_iohandler_sync.GetValue() + 1,
eBroadcastAlways);
- if (log)
- log->Printf("Process::%s updated m_iohandler_sync to %d",
- __FUNCTION__, m_iohandler_sync.GetValue());
+ LLDB_LOGF(log, "Process::%s updated m_iohandler_sync to %d",
+ __FUNCTION__, m_iohandler_sync.GetValue());
}
} else if (StateIsStoppedState(new_state, false)) {
if (!Process::ProcessEventData::GetRestartedFromEvent(event_sp.get())) {
@@ -3785,7 +3759,8 @@ void Process::HandlePrivateEvent(EventSP &event_sp) {
BroadcastEvent(event_sp);
} else {
if (log) {
- log->Printf(
+ LLDB_LOGF(
+ log,
"Process::%s (pid = %" PRIu64
") suppressing state %s (old state %s): should_broadcast == false",
__FUNCTION__, GetID(), StateAsCString(new_state),
@@ -3820,9 +3795,8 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
bool control_only = true;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...",
- __FUNCTION__, static_cast<void *>(this), GetID());
+ LLDB_LOGF(log, "Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...",
+ __FUNCTION__, static_cast<void *>(this), GetID());
bool exit_now = false;
bool interrupt_requested = false;
@@ -3830,11 +3804,11 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
EventSP event_sp;
GetEventsPrivate(event_sp, llvm::None, control_only);
if (event_sp->BroadcasterIs(&m_private_state_control_broadcaster)) {
- if (log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64
- ") got a control event: %d",
- __FUNCTION__, static_cast<void *>(this), GetID(),
- event_sp->GetType());
+ LLDB_LOGF(log,
+ "Process::%s (arg = %p, pid = %" PRIu64
+ ") got a control event: %d",
+ __FUNCTION__, static_cast<void *>(this), GetID(),
+ event_sp->GetType());
switch (event_sp->GetType()) {
case eBroadcastInternalStateControlStop:
@@ -3853,23 +3827,24 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
continue;
} else if (event_sp->GetType() == eBroadcastBitInterrupt) {
if (m_public_state.GetValue() == eStateAttaching) {
- if (log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64
- ") woke up with an interrupt while attaching - "
- "forwarding interrupt.",
- __FUNCTION__, static_cast<void *>(this), GetID());
+ LLDB_LOGF(log,
+ "Process::%s (arg = %p, pid = %" PRIu64
+ ") woke up with an interrupt while attaching - "
+ "forwarding interrupt.",
+ __FUNCTION__, static_cast<void *>(this), GetID());
BroadcastEvent(eBroadcastBitInterrupt, nullptr);
} else if (StateIsRunningState(m_last_broadcast_state)) {
- if (log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64
- ") woke up with an interrupt - Halting.",
- __FUNCTION__, static_cast<void *>(this), GetID());
+ LLDB_LOGF(log,
+ "Process::%s (arg = %p, pid = %" PRIu64
+ ") woke up with an interrupt - Halting.",
+ __FUNCTION__, static_cast<void *>(this), GetID());
Status error = HaltPrivate();
if (error.Fail() && log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64
- ") failed to halt the process: %s",
- __FUNCTION__, static_cast<void *>(this), GetID(),
- error.AsCString());
+ LLDB_LOGF(log,
+ "Process::%s (arg = %p, pid = %" PRIu64
+ ") failed to halt the process: %s",
+ __FUNCTION__, static_cast<void *>(this), GetID(),
+ error.AsCString());
// Halt should generate a stopped event. Make a note of the fact that
// we were doing the interrupt, so we can set the interrupted flag
// after we receive the event. We deliberately set this to true even if
@@ -3883,10 +3858,9 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
// request. We use m_last_broadcast_state, because the Stopped event
// may not have been popped of the event queue yet, which is when the
// public state gets updated.
- if (log)
- log->Printf(
- "Process::%s ignoring interrupt as we have already stopped.",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "Process::%s ignoring interrupt as we have already stopped.",
+ __FUNCTION__);
}
continue;
}
@@ -3908,9 +3882,10 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
ProcessEventData::SetInterruptedInEvent(event_sp.get(), true);
interrupt_requested = false;
} else if (log) {
- log->Printf("Process::%s interrupt_requested, but a non-stopped "
- "state '%s' received.",
- __FUNCTION__, StateAsCString(internal_state));
+ LLDB_LOGF(log,
+ "Process::%s interrupt_requested, but a non-stopped "
+ "state '%s' received.",
+ __FUNCTION__, StateAsCString(internal_state));
}
}
@@ -3919,20 +3894,19 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
if (internal_state == eStateInvalid || internal_state == eStateExited ||
internal_state == eStateDetached) {
- if (log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64
- ") about to exit with internal state %s...",
- __FUNCTION__, static_cast<void *>(this), GetID(),
- StateAsCString(internal_state));
+ LLDB_LOGF(log,
+ "Process::%s (arg = %p, pid = %" PRIu64
+ ") about to exit with internal state %s...",
+ __FUNCTION__, static_cast<void *>(this), GetID(),
+ StateAsCString(internal_state));
break;
}
}
// Verify log is still enabled before attempting to write to it...
- if (log)
- log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...",
- __FUNCTION__, static_cast<void *>(this), GetID());
+ LLDB_LOGF(log, "Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...",
+ __FUNCTION__, static_cast<void *>(this), GetID());
// If we are a secondary thread, then the primary thread we are working for
// will have already acquired the public_run_lock, and isn't done with what
@@ -4042,10 +4016,10 @@ void Process::ProcessEventData::DoOnRemoval(Event *event_ptr) {
if (curr_thread_list.GetSize() != num_threads) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP |
LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "Number of threads changed from %u to %u while processing event.",
- num_threads, curr_thread_list.GetSize());
+ LLDB_LOGF(
+ log,
+ "Number of threads changed from %u to %u while processing event.",
+ num_threads, curr_thread_list.GetSize());
break;
}
@@ -4054,10 +4028,10 @@ void Process::ProcessEventData::DoOnRemoval(Event *event_ptr) {
if (thread_sp->GetIndexID() != thread_index_array[idx]) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP |
LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("The thread at position %u changed from %u to %u while "
- "processing event.",
- idx, thread_index_array[idx], thread_sp->GetIndexID());
+ LLDB_LOGF(log,
+ "The thread at position %u changed from %u to %u while "
+ "processing event.",
+ idx, thread_index_array[idx], thread_sp->GetIndexID());
break;
}
@@ -4303,9 +4277,8 @@ size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Status &error) {
size_t bytes_available = one_profile_data.size();
if (bytes_available > 0) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::GetProfileData (buf = %p, size = %" PRIu64 ")",
- static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
+ LLDB_LOGF(log, "Process::GetProfileData (buf = %p, size = %" PRIu64 ")",
+ static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
if (bytes_available > buf_size) {
memcpy(buf, one_profile_data.c_str(), buf_size);
one_profile_data.erase(0, buf_size);
@@ -4325,9 +4298,8 @@ size_t Process::GetSTDOUT(char *buf, size_t buf_size, Status &error) {
size_t bytes_available = m_stdout_data.size();
if (bytes_available > 0) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")",
- static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
+ LLDB_LOGF(log, "Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")",
+ static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
if (bytes_available > buf_size) {
memcpy(buf, m_stdout_data.c_str(), buf_size);
m_stdout_data.erase(0, buf_size);
@@ -4345,9 +4317,8 @@ size_t Process::GetSTDERR(char *buf, size_t buf_size, Status &error) {
size_t bytes_available = m_stderr_data.size();
if (bytes_available > 0) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::GetSTDERR (buf = %p, size = %" PRIu64 ")",
- static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
+ LLDB_LOGF(log, "Process::GetSTDERR (buf = %p, size = %" PRIu64 ")",
+ static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
if (bytes_available > buf_size) {
memcpy(buf, m_stderr_data.c_str(), buf_size);
m_stderr_data.erase(0, buf_size);
@@ -4532,8 +4503,7 @@ bool Process::PushProcessIOHandler() {
IOHandlerSP io_handler_sp(m_process_input_reader);
if (io_handler_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::%s pushing IO handler", __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s pushing IO handler", __FUNCTION__);
io_handler_sp->SetIsDone(false);
// If we evaluate an utility function, then we don't cancel the current
@@ -4797,9 +4767,8 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
// public events. The simplest thing to do is to spin up a temporary thread
// to handle private state thread events while we are fielding public
// events here.
- if (log)
- log->Printf("Running thread plan on private state thread, spinning up "
- "another state thread to handle the events.");
+ LLDB_LOGF(log, "Running thread plan on private state thread, spinning up "
+ "another state thread to handle the events.");
backup_private_state_thread = m_private_state_thread;
@@ -4854,9 +4823,10 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
if (log) {
StreamString s;
thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
- log->Printf("Process::RunThreadPlan(): Resuming thread %u - 0x%4.4" PRIx64
- " to run thread plan \"%s\".",
- thread->GetIndexID(), thread->GetID(), s.GetData());
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): Resuming thread %u - 0x%4.4" PRIx64
+ " to run thread plan \"%s\".",
+ thread->GetIndexID(), thread->GetID(), s.GetData());
}
bool got_event;
@@ -4877,10 +4847,9 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
if (!options.GetStopOthers() || !options.GetTryAllThreads())
before_first_timeout = false;
- if (log)
- log->Printf("Stop others: %u, try all: %u, before_first: %u.\n",
- options.GetStopOthers(), options.GetTryAllThreads(),
- before_first_timeout);
+ LLDB_LOGF(log, "Stop others: %u, try all: %u, before_first: %u.\n",
+ options.GetStopOthers(), options.GetTryAllThreads(),
+ before_first_timeout);
// This isn't going to work if there are unfetched events on the queue. Are
// there cases where we might want to run the remaining events here, and
@@ -4919,10 +4888,10 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
// loop. The only exception is if we get two running events with no
// intervening stop, which can happen, we will just wait for then next
// stop event.
- if (log)
- log->Printf("Top of while loop: do_resume: %i handle_running_event: %i "
- "before_first_timeout: %i.",
- do_resume, handle_running_event, before_first_timeout);
+ LLDB_LOGF(log,
+ "Top of while loop: do_resume: %i handle_running_event: %i "
+ "before_first_timeout: %i.",
+ do_resume, handle_running_event, before_first_timeout);
if (do_resume || handle_running_event) {
// Do the initial resume and wait for the running event before going
@@ -4944,10 +4913,10 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
got_event =
listener_sp->GetEvent(event_sp, GetUtilityExpressionTimeout());
if (!got_event) {
- if (log)
- log->Printf("Process::RunThreadPlan(): didn't get any event after "
- "resume %" PRIu32 ", exiting.",
- num_resumes);
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): didn't get any event after "
+ "resume %" PRIu32 ", exiting.",
+ num_resumes);
diagnostic_manager.Printf(eDiagnosticSeverityError,
"didn't get any event after resume %" PRIu32
@@ -4966,13 +4935,13 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
if (stop_state == eStateStopped) {
restarted = Process::ProcessEventData::GetRestartedFromEvent(
event_sp.get());
- if (log)
- log->Printf(
- "Process::RunThreadPlan(): didn't get running event after "
- "resume %d, got %s instead (restarted: %i, do_resume: %i, "
- "handle_running_event: %i).",
- num_resumes, StateAsCString(stop_state), restarted, do_resume,
- handle_running_event);
+ LLDB_LOGF(
+ log,
+ "Process::RunThreadPlan(): didn't get running event after "
+ "resume %d, got %s instead (restarted: %i, do_resume: %i, "
+ "handle_running_event: %i).",
+ num_resumes, StateAsCString(stop_state), restarted, do_resume,
+ handle_running_event);
}
if (restarted) {
@@ -5015,12 +4984,13 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
if (log) {
if (timeout) {
auto now = system_clock::now();
- log->Printf("Process::RunThreadPlan(): about to wait - now is %s - "
- "endpoint is %s",
- llvm::to_string(now).c_str(),
- llvm::to_string(now + *timeout).c_str());
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): about to wait - now is %s - "
+ "endpoint is %s",
+ llvm::to_string(now).c_str(),
+ llvm::to_string(now + *timeout).c_str());
} else {
- log->Printf("Process::RunThreadPlan(): about to wait forever.");
+ LLDB_LOGF(log, "Process::RunThreadPlan(): about to wait forever.");
}
}
@@ -5044,17 +5014,15 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
return_value = eExpressionInterrupted;
diagnostic_manager.PutString(eDiagnosticSeverityRemark,
"execution halted by user interrupt.");
- if (log)
- log->Printf("Process::RunThreadPlan(): Got interrupted by "
- "eBroadcastBitInterrupted, exiting.");
+ LLDB_LOGF(log, "Process::RunThreadPlan(): Got interrupted by "
+ "eBroadcastBitInterrupted, exiting.");
break;
} else {
stop_state =
Process::ProcessEventData::GetStateFromEvent(event_sp.get());
- if (log)
- log->Printf(
- "Process::RunThreadPlan(): in while loop, got event: %s.",
- StateAsCString(stop_state));
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): in while loop, got event: %s.",
+ StateAsCString(stop_state));
switch (stop_state) {
case lldb::eStateStopped: {
@@ -5064,18 +5032,18 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
if (!thread_sp) {
// Ooh, our thread has vanished. Unlikely that this was
// successful execution...
- if (log)
- log->Printf("Process::RunThreadPlan(): execution completed "
- "but our thread (index-id=%u) has vanished.",
- thread_idx_id);
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): execution completed "
+ "but our thread (index-id=%u) has vanished.",
+ thread_idx_id);
return_value = eExpressionInterrupted;
} else if (Process::ProcessEventData::GetRestartedFromEvent(
event_sp.get())) {
// If we were restarted, we just need to go back up to fetch
// another event.
if (log) {
- log->Printf("Process::RunThreadPlan(): Got a stop and "
- "restart, so we'll continue waiting.");
+ LLDB_LOGF(log, "Process::RunThreadPlan(): Got a stop and "
+ "restart, so we'll continue waiting.");
}
keep_going = true;
do_resume = false;
@@ -5098,10 +5066,10 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
break;
default:
- if (log)
- log->Printf("Process::RunThreadPlan(): execution stopped with "
- "unexpected state: %s.",
- StateAsCString(stop_state));
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): execution stopped with "
+ "unexpected state: %s.",
+ StateAsCString(stop_state));
if (stop_state == eStateExited)
event_to_broadcast_sp = event_sp;
@@ -5162,8 +5130,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
while (try_halt_again < num_retries) {
Status halt_error;
if (do_halt) {
- if (log)
- log->Printf("Process::RunThreadPlan(): Running Halt.");
+ LLDB_LOGF(log, "Process::RunThreadPlan(): Running Halt.");
const bool clear_thread_plans = false;
const bool use_run_lock = false;
Halt(clear_thread_plans, use_run_lock);
@@ -5179,8 +5146,9 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
stop_state =
Process::ProcessEventData::GetStateFromEvent(event_sp.get());
if (log) {
- log->Printf("Process::RunThreadPlan(): Stopped with event: %s",
- StateAsCString(stop_state));
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): Stopped with event: %s",
+ StateAsCString(stop_state));
if (stop_state == lldb::eStateStopped &&
Process::ProcessEventData::GetInterruptedFromEvent(
event_sp.get()))
@@ -5379,24 +5347,25 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
} while (false);
if (event_explanation)
- log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s",
- s.GetData(), event_explanation);
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan(): execution interrupted: %s %s",
+ s.GetData(), event_explanation);
else
- log->Printf("Process::RunThreadPlan(): execution interrupted: %s",
- s.GetData());
+ LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
+ s.GetData());
}
if (should_unwind) {
- if (log)
- log->Printf("Process::RunThreadPlan: ExecutionInterrupted - "
- "discarding thread plans up to %p.",
- static_cast<void *>(thread_plan_sp.get()));
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan: ExecutionInterrupted - "
+ "discarding thread plans up to %p.",
+ static_cast<void *>(thread_plan_sp.get()));
thread->DiscardThreadPlansUpToPlan(thread_plan_sp);
} else {
- if (log)
- log->Printf("Process::RunThreadPlan: ExecutionInterrupted - for "
- "plan: %p not discarding.",
- static_cast<void *>(thread_plan_sp.get()));
+ LLDB_LOGF(log,
+ "Process::RunThreadPlan: ExecutionInterrupted - for "
+ "plan: %p not discarding.",
+ static_cast<void *>(thread_plan_sp.get()));
}
} else if (return_value == eExpressionSetupError) {
if (log)
@@ -5559,9 +5528,8 @@ size_t Process::GetThreadStatus(Stream &strm,
++num_thread_infos_dumped;
} else {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::GetThreadStatus - thread 0x" PRIu64
- " vanished while running Thread::GetStatus.");
+ LLDB_LOGF(log, "Process::GetThreadStatus - thread 0x" PRIu64
+ " vanished while running Thread::GetStatus.");
}
}
return num_thread_infos_dumped;
@@ -5622,8 +5590,7 @@ void Process::Flush() {
void Process::DidExec() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("Process::%s()", __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s()", __FUNCTION__);
Target &target = GetTarget();
target.CleanupProcess();
@@ -5929,19 +5896,18 @@ void Process::MapSupportedStructuredDataPlugins(
// Bail out early if there are no type names to map.
if (supported_type_names.GetSize() == 0) {
- if (log)
- log->Printf("Process::%s(): no structured data types supported",
- __FUNCTION__);
+ LLDB_LOGF(log, "Process::%s(): no structured data types supported",
+ __FUNCTION__);
return;
}
// Convert StructuredData type names to ConstString instances.
std::set<ConstString> const_type_names;
- if (log)
- log->Printf("Process::%s(): the process supports the following async "
- "structured data types:",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "Process::%s(): the process supports the following async "
+ "structured data types:",
+ __FUNCTION__);
supported_type_names.ForEach(
[&const_type_names, &log](StructuredData::Object *object) {
@@ -5988,11 +5954,11 @@ void Process::MapSupportedStructuredDataPlugins(
m_structured_data_plugin_map.insert(
std::make_pair(type_name, plugin_sp));
names_to_remove.push_back(type_name);
- if (log)
- log->Printf("Process::%s(): using plugin %s for type name "
- "%s",
- __FUNCTION__, plugin_sp->GetPluginName().GetCString(),
- type_name.GetCString());
+ LLDB_LOGF(log,
+ "Process::%s(): using plugin %s for type name "
+ "%s",
+ __FUNCTION__, plugin_sp->GetPluginName().GetCString(),
+ type_name.GetCString());
}
}
diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp
index 598f49ca13d..f2546a89319 100644
--- a/lldb/source/Target/SectionLoadList.cpp
+++ b/lldb/source/Target/SectionLoadList.cpp
@@ -121,7 +121,8 @@ bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP &section,
} else {
if (log) {
- log->Printf(
+ LLDB_LOGF(
+ log,
"SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64
") error: module has been deleted",
__FUNCTION__, static_cast<void *>(section.get()),
@@ -145,9 +146,9 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp) {
section_sp->GetModule()->GetFileSpec());
module_name = module_file_spec.GetPath();
}
- log->Printf("SectionLoadList::%s (section = %p (%s.%s))", __FUNCTION__,
- static_cast<void *>(section_sp.get()), module_name.c_str(),
- section_sp->GetName().AsCString());
+ LLDB_LOGF(log, "SectionLoadList::%s (section = %p (%s.%s))", __FUNCTION__,
+ static_cast<void *>(section_sp.get()), module_name.c_str(),
+ section_sp->GetName().AsCString());
}
std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -179,7 +180,8 @@ bool SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp,
const FileSpec &module_file_spec(section_sp->GetModule()->GetFileSpec());
module_name = module_file_spec.GetPath();
}
- log->Printf(
+ LLDB_LOGF(
+ log,
"SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64
")",
__FUNCTION__, static_cast<void *>(section_sp.get()),
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index 5492dda4640..0723ed0b5a2 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -67,7 +67,8 @@ uint32_t StackFrameList::GetCurrentInlinedDepth() {
m_current_inlined_depth = UINT32_MAX;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
- log->Printf(
+ LLDB_LOGF(
+ log,
"GetCurrentInlinedDepth: invalidating current inlined depth.\n");
}
return m_current_inlined_depth;
@@ -90,7 +91,8 @@ void StackFrameList::ResetCurrentInlinedDepth() {
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
- log->Printf(
+ LLDB_LOGF(
+ log,
"ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
return;
}
@@ -184,9 +186,10 @@ void StackFrameList::ResetCurrentInlinedDepth() {
m_current_inlined_depth = num_inlined_functions + 1;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
- log->Printf("ResetCurrentInlinedDepth: setting inlined "
- "depth: %d 0x%" PRIx64 ".\n",
- m_current_inlined_depth, curr_pc);
+ LLDB_LOGF(log,
+ "ResetCurrentInlinedDepth: setting inlined "
+ "depth: %d 0x%" PRIx64 ".\n",
+ m_current_inlined_depth, curr_pc);
break;
}
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 6db0c2b037e..4b048a3ef4f 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -147,10 +147,10 @@ public:
} else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "Process::%s could not find breakpoint site id: %" PRId64 "...",
- __FUNCTION__, m_value);
+ LLDB_LOGF(log,
+ "Process::%s could not find breakpoint site id: %" PRId64
+ "...",
+ __FUNCTION__, m_value);
m_should_stop = true;
}
@@ -270,7 +270,7 @@ protected:
if (!thread_sp->IsValid()) {
// This shouldn't ever happen, but just in case, don't do more harm.
if (log) {
- log->Printf("PerformAction got called with an invalid thread.");
+ LLDB_LOGF(log, "PerformAction got called with an invalid thread.");
}
m_should_stop = true;
m_should_stop_is_valid = true;
@@ -339,10 +339,9 @@ protected:
return;
}
- if (log)
- log->Printf("StopInfoBreakpoint::PerformAction - Hit a "
- "breakpoint while running an expression,"
- " not running commands to avoid recursion.");
+ LLDB_LOGF(log, "StopInfoBreakpoint::PerformAction - Hit a "
+ "breakpoint while running an expression,"
+ " not running commands to avoid recursion.");
bool ignoring_breakpoints =
process->GetIgnoreBreakpointsInExpressions();
if (ignoring_breakpoints) {
@@ -359,10 +358,10 @@ protected:
} else {
m_should_stop = true;
}
- if (log)
- log->Printf("StopInfoBreakpoint::PerformAction - in expression, "
- "continuing: %s.",
- m_should_stop ? "true" : "false");
+ LLDB_LOGF(log,
+ "StopInfoBreakpoint::PerformAction - in expression, "
+ "continuing: %s.",
+ m_should_stop ? "true" : "false");
process->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
"Warning: hit breakpoint while running function, skipping "
"commands and conditions to prevent recursion.\n");
@@ -402,10 +401,11 @@ protected:
// aren't:
if (!bp_loc_sp->ValidForThisThread(thread_sp.get())) {
if (log) {
- log->Printf("Breakpoint %s hit on thread 0x%llx but it was not "
- "for this thread, continuing.",
- loc_desc.GetData(), static_cast<unsigned long long>(
- thread_sp->GetID()));
+ LLDB_LOGF(log,
+ "Breakpoint %s hit on thread 0x%llx but it was not "
+ "for this thread, continuing.",
+ loc_desc.GetData(),
+ static_cast<unsigned long long>(thread_sp->GetID()));
}
continue;
}
@@ -445,21 +445,18 @@ protected:
error_sp->EOL();
const char *err_str =
condition_error.AsCString("<Unknown Error>");
- if (log)
- log->Printf("Error evaluating condition: \"%s\"\n", err_str);
+ LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
error_sp->PutCString(err_str);
error_sp->EOL();
error_sp->Flush();
} else {
- if (log) {
- log->Printf("Condition evaluated for breakpoint %s on thread "
- "0x%llx conditon_says_stop: %i.",
- loc_desc.GetData(),
- static_cast<unsigned long long>(
- thread_sp->GetID()),
- condition_says_stop);
- }
+ LLDB_LOGF(log,
+ "Condition evaluated for breakpoint %s on thread "
+ "0x%llx conditon_says_stop: %i.",
+ loc_desc.GetData(),
+ static_cast<unsigned long long>(thread_sp->GetID()),
+ condition_says_stop);
if (!condition_says_stop) {
// We don't want to increment the hit count of breakpoints if
// the condition fails. We've already bumped it by the time
@@ -479,9 +476,9 @@ protected:
bool auto_continue_says_stop = true;
if (bp_loc_sp->IsAutoContinue())
{
- if (log)
- log->Printf("Continuing breakpoint %s as AutoContinue was set.",
- loc_desc.GetData());
+ LLDB_LOGF(log,
+ "Continuing breakpoint %s as AutoContinue was set.",
+ loc_desc.GetData());
// We want this stop reported, so you will know we auto-continued
// but only for external breakpoints:
if (!internal_breakpoint)
@@ -533,10 +530,10 @@ protected:
Log *log_process(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log_process)
- log_process->Printf(
- "Process::%s could not find breakpoint site id: %" PRId64 "...",
- __FUNCTION__, m_value);
+ LLDB_LOGF(log_process,
+ "Process::%s could not find breakpoint site id: %" PRId64
+ "...",
+ __FUNCTION__, m_value);
}
if ((!m_should_stop || internal_breakpoint) &&
@@ -552,9 +549,9 @@ protected:
thread_sp->ResetStopInfo();
}
- if (log)
- log->Printf("Process::%s returning from action with m_should_stop: %d.",
- __FUNCTION__, m_should_stop);
+ LLDB_LOGF(log,
+ "Process::%s returning from action with m_should_stop: %d.",
+ __FUNCTION__, m_should_stop);
}
}
@@ -664,11 +661,10 @@ protected:
} else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf(
- "Process::%s could not find watchpoint location id: %" PRId64
- "...",
- __FUNCTION__, GetValue());
+ LLDB_LOGF(log,
+ "Process::%s could not find watchpoint location id: %" PRId64
+ "...",
+ __FUNCTION__, GetValue());
m_should_stop = true;
}
@@ -817,15 +813,14 @@ protected:
m_should_stop = false;
} else
m_should_stop = true;
- if (log)
- log->Printf(
- "Condition successfully evaluated, result is %s.\n",
- m_should_stop ? "true" : "false");
+ LLDB_LOGF(log,
+ "Condition successfully evaluated, result is %s.\n",
+ m_should_stop ? "true" : "false");
} else {
m_should_stop = true;
- if (log)
- log->Printf(
- "Failed to get an integer result from the expression.");
+ LLDB_LOGF(
+ log,
+ "Failed to get an integer result from the expression.");
}
}
} else {
@@ -836,8 +831,7 @@ protected:
error_sp->Printf(": \"%s\"", wp_sp->GetConditionText());
error_sp->EOL();
const char *err_str = error.AsCString("<Unknown Error>");
- if (log)
- log->Printf("Error evaluating condition: \"%s\"\n", err_str);
+ LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
error_sp->PutCString(err_str);
error_sp->EOL();
@@ -889,14 +883,13 @@ protected:
Log *log_process(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log_process)
- log_process->Printf(
- "Process::%s could not find watchpoint id: %" PRId64 "...",
- __FUNCTION__, m_value);
+ LLDB_LOGF(log_process,
+ "Process::%s could not find watchpoint id: %" PRId64 "...",
+ __FUNCTION__, m_value);
}
- if (log)
- log->Printf("Process::%s returning from action with m_should_stop: %d.",
- __FUNCTION__, m_should_stop);
+ LLDB_LOGF(log,
+ "Process::%s returning from action with m_should_stop: %d.",
+ __FUNCTION__, m_should_stop);
m_should_stop_is_valid = true;
}
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index ee48f2b6b3e..2bdfc3029cd 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -643,8 +643,8 @@ void Target::AddBreakpoint(lldb::BreakpointSP bp_sp, bool internal) {
if (log) {
StreamString s;
bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
- log->Printf("Target::%s (internal = %s) => break_id = %s\n", __FUNCTION__,
- bp_sp->IsInternal() ? "yes" : "no", s.GetData());
+ LLDB_LOGF(log, "Target::%s (internal = %s) => break_id = %s\n",
+ __FUNCTION__, bp_sp->IsInternal() ? "yes" : "no", s.GetData());
}
bp_sp->ResolveBreakpoint();
@@ -776,10 +776,10 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
const CompilerType *type, uint32_t kind,
Status &error) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64
- " type = %u)\n",
- __FUNCTION__, addr, (uint64_t)size, kind);
+ LLDB_LOGF(log,
+ "Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64
+ " type = %u)\n",
+ __FUNCTION__, addr, (uint64_t)size, kind);
WatchpointSP wp_sp;
if (!ProcessIsValid()) {
@@ -834,10 +834,9 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
}
error = m_process_sp->EnableWatchpoint(wp_sp.get(), notify);
- if (log)
- log->Printf("Target::%s (creation of watchpoint %s with id = %u)\n",
- __FUNCTION__, error.Success() ? "succeeded" : "failed",
- wp_sp->GetID());
+ LLDB_LOGF(log, "Target::%s (creation of watchpoint %s with id = %u)\n",
+ __FUNCTION__, error.Success() ? "succeeded" : "failed",
+ wp_sp->GetID());
if (error.Fail()) {
// Enabling the watchpoint on the device side failed. Remove the said
@@ -856,8 +855,7 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size,
void Target::RemoveAllowedBreakpoints() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s \n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s \n", __FUNCTION__);
m_breakpoint_list.RemoveAllowed(true);
@@ -866,9 +864,8 @@ void Target::RemoveAllowedBreakpoints() {
void Target::RemoveAllBreakpoints(bool internal_also) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s (internal_also = %s)\n", __FUNCTION__,
- internal_also ? "yes" : "no");
+ LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__,
+ internal_also ? "yes" : "no");
m_breakpoint_list.RemoveAll(true);
if (internal_also)
@@ -879,9 +876,8 @@ void Target::RemoveAllBreakpoints(bool internal_also) {
void Target::DisableAllBreakpoints(bool internal_also) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s (internal_also = %s)\n", __FUNCTION__,
- internal_also ? "yes" : "no");
+ LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__,
+ internal_also ? "yes" : "no");
m_breakpoint_list.SetEnabledAll(false);
if (internal_also)
@@ -890,17 +886,15 @@ void Target::DisableAllBreakpoints(bool internal_also) {
void Target::DisableAllowedBreakpoints() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s", __FUNCTION__);
m_breakpoint_list.SetEnabledAllowed(false);
}
void Target::EnableAllBreakpoints(bool internal_also) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s (internal_also = %s)\n", __FUNCTION__,
- internal_also ? "yes" : "no");
+ LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__,
+ internal_also ? "yes" : "no");
m_breakpoint_list.SetEnabledAll(true);
if (internal_also)
@@ -909,17 +903,15 @@ void Target::EnableAllBreakpoints(bool internal_also) {
void Target::EnableAllowedBreakpoints() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s", __FUNCTION__);
m_breakpoint_list.SetEnabledAllowed(true);
}
bool Target::RemoveBreakpointByID(break_id_t break_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
- break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
+ LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
+ break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
if (DisableBreakpointByID(break_id)) {
if (LLDB_BREAK_ID_IS_INTERNAL(break_id))
@@ -938,9 +930,8 @@ bool Target::RemoveBreakpointByID(break_id_t break_id) {
bool Target::DisableBreakpointByID(break_id_t break_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
- break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
+ LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
+ break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
BreakpointSP bp_sp;
@@ -957,9 +948,8 @@ bool Target::DisableBreakpointByID(break_id_t break_id) {
bool Target::EnableBreakpointByID(break_id_t break_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
- break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
+ LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
+ break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
BreakpointSP bp_sp;
@@ -1137,8 +1127,7 @@ Status Target::CreateBreakpointsFromFile(const FileSpec &file,
// to end operations.
bool Target::RemoveAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s\n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
if (!end_to_end) {
m_watchpoint_list.RemoveAll(true);
@@ -1169,8 +1158,7 @@ bool Target::RemoveAllWatchpoints(bool end_to_end) {
// to end operations.
bool Target::DisableAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s\n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
if (!end_to_end) {
m_watchpoint_list.SetEnabledAll(false);
@@ -1199,8 +1187,7 @@ bool Target::DisableAllWatchpoints(bool end_to_end) {
// to end operations.
bool Target::EnableAllWatchpoints(bool end_to_end) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s\n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
if (!end_to_end) {
m_watchpoint_list.SetEnabledAll(true);
@@ -1228,8 +1215,7 @@ bool Target::EnableAllWatchpoints(bool end_to_end) {
// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
bool Target::ClearAllWatchpointHitCounts() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s\n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
size_t num_watchpoints = m_watchpoint_list.GetSize();
for (size_t i = 0; i < num_watchpoints; ++i) {
@@ -1245,8 +1231,7 @@ bool Target::ClearAllWatchpointHitCounts() {
// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
bool Target::ClearAllWatchpointHistoricValues() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s\n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
size_t num_watchpoints = m_watchpoint_list.GetSize();
for (size_t i = 0; i < num_watchpoints; ++i) {
@@ -1263,8 +1248,7 @@ bool Target::ClearAllWatchpointHistoricValues() {
// these operations.
bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s\n", __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
if (!ProcessIsValid())
return false;
@@ -1283,8 +1267,7 @@ bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) {
// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+ LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
if (!ProcessIsValid())
return false;
@@ -1303,8 +1286,7 @@ bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) {
// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+ LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
if (!ProcessIsValid())
return false;
@@ -1323,8 +1305,7 @@ bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) {
// Assumption: Caller holds the list mutex lock for m_watchpoint_list.
bool Target::RemoveWatchpointByID(lldb::watch_id_t watch_id) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+ LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
WatchpointSP watch_to_remove_sp = m_watchpoint_list.FindByID(watch_id);
if (watch_to_remove_sp == m_last_created_watchpoint)
@@ -1341,8 +1322,7 @@ bool Target::RemoveWatchpointByID(lldb::watch_id_t watch_id) {
bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id,
uint32_t ignore_count) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
- if (log)
- log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+ LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
if (!ProcessIsValid())
return false;
@@ -1533,10 +1513,9 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform) {
// If we have an executable file, try to reset the executable to the desired
// architecture
- if (log)
- log->Printf("Target::SetArchitecture changing architecture to %s (%s)",
- arch_spec.GetArchitectureName(),
- arch_spec.GetTriple().getTriple().c_str());
+ LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)",
+ arch_spec.GetArchitectureName(),
+ arch_spec.GetTriple().getTriple().c_str());
m_arch = other;
ModuleSP executable_sp = GetExecutableModule();
@@ -1544,11 +1523,11 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform) {
// Need to do something about unsetting breakpoints.
if (executable_sp) {
- if (log)
- log->Printf("Target::SetArchitecture Trying to select executable file "
- "architecture %s (%s)",
- arch_spec.GetArchitectureName(),
- arch_spec.GetTriple().getTriple().c_str());
+ LLDB_LOGF(log,
+ "Target::SetArchitecture Trying to select executable file "
+ "architecture %s (%s)",
+ arch_spec.GetArchitectureName(),
+ arch_spec.GetTriple().getTriple().c_str());
ModuleSpec module_spec(executable_sp->GetFileSpec(), other);
FileSpecList search_paths = GetExecutableSearchPaths();
Status error = ModuleList::GetSharedModule(module_spec, executable_sp,
@@ -1569,12 +1548,11 @@ bool Target::MergeArchitecture(const ArchSpec &arch_spec) {
// The current target arch is compatible with "arch_spec", see if we can
// improve our current architecture using bits from "arch_spec"
- if (log)
- log->Printf(
- "Target::MergeArchitecture target has arch %s, merging with "
- "arch %s",
- m_arch.GetSpec().GetTriple().getTriple().c_str(),
- arch_spec.GetTriple().getTriple().c_str());
+ LLDB_LOGF(log,
+ "Target::MergeArchitecture target has arch %s, merging with "
+ "arch %s",
+ m_arch.GetSpec().GetTriple().getTriple().c_str(),
+ arch_spec.GetTriple().getTriple().c_str());
// Merge bits from arch_spec into "merged_arch" and set our architecture
ArchSpec merged_arch(m_arch.GetSpec());
@@ -2835,9 +2813,8 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) {
Status error;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET));
- if (log)
- log->Printf("Target::%s() called for %s", __FUNCTION__,
- launch_info.GetExecutableFile().GetPath().c_str());
+ LLDB_LOGF(log, "Target::%s() called for %s", __FUNCTION__,
+ launch_info.GetExecutableFile().GetPath().c_str());
StateType state = eStateInvalid;
@@ -2849,14 +2826,12 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) {
if (process_sp) {
state = process_sp->GetState();
- if (log)
- log->Printf(
- "Target::%s the process exists, and its current state is %s",
- __FUNCTION__, StateAsCString(state));
+ LLDB_LOGF(log,
+ "Target::%s the process exists, and its current state is %s",
+ __FUNCTION__, StateAsCString(state));
} else {
- if (log)
- log->Printf("Target::%s the process instance doesn't currently exist.",
- __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s the process instance doesn't currently exist.",
+ __FUNCTION__);
}
}
@@ -2888,9 +2863,8 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) {
// that can launch a process for debugging, go ahead and do that here.
if (state != eStateConnected && platform_sp &&
platform_sp->CanDebugProcess()) {
- if (log)
- log->Printf("Target::%s asking the platform to debug the process",
- __FUNCTION__);
+ LLDB_LOGF(log, "Target::%s asking the platform to debug the process",
+ __FUNCTION__);
// If there was a previous process, delete it before we make the new one.
// One subtle point, we delete the process before we release the reference
@@ -2902,10 +2876,10 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) {
GetPlatform()->DebugProcess(launch_info, debugger, this, error);
} else {
- if (log)
- log->Printf("Target::%s the platform doesn't know how to debug a "
- "process, getting a process plugin to do this for us.",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "Target::%s the platform doesn't know how to debug a "
+ "process, getting a process plugin to do this for us.",
+ __FUNCTION__);
if (state == eStateConnected) {
assert(m_process_sp);
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 7a6b49e5525..707559f9c5a 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -256,9 +256,8 @@ Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id)
m_override_should_notify(eLazyBoolCalculate),
m_extended_info_fetched(false), m_extended_info() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
- if (log)
- log->Printf("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
- static_cast<void *>(this), GetID());
+ LLDB_LOGF(log, "%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
+ static_cast<void *>(this), GetID());
CheckInWithManager();
@@ -267,9 +266,8 @@ Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id)
Thread::~Thread() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
- if (log)
- log->Printf("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
- static_cast<void *>(this), GetID());
+ LLDB_LOGF(log, "%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
+ static_cast<void *>(this), GetID());
/// If you hit this assert, it means your derived class forgot to call
/// DoDestroy in its destructor.
assert(m_destroy_called);
@@ -490,11 +488,10 @@ void Thread::SetStopInfo(const lldb::StopInfoSP &stop_info_sp) {
else
m_stop_info_stop_id = UINT32_MAX;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
- static_cast<void *>(this), GetID(),
- stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
- m_stop_info_stop_id);
+ LLDB_LOGF(log, "%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
+ static_cast<void *>(this), GetID(),
+ stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
+ m_stop_info_stop_id);
}
void Thread::SetShouldReportStop(Vote vote) {
@@ -721,18 +718,18 @@ bool Thread::ShouldStop(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (GetResumeState() == eStateSuspended) {
- if (log)
- log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
- ", should_stop = 0 (ignore since thread was suspended)",
- __FUNCTION__, GetID(), GetProtocolID());
+ LLDB_LOGF(log,
+ "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+ ", should_stop = 0 (ignore since thread was suspended)",
+ __FUNCTION__, GetID(), GetProtocolID());
return false;
}
if (GetTemporaryResumeState() == eStateSuspended) {
- if (log)
- log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
- ", should_stop = 0 (ignore since thread was suspended)",
- __FUNCTION__, GetID(), GetProtocolID());
+ LLDB_LOGF(log,
+ "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+ ", should_stop = 0 (ignore since thread was suspended)",
+ __FUNCTION__, GetID(), GetProtocolID());
return false;
}
@@ -740,28 +737,28 @@ bool Thread::ShouldStop(Event *event_ptr) {
// thread caused the process to stop. NOTE: this must take place before the
// plan is moved from the current plan stack to the completed plan stack.
if (!ThreadStoppedForAReason()) {
- if (log)
- log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
- ", pc = 0x%16.16" PRIx64
- ", should_stop = 0 (ignore since no stop reason)",
- __FUNCTION__, GetID(), GetProtocolID(),
- GetRegisterContext() ? GetRegisterContext()->GetPC()
- : LLDB_INVALID_ADDRESS);
+ LLDB_LOGF(log,
+ "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+ ", pc = 0x%16.16" PRIx64
+ ", should_stop = 0 (ignore since no stop reason)",
+ __FUNCTION__, GetID(), GetProtocolID(),
+ GetRegisterContext() ? GetRegisterContext()->GetPC()
+ : LLDB_INVALID_ADDRESS);
return false;
}
if (log) {
- log->Printf("Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
- ", pc = 0x%16.16" PRIx64,
- __FUNCTION__, static_cast<void *>(this), GetID(),
- GetProtocolID(),
- GetRegisterContext() ? GetRegisterContext()->GetPC()
- : LLDB_INVALID_ADDRESS);
- log->Printf("^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
+ LLDB_LOGF(log,
+ "Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+ ", pc = 0x%16.16" PRIx64,
+ __FUNCTION__, static_cast<void *>(this), GetID(), GetProtocolID(),
+ GetRegisterContext() ? GetRegisterContext()->GetPC()
+ : LLDB_INVALID_ADDRESS);
+ LLDB_LOGF(log, "^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
StreamString s;
s.IndentMore();
DumpThreadPlans(&s);
- log->Printf("Plan stack initial state:\n%s", s.GetData());
+ LLDB_LOGF(log, "Plan stack initial state:\n%s", s.GetData());
}
// The top most plan always gets to do the trace log...
@@ -774,9 +771,8 @@ bool Thread::ShouldStop(Event *event_ptr) {
StopInfoSP private_stop_info(GetPrivateStopInfo());
if (private_stop_info &&
!private_stop_info->ShouldStopSynchronous(event_ptr)) {
- if (log)
- log->Printf("StopInfo::ShouldStop async callback says we should not "
- "stop, returning ShouldStop of false.");
+ LLDB_LOGF(log, "StopInfo::ShouldStop async callback says we should not "
+ "stop, returning ShouldStop of false.");
return false;
}
@@ -840,15 +836,13 @@ bool Thread::ShouldStop(Event *event_ptr) {
if (!done_processing_current_plan) {
bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr);
- if (log)
- log->Printf("Plan %s explains stop, auto-continue %i.",
- current_plan->GetName(), over_ride_stop);
+ LLDB_LOGF(log, "Plan %s explains stop, auto-continue %i.",
+ current_plan->GetName(), over_ride_stop);
// We're starting from the base plan, so just let it decide;
if (PlanIsBasePlan(current_plan)) {
should_stop = current_plan->ShouldStop(event_ptr);
- if (log)
- log->Printf("Base plan says should stop: %i.", should_stop);
+ LLDB_LOGF(log, "Base plan says should stop: %i.", should_stop);
} else {
// Otherwise, don't let the base plan override what the other plans say
// to do, since presumably if there were other plans they would know what
@@ -858,9 +852,8 @@ bool Thread::ShouldStop(Event *event_ptr) {
break;
should_stop = current_plan->ShouldStop(event_ptr);
- if (log)
- log->Printf("Plan %s should stop: %d.", current_plan->GetName(),
- should_stop);
+ LLDB_LOGF(log, "Plan %s should stop: %d.", current_plan->GetName(),
+ should_stop);
if (current_plan->MischiefManaged()) {
if (should_stop)
current_plan->WillStop();
@@ -907,10 +900,10 @@ bool Thread::ShouldStop(Event *event_ptr) {
plan_ptr = GetPreviousPlan(examined_plan);
if (stale) {
- if (log)
- log->Printf(
- "Plan %s being discarded in cleanup, it says it is already done.",
- examined_plan->GetName());
+ LLDB_LOGF(
+ log,
+ "Plan %s being discarded in cleanup, it says it is already done.",
+ examined_plan->GetName());
while (GetCurrentPlan() != examined_plan) {
DiscardPlan();
}
@@ -929,9 +922,9 @@ bool Thread::ShouldStop(Event *event_ptr) {
StreamString s;
s.IndentMore();
DumpThreadPlans(&s);
- log->Printf("Plan stack final state:\n%s", s.GetData());
- log->Printf("vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
- should_stop);
+ LLDB_LOGF(log, "Plan stack final state:\n%s", s.GetData());
+ LLDB_LOGF(log, "vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
+ should_stop);
}
return should_stop;
}
@@ -943,37 +936,36 @@ Vote Thread::ShouldReportStop(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (thread_state == eStateSuspended || thread_state == eStateInvalid) {
- if (log)
- log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
- ": returning vote %i (state was suspended or invalid)",
- GetID(), eVoteNoOpinion);
+ LLDB_LOGF(log,
+ "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+ ": returning vote %i (state was suspended or invalid)",
+ GetID(), eVoteNoOpinion);
return eVoteNoOpinion;
}
if (temp_thread_state == eStateSuspended ||
temp_thread_state == eStateInvalid) {
- if (log)
- log->Printf(
- "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
- ": returning vote %i (temporary state was suspended or invalid)",
- GetID(), eVoteNoOpinion);
+ LLDB_LOGF(log,
+ "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+ ": returning vote %i (temporary state was suspended or invalid)",
+ GetID(), eVoteNoOpinion);
return eVoteNoOpinion;
}
if (!ThreadStoppedForAReason()) {
- if (log)
- log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
- ": returning vote %i (thread didn't stop for a reason.)",
- GetID(), eVoteNoOpinion);
+ LLDB_LOGF(log,
+ "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+ ": returning vote %i (thread didn't stop for a reason.)",
+ GetID(), eVoteNoOpinion);
return eVoteNoOpinion;
}
if (m_completed_plan_stack.size() > 0) {
// Don't use GetCompletedPlan here, since that suppresses private plans.
- if (log)
- log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
- ": returning vote for complete stack's back plan",
- GetID());
+ LLDB_LOGF(log,
+ "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+ ": returning vote for complete stack's back plan",
+ GetID());
return m_completed_plan_stack.back()->ShouldReportStop(event_ptr);
} else {
Vote thread_vote = eVoteNoOpinion;
@@ -988,10 +980,10 @@ Vote Thread::ShouldReportStop(Event *event_ptr) {
else
plan_ptr = GetPreviousPlan(plan_ptr);
}
- if (log)
- log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
- ": returning vote %i for current plan",
- GetID(), thread_vote);
+ LLDB_LOGF(log,
+ "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+ ": returning vote %i for current plan",
+ GetID(), thread_vote);
return thread_vote;
}
@@ -1007,21 +999,21 @@ Vote Thread::ShouldReportRun(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (m_completed_plan_stack.size() > 0) {
// Don't use GetCompletedPlan here, since that suppresses private plans.
- if (log)
- log->Printf("Current Plan for thread %d(%p) (0x%4.4" PRIx64
- ", %s): %s being asked whether we should report run.",
- GetIndexID(), static_cast<void *>(this), GetID(),
- StateAsCString(GetTemporaryResumeState()),
- m_completed_plan_stack.back()->GetName());
+ LLDB_LOGF(log,
+ "Current Plan for thread %d(%p) (0x%4.4" PRIx64
+ ", %s): %s being asked whether we should report run.",
+ GetIndexID(), static_cast<void *>(this), GetID(),
+ StateAsCString(GetTemporaryResumeState()),
+ m_completed_plan_stack.back()->GetName());
return m_completed_plan_stack.back()->ShouldReportRun(event_ptr);
} else {
- if (log)
- log->Printf("Current Plan for thread %d(%p) (0x%4.4" PRIx64
- ", %s): %s being asked whether we should report run.",
- GetIndexID(), static_cast<void *>(this), GetID(),
- StateAsCString(GetTemporaryResumeState()),
- GetCurrentPlan()->GetName());
+ LLDB_LOGF(log,
+ "Current Plan for thread %d(%p) (0x%4.4" PRIx64
+ ", %s): %s being asked whether we should report run.",
+ GetIndexID(), static_cast<void *>(this), GetID(),
+ StateAsCString(GetTemporaryResumeState()),
+ GetCurrentPlan()->GetName());
return GetCurrentPlan()->ShouldReportRun(event_ptr);
}
@@ -1048,9 +1040,9 @@ void Thread::PushPlan(ThreadPlanSP &thread_plan_sp) {
if (log) {
StreamString s;
thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
- log->Printf("Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
- static_cast<void *>(this), s.GetData(),
- thread_plan_sp->GetThread().GetID());
+ LLDB_LOGF(log, "Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
+ static_cast<void *>(this), s.GetData(),
+ thread_plan_sp->GetThread().GetID());
}
}
}
@@ -1063,8 +1055,8 @@ void Thread::PopPlan() {
else {
ThreadPlanSP &plan = m_plan_stack.back();
if (log) {
- log->Printf("Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
- plan->GetName(), plan->GetThread().GetID());
+ LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
+ plan->GetName(), plan->GetThread().GetID());
}
m_completed_plan_stack.push_back(plan);
plan->WillPop();
@@ -1076,9 +1068,8 @@ void Thread::DiscardPlan() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (m_plan_stack.size() > 1) {
ThreadPlanSP &plan = m_plan_stack.back();
- if (log)
- log->Printf("Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
- plan->GetName(), plan->GetThread().GetID());
+ LLDB_LOGF(log, "Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
+ plan->GetName(), plan->GetThread().GetID());
m_discarded_plan_stack.push_back(plan);
plan->WillPop();
@@ -1252,10 +1243,10 @@ void Thread::DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp) {
void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Discarding thread plans for thread tid = 0x%4.4" PRIx64
- ", up to %p",
- GetID(), static_cast<void *>(up_to_plan_ptr));
+ LLDB_LOGF(log,
+ "Discarding thread plans for thread tid = 0x%4.4" PRIx64
+ ", up to %p",
+ GetID(), static_cast<void *>(up_to_plan_ptr));
int stack_size = m_plan_stack.size();
@@ -1285,9 +1276,10 @@ void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) {
void Thread::DiscardThreadPlans(bool force) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log) {
- log->Printf("Discarding thread plans for thread (tid = 0x%4.4" PRIx64
- ", force %d)",
- GetID(), force);
+ LLDB_LOGF(log,
+ "Discarding thread plans for thread (tid = 0x%4.4" PRIx64
+ ", force %d)",
+ GetID(), force);
}
if (force) {
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp
index afdfda3b0ae..183b39c2cfa 100644
--- a/lldb/source/Target/ThreadList.cpp
+++ b/lldb/source/Target/ThreadList.cpp
@@ -267,10 +267,11 @@ bool ThreadList::ShouldStop(Event *event_ptr) {
if (log) {
log->PutCString("");
- log->Printf("ThreadList::%s: %" PRIu64 " threads, %" PRIu64
- " unsuspended threads",
- __FUNCTION__, (uint64_t)m_threads.size(),
- (uint64_t)threads_copy.size());
+ LLDB_LOGF(log,
+ "ThreadList::%s: %" PRIu64 " threads, %" PRIu64
+ " unsuspended threads",
+ __FUNCTION__, (uint64_t)m_threads.size(),
+ (uint64_t)threads_copy.size());
}
bool did_anybody_stop_for_a_reason = false;
@@ -279,10 +280,9 @@ bool ThreadList::ShouldStop(Event *event_ptr) {
// what. Otherwise, presume we won't stop.
bool should_stop = false;
if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
- if (log)
- log->Printf(
- "ThreadList::%s handling interrupt event, should stop set to true",
- __FUNCTION__);
+ LLDB_LOGF(
+ log, "ThreadList::%s handling interrupt event, should stop set to true",
+ __FUNCTION__);
should_stop = true;
}
@@ -334,15 +334,14 @@ bool ThreadList::ShouldStop(Event *event_ptr) {
if (!should_stop && !did_anybody_stop_for_a_reason) {
should_stop = true;
- if (log)
- log->Printf("ThreadList::%s we stopped but no threads had a stop reason, "
- "overriding should_stop and stopping.",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "ThreadList::%s we stopped but no threads had a stop reason, "
+ "overriding should_stop and stopping.",
+ __FUNCTION__);
}
- if (log)
- log->Printf("ThreadList::%s overall should_stop = %i", __FUNCTION__,
- should_stop);
+ LLDB_LOGF(log, "ThreadList::%s overall should_stop = %i", __FUNCTION__,
+ should_stop);
if (should_stop) {
for (pos = threads_copy.begin(); pos != end; ++pos) {
@@ -363,9 +362,8 @@ Vote ThreadList::ShouldReportStop(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("ThreadList::%s %" PRIu64 " threads", __FUNCTION__,
- (uint64_t)m_threads.size());
+ LLDB_LOGF(log, "ThreadList::%s %" PRIu64 " threads", __FUNCTION__,
+ (uint64_t)m_threads.size());
// Run through the threads and ask whether we should report this event. For
// stopping, a YES vote wins over everything. A NO vote wins over NO
@@ -430,10 +428,10 @@ Vote ThreadList::ShouldReportRun(Event *event_ptr) {
result = eVoteYes;
break;
case eVoteNo:
- if (log)
- log->Printf("ThreadList::ShouldReportRun() thread %d (0x%4.4" PRIx64
- ") says don't report.",
- (*pos)->GetIndexID(), (*pos)->GetID());
+ LLDB_LOGF(log,
+ "ThreadList::ShouldReportRun() thread %d (0x%4.4" PRIx64
+ ") says don't report.",
+ (*pos)->GetIndexID(), (*pos)->GetID());
result = eVoteNo;
break;
}
@@ -464,8 +462,9 @@ void ThreadList::RefreshStateAfterStop() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
- log->Printf("Turning off notification of new threads while single stepping "
- "a thread.");
+ LLDB_LOGF(log,
+ "Turning off notification of new threads while single stepping "
+ "a thread.");
collection::iterator pos, end = m_threads.end();
for (pos = m_threads.begin(); pos != end; ++pos)
@@ -517,14 +516,14 @@ bool ThreadList::WillResume() {
if (wants_solo_run) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
- log->Printf("Turning on notification of new threads while single "
- "stepping a thread.");
+ LLDB_LOGF(log, "Turning on notification of new threads while single "
+ "stepping a thread.");
m_process->StartNoticingNewThreads();
} else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
- log->Printf("Turning off notification of new threads while single "
- "stepping a thread.");
+ LLDB_LOGF(log, "Turning off notification of new threads while single "
+ "stepping a thread.");
m_process->StopNoticingNewThreads();
}
diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp
index 1d8cc18db4d..ba56f8d15d8 100644
--- a/lldb/source/Target/ThreadPlan.cpp
+++ b/lldb/source/Target/ThreadPlan.cpp
@@ -108,7 +108,8 @@ bool ThreadPlan::WillResume(StateType resume_state, bool current_plan) {
addr_t pc = reg_ctx->GetPC();
addr_t sp = reg_ctx->GetSP();
addr_t fp = reg_ctx->GetFP();
- log->Printf(
+ LLDB_LOGF(
+ log,
"%s Thread #%u (0x%p): tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64
", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", "
"plan = '%s', state = %s, stop others = %d",
diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp
index 9cd4bcb455b..821643d4bce 100644
--- a/lldb/source/Target/ThreadPlanBase.cpp
+++ b/lldb/source/Target/ThreadPlanBase.cpp
@@ -92,11 +92,11 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) {
// If we are going to stop for a breakpoint, then unship the other
// plans at this point. Don't force the discard, however, so Master
// plans can stay in place if they want to.
- if (log)
- log->Printf(
- "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
- " (breakpoint hit.)",
- m_thread.GetID());
+ LLDB_LOGF(
+ log,
+ "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+ " (breakpoint hit.)",
+ m_thread.GetID());
m_thread.DiscardThreadPlans(false);
return true;
}
@@ -122,11 +122,11 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) {
// If we crashed, discard thread plans and stop. Don't force the
// discard, however, since on rerun the target may clean up this
// exception and continue normally from there.
- if (log)
- log->Printf(
- "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
- " (exception: %s)",
- m_thread.GetID(), stop_info_sp->GetDescription());
+ LLDB_LOGF(
+ log,
+ "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+ " (exception: %s)",
+ m_thread.GetID(), stop_info_sp->GetDescription());
m_thread.DiscardThreadPlans(false);
return true;
@@ -134,22 +134,22 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) {
// If we crashed, discard thread plans and stop. Don't force the
// discard, however, since on rerun the target may clean up this
// exception and continue normally from there.
- if (log)
- log->Printf(
- "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
- " (exec.)",
- m_thread.GetID());
+ LLDB_LOGF(
+ log,
+ "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+ " (exec.)",
+ m_thread.GetID());
m_thread.DiscardThreadPlans(false);
return true;
case eStopReasonThreadExiting:
case eStopReasonSignal:
if (stop_info_sp->ShouldStop(event_ptr)) {
- if (log)
- log->Printf(
- "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
- " (signal: %s)",
- m_thread.GetID(), stop_info_sp->GetDescription());
+ LLDB_LOGF(
+ log,
+ "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+ " (signal: %s)",
+ m_thread.GetID(), stop_info_sp->GetDescription());
m_thread.DiscardThreadPlans(false);
return true;
} else {
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index c4cf133a27f..23d114e3099 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -59,9 +59,8 @@ bool ThreadPlanCallFunction::ConstructorSetup(
m_constructor_errors.Printf(
"Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".",
m_function_sp);
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
- m_constructor_errors.GetData());
+ LLDB_LOGF(log, "ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+ m_constructor_errors.GetData());
return false;
}
@@ -69,9 +68,8 @@ bool ThreadPlanCallFunction::ConstructorSetup(
if (!start_address) {
m_constructor_errors.Printf(
"%s", llvm::toString(start_address.takeError()).c_str());
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
- m_constructor_errors.GetData());
+ LLDB_LOGF(log, "ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+ m_constructor_errors.GetData());
return false;
}
@@ -86,9 +84,8 @@ bool ThreadPlanCallFunction::ConstructorSetup(
if (!thread.CheckpointThreadState(m_stored_thread_state)) {
m_constructor_errors.Printf("Setting up ThreadPlanCallFunction, failed to "
"checkpoint thread state.");
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
- m_constructor_errors.GetData());
+ LLDB_LOGF(log, "ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+ m_constructor_errors.GetData());
return false;
}
function_load_addr = m_function_addr.GetLoadAddress(&GetTarget());
@@ -173,10 +170,10 @@ void ThreadPlanCallFunction::DoTakedown(bool success) {
if (!m_valid) {
// Don't call DoTakedown if we were never valid to begin with.
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): Log called on "
- "ThreadPlanCallFunction that was never valid.",
- static_cast<void *>(this));
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction(%p): Log called on "
+ "ThreadPlanCallFunction that was never valid.",
+ static_cast<void *>(this));
return;
}
@@ -184,20 +181,20 @@ void ThreadPlanCallFunction::DoTakedown(bool success) {
if (success) {
SetReturnValue();
}
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): DoTakedown called for thread "
- "0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
- static_cast<void *>(this), m_thread.GetID(), m_valid,
- IsPlanComplete());
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction(%p): DoTakedown called for thread "
+ "0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
+ static_cast<void *>(this), m_thread.GetID(), m_valid,
+ IsPlanComplete());
m_takedown_done = true;
m_stop_address =
m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
m_real_stop_info_sp = GetPrivateStopInfo();
if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) {
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore "
- "register state",
- static_cast<void *>(this));
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction(%p): DoTakedown failed to restore "
+ "register state",
+ static_cast<void *>(this));
}
SetPlanComplete(success);
ClearBreakpoints();
@@ -205,11 +202,11 @@ void ThreadPlanCallFunction::DoTakedown(bool success) {
ReportRegisterState("Restoring thread state after function call. "
"Restored register state:");
} else {
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): DoTakedown called as no-op for "
- "thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
- static_cast<void *>(this), m_thread.GetID(), m_valid,
- IsPlanComplete());
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction(%p): DoTakedown called as no-op for "
+ "thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
+ static_cast<void *>(this), m_thread.GetID(), m_valid,
+ IsPlanComplete());
}
}
@@ -265,10 +262,9 @@ bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) {
stop_reason = eStopReasonNone;
else
stop_reason = m_real_stop_info_sp->GetStopReason();
- if (log)
- log->Printf(
- "ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.",
- Thread::StopReasonAsCString(stop_reason));
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.",
+ Thread::StopReasonAsCString(stop_reason));
if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop())
return true;
@@ -277,9 +273,8 @@ bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) {
// then we should not consider ourselves complete. Return true to
// acknowledge the stop.
if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop: The event is an "
- "Interrupt, returning true.");
+ LLDB_LOGF(log, "ThreadPlanCallFunction::PlanExplainsStop: The event is an "
+ "Interrupt, returning true.");
return true;
}
// We control breakpoints separately from other "stop reasons." So first,
@@ -298,10 +293,10 @@ bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) {
bool is_internal = true;
for (uint32_t i = 0; i < num_owners; i++) {
Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop: hit "
- "breakpoint %d while calling function",
- bp.GetID());
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction::PlanExplainsStop: hit "
+ "breakpoint %d while calling function",
+ bp.GetID());
if (!bp.IsInternal()) {
is_internal = false;
@@ -309,25 +304,23 @@ bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) {
}
}
if (is_internal) {
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop hit an "
- "internal breakpoint, not stopping.");
+ LLDB_LOGF(log, "ThreadPlanCallFunction::PlanExplainsStop hit an "
+ "internal breakpoint, not stopping.");
return false;
}
}
if (m_ignore_breakpoints) {
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are ignoring "
- "breakpoints, overriding breakpoint stop info ShouldStop, "
- "returning true");
+ LLDB_LOGF(log,
+ "ThreadPlanCallFunction::PlanExplainsStop: we are ignoring "
+ "breakpoints, overriding breakpoint stop info ShouldStop, "
+ "returning true");
m_real_stop_info_sp->OverrideShouldStop(false);
return true;
} else {
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are not "
- "ignoring breakpoints, overriding breakpoint stop info "
- "ShouldStop, returning true");
+ LLDB_LOGF(log, "ThreadPlanCallFunction::PlanExplainsStop: we are not "
+ "ignoring breakpoints, overriding breakpoint stop info "
+ "ShouldStop, returning true");
m_real_stop_info_sp->OverrideShouldStop(true);
return false;
}
@@ -395,9 +388,8 @@ bool ThreadPlanCallFunction::MischiefManaged() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (IsPlanComplete()) {
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
- static_cast<void *>(this));
+ LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.",
+ static_cast<void *>(this));
ThreadPlan::MischiefManaged();
return true;
@@ -446,9 +438,8 @@ bool ThreadPlanCallFunction::BreakpointsExplainStop() {
m_objc_language_runtime->ExceptionBreakpointsExplainStop(
stop_info_sp))) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an "
- "exception breakpoint, setting plan complete.");
+ LLDB_LOGF(log, "ThreadPlanCallFunction::BreakpointsExplainStop - Hit an "
+ "exception breakpoint, setting plan complete.");
SetPlanComplete(false);
diff --git a/lldb/source/Target/ThreadPlanCallUserExpression.cpp b/lldb/source/Target/ThreadPlanCallUserExpression.cpp
index 864808a4b5e..436938c8f20 100644
--- a/lldb/source/Target/ThreadPlanCallUserExpression.cpp
+++ b/lldb/source/Target/ThreadPlanCallUserExpression.cpp
@@ -69,9 +69,8 @@ bool ThreadPlanCallUserExpression::MischiefManaged() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (IsPlanComplete()) {
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
- static_cast<void *>(this));
+ LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.",
+ static_cast<void *>(this));
if (m_manage_materialization && PlanSucceeded() && m_user_expression_sp) {
lldb::addr_t function_stack_top;
diff --git a/lldb/source/Target/ThreadPlanPython.cpp b/lldb/source/Target/ThreadPlanPython.cpp
index 8b30c4ea7cb..cc0f55bf8d8 100644
--- a/lldb/source/Target/ThreadPlanPython.cpp
+++ b/lldb/source/Target/ThreadPlanPython.cpp
@@ -70,9 +70,8 @@ void ThreadPlanPython::DidPush() {
bool ThreadPlanPython::ShouldStop(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
- m_class_name.c_str());
+ LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+ m_class_name.c_str());
bool should_stop = true;
if (m_implementation_sp) {
@@ -93,9 +92,8 @@ bool ThreadPlanPython::ShouldStop(Event *event_ptr) {
bool ThreadPlanPython::IsPlanStale() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
- m_class_name.c_str());
+ LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+ m_class_name.c_str());
bool is_stale = true;
if (m_implementation_sp) {
@@ -116,9 +114,8 @@ bool ThreadPlanPython::IsPlanStale() {
bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
- m_class_name.c_str());
+ LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+ m_class_name.c_str());
bool explains_stop = true;
if (m_implementation_sp) {
@@ -139,9 +136,8 @@ bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) {
bool ThreadPlanPython::MischiefManaged() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
- m_class_name.c_str());
+ LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+ m_class_name.c_str());
bool mischief_managed = true;
if (m_implementation_sp) {
// I don't really need mischief_managed, since it's simpler to just call
@@ -155,9 +151,8 @@ bool ThreadPlanPython::MischiefManaged() {
lldb::StateType ThreadPlanPython::GetPlanRunState() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
- m_class_name.c_str());
+ LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+ m_class_name.c_str());
lldb::StateType run_state = eStateRunning;
if (m_implementation_sp) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
@@ -188,8 +183,7 @@ void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) {
bool ThreadPlanPython::WillStop() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
- if (log)
- log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
- m_class_name.c_str());
+ LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+ m_class_name.c_str());
return true;
}
diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp
index a973bd11279..160743a9f3f 100644
--- a/lldb/source/Target/ThreadPlanRunToAddress.cpp
+++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp
@@ -182,8 +182,7 @@ bool ThreadPlanRunToAddress::MischiefManaged() {
m_break_ids[i] = LLDB_INVALID_BREAK_ID;
}
}
- if (log)
- log->Printf("Completed run to address plan.");
+ LLDB_LOGF(log, "Completed run to address plan.");
ThreadPlan::MischiefManaged();
return true;
} else
diff --git a/lldb/source/Target/ThreadPlanShouldStopHere.cpp b/lldb/source/Target/ThreadPlanShouldStopHere.cpp
index a0b7072a107..9599d8197b0 100644
--- a/lldb/source/Target/ThreadPlanShouldStopHere.cpp
+++ b/lldb/source/Target/ThreadPlanShouldStopHere.cpp
@@ -46,8 +46,8 @@ bool ThreadPlanShouldStopHere::InvokeShouldStopHereCallback(
lldb::addr_t current_addr =
m_owner->GetThread().GetRegisterContext()->GetPC(0);
- log->Printf("ShouldStopHere callback returned %u from 0x%" PRIx64 ".",
- should_stop_here, current_addr);
+ LLDB_LOGF(log, "ShouldStopHere callback returned %u from 0x%" PRIx64 ".",
+ should_stop_here, current_addr);
}
}
@@ -69,8 +69,7 @@ bool ThreadPlanShouldStopHere::DefaultShouldStopHereCallback(
(operation == eFrameCompareSameParent &&
flags.Test(eStepInAvoidNoDebug))) {
if (!frame->HasDebugInformation()) {
- if (log)
- log->Printf("Stepping out of frame with no debug info");
+ LLDB_LOGF(log, "Stepping out of frame with no debug info");
should_stop_here = false;
}
@@ -118,16 +117,14 @@ ThreadPlanSP ThreadPlanShouldStopHere::DefaultStepFromHereCallback(
symbol_end.Slide(sc.symbol->GetByteSize() - 1);
if (range.ContainsFileAddress(sc.symbol->GetAddress()) &&
range.ContainsFileAddress(symbol_end)) {
- if (log)
- log->Printf("Stopped in a function with only line 0 lines, just "
- "stepping out.");
+ LLDB_LOGF(log, "Stopped in a function with only line 0 lines, just "
+ "stepping out.");
just_step_out = true;
}
}
if (!just_step_out) {
- if (log)
- log->Printf("ThreadPlanShouldStopHere::DefaultStepFromHereCallback "
- "Queueing StepInRange plan to step through line 0 code.");
+ LLDB_LOGF(log, "ThreadPlanShouldStopHere::DefaultStepFromHereCallback "
+ "Queueing StepInRange plan to step through line 0 code.");
return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepInRange(
false, range, sc, nullptr, eOnlyDuringStepping, status,
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index 2065fa55fa6..ff6553e4557 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -148,7 +148,7 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
s.Address(
m_thread.GetRegisterContext()->GetPC(),
m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize());
- log->Printf("ThreadPlanStepInRange reached %s.", s.GetData());
+ LLDB_LOGF(log, "ThreadPlanStepInRange reached %s.", s.GetData());
}
if (IsPlanComplete())
@@ -197,13 +197,14 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
CheckShouldStopHereAndQueueStepOut(frame_order, m_status);
if (log) {
if (m_sub_plan_sp)
- log->Printf("ShouldStopHere found plan to step out of this frame.");
+ LLDB_LOGF(log,
+ "ShouldStopHere found plan to step out of this frame.");
else
- log->Printf("ShouldStopHere no plan to step out of this frame.");
+ LLDB_LOGF(log, "ShouldStopHere no plan to step out of this frame.");
}
} else if (log) {
- log->Printf(
- "Thought I stepped out, but in fact arrived at a trampoline.");
+ LLDB_LOGF(
+ log, "Thought I stepped out, but in fact arrived at a trampoline.");
}
} else if (frame_order == eFrameCompareEqual && InSymbol()) {
// If we are not in a place we should step through, we're done. One
@@ -237,9 +238,10 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
if (log) {
if (m_sub_plan_sp)
- log->Printf("Found a step through plan: %s", m_sub_plan_sp->GetName());
+ LLDB_LOGF(log, "Found a step through plan: %s",
+ m_sub_plan_sp->GetName());
else
- log->Printf("No step through plan found.");
+ LLDB_LOGF(log, "No step through plan found.");
}
// If not, give the "should_stop" callback a chance to push a plan to get
@@ -289,8 +291,7 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) {
if (bytes_to_skip != 0) {
func_start_address.Slide(bytes_to_skip);
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP);
- if (log)
- log->Printf("Pushing past prologue ");
+ LLDB_LOGF(log, "Pushing past prologue ");
m_sub_plan_sp = m_thread.QueueThreadPlanForRunToAddress(
false, func_start_address, true, m_status);
@@ -373,11 +374,12 @@ bool ThreadPlanStepInRange::FrameMatchesAvoidCriteria() {
if (log) {
std::string match;
regex_match.GetMatchAtIndex(frame_function_name, 0, match);
- log->Printf("Stepping out of function \"%s\" because it matches "
- "the avoid regexp \"%s\" - match substring: \"%s\".",
- frame_function_name,
- avoid_regexp_to_use->GetText().str().c_str(),
- match.c_str());
+ LLDB_LOGF(log,
+ "Stepping out of function \"%s\" because it matches "
+ "the avoid regexp \"%s\" - match substring: \"%s\".",
+ frame_function_name,
+ avoid_regexp_to_use->GetText().str().c_str(),
+ match.c_str());
}
}
return return_value;
@@ -424,10 +426,11 @@ bool ThreadPlanStepInRange::DefaultShouldStopHereCallback(
should_stop_here = false;
}
if (log && !should_stop_here)
- log->Printf("Stepping out of frame %s which did not match step into "
- "target %s.",
- sc.GetFunctionName().AsCString(),
- step_in_range_plan->m_step_into_target.AsCString());
+ LLDB_LOGF(log,
+ "Stepping out of frame %s which did not match step into "
+ "target %s.",
+ sc.GetFunctionName().AsCString(),
+ step_in_range_plan->m_step_into_target.AsCString());
}
}
@@ -496,10 +499,10 @@ bool ThreadPlanStepInRange::DoWillResume(lldb::StateType resume_state,
bool step_without_resume = m_thread.DecrementCurrentInlinedDepth();
if (step_without_resume) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("ThreadPlanStepInRange::DoWillResume: returning false, "
- "inline_depth: %d",
- m_thread.GetCurrentInlinedDepth());
+ LLDB_LOGF(log,
+ "ThreadPlanStepInRange::DoWillResume: returning false, "
+ "inline_depth: %d",
+ m_thread.GetCurrentInlinedDepth());
SetStopInfo(StopInfo::CreateStopReasonToTrace(m_thread));
// FIXME: Maybe it would be better to create a InlineStep stop reason, but
diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp
index a11b623c8ac..0c75cb81115 100644
--- a/lldb/source/Target/ThreadPlanStepInstruction.cpp
+++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp
@@ -114,8 +114,9 @@ bool ThreadPlanStepInstruction::IsPlanStale() {
return !m_step_over;
} else {
if (log) {
- log->Printf("ThreadPlanStepInstruction::IsPlanStale - Current frame is "
- "older than start frame, plan is stale.");
+ LLDB_LOGF(log,
+ "ThreadPlanStepInstruction::IsPlanStale - Current frame is "
+ "older than start frame, plan is stale.");
}
return true;
}
@@ -127,9 +128,9 @@ bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) {
StackFrameSP cur_frame_sp = m_thread.GetStackFrameAtIndex(0);
if (!cur_frame_sp) {
- if (log)
- log->Printf(
- "ThreadPlanStepInstruction couldn't get the 0th frame, stopping.");
+ LLDB_LOGF(
+ log,
+ "ThreadPlanStepInstruction couldn't get the 0th frame, stopping.");
SetPlanComplete();
return true;
}
@@ -168,8 +169,9 @@ bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) {
cur_frame_sp->GetConcreteFrameIndex()) {
SetPlanComplete();
if (log) {
- log->Printf("Frame we stepped into is inlined into the frame "
- "we were stepping from, stopping.");
+ LLDB_LOGF(log,
+ "Frame we stepped into is inlined into the frame "
+ "we were stepping from, stopping.");
}
return true;
}
@@ -188,7 +190,7 @@ bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) {
s.Address(return_addr, m_thread.CalculateTarget()
->GetArchitecture()
.GetAddressByteSize());
- log->Printf("%s.", s.GetData());
+ LLDB_LOGF(log, "%s.", s.GetData());
}
// StepInstruction should probably have the tri-state RunMode, but
@@ -209,8 +211,7 @@ bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) {
return true;
}
} else {
- if (log)
- log->Printf("Could not find previous frame, stopping.");
+ LLDB_LOGF(log, "Could not find previous frame, stopping.");
SetPlanComplete();
return true;
}
@@ -243,8 +244,7 @@ bool ThreadPlanStepInstruction::WillStop() { return true; }
bool ThreadPlanStepInstruction::MischiefManaged() {
if (IsPlanComplete()) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Completed single instruction step plan.");
+ LLDB_LOGF(log, "Completed single instruction step plan.");
ThreadPlan::MischiefManaged();
return true;
} else {
diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp
index bf55c376513..d7dae446b22 100644
--- a/lldb/source/Target/ThreadPlanStepOut.cpp
+++ b/lldb/source/Target/ThreadPlanStepOut.cpp
@@ -408,7 +408,7 @@ bool ThreadPlanStepOut::MischiefManaged() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log)
- log->Printf("Completed step out plan.");
+ LLDB_LOGF(log, "Completed step out plan.");
if (m_return_bp_id != LLDB_INVALID_BREAK_ID) {
m_thread.CalculateTarget()->RemoveBreakpointByID(m_return_bp_id);
m_return_bp_id = LLDB_INVALID_BREAK_ID;
@@ -433,7 +433,7 @@ bool ThreadPlanStepOut::QueueInlinedStepPlan(bool queue_now) {
if (log) {
StreamString s;
immediate_return_from_sp->Dump(&s, true, false);
- log->Printf("Queuing inlined frame to step past: %s.", s.GetData());
+ LLDB_LOGF(log, "Queuing inlined frame to step past: %s.", s.GetData());
}
Block *from_block = immediate_return_from_sp->GetFrameBlock();
diff --git a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
index 4770b57ab7f..725669b1e9a 100644
--- a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
@@ -62,11 +62,9 @@ bool ThreadPlanStepOverBreakpoint::DoPlanExplainsStop(Event *event_ptr) {
StopReason reason = stop_info_sp->GetStopReason();
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
+ LLDB_LOGF(log, "Step over breakpoint stopped for reason: %s.",
+ Thread::StopReasonAsCString(reason));
- if (log)
- log->Printf("Step over breakpoint stopped for reason: %s.",
- Thread::StopReasonAsCString(reason));
-
switch (reason) {
case eStopReasonTrace:
case eStopReasonNone:
@@ -91,9 +89,10 @@ bool ThreadPlanStepOverBreakpoint::DoPlanExplainsStop(Event *event_ptr) {
lldb::addr_t pc_addr = m_thread.GetRegisterContext()->GetPC();
if (pc_addr == m_breakpoint_addr) {
- if (log)
- log->Printf("Got breakpoint stop reason but pc: 0x%" PRIx64
- "hasn't changed.", pc_addr);
+ LLDB_LOGF(log,
+ "Got breakpoint stop reason but pc: 0x%" PRIx64
+ "hasn't changed.",
+ pc_addr);
return true;
}
@@ -149,8 +148,7 @@ bool ThreadPlanStepOverBreakpoint::MischiefManaged() {
return false;
} else {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Completed step over breakpoint plan.");
+ LLDB_LOGF(log, "Completed step over breakpoint plan.");
// Otherwise, re-enable the breakpoint we were stepping over, and we're
// done.
ReenableBreakpointSite();
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp
index 3aaeac9f5b2..2de678597c8 100644
--- a/lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -131,7 +131,7 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
s.Address(
m_thread.GetRegisterContext()->GetPC(),
m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize());
- log->Printf("ThreadPlanStepOverRange reached %s.", s.GetData());
+ LLDB_LOGF(log, "ThreadPlanStepOverRange reached %s.", s.GetData());
}
// If we're out of the range but in the same frame or in our caller's frame
@@ -155,8 +155,8 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) {
stop_others, m_status);
if (new_plan_sp && log)
- log->Printf(
- "Thought I stepped out, but in fact arrived at a trampoline.");
+ LLDB_LOGF(log,
+ "Thought I stepped out, but in fact arrived at a trampoline.");
} else if (frame_order == eFrameCompareYounger) {
// Make sure we really are in a new frame. Do that by unwinding and seeing
// if the start function really is our start function...
@@ -371,10 +371,10 @@ bool ThreadPlanStepOverRange::DoWillResume(lldb::StateType resume_state,
bool in_inlined_stack = m_thread.DecrementCurrentInlinedDepth();
if (in_inlined_stack) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("ThreadPlanStepInRange::DoWillResume: adjusting range to "
- "the frame at inlined depth %d.",
- m_thread.GetCurrentInlinedDepth());
+ LLDB_LOGF(log,
+ "ThreadPlanStepInRange::DoWillResume: adjusting range to "
+ "the frame at inlined depth %d.",
+ m_thread.GetCurrentInlinedDepth());
StackFrameSP stack_sp = m_thread.GetStackFrameAtIndex(0);
if (stack_sp) {
Block *frame_block = stack_sp->GetFrameBlock();
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index 49c72dbf091..27513a34ead 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -68,9 +68,8 @@ Vote ThreadPlanStepRange::ShouldReportStop(Event *event_ptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo;
- if (log)
- log->Printf("ThreadPlanStepRange::ShouldReportStop() returning vote %i\n",
- vote);
+ LLDB_LOGF(log, "ThreadPlanStepRange::ShouldReportStop() returning vote %i\n",
+ vote);
return vote;
}
@@ -137,7 +136,8 @@ bool ThreadPlanStepRange::InRange() {
true, Address::DumpStyleLoadAddress,
Address::DumpStyleLoadAddress, true);
- log->Printf(
+ LLDB_LOGF(
+ log,
"Step range plan stepped to another range of same line: %s",
s.GetData());
}
@@ -155,9 +155,10 @@ bool ThreadPlanStepRange::InRange() {
true, Address::DumpStyleLoadAddress,
Address::DumpStyleLoadAddress, true);
- log->Printf("Step range plan stepped to a range at linenumber 0 "
- "stepping through that range: %s",
- s.GetData());
+ LLDB_LOGF(log,
+ "Step range plan stepped to a range at linenumber 0 "
+ "stepping through that range: %s",
+ s.GetData());
}
} else if (new_context.line_entry.range.GetBaseAddress().GetLoadAddress(
m_thread.CalculateTarget().get()) != pc_load_addr) {
@@ -177,9 +178,10 @@ bool ThreadPlanStepRange::InRange() {
true, Address::DumpStyleLoadAddress,
Address::DumpStyleLoadAddress, true);
- log->Printf("Step range plan stepped to the middle of new "
- "line(%d): %s, continuing to clear this line.",
- new_context.line_entry.line, s.GetData());
+ LLDB_LOGF(log,
+ "Step range plan stepped to the middle of new "
+ "line(%d): %s, continuing to clear this line.",
+ new_context.line_entry.line, s.GetData());
}
}
}
@@ -187,7 +189,7 @@ bool ThreadPlanStepRange::InRange() {
}
if (!ret_value && log)
- log->Printf("Step range plan out of range to 0x%" PRIx64, pc_load_addr);
+ LLDB_LOGF(log, "Step range plan out of range to 0x%" PRIx64, pc_load_addr);
return ret_value;
}
@@ -285,9 +287,8 @@ InstructionList *ThreadPlanStepRange::GetInstructionsForAddress(
void ThreadPlanStepRange::ClearNextBranchBreakpoint() {
if (m_next_branch_bp_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Removing next branch breakpoint: %d.",
- m_next_branch_bp_sp->GetID());
+ LLDB_LOGF(log, "Removing next branch breakpoint: %d.",
+ m_next_branch_bp_sp->GetID());
GetTarget().RemoveBreakpointByID(m_next_branch_bp_sp->GetID());
m_next_branch_bp_sp.reset();
m_could_not_resolve_hw_bp = false;
@@ -357,11 +358,12 @@ bool ThreadPlanStepRange::SetNextBranchBreakpoint() {
bp_site_id = bp_site->GetID();
}
}
- log->Printf("ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
- "breakpoint %d (site %d) to run to address 0x%" PRIx64,
- m_next_branch_bp_sp->GetID(), bp_site_id,
- run_to_address.GetLoadAddress(
- &m_thread.GetProcess()->GetTarget()));
+ LLDB_LOGF(log,
+ "ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
+ "breakpoint %d (site %d) to run to address 0x%" PRIx64,
+ m_next_branch_bp_sp->GetID(), bp_site_id,
+ run_to_address.GetLoadAddress(
+ &m_thread.GetProcess()->GetTarget()));
}
m_next_branch_bp_sp->SetThreadID(m_thread.GetID());
@@ -402,11 +404,11 @@ bool ThreadPlanStepRange::NextRangeBreakpointExplainsStop(
break;
}
}
- if (log)
- log->Printf("ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
- "next range breakpoint which has %" PRIu64
- " owners - explains stop: %u.",
- (uint64_t)num_owners, explains_stop);
+ LLDB_LOGF(log,
+ "ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
+ "next range breakpoint which has %" PRIu64
+ " owners - explains stop: %u.",
+ (uint64_t)num_owners, explains_stop);
ClearNextBranchBreakpoint();
return explains_stop;
}
@@ -445,8 +447,7 @@ bool ThreadPlanStepRange::MischiefManaged() {
if (done) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Completed step through range plan.");
+ LLDB_LOGF(log, "Completed step through range plan.");
ClearNextBranchBreakpoint();
ThreadPlan::MischiefManaged();
return true;
@@ -461,8 +462,8 @@ bool ThreadPlanStepRange::IsPlanStale() {
if (frame_order == eFrameCompareOlder) {
if (log) {
- log->Printf("ThreadPlanStepRange::IsPlanStale returning true, we've "
- "stepped out.");
+ LLDB_LOGF(log, "ThreadPlanStepRange::IsPlanStale returning true, we've "
+ "stepped out.");
}
return true;
} else if (frame_order == eFrameCompareEqual && InSymbol()) {
diff --git a/lldb/source/Target/ThreadPlanStepThrough.cpp b/lldb/source/Target/ThreadPlanStepThrough.cpp
index e46eba00184..92b7fce1bc9 100644
--- a/lldb/source/Target/ThreadPlanStepThrough.cpp
+++ b/lldb/source/Target/ThreadPlanStepThrough.cpp
@@ -64,8 +64,8 @@ ThreadPlanStepThrough::ThreadPlanStepThrough(Thread &thread,
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log) {
- log->Printf("Setting backstop breakpoint %d at address: 0x%" PRIx64,
- m_backstop_bkpt_id, m_backstop_addr);
+ LLDB_LOGF(log, "Setting backstop breakpoint %d at address: 0x%" PRIx64,
+ m_backstop_bkpt_id, m_backstop_addr);
}
}
}
@@ -103,11 +103,12 @@ void ThreadPlanStepThrough::LookForPlanToStepThroughFromCurrentPC() {
if (m_sub_plan_sp) {
StreamString s;
m_sub_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
- log->Printf("Found step through plan from 0x%" PRIx64 ": %s",
- current_address, s.GetData());
+ LLDB_LOGF(log, "Found step through plan from 0x%" PRIx64 ": %s",
+ current_address, s.GetData());
} else {
- log->Printf("Couldn't find step through plan from address 0x%" PRIx64 ".",
- current_address);
+ LLDB_LOGF(log,
+ "Couldn't find step through plan from address 0x%" PRIx64 ".",
+ current_address);
}
}
}
@@ -234,8 +235,7 @@ bool ThreadPlanStepThrough::MischiefManaged() {
if (!IsPlanComplete()) {
return false;
} else {
- if (log)
- log->Printf("Completed step through step plan.");
+ LLDB_LOGF(log, "Completed step through step plan.");
ClearBackstopBreakpoint();
ThreadPlan::MischiefManaged();
diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp
index d4109c3d38d..54d27633748 100644
--- a/lldb/source/Target/ThreadPlanStepUntil.cpp
+++ b/lldb/source/Target/ThreadPlanStepUntil.cpp
@@ -326,8 +326,7 @@ bool ThreadPlanStepUntil::MischiefManaged() {
bool done = false;
if (IsPlanComplete()) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (log)
- log->Printf("Completed step until plan.");
+ LLDB_LOGF(log, "Completed step until plan.");
Clear();
done = true;
OpenPOWER on IntegriCloud