summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-04-04 04:06:10 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-04-04 04:06:10 +0000
commit324a1036194f95385b26c941bc82cc6dadf50ac7 (patch)
tree06bb7d9660aafa1ff4e69cfa813b5c122038e09f /lldb/source/Target
parentf3aefca7c1bcdd3a6445b7ae04a9f69af567a7e7 (diff)
downloadbcm5719-llvm-324a1036194f95385b26c941bc82cc6dadf50ac7.tar.gz
bcm5719-llvm-324a1036194f95385b26c941bc82cc6dadf50ac7.zip
sweep up -Wformat warnings from gcc
This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Platform.cpp4
-rw-r--r--lldb/source/Target/Process.cpp289
-rw-r--r--lldb/source/Target/SectionLoadList.cpp29
-rw-r--r--lldb/source/Target/StackFrameList.cpp2
-rw-r--r--lldb/source/Target/StackID.cpp5
-rw-r--r--lldb/source/Target/StopInfo.cpp68
-rw-r--r--lldb/source/Target/Target.cpp6
-rw-r--r--lldb/source/Target/Thread.cpp108
-rw-r--r--lldb/source/Target/ThreadPlan.cpp15
-rw-r--r--lldb/source/Target/ThreadPlanCallFunction.cpp69
10 files changed, 310 insertions, 285 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index cefc2f0ece0..d1e5cebc685 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -261,7 +261,7 @@ Platform::Platform (bool is_host) :
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Platform::Platform()", this);
+ log->Printf ("%p Platform::Platform()", static_cast<void*>(this));
}
//------------------------------------------------------------------
@@ -274,7 +274,7 @@ Platform::~Platform()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Platform::~Platform()", this);
+ log->Printf ("%p Platform::~Platform()", static_cast<void*>(this));
}
void
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 6f86a6158ae..db992dde4de 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -700,7 +700,7 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions,
eErrorTypePOSIX);
if (log && (error.Fail() || log))
error.PutToLog(log, "posix_spawn_file_actions_addclose (action=%p, fd=%i)",
- file_actions, info->m_fd);
+ static_cast<void*>(file_actions), info->m_fd);
}
break;
@@ -715,7 +715,8 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions,
eErrorTypePOSIX);
if (log && (error.Fail() || log))
error.PutToLog(log, "posix_spawn_file_actions_adddup2 (action=%p, fd=%i, dup_fd=%i)",
- file_actions, info->m_fd, info->m_arg);
+ static_cast<void*>(file_actions), info->m_fd,
+ info->m_arg);
}
break;
@@ -725,7 +726,7 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions,
else
{
int oflag = info->m_arg;
-
+
mode_t mode = 0;
if (oflag & O_CREAT)
@@ -739,8 +740,9 @@ ProcessLaunchInfo::FileAction::AddPosixSpawnFileAction (void *_file_actions,
eErrorTypePOSIX);
if (error.Fail() || log)
error.PutToLog(log,
- "posix_spawn_file_actions_addopen (action=%p, fd=%i, path='%s', oflag=%i, mode=%i)",
- file_actions, info->m_fd, info->m_path.c_str(), oflag, mode);
+ "posix_spawn_file_actions_addopen (action=%p, fd=%i, path='%s', oflag=%i, mode=%i)",
+ static_cast<void*>(file_actions), info->m_fd,
+ info->m_path.c_str(), oflag, mode);
}
break;
}
@@ -1063,7 +1065,7 @@ Process::Process(Target &target, Listener &listener) :
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Process::Process()", this);
+ log->Printf ("%p Process::Process()", static_cast<void*>(this));
SetEventName (eBroadcastBitStateChanged, "state-changed");
SetEventName (eBroadcastBitInterrupt, "interrupt");
@@ -1099,7 +1101,7 @@ Process::~Process()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Process::~Process()", this);
+ log->Printf ("%p Process::~Process()", static_cast<void*>(this));
StopPrivateStateThread();
}
@@ -1260,7 +1262,8 @@ Process::WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::%s (timeout = %p)", __FUNCTION__, timeout);
+ log->Printf ("Process::%s (timeout = %p)", __FUNCTION__,
+ static_cast<const void*>(timeout));
if (!wait_always &&
StateIsStoppedState(state, true) &&
@@ -1377,12 +1380,13 @@ Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp,
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
+ log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__,
+ static_cast<const void*>(timeout));
Listener *listener = hijack_listener;
if (listener == NULL)
listener = &m_listener;
-
+
StateType state = eStateInvalid;
if (listener->WaitForEventForBroadcasterWithType (timeout,
this,
@@ -1397,8 +1401,7 @@ Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp,
if (log)
log->Printf ("Process::%s (timeout = %p, event_sp) => %s",
- __FUNCTION__,
- timeout,
+ __FUNCTION__, static_cast<const void*>(timeout),
StateAsCString(state));
return state;
}
@@ -1437,7 +1440,8 @@ Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &ev
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
+ log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__,
+ static_cast<const void*>(timeout));
StateType state = eStateInvalid;
if (m_private_state_listener.WaitForEventForBroadcasterWithType (timeout,
@@ -1451,12 +1455,9 @@ Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &ev
// to the command-line, and that could disable the log, which would render the
// log we got above invalid.
if (log)
- {
- if (state == eStateInvalid)
- log->Printf ("Process::%s (timeout = %p, event_sp) => TIMEOUT", __FUNCTION__, timeout);
- else
- log->Printf ("Process::%s (timeout = %p, event_sp) => %s", __FUNCTION__, timeout, StateAsCString(state));
- }
+ log->Printf ("Process::%s (timeout = %p, event_sp) => %s",
+ __FUNCTION__, static_cast<const void *>(timeout),
+ state == eStateInvalid ? "TIMEOUT" : StateAsCString(state));
return state;
}
@@ -1466,7 +1467,8 @@ Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
+ log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__,
+ static_cast<const void*>(timeout));
if (control_only)
return m_private_state_listener.WaitForEventForBroadcaster(timeout, &m_private_state_control_broadcaster, event_sp);
@@ -3897,7 +3899,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
{
if (log)
log->Printf ("Process::ShouldBroadcastEvent (%p) stopped due to an interrupt, state: %s",
- event_ptr,
+ static_cast<void*>(event_ptr),
StateAsCString(state));
return_value = true;
}
@@ -3905,24 +3907,22 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
{
bool was_restarted = ProcessEventData::GetRestartedFromEvent (event_ptr);
bool should_resume = false;
-
+
// It makes no sense to ask "ShouldStop" if we've already been restarted...
// Asking the thread list is also not likely to go well, since we are running again.
// So in that case just report the event.
-
+
if (!was_restarted)
should_resume = m_thread_list.ShouldStop (event_ptr) == false;
-
+
if (was_restarted || should_resume || m_resume_requested)
{
Vote stop_vote = m_thread_list.ShouldReportStop (event_ptr);
if (log)
log->Printf ("Process::ShouldBroadcastEvent: should_stop: %i state: %s was_restarted: %i stop_vote: %d.",
- should_resume,
- StateAsCString(state),
- was_restarted,
- stop_vote);
-
+ should_resume, StateAsCString(state),
+ was_restarted, stop_vote);
+
switch (stop_vote)
{
case eVoteYes:
@@ -3933,15 +3933,17 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
return_value = false;
break;
}
-
+
if (!was_restarted)
{
if (log)
- log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s", event_ptr, StateAsCString(state));
+ log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s",
+ static_cast<void*>(event_ptr),
+ StateAsCString(state));
ProcessEventData::SetRestartedInEvent(event_ptr, true);
PrivateResume ();
}
-
+
}
else
{
@@ -3952,7 +3954,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
}
break;
}
-
+
// Forcing the next event delivery is a one shot deal. So reset it here.
m_force_next_event_delivery = false;
@@ -3962,14 +3964,13 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
// because the PublicState reflects the last event pulled off the queue, and there may be several
// events stacked up on the queue unserviced. So the PublicState may not reflect the last broadcasted event
// yet. m_last_broadcast_state gets updated here.
-
+
if (return_value)
m_last_broadcast_state = state;
-
+
if (log)
log->Printf ("Process::ShouldBroadcastEvent (%p) => new state: %s, last broadcast state: %s - %s",
- event_ptr,
- StateAsCString(state),
+ static_cast<void*>(event_ptr), StateAsCString(state),
StateAsCString(m_last_broadcast_state),
return_value ? "YES" : "NO");
return return_value;
@@ -4235,7 +4236,8 @@ Process::RunPrivateStateThread ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...", __FUNCTION__, this, GetID());
+ log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...",
+ __FUNCTION__, static_cast<void*>(this), GetID());
bool exit_now = false;
while (!exit_now)
@@ -4245,7 +4247,9 @@ Process::RunPrivateStateThread ()
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__, this, GetID(), event_sp->GetType());
+ log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") got a control event: %d",
+ __FUNCTION__, static_cast<void*>(this), GetID(),
+ event_sp->GetType());
switch (event_sp->GetType())
{
@@ -4261,7 +4265,7 @@ Process::RunPrivateStateThread ()
control_only = false;
break;
}
-
+
m_private_state_control_wait.SetValue (true, eBroadcastAlways);
continue;
}
@@ -4270,13 +4274,17 @@ Process::RunPrivateStateThread ()
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__, this, GetID());
+ log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt while attaching - forwarding interrupt.",
+ __FUNCTION__, static_cast<void*>(this),
+ GetID());
BroadcastEvent (eBroadcastBitInterrupt, NULL);
}
else
{
if (log)
- log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt - Halting.", __FUNCTION__, this, GetID());
+ log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt - Halting.",
+ __FUNCTION__, static_cast<void*>(this),
+ GetID());
Halt();
}
continue;
@@ -4300,7 +4308,9 @@ Process::RunPrivateStateThread ()
internal_state == eStateDetached )
{
if (log)
- log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") about to exit with internal state %s...", __FUNCTION__, this, GetID(), StateAsCString(internal_state));
+ log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") about to exit with internal state %s...",
+ __FUNCTION__, static_cast<void*>(this), GetID(),
+ StateAsCString(internal_state));
break;
}
@@ -4308,7 +4318,8 @@ Process::RunPrivateStateThread ()
// Verify log is still enabled before attempting to write to it...
if (log)
- log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...", __FUNCTION__, this, GetID());
+ log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...",
+ __FUNCTION__, static_cast<void*>(this), GetID());
m_public_run_lock.SetStopped();
m_private_state_control_wait.SetValue (true, eBroadcastAlways);
@@ -4485,7 +4496,8 @@ void
Process::ProcessEventData::Dump (Stream *s) const
{
if (m_process_sp)
- s->Printf(" process = %p (pid = %" PRIu64 "), ", m_process_sp.get(), m_process_sp->GetID());
+ s->Printf(" process = %p (pid = %" PRIu64 "), ",
+ static_cast<void*>(m_process_sp.get()), m_process_sp->GetID());
s->Printf("state = %s", StateAsCString(GetState()));
}
@@ -4668,7 +4680,9 @@ Process::GetAsyncProfileData (char *buf, size_t buf_size, Error &error)
{
Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::GetProfileData (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
+ log->Printf ("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);
@@ -4698,7 +4712,9 @@ Process::GetSTDOUT (char *buf, size_t buf_size, Error &error)
{
Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
+ log->Printf ("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);
@@ -4724,7 +4740,9 @@ Process::GetSTDERR (char *buf, size_t buf_size, Error &error)
{
Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
- log->Printf ("Process::GetSTDERR (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
+ log->Printf ("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);
@@ -5010,19 +5028,19 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
Stream &errors)
{
ExecutionResults return_value = eExecutionSetupError;
-
+
if (thread_plan_sp.get() == NULL)
{
errors.Printf("RunThreadPlan called with empty thread plan.");
return eExecutionSetupError;
}
-
+
if (!thread_plan_sp->ValidatePlan(NULL))
{
errors.Printf ("RunThreadPlan called with an invalid thread plan.");
return eExecutionSetupError;
}
-
+
if (exe_ctx.GetProcessPtr() != this)
{
errors.Printf("RunThreadPlan called on wrong process.");
@@ -5035,20 +5053,20 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
errors.Printf("RunThreadPlan called with invalid thread.");
return eExecutionSetupError;
}
-
+
// We rely on the thread plan we are running returning "PlanCompleted" if when it successfully completes.
// For that to be true the plan can't be private - since private plans suppress themselves in the
// GetCompletedPlan call.
-
+
bool orig_plan_private = thread_plan_sp->GetPrivate();
thread_plan_sp->SetPrivate(false);
-
+
if (m_private_state.GetValue() != eStateStopped)
{
errors.Printf ("RunThreadPlan called while the private state was not stopped.");
return eExecutionSetupError;
}
-
+
// Save the thread & frame from the exe_ctx for restoration after we run
const uint32_t thread_idx_id = thread->GetIndexID();
StackFrameSP selected_frame_sp = thread->GetSelectedFrame();
@@ -5062,14 +5080,14 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
return eExecutionSetupError;
}
}
-
+
StackID ctx_frame_id = selected_frame_sp->GetStackID();
// N.B. Running the target may unset the currently selected thread and frame. We don't want to do that either,
// so we should arrange to reset them as well.
-
+
lldb::ThreadSP selected_thread_sp = GetThreadList().GetSelectedThread();
-
+
uint32_t selected_tid;
StackID selected_stack_id;
if (selected_thread_sp)
@@ -5095,7 +5113,6 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
// 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.");
-
backup_private_state_thread = m_private_state_thread;
@@ -5110,13 +5127,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
// Have to make sure our public state is stopped, since otherwise the reporting logic below doesn't work correctly.
old_state = m_public_state.GetValue();
m_public_state.SetValueNoLock(eStateStopped);
-
+
// Now spin up the private state thread:
StartPrivateStateThread(true);
}
-
+
thread->QueueThreadPlan(thread_plan_sp, false); // This used to pass "true" does that make sense?
-
+
if (options.GetDebug())
{
// In this case, we aren't actually going to run, we just want to stop right away.
@@ -5127,20 +5144,20 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
thread->Flush();
return eExecutionStoppedForDebug;
}
-
+
Listener listener("lldb.process.listener.run-thread-plan");
-
+
lldb::EventSP event_to_broadcast_sp;
-
+
{
// This process event hijacker Hijacks the Public events and its destructor makes sure that the process events get
// restored on exit to the function.
//
// If the event needs to propagate beyond the hijacker (e.g., the process exits during execution), then the event
// is put into event_to_broadcast_sp for rebroadcasting.
-
+
ProcessEventHijacker run_thread_plan_hijacker (*this, &listener);
-
+
if (log)
{
StreamString s;
@@ -5150,25 +5167,25 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
thread->GetID(),
s.GetData());
}
-
+
bool got_event;
lldb::EventSP event_sp;
lldb::StateType stop_state = lldb::eStateInvalid;
-
+
TimeValue* timeout_ptr = NULL;
TimeValue real_timeout;
-
+
bool before_first_timeout = true; // This is set to false the first time that we have to halt the target.
bool do_resume = true;
bool handle_running_event = true;
const uint64_t default_one_thread_timeout_usec = 250000;
-
+
// This is just for accounting:
uint32_t num_resumes = 0;
-
+
TimeValue one_thread_timeout = TimeValue::Now();
TimeValue final_timeout = one_thread_timeout;
-
+
uint32_t timeout_usec = options.GetTimeoutUsec();
if (!options.GetStopOthers())
@@ -5179,7 +5196,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
else if (options.GetTryAllThreads())
{
uint64_t option_one_thread_timeout = options.GetOneThreadTimeoutUsec();
-
+
// If the overall wait is forever, then we only need to set the one thread timeout:
if (timeout_usec == 0)
{
@@ -5221,22 +5238,22 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
// 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 then try to
// call the function? That's probably being too tricky for our own good.
-
+
Event *other_events = listener.PeekAtNextEvent();
if (other_events != NULL)
{
errors.Printf("Calling RunThreadPlan with pending events on the queue.");
return eExecutionSetupError;
}
-
+
// We also need to make sure that the next event is delivered. We might be calling a function as part of
// a thread plan, in which case the last delivered event could be the running event, and we don't want
// event coalescing to cause us to lose OUR running event...
ForceNextEventDelivery();
-
+
// This while loop must exit out the bottom, there's cleanup that we need to do when we are done.
// So don't call return anywhere within it.
-
+
while (1)
{
// We usually want to resume the process if we get to the top of the loop.
@@ -5247,11 +5264,11 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
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 further.
-
+
if (do_resume)
{
num_resumes++;
@@ -5265,10 +5282,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
break;
}
}
-
+
TimeValue resume_timeout = TimeValue::Now();
resume_timeout.OffsetWithMicroSeconds(500000);
-
+
got_event = listener.WaitForEvent(&resume_timeout, event_sp);
if (!got_event)
{
@@ -5280,13 +5297,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
return_value = eExecutionSetupError;
break;
}
-
+
stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
if (stop_state != eStateRunning)
{
bool restarted = false;
-
+
if (stop_state == eStateStopped)
{
restarted = Process::ProcessEventData::GetRestartedFromEvent(event_sp.get());
@@ -5299,20 +5316,20 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
do_resume,
handle_running_event);
}
-
+
if (restarted)
{
// This is probably an overabundance of caution, I don't think I should ever get a stopped & restarted
// event here. But if I do, the best thing is to Halt and then get out of here.
Halt();
}
-
+
errors.Printf("Didn't get running event after initial resume, got %s instead.",
StateAsCString(stop_state));
return_value = eExecutionSetupError;
break;
}
-
+
if (log)
log->PutCString ("Process::RunThreadPlan(): resuming succeeded.");
// We need to call the function synchronously, so spin waiting for it to return.
@@ -5326,7 +5343,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
if (log)
log->PutCString ("Process::RunThreadPlan(): waiting for next event.");
}
-
+
if (before_first_timeout)
{
if (options.GetTryAllThreads())
@@ -5346,10 +5363,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
else
timeout_ptr = &final_timeout;
}
-
+
do_resume = true;
handle_running_event = true;
-
+
// Now wait for the process to stop again:
event_sp.reset();
@@ -5366,9 +5383,9 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
log->Printf ("Process::RunThreadPlan(): about to wait forever.");
}
}
-
+
got_event = listener.WaitForEvent (timeout_ptr, event_sp);
-
+
if (got_event)
{
if (event_sp.get())
@@ -5388,7 +5405,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
if (log)
log->Printf("Process::RunThreadPlan(): in while loop, got event: %s.", StateAsCString(stop_state));
-
+
switch (stop_state)
{
case lldb::eStateStopped:
@@ -5414,17 +5431,15 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
keep_going = true;
do_resume = false;
handle_running_event = true;
-
+
}
else
{
-
StopInfoSP stop_info_sp (thread_sp->GetStopInfo ());
StopReason stop_reason = eStopReasonInvalid;
if (stop_info_sp)
stop_reason = stop_info_sp->GetStopReason();
-
-
+
// FIXME: We only check if the stop reason is plan complete, should we make sure that
// it is OUR plan that is complete?
if (stop_reason == eStopReasonPlanComplete)
@@ -5475,16 +5490,16 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
default:
if (log)
log->Printf("Process::RunThreadPlan(): execution stopped with unexpected state: %s.", StateAsCString(stop_state));
-
+
if (stop_state == eStateExited)
event_to_broadcast_sp = event_sp;
-
+
errors.Printf ("Execution stopped with unexpected state.\n");
return_value = eExecutionInterrupted;
break;
}
}
-
+
if (keep_going)
continue;
else
@@ -5503,7 +5518,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
// If we didn't get an event that means we've timed out...
// We will interrupt the process here. Depending on what we were asked to do we will
// either exit, or try with all threads running for the same timeout.
-
+
if (log) {
if (options.GetTryAllThreads())
{
@@ -5522,13 +5537,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
"abandoning execution.",
timeout_usec);
}
-
+
// It is possible that between the time we issued the Halt, and we get around to calling Halt the target
// could have stopped. That's fine, Halt will figure that out and send the appropriate Stopped event.
// BUT it is also possible that we stopped & restarted (e.g. hit a signal with "stop" set to false.) In
// that case, we'll get the stopped & restarted event, and we should go back to waiting for the Halt's
// stopped event. That's what this while loop does.
-
+
bool back_to_top = true;
uint32_t try_halt_again = 0;
bool do_halt = true;
@@ -5546,12 +5561,12 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
{
if (log)
log->PutCString ("Process::RunThreadPlan(): Halt succeeded.");
-
+
real_timeout = TimeValue::Now();
real_timeout.OffsetWithMicroSeconds(500000);
got_event = listener.WaitForEvent(&real_timeout, event_sp);
-
+
if (got_event)
{
stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
@@ -5562,12 +5577,12 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
&& Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get()))
log->PutCString (" Event was the Halt interruption event.");
}
-
+
if (stop_state == lldb::eStateStopped)
{
// Between the time we initiated the Halt and the time we delivered it, the process could have
// already finished its job. Check that here:
-
+
if (thread->IsThreadPlanDone (thread_plan_sp.get()))
{
if (log)
@@ -5577,7 +5592,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
back_to_top = false;
break;
}
-
+
if (Process::ProcessEventData::GetRestartedFromEvent(event_sp.get()))
{
if (log)
@@ -5596,7 +5611,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
back_to_top = false;
break;
}
-
+
if (before_first_timeout)
{
// Set all the other threads to run, and return to the top of the loop, which will continue;
@@ -5634,14 +5649,14 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
continue;
}
}
-
+
if (!back_to_top || try_halt_again > num_retries)
break;
else
continue;
}
} // END WAIT LOOP
-
+
// If we had to start up a temporary private state thread to run this thread plan, shut it down now.
if (IS_VALID_LLDB_HOST_THREAD(backup_private_state_thread))
{
@@ -5655,7 +5670,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
m_public_state.SetValueNoLock(old_state);
}
-
+
// Restore the thread state if we are going to discard the plan execution. There are three cases where this
// could happen:
// 1) The execution successfully completed
@@ -5663,13 +5678,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
// 3) We got some other error, and discard_on_error was true
bool should_unwind = (return_value == eExecutionInterrupted && options.DoesUnwindOnError())
|| (return_value == eExecutionHitBreakpoint && options.DoesIgnoreBreakpoints());
-
+
if (return_value == eExecutionCompleted
|| should_unwind)
{
thread_plan_sp->RestoreThreadState();
}
-
+
// Now do some processing on the results of the run:
if (return_value == eExecutionInterrupted || return_value == eExecutionHitBreakpoint)
{
@@ -5686,7 +5701,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
StreamString ts;
const char *event_explanation = NULL;
-
+
do
{
if (!event_sp)
@@ -5708,7 +5723,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
event_explanation = "<no event data>";
break;
}
-
+
Process *process = event_data->GetProcessSP().get();
if (!process)
@@ -5716,34 +5731,34 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
event_explanation = "<no process>";
break;
}
-
+
ThreadList &thread_list = process->GetThreadList();
-
+
uint32_t num_threads = thread_list.GetSize();
uint32_t thread_index;
-
+
ts.Printf("<%u threads> ", num_threads);
-
+
for (thread_index = 0;
thread_index < num_threads;
++thread_index)
{
Thread *thread = thread_list.GetThreadAtIndex(thread_index).get();
-
+
if (!thread)
{
ts.Printf("<?> ");
continue;
}
-
+
ts.Printf("<0x%4.4" PRIx64 " ", thread->GetID());
RegisterContext *register_context = thread->GetRegisterContext().get();
-
+
if (register_context)
ts.Printf("[ip 0x%" PRIx64 "] ", register_context->GetPC());
else
ts.Printf("[ip unknown] ");
-
+
lldb::StopInfoSP stop_info_sp = thread->GetStopInfo();
if (stop_info_sp)
{
@@ -5753,35 +5768,37 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
}
ts.Printf(">");
}
-
+
event_explanation = ts.GetData();
}
} while (0);
-
+
if (event_explanation)
log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s", s.GetData(), event_explanation);
else
log->Printf("Process::RunThreadPlan(): execution interrupted: %s", s.GetData());
}
-
+
if (should_unwind)
{
if (log)
- log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - discarding thread plans up to %p.", thread_plan_sp.get());
+ log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - discarding thread plans up to %p.",
+ static_cast<void*>(thread_plan_sp.get()));
thread->DiscardThreadPlansUpToPlan (thread_plan_sp);
thread_plan_sp->SetPrivate (orig_plan_private);
}
else
{
if (log)
- log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - for plan: %p not discarding.", thread_plan_sp.get());
+ log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - for plan: %p not discarding.",
+ static_cast<void*>(thread_plan_sp.get()));
}
}
else if (return_value == eExecutionSetupError)
{
if (log)
log->PutCString("Process::RunThreadPlan(): execution set up error.");
-
+
if (options.DoesUnwindOnError())
{
thread->DiscardThreadPlansUpToPlan (thread_plan_sp);
@@ -5815,7 +5832,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
}
}
}
-
+
// Thread we ran the function in may have gone away because we ran the target
// Check that it's still there, and if it is put it back in the context. Also restore the
// frame in the context if it is still present.
@@ -5824,10 +5841,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
{
exe_ctx.SetFrameSP (thread->GetFrameWithStackID (ctx_frame_id));
}
-
+
// Also restore the current process'es selected frame & thread, since this function calling may
// be done behind the user's back.
-
+
if (selected_tid != LLDB_INVALID_THREAD_ID)
{
if (GetThreadList().SetSelectedThreadByIndexID (selected_tid) && selected_stack_id.IsValid())
@@ -5840,16 +5857,16 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
}
}
}
-
+
// If the process exited during the run of the thread plan, notify everyone.
-
+
if (event_to_broadcast_sp)
{
if (log)
log->PutCString("Process::RunThreadPlan(): rebroadcasting event.");
BroadcastEvent(event_to_broadcast_sp);
}
-
+
return return_value;
}
diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp
index 82f52f9db1b..1975a868df0 100644
--- a/lldb/source/Target/SectionLoadList.cpp
+++ b/lldb/source/Target/SectionLoadList.cpp
@@ -81,19 +81,17 @@ SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP &section, addr_t l
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
ModuleSP module_sp (section->GetModule());
-
+
if (module_sp)
{
if (log)
{
const FileSpec &module_file_spec (module_sp->GetFileSpec());
log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ") module = %p",
- __FUNCTION__,
- section.get(),
+ __FUNCTION__, static_cast<void*>(section.get()),
module_file_spec.GetPath().c_str(),
- section->GetName().AsCString(),
- load_addr,
- module_sp.get());
+ section->GetName().AsCString(), load_addr,
+ static_cast<void*>(module_sp.get()));
}
if (section->GetByteSize() == 0)
@@ -155,8 +153,7 @@ SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP &section, addr_t l
if (log)
{
log->Printf ("SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64 ") error: module has been deleted",
- __FUNCTION__,
- section.get(),
+ __FUNCTION__, static_cast<void*>(section.get()),
section->GetName().AsCString(),
load_addr);
}
@@ -177,14 +174,13 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP &section_sp)
{
const FileSpec &module_file_spec (section_sp->GetModule()->GetFileSpec());
log->Printf ("SectionLoadList::%s (section = %p (%s.%s))",
- __FUNCTION__,
- section_sp.get(),
+ __FUNCTION__, static_cast<void*>(section_sp.get()),
module_file_spec.GetPath().c_str(),
section_sp->GetName().AsCString());
}
Mutex::Locker locker(m_mutex);
-
+
sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section_sp.get());
if (sta_pos != m_sect_to_addr.end())
{
@@ -209,11 +205,9 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP &section_sp, addr_t l
{
const FileSpec &module_file_spec (section_sp->GetModule()->GetFileSpec());
log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ")",
- __FUNCTION__,
- section_sp.get(),
+ __FUNCTION__, static_cast<void*>(section_sp.get()),
module_file_spec.GetPath().c_str(),
- section_sp->GetName().AsCString(),
- load_addr);
+ section_sp->GetName().AsCString(), load_addr);
}
bool erased = false;
Mutex::Locker locker(m_mutex);
@@ -223,7 +217,7 @@ SectionLoadList::SetSectionUnloaded (const lldb::SectionSP &section_sp, addr_t l
erased = true;
m_sect_to_addr.erase (sta_pos);
}
-
+
addr_to_sect_collection::iterator ats_pos = m_addr_to_sect.find(load_addr);
if (ats_pos != m_addr_to_sect.end())
{
@@ -287,7 +281,8 @@ SectionLoadList::Dump (Stream &s, Target *target)
addr_to_sect_collection::const_iterator pos, end;
for (pos = m_addr_to_sect.begin(), end = m_addr_to_sect.end(); pos != end; ++pos)
{
- s.Printf("addr = 0x%16.16" PRIx64 ", section = %p: ", pos->first, pos->second.get());
+ s.Printf("addr = 0x%16.16" PRIx64 ", section = %p: ",
+ pos->first, static_cast<void*>(pos->second.get()));
pos->second->Dump (&s, target, 0);
}
}
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index 631a77bd495..d81606a4ef7 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -491,7 +491,7 @@ StackFrameList::Dump (Stream *s)
for (pos = begin; pos != end; ++pos)
{
StackFrame *frame = (*pos).get();
- s->Printf("%p: ", frame);
+ s->Printf("%p: ", static_cast<void*>(frame));
if (frame)
{
frame->GetStackID().Dump (s);
diff --git a/lldb/source/Target/StackID.cpp b/lldb/source/Target/StackID.cpp
index 9e8c315d070..ca337f91440 100644
--- a/lldb/source/Target/StackID.cpp
+++ b/lldb/source/Target/StackID.cpp
@@ -24,11 +24,12 @@ using namespace lldb_private;
void
StackID::Dump (Stream *s)
{
- s->Printf("StackID (pc = 0x%16.16" PRIx64 ", cfa = 0x%16.16" PRIx64 ", symbol_scope = %p", (uint64_t)m_pc, (uint64_t)m_cfa, m_symbol_scope);
+ s->Printf("StackID (pc = 0x%16.16" PRIx64 ", cfa = 0x%16.16" PRIx64 ", symbol_scope = %p",
+ m_pc, m_cfa, static_cast<void*>(m_symbol_scope));
if (m_symbol_scope)
{
SymbolContext sc;
-
+
m_symbol_scope->CalculateSymbolContext (&sc);
if (sc.block)
s->Printf(" (Block {0x%8.8" PRIx64 "})", sc.block->GetID());
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index d56efc50f55..a3ba41a09e4 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -108,7 +108,6 @@ namespace lldb_private
class StopInfoBreakpoint : public StopInfo
{
public:
-
StopInfoBreakpoint (Thread &thread, break_id_t break_id) :
StopInfo (thread, break_id),
m_description(),
@@ -121,7 +120,7 @@ public:
{
StoreBPInfo();
}
-
+
StopInfoBreakpoint (Thread &thread, break_id_t break_id, bool should_stop) :
StopInfo (thread, break_id),
m_description(),
@@ -161,7 +160,7 @@ public:
virtual ~StopInfoBreakpoint ()
{
}
-
+
virtual StopReason
GetStopReason () const
{
@@ -199,7 +198,7 @@ public:
}
return false;
}
-
+
virtual bool
DoShouldNotify (Event *event_ptr)
{
@@ -252,7 +251,7 @@ public:
}
}
}
-
+
strm.Printf("breakpoint ");
bp_site_sp->GetDescription(&strm, eDescriptionLevelBrief);
m_description.swap (strm.GetString());
@@ -290,7 +289,7 @@ public:
strm.Printf("breakpoint site %" PRIi64 " which has been deleted - unknown address", m_value);
else
strm.Printf("breakpoint site %" PRIi64 " which has been deleted - was at 0x%" PRIx64, m_value, m_address);
-
+
m_description.swap (strm.GetString());
}
}
@@ -307,20 +306,20 @@ protected:
assert (m_should_stop_is_valid);
return m_should_stop;
}
-
+
virtual void
PerformAction (Event *event_ptr)
{
if (!m_should_perform_action)
return;
m_should_perform_action = false;
-
+
ThreadSP thread_sp (m_thread_wp.lock());
if (thread_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
-
+
if (!thread_sp->IsValid())
{
// This shouldn't ever happen, but just in case, don't do more harm.
@@ -332,13 +331,13 @@ protected:
m_should_stop_is_valid = true;
return;
}
-
+
BreakpointSiteSP bp_site_sp (thread_sp->GetProcess()->GetBreakpointSiteList().FindByID (m_value));
-
+
if (bp_site_sp)
{
size_t num_owners = bp_site_sp->GetNumberOfOwners();
-
+
if (num_owners == 0)
{
m_should_stop = true;
@@ -354,7 +353,7 @@ protected:
// we're going to restart, without running the rest of the callbacks. And in this case we will
// end up not stopping even if another location said we should stop. But that's better than not
// running all the callbacks.
-
+
m_should_stop = false;
ExecutionContext exe_ctx (thread_sp->GetStackFrameAtIndex(0));
@@ -367,7 +366,7 @@ protected:
// TODO: We can keep a list of the breakpoints we've seen while running expressions in the nested
// PerformAction calls that can arise when the action runs a function that hits another breakpoint,
// and only stop running commands when we see the same breakpoint hit a second time.
-
+
m_should_stop_is_valid = true;
if (log)
log->Printf ("StopInfoBreakpoint::PerformAction - Hit a breakpoint while running an expression,"
@@ -398,12 +397,12 @@ protected:
"running function, skipping commands and conditions to prevent recursion.");
return;
}
-
+
StoppointCallbackContext context (event_ptr, exe_ctx, false);
-
+
// Let's copy the breakpoint locations out of the site and store them in a local list. That way if
// one of the breakpoint actions changes the site, then we won't be operating on a bad list.
-
+
BreakpointLocationCollection site_locations;
for (size_t j = 0; j < num_owners; j++)
site_locations.Add(bp_site_sp->GetOwnerAtIndex(j));
@@ -411,11 +410,11 @@ protected:
for (size_t j = 0; j < num_owners; j++)
{
lldb::BreakpointLocationSP bp_loc_sp = site_locations.GetByIndex(j);
-
+
// If another action disabled this breakpoint or its location, then don't run the actions.
if (!bp_loc_sp->IsEnabled() || !bp_loc_sp->GetBreakpoint().IsEnabled())
continue;
-
+
// The breakpoint site may have many locations associated with it, not all of them valid for
// this thread. Skip the ones that aren't:
if (!bp_loc_sp->ValidForThisThread(thread_sp.get()))
@@ -424,18 +423,20 @@ protected:
{
StreamString s;
bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief);
- log->Printf ("Breakpoint %s hit on thread 0x%llx but it was not for this thread, continuing.", s.GetData(), thread_sp->GetID());
+ log->Printf ("Breakpoint %s hit on thread 0x%llx but it was not for this thread, continuing.",
+ s.GetData(),
+ static_cast<unsigned long long>(thread_sp->GetID()));
}
continue;
}
// First run the condition for the breakpoint. If that says we should stop, then we'll run
// the callback for the breakpoint. If the callback says we shouldn't stop that will win.
-
+
if (bp_loc_sp->GetConditionText() != NULL)
{
Error condition_error;
bool condition_says_stop = bp_loc_sp->ConditionSaysStop(exe_ctx, condition_error);
-
+
if (!condition_error.Success())
{
Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger();
@@ -448,7 +449,7 @@ protected:
const char *err_str = condition_error.AsCString("<Unknown Error>");
if (log)
log->Printf("Error evaluating condition: \"%s\"\n", err_str);
-
+
error_sp->PutCString (err_str);
error_sp->EOL();
error_sp->Flush();
@@ -459,36 +460,39 @@ protected:
{
StreamString s;
bp_loc_sp->GetDescription(&s, eDescriptionLevelBrief);
- log->Printf ("Condition evaluated for breakpoint %s on thread 0x%llx conditon_says_stop: %i.", s.GetData(), thread_sp->GetID(), condition_says_stop);
+ log->Printf ("Condition evaluated for breakpoint %s on thread 0x%llx conditon_says_stop: %i.",
+ s.GetData(),
+ static_cast<unsigned long long>(thread_sp->GetID()),
+ condition_says_stop);
}
if (!condition_says_stop)
continue;
}
}
-
+
bool callback_says_stop;
-
+
// FIXME: For now the callbacks have to run in async mode - the first time we restart we need
// to get out of there. So set it here.
// When we figure out how to nest breakpoint hits then this will change.
-
+
Debugger &debugger = thread_sp->CalculateTarget()->GetDebugger();
bool old_async = debugger.GetAsyncExecution();
debugger.SetAsyncExecution (true);
-
+
callback_says_stop = bp_loc_sp->InvokeCallback (&context);
-
+
debugger.SetAsyncExecution (old_async);
-
+
if (callback_says_stop)
m_should_stop = true;
-
+
// If we are going to stop for this breakpoint, then remove the breakpoint.
if (callback_says_stop && bp_loc_sp && bp_loc_sp->GetBreakpoint().IsOneShot())
{
thread_sp->GetProcess()->GetTarget().RemoveBreakpointByID (bp_loc_sp->GetBreakpoint().GetID());
}
-
+
// Also make sure that the callback hasn't continued the target.
// If it did, when we'll set m_should_start to false and get out of here.
if (HasTargetRunSinceMe ())
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index e9a8189814a..bbf514dff06 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -94,12 +94,12 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat
SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded");
SetEventName (eBroadcastBitWatchpointChanged, "watchpoint-changed");
SetEventName (eBroadcastBitSymbolsLoaded, "symbols-loaded");
-
+
CheckInWithManager();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Target::Target()", this);
+ log->Printf ("%p Target::Target()", static_cast<void*>(this));
if (m_arch.IsValid())
{
LogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET, "Target::Target created with architecture %s (%s)", m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
@@ -113,7 +113,7 @@ Target::~Target()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Target::~Target()", this);
+ log->Printf ("%p Target::~Target()", static_cast<void*>(this));
DeleteCurrentProcess ();
}
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 0f82617acf6..4543dc03678 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -295,7 +295,8 @@ Thread::Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id) :
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", this, GetID());
+ log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
+ static_cast<void*>(this), GetID());
CheckInWithManager();
QueueFundamentalPlan(true);
@@ -306,7 +307,8 @@ Thread::~Thread()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")", this, GetID());
+ log->Printf ("%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);
}
@@ -495,7 +497,10 @@ Thread::SetStopInfo (const lldb::StopInfoSP &stop_info_sp)
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)\n", this, GetID(), stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>", m_stop_info_stop_id);
+ log->Printf("%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)\n",
+ static_cast<void*>(this), GetID(),
+ stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
+ m_stop_info_stop_id);
}
void
@@ -743,31 +748,27 @@ bool
Thread::ShouldStop (Event* event_ptr)
{
ThreadPlan *current_plan = GetCurrentPlan();
-
+
bool should_stop = true;
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());
+ __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());
+ __FUNCTION__, GetID (), GetProtocolID());
return false;
}
-
+
// Based on the current thread plan and process stop info, check if this
// 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
@@ -776,31 +777,29 @@ Thread::ShouldStop (Event* event_ptr)
{
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(),
+ __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__,
- this,
- GetID (),
+ __FUNCTION__, static_cast<void*>(this), GetID (),
GetProtocolID (),
- GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS);
+ GetRegisterContext()
+ ? GetRegisterContext()->GetPC()
+ : LLDB_INVALID_ADDRESS);
log->Printf ("^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
StreamString s;
s.IndentMore();
DumpThreadPlans(&s);
log->Printf ("Plan stack initial state:\n%s", s.GetData());
}
-
+
// The top most plan always gets to do the trace log...
current_plan->DoTraceLog ();
-
+
// First query the stop info's ShouldStopSynchronous. This handles "synchronous" stop reasons, for example the breakpoint
// command on internal breakpoints. If a synchronous stop reason says we should not stop, then we don't have to
// do any more work on this stop.
@@ -843,15 +842,15 @@ Thread::ShouldStop (Event* event_ptr)
if (plan_ptr->PlanExplainsStop(event_ptr))
{
should_stop = plan_ptr->ShouldStop (event_ptr);
-
+
// plan_ptr explains the stop, next check whether plan_ptr is done, if so, then we should take it
// and all the plans below it off the stack.
-
+
if (plan_ptr->MischiefManaged())
{
// We're going to pop the plans up to and including the plan that explains the stop.
ThreadPlan *prev_plan_ptr = GetPreviousPlan (plan_ptr);
-
+
do
{
if (should_stop)
@@ -868,21 +867,22 @@ Thread::ShouldStop (Event* event_ptr)
}
else
done_processing_current_plan = true;
-
+
break;
}
}
}
}
-
+
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);
-
+ log->Printf("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))
{
@@ -898,10 +898,11 @@ Thread::ShouldStop (Event* event_ptr)
{
if (PlanIsBasePlan(current_plan))
break;
-
+
should_stop = current_plan->ShouldStop(event_ptr);
if (log)
- log->Printf("Plan %s should stop: %d.", current_plan->GetName(), should_stop);
+ log->Printf("Plan %s should stop: %d.",
+ current_plan->GetName(), should_stop);
if (current_plan->MischiefManaged())
{
if (should_stop)
@@ -933,7 +934,7 @@ Thread::ShouldStop (Event* event_ptr)
}
}
}
-
+
if (over_ride_stop)
should_stop = false;
@@ -941,7 +942,7 @@ Thread::ShouldStop (Event* event_ptr)
// by hitting a breakpoint during a step-over - then do some step/finish/etc operations that wind up
// past the end point condition of the initial plan. We don't want to strand the original plan on the stack,
// This code clears stale plans off the stack.
-
+
if (should_stop)
{
ThreadPlan *plan_ptr = GetCurrentPlan();
@@ -950,16 +951,17 @@ Thread::ShouldStop (Event* event_ptr)
bool stale = plan_ptr->IsPlanStale ();
ThreadPlan *examined_plan = plan_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());
+ log->Printf("Plan %s being discarded in cleanup, it says it is already done.",
+ examined_plan->GetName());
DiscardThreadPlansUpToPlan(examined_plan);
}
}
}
-
+
}
if (log)
@@ -1036,37 +1038,33 @@ Vote
Thread::ShouldReportRun (Event* event_ptr)
{
StateType thread_state = GetResumeState ();
-
+
if (thread_state == eStateSuspended
|| thread_state == eStateInvalid)
{
return eVoteNoOpinion;
}
-
+
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(),
- this,
- GetID(),
+ 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(),
- this,
- GetID(),
+ GetIndexID(), static_cast<void*>(this), GetID(),
StateAsCString(GetTemporaryResumeState()),
GetCurrentPlan()->GetName());
-
+
return GetCurrentPlan()->ShouldReportRun (event_ptr);
}
}
@@ -1089,7 +1087,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
if (!thread_plan_sp->GetThreadPlanTracer())
thread_plan_sp->SetThreadPlanTracer(m_plan_stack.back()->GetThreadPlanTracer());
m_plan_stack.push_back (thread_plan_sp);
-
+
thread_plan_sp->DidPush();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
@@ -1098,8 +1096,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
StreamString s;
thread_plan_sp->GetDescription (&s, lldb::eDescriptionLevelFull);
log->Printf("Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
- this,
- s.GetData(),
+ static_cast<void*>(this), s.GetData(),
thread_plan_sp->GetThread().GetID());
}
}
@@ -1285,15 +1282,14 @@ 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(), up_to_plan_ptr);
- }
+ log->Printf("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();
-
+
// If the input plan is NULL, discard all plans. Otherwise make sure this plan is in the
// stack, and if so discard up to and including it.
-
+
if (up_to_plan_ptr == NULL)
{
for (int i = stack_size - 1; i > 0; i--)
diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp
index 65d51bd0173..2c9b7fce7c2 100644
--- a/lldb/source/Target/ThreadPlan.cpp
+++ b/lldb/source/Target/ThreadPlan.cpp
@@ -161,16 +161,11 @@ ThreadPlan::WillResume (StateType resume_state, bool current_plan)
addr_t fp = reg_ctx->GetFP();
log->Printf("%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",
- __FUNCTION__,
- m_thread.GetIndexID(),
- &m_thread,
- m_thread.GetID(),
- (uint64_t)pc,
- (uint64_t)sp,
- (uint64_t)fp,
- m_name.c_str(),
- StateAsCString(resume_state),
- StopOthers());
+ __FUNCTION__, m_thread.GetIndexID(),
+ static_cast<void*>(&m_thread), m_thread.GetID(),
+ static_cast<uint64_t>(pc), static_cast<uint64_t>(sp),
+ static_cast<uint64_t>(fp), m_name.c_str(),
+ StateAsCString(resume_state), StopOthers());
}
}
return DoWillResume (resume_state, current_plan);
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index 0c019960703..0f2a0d32045 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -49,16 +49,16 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread,
ProcessSP process_sp (thread.GetProcess());
if (!process_sp)
return false;
-
+
abi = process_sp->GetABI().get();
-
+
if (!abi)
return false;
-
+
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
-
+
SetBreakpoints();
-
+
m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
// If we can't read memory at the point of the process where we are planning to put our function, we're
// not going to get any further...
@@ -68,17 +68,21 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread,
{
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.", this, m_constructor_errors.GetData());
+ log->Printf ("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void*>(this),
+ m_constructor_errors.GetData());
return false;
}
-
+
Module *exe_module = GetTarget().GetExecutableModulePointer();
if (exe_module == NULL)
{
m_constructor_errors.Printf ("Can't execute code without an executable module.");
if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
+ log->Printf ("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void*>(this),
+ m_constructor_errors.GetData());
return false;
}
else
@@ -90,23 +94,27 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread,
exe_module->GetFileSpec().GetFilename().AsCString());
if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
+ log->Printf ("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void*>(this),
+ m_constructor_errors.GetData());
return false;
}
-
+
m_start_addr = objectFile->GetEntryPointAddress();
if (!m_start_addr.IsValid())
{
m_constructor_errors.Printf ("Could not find entry point address for executable module \"%s\".",
exe_module->GetFileSpec().GetFilename().AsCString());
if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
+ log->Printf ("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void*>(this),
+ m_constructor_errors.GetData());
return false;
}
}
-
+
start_load_addr = m_start_addr.GetLoadAddress (&GetTarget());
-
+
// Checkpoint the thread state so we can restore it later.
if (log && log->GetVerbose())
ReportRegisterState ("About to checkpoint thread before function call. Original register state was:");
@@ -115,11 +123,13 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread,
{
m_constructor_errors.Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state.");
if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
+ log->Printf ("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void*>(this),
+ m_constructor_errors.GetData());
return false;
}
function_load_addr = m_function_addr.GetLoadAddress (&GetTarget());
-
+
return true;
}
@@ -148,16 +158,16 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
lldb::addr_t function_load_addr;
if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr))
return;
-
+
if (!abi->PrepareTrivialCall(thread,
m_function_sp,
function_load_addr,
start_load_addr,
args))
return;
-
+
ReportRegisterState ("Function call was set up. Register state was:");
-
+
m_valid = true;
}
@@ -198,15 +208,16 @@ void
ThreadPlanCallFunction::DoTakedown (bool success)
{
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
-
+
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.", this);
+ log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.",
+ static_cast<void*>(this));
return;
}
-
+
if (!m_takedown_done)
{
if (success)
@@ -220,14 +231,17 @@ ThreadPlanCallFunction::DoTakedown (bool success)
}
}
if (log)
- log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
+ 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());
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", this);
+ log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore register state",
+ static_cast<void*>(this));
}
SetPlanComplete(success);
ClearBreakpoints();
@@ -238,7 +252,9 @@ ThreadPlanCallFunction::DoTakedown (bool success)
else
{
if (log)
- log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
+ 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());
}
}
@@ -459,11 +475,12 @@ bool
ThreadPlanCallFunction::MischiefManaged ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
-
+
if (IsPlanComplete())
{
if (log)
- log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", this);
+ log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
+ static_cast<void*>(this));
ThreadPlan::MischiefManaged ();
return true;
OpenPOWER on IntegriCloud