diff options
author | Greg Clayton <gclayton@apple.com> | 2011-01-25 02:58:48 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-01-25 02:58:48 +0000 |
commit | 414f5d3fe8c28ade7394930159e74a72aa7eba72 (patch) | |
tree | d5542c795624eb06a0eaa809603dc31f9b6be348 | |
parent | 0c2706823e22af895844fca14dab528c4f95d044 (diff) | |
download | bcm5719-llvm-414f5d3fe8c28ade7394930159e74a72aa7eba72.tar.gz bcm5719-llvm-414f5d3fe8c28ade7394930159e74a72aa7eba72.zip |
Fixed ProcessGDBRemote to kill the process correctly when it is either running
or stopped.
Added support for sections to be able to state if they are encrypted or not.
llvm-svn: 124171
-rw-r--r-- | lldb/include/lldb/Core/Broadcaster.h | 8 | ||||
-rw-r--r-- | lldb/include/lldb/Core/Section.h | 15 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 43 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 84 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 4 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 63 |
7 files changed, 113 insertions, 112 deletions
diff --git a/lldb/include/lldb/Core/Broadcaster.h b/lldb/include/lldb/Core/Broadcaster.h index 078aa36d47b..7ff9e207bed 100644 --- a/lldb/include/lldb/Core/Broadcaster.h +++ b/lldb/include/lldb/Core/Broadcaster.h @@ -222,6 +222,14 @@ protected: bool HijackBroadcaster (Listener *listener, uint32_t event_mask = UINT32_MAX); + bool + IsHijackedForEvent (uint32_t event_mask) + { + if (m_hijacking_listener) + return (event_mask & m_hijacking_mask) != 0; + return false; + } + //------------------------------------------------------------------ /// Restore the state of the Broadcaster from a previous hijack attempt. /// diff --git a/lldb/include/lldb/Core/Section.h b/lldb/include/lldb/Core/Section.h index 916f0745850..e15ef890da8 100644 --- a/lldb/include/lldb/Core/Section.h +++ b/lldb/include/lldb/Core/Section.h @@ -213,6 +213,18 @@ public: { m_fake = fake; } + + bool + IsEncrypted () const + { + return m_encrypted; + } + + void + SetIsEncrypted (bool b) + { + m_encrypted = b; + } bool IsDescendant (const Section *section); @@ -273,10 +285,11 @@ protected: uint64_t m_file_offset; // Object file offset (if any) uint64_t m_file_size; // Object file size (can be smaller than m_byte_size for zero filled sections...) SectionList m_children; // Child sections - bool m_fake; // If true, then this section only can contain the address if one of its + bool m_fake:1, // If true, then this section only can contain the address if one of its // children contains an address. This allows for gaps between the children // that are contained in the address range for this section, but do not produce // hits unless the children contain the address. + m_encrypted:1; // Set to true if the contents are encrypted const Section * m_linked_section; uint64_t m_linked_offset; private: diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 0e82a15f391..7b045ab8395 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -251,6 +251,9 @@ ObjectFileMachO::ParseSections () load_cmd.filesize = m_data.GetAddress(&offset); if (m_data.GetU32(&offset, &load_cmd.maxprot, 4)) { + + const bool segment_is_encrypted = (load_cmd.flags & SegmentCommandFlagBitProtectedVersion1) != 0; + // Keep a list of mach segments around in case we need to // get at data that isn't stored in the abstracted Sections. m_mach_segments.push_back (load_cmd); @@ -272,6 +275,7 @@ ObjectFileMachO::ParseSections () load_cmd.filesize, // Size in bytes of this section as found in the the file load_cmd.flags)); // Flags for this section + segment_sp->SetIsEncrypted (segment_is_encrypted); m_sections_ap->AddSection(segment_sp); } @@ -369,6 +373,7 @@ ObjectFileMachO::ParseSections () load_cmd.flags)); // Flags for this section segment_sp->SetIsFake(true); m_sections_ap->AddSection(segment_sp); + segment_sp->SetIsEncrypted (segment_is_encrypted); } } assert (segment_sp.get()); @@ -482,6 +487,9 @@ ObjectFileMachO::ParseSections () sect64.offset, sect64.offset == 0 ? 0 : sect64.size, sect64.flags)); + // Set the section to be encrypted to match the segment + section_sp->SetIsEncrypted (segment_is_encrypted); + segment_sp->GetChildren().AddSection(section_sp); if (segment_sp->IsFake()) diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index a779db25756..aa100840936 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -151,7 +151,7 @@ GDBRemoteCommunication::SendPacketAndWaitForResponse bool timed_out = false; bool sent_interrupt = false; - if (SendInterrupt(locker, 1, sent_interrupt, timed_out)) + if (SendInterrupt(locker, 2, sent_interrupt, timed_out)) { if (m_async_packet_predicate.WaitForValueEqualTo (false, &timeout_time, &timed_out)) { @@ -206,7 +206,6 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse ) { LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); - LogSP async_log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC)); if (log) log->Printf ("GDBRemoteCommunication::%s ()", __FUNCTION__); @@ -222,21 +221,18 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse while (state == eStateRunning) { - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...)", __FUNCTION__); if (WaitForPacket (response, (TimeValue*)NULL)) { - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); - async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC); if (response.Empty()) state = eStateInvalid; else { const char stop_type = response.GetChar(); if (log) - log->Printf ("GDBRemoteCommunication::%s () got '%c' packet", __FUNCTION__, stop_type); + log->Printf ("GDBRemoteCommunication::%s () got packet: %s", __FUNCTION__, response.GetStringRef().c_str()); switch (stop_type) { case 'T': @@ -248,8 +244,8 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse m_private_is_running.SetValue (false, eBroadcastAlways); if (m_async_signal != -1) { - if (async_log) - async_log->Printf ("async: send signo = %s", Host::GetSignalAsCString (m_async_signal)); + if (log) + log->Printf ("async: send signo = %s", Host::GetSignalAsCString (m_async_signal)); // Save off the async signal we are supposed to send const int async_signal = m_async_signal; @@ -260,8 +256,8 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse uint8_t signo = response.GetHexU8(255); if (signo == async_signal) { - if (async_log) - async_log->Printf ("async: stopped with signal %s, we are done running", Host::GetSignalAsCString (signo)); + if (log) + log->Printf ("async: stopped with signal %s, we are done running", Host::GetSignalAsCString (signo)); // We already stopped with a signal that we wanted // to stop with, so we are done @@ -279,15 +275,15 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse "C%2.2x", async_signal); - if (async_log) - async_log->Printf ("async: stopped with signal %s, resume with %s", + if (log) + log->Printf ("async: stopped with signal %s, resume with %s", Host::GetSignalAsCString (signo), Host::GetSignalAsCString (async_signal)); if (SendPacket(signal_packet, signal_packet_len) == 0) { - if (async_log) - async_log->Printf ("async: error: failed to resume with %s", + if (log) + log->Printf ("async: error: failed to resume with %s", Host::GetSignalAsCString (async_signal)); state = eStateExited; break; @@ -301,9 +297,9 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse } else if (m_async_packet_predicate.GetValue()) { - if (async_log) - async_log->Printf ("async: send async packet: %s", - m_async_packet.c_str()); + if (log) + log->Printf ("async: send async packet: %s", + m_async_packet.c_str()); // We are supposed to send an asynchronous packet while // we are running. @@ -320,9 +316,9 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse // packet know that the packet has been sent. m_async_packet_predicate.SetValue(false, eBroadcastAlways); - if (async_log) - async_log->Printf ("async: resume after async response received: %s", - m_async_response.GetStringRef().c_str()); + if (log) + log->Printf ("async: resume after async response received: %s", + m_async_response.GetStringRef().c_str()); // Continue again if (SendPacket("c", 1) == 0) @@ -342,6 +338,7 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse break; case 'W': + case 'X': // process exited state = eStateExited; break; @@ -365,20 +362,18 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse default: if (log) - log->Printf ("GDBRemoteCommunication::%s () got unrecognized async packet: '%s'", __FUNCTION__, stop_type); + log->Printf ("GDBRemoteCommunication::%s () unrecognized async packet", __FUNCTION__); break; } } } else { - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...) => false", __FUNCTION__); state = eStateInvalid; } } - log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () => %s", __FUNCTION__, StateAsCString(state)); response.SetFilePos(0); @@ -498,7 +493,7 @@ GDBRemoteCommunication::SendInterrupt timeout = TimeValue::Now(); timeout.OffsetWithSeconds (seconds_to_wait_for_stop); } - ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: \\x03"); + ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS | GDBR_LOG_PROCESS, "send packet: \\x03"); if (Write (&ctrl_c, 1, status, NULL) > 0) { sent_interrupt = true; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 6139031cefb..b601d2c31d7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1175,7 +1175,6 @@ ProcessGDBRemote::InterruptIfRunning ( bool discard_thread_plans, bool catch_stop_event, - bool resume_private_state_thread, EventSP &stop_event_sp ) { @@ -1183,21 +1182,14 @@ ProcessGDBRemote::InterruptIfRunning LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); + bool paused_private_state_thread = false; const bool is_running = m_gdb_comm.IsRunning(); if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning(discard_thread_plans=%i, catch_stop_event=%i, resume_private_state_thread=%i) is_running=%i", + log->Printf ("ProcessGDBRemote::InterruptIfRunning(discard_thread_plans=%i, catch_stop_event=%i) is_running=%i", discard_thread_plans, - catch_stop_event, - resume_private_state_thread, + catch_stop_event, is_running); - if (catch_stop_event) - { - if (log) - log->Printf ("ProcessGDBRemote::InterruptIfRunning() pausing private state thread"); - PausePrivateStateThread(); - } - if (discard_thread_plans) { if (log) @@ -1206,6 +1198,14 @@ ProcessGDBRemote::InterruptIfRunning } if (is_running) { + if (catch_stop_event) + { + if (log) + log->Printf ("ProcessGDBRemote::InterruptIfRunning() pausing private state thread"); + PausePrivateStateThread(); + paused_private_state_thread = true; + } + bool timed_out = false; bool sent_interrupt = false; Mutex::Locker locker; @@ -1217,17 +1217,18 @@ ProcessGDBRemote::InterruptIfRunning error.SetErrorString("timed out sending interrupt packet"); else error.SetErrorString("unknown error sending interrupt packet"); - if (catch_stop_event) + if (paused_private_state_thread) ResumePrivateStateThread(); return error; } if (catch_stop_event) { + // LISTEN HERE TimeValue timeout_time; timeout_time = TimeValue::Now(); - timeout_time.OffsetWithSeconds(1); - StateType state = WaitForProcessStopPrivate (&timeout_time, stop_event_sp); + timeout_time.OffsetWithSeconds(5); + StateType state = WaitForStateChangedEventsPrivate (&timeout_time, stop_event_sp); const bool timed_out = state == eStateInvalid; if (log) @@ -1237,7 +1238,7 @@ ProcessGDBRemote::InterruptIfRunning error.SetErrorString("unable to verify target stopped"); } - if (catch_stop_event && resume_private_state_thread) + if (paused_private_state_thread) { if (log) log->Printf ("ProcessGDBRemote::InterruptIfRunning() resuming private state thread"); @@ -1256,9 +1257,8 @@ ProcessGDBRemote::WillDetach () bool discard_thread_plans = true; bool catch_stop_event = true; - bool resume_private_state_thread = false; // DoDetach will resume the thread EventSP event_sp; - return InterruptIfRunning (discard_thread_plans, catch_stop_event, resume_private_state_thread, event_sp); + return InterruptIfRunning (discard_thread_plans, catch_stop_event, event_sp); } Error @@ -1295,21 +1295,6 @@ ProcessGDBRemote::DoDetach() } Error -ProcessGDBRemote::WillDestroy () -{ - LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); - if (log) - log->Printf ("ProcessGDBRemote::WillDestroy()"); - bool discard_thread_plans = true; - bool catch_stop_event = true; - bool resume_private_state_thread = true; - EventSP event_sp; - return InterruptIfRunning (discard_thread_plans, catch_stop_event, resume_private_state_thread, event_sp); - - -} - -Error ProcessGDBRemote::DoDestroy () { Error error; @@ -1320,38 +1305,11 @@ ProcessGDBRemote::DoDestroy () // Interrupt if our inferior is running... if (m_gdb_comm.IsConnected()) { - m_continue_packet.Clear(); - m_continue_packet.Printf("k"); - Listener listener ("gdb-remote.kill-packet-sent"); - if (listener.StartListeningForEvents (&m_gdb_comm, GDBRemoteCommunication::eBroadcastBitRunPacketSent)) + StringExtractorGDBRemote response; + bool send_async = true; + if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, 3, send_async) == 0) { - EventSP event_sp; - TimeValue timeout; - timeout = TimeValue::Now(); - timeout.OffsetWithSeconds (1); - m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (m_continue_packet.GetData(), m_continue_packet.GetSize())); - - // Wait for the async thread to send the "k" packet - if (listener.WaitForEvent (&timeout, event_sp)) - { - if (log) - log->Printf ("ProcessGDBRemote::DoDestroy() got confirmation the \"k\" packet was sent"); - } - else - { - if (log) - log->Printf ("ProcessGDBRemote::DoDestroy() timed out waiting for \"k\" packet to be sent"); - error.SetErrorString("Resume timed out."); - } - - // Wait for the async thread to exit which will indicate we stopped. - // Hopefully the stop will be a process exited state since we are - // asking the process to go away. - if (!m_gdb_comm.WaitForNotRunning (&timeout)) - { - if (log) - log->Printf ("ProcessGDBRemote::DoDestroy() timed out waiting for \"k\" stop reply packet"); - } + error.SetErrorString("kill packet failed"); } } StopAsyncThread (); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 8c8f1a8a9af..6fa5ab7a752 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -150,9 +150,6 @@ public: DoSignal (int signal); virtual lldb_private::Error - WillDestroy (); - - virtual lldb_private::Error DoDestroy (); virtual void @@ -392,7 +389,6 @@ protected: lldb_private::Error InterruptIfRunning (bool discard_thread_plans, bool catch_stop_event, - bool resume_private_state_thread, lldb::EventSP &stop_event_sp); private: diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 3999f150bba..ecf8ef1ba57 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -555,9 +555,20 @@ Process::GetExitDescription () bool Process::SetExitStatus (int status, const char *cstr) { + LogSP 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 ? "\"" : ""); + // We were already in the exited state if (m_private_state.GetValue() == eStateExited) + { + log->Printf("Process::SetExitStatus () ignoring exit status because state was already set to eStateExited"); return false; + } m_exit_status = status; if (cstr) @@ -621,7 +632,7 @@ Process::GetState() void Process::SetPublicState (StateType new_state) { - LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE)); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::SetPublicState (%s)", StateAsCString(new_state)); m_public_state.SetValue (new_state); @@ -636,7 +647,7 @@ Process::GetPrivateState () void Process::SetPrivateState (StateType new_state) { - LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE)); + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); bool state_changed = false; if (log) @@ -2111,19 +2122,22 @@ void Process::HandlePrivateEvent (EventSP &event_sp) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); - const StateType internal_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); + const StateType new_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); // See if we should broadcast this state to external clients? const bool should_broadcast = ShouldBroadcastEvent (event_sp.get()); - if (log) - log->Printf ("Process::%s (arg = %p, pid = %i) got event '%s' broadcast = %s", __FUNCTION__, this, GetID(), StateAsCString(internal_state), should_broadcast ? "yes" : "no"); if (should_broadcast) { if (log) { - log->Printf ("\tChanging public state from: %s to %s", StateAsCString(GetState ()), StateAsCString (internal_state)); + log->Printf ("Process::%s (pid = %i) broadcasting new state %s (old state %s) to %s", + __FUNCTION__, + GetID(), + StateAsCString(new_state), + StateAsCString (GetState ()), + IsHijackedForEvent(eBroadcastBitStateChanged) ? "hijacked" : "public"); } - if (StateIsRunningState (internal_state)) + if (StateIsRunningState (new_state)) PushProcessInputReader (); else PopProcessInputReader (); @@ -2134,7 +2148,12 @@ Process::HandlePrivateEvent (EventSP &event_sp) { if (log) { - log->Printf ("\tNot changing public state with event: %s", StateAsCString (internal_state)); + log->Printf ("Process::%s (pid = %i) suppressing state %s (old state %s): should_broadcast == false", + __FUNCTION__, + GetID(), + StateAsCString(new_state), + StateAsCString (GetState ()), + IsHijackedForEvent(eBroadcastBitStateChanged) ? "hijacked" : "public"); } } } @@ -2649,7 +2668,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, { StreamString s; thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - log->Printf ("Resuming thread %u - 0x%4.4x to run thread plan \"%s\".", exe_ctx.thread->GetIndexID(), exe_ctx.thread->GetID(), s.GetData()); + log->Printf ("Process::RunThreadPlan(): Resuming thread %u - 0x%4.4x to run thread plan \"%s\".", exe_ctx.thread->GetIndexID(), exe_ctx.thread->GetID(), s.GetData()); } Error resume_error = exe_ctx.process->Resume (); @@ -2690,10 +2709,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, // Not really sure what to do if Halt fails here... if (log) { if (try_all_threads) - log->Printf ("Running function with timeout: %d timed out, trying with all threads enabled.", + log->Printf ("Process::RunThreadPlan(): Running function with timeout: %d timed out, trying with all threads enabled.", single_thread_timeout_usec); else - log->Printf ("Running function with timeout: %d timed out, abandoning execution.", + log->Printf ("Process::RunThreadPlan(): Running function with timeout: %d timed out, abandoning execution.", single_thread_timeout_usec); } @@ -2703,7 +2722,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, { timeout_ptr = NULL; if (log) - log->Printf ("Halt succeeded."); + log->Printf ("Process::RunThreadPlan(): Halt succeeded."); // Between the time that we got the timeout and the time we halted, but target // might have actually completed the plan. If so, we're done. Note, I call WFE here with a short @@ -2715,7 +2734,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); if (log) { - log->Printf ("Stopped with event: %s", StateAsCString(stop_state)); + log->Printf ("Process::RunThreadPlan(): Stopped with event: %s", StateAsCString(stop_state)); if (stop_state == lldb::eStateStopped && Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get())) log->Printf (" Event was the Halt interruption event."); } @@ -2723,7 +2742,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, if (exe_ctx.thread->IsThreadPlanDone (thread_plan_sp.get())) { if (log) - log->Printf ("Even though we timed out, the call plan was done. Exiting wait loop."); + log->Printf ("Process::RunThreadPlan(): Even though we timed out, the call plan was done. Exiting wait loop."); return_value = lldb::eExecutionCompleted; break; } @@ -2734,7 +2753,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, thread_plan_sp->SetStopOthers (false); if (log) - log->Printf ("About to resume."); + log->Printf ("Process::RunThreadPlan(): About to resume."); exe_ctx.process->Resume(); continue; @@ -2750,7 +2769,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, { if (log) - log->Printf ("Halt failed: \"%s\", I'm just going to wait a little longer and see if the world gets nicer to me.", + log->Printf ("Process::RunThreadPlan(): halt failed: error = \"%s\", I'm just going to wait a little longer and see if the world gets nicer to me.", halt_error.AsCString()); // abort(); @@ -2767,18 +2786,22 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); if (log) - log->Printf("Got event: %s.", StateAsCString(stop_state)); + log->Printf("Process::RunThreadPlan(): got event: %s.", StateAsCString(stop_state)); if (stop_state == lldb::eStateRunning || stop_state == lldb::eStateStepping) continue; if (exe_ctx.thread->IsThreadPlanDone (thread_plan_sp.get())) { + if (log) + log->Printf("Process::RunThreadPlan(): thread plan is done"); return_value = lldb::eExecutionCompleted; break; } else if (exe_ctx.thread->WasThreadPlanDiscarded (thread_plan_sp.get())) { + if (log) + log->Printf("Process::RunThreadPlan(): thread plan was discarded"); return_value = lldb::eExecutionDiscarded; break; } @@ -2791,7 +2814,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, event_sp->Dump (&s); else { - log->Printf ("Stop event that interrupted us is NULL."); + log->Printf ("Process::RunThreadPlan(): Stop event that interrupted us is NULL."); } StreamString ts; @@ -2860,7 +2883,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, if (!GetThreadList().ShouldStop(event_sp.get())) { if (log) - log->Printf("Execution interrupted, but nobody wanted to stop, so we continued: %s %s", + log->Printf("Process::RunThreadPlan(): execution interrupted, but nobody wanted to stop, so we continued: %s %s", s.GetData(), event_explanation); if (single_thread_timeout_usec != 0) { @@ -2874,7 +2897,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, else { if (log) - log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation); + log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s", s.GetData(), event_explanation); } } |