diff options
| author | Jim Ingham <jingham@apple.com> | 2011-01-24 06:34:17 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-01-24 06:34:17 +0000 |
| commit | 444586b5d2ccc6130de20677a5822ecd1df0fdaa (patch) | |
| tree | ed2abf9c99f41fb01208a22fbcc4b8780bff4c80 | |
| parent | 2ad6670ef1511244d8017a2dd4f3e42b3cb47c60 (diff) | |
| download | bcm5719-llvm-444586b5d2ccc6130de20677a5822ecd1df0fdaa.tar.gz bcm5719-llvm-444586b5d2ccc6130de20677a5822ecd1df0fdaa.zip | |
More useful STEP logging.
Be sure to clear out the base plan's m_report_run and m_report_stop each time we resume so we don't use stale values.
llvm-svn: 124113
| -rw-r--r-- | lldb/include/lldb/Target/ThreadPlanBase.h | 1 | ||||
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Target/Process.cpp | 25 | ||||
| -rw-r--r-- | lldb/source/Target/Thread.cpp | 20 | ||||
| -rw-r--r-- | lldb/source/Target/ThreadPlanBase.cpp | 16 | ||||
| -rw-r--r-- | lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj | 1 |
6 files changed, 57 insertions, 10 deletions
diff --git a/lldb/include/lldb/Target/ThreadPlanBase.h b/lldb/include/lldb/Target/ThreadPlanBase.h index dd2b8680c7f..f89d1d68fe9 100644 --- a/lldb/include/lldb/Target/ThreadPlanBase.h +++ b/lldb/include/lldb/Target/ThreadPlanBase.h @@ -39,6 +39,7 @@ public: virtual lldb::StateType GetPlanRunState (); virtual bool WillStop (); virtual bool MischiefManaged (); + virtual bool WillResume (lldb::StateType resume_state, bool current_plan); virtual bool IsMasterPlan() { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 6139031cefb..2e3cd68a078 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1968,8 +1968,8 @@ ProcessGDBRemote::StartDebugserverProcess ::snprintf (arg_cstr, sizeof(arg_cstr), "--log-flags=%s", env_debugserver_log_flags); debugserver_args.AppendArgument(arg_cstr); } -// debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); -// debugserver_args.AppendArgument("--log-flags=0x800e0e"); + debugserver_args.AppendArgument("--log-file=/tmp/debugserver.txt"); + debugserver_args.AppendArgument("--log-flags=0x800e0e"); // Now append the program arguments if (launch_process) diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 49eefc8302b..9e66b71c40e 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1716,7 +1716,10 @@ Process::Resume () { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); if (log) - log->Printf("Process::Resume() m_stop_id = %u", m_stop_id); + log->Printf("Process::Resume() m_stop_id = %u, public state: %s private state: %s", + m_stop_id, + StateAsCString(m_public_state.GetValue()), + StateAsCString(m_private_state.GetValue())); Error error (WillResume()); // Tell the process it is about to resume before the thread list @@ -1737,13 +1740,17 @@ Process::Resume () { DidResume(); m_thread_list.DidResume(); + if (log) + log->Printf ("Process thinks the process has resumed."); } } else { - error.SetErrorStringWithFormat("thread list returned flase after WillResume"); + error.SetErrorStringWithFormat("Process::WillResume() thread list returned false after WillResume"); } } + else if (log) + log->Printf ("Process::WillResume() got an error \"%s\".", error.AsCString("<unknown error>")); return error; } @@ -2605,6 +2612,13 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, return lldb::eExecutionSetupError; } + if (m_private_state.GetValue() != eStateStopped) + { + errors.Printf ("RunThreadPlan called while the private state was not stopped."); + // REMOVE BEAR TRAP... + // abort(); + } + // Save this value for restoration of the execution context after we run uint32_t tid = exe_ctx.thread->GetIndexID(); @@ -2629,7 +2643,10 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, Listener listener("lldb.process.listener.run-thread-plan"); exe_ctx.process->HijackProcessEvents(&listener); - + Event *random_event = listener.PeekAtNextEvent(); + // if (random_event != NULL) + // abort(); + lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); if (log) { @@ -2738,7 +2755,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.", halt_error.AsCString()); - abort(); +// abort(); if (single_thread_timeout_usec != 0) { diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 2c544a2ca5b..232bf287f63 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -351,17 +351,35 @@ Vote Thread::ShouldReportRun (Event* event_ptr) { StateType thread_state = GetResumeState (); + if (thread_state == eStateSuspended || thread_state == eStateInvalid) + { return eVoteNoOpinion; - + } + + LogSP 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 (0x%4.4x): %s being asked whether we should report run.", + GetIndexID(), + GetID(), + 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 (0x%4.4x): %s being asked whether we should report run.", + GetIndexID(), + GetID(), + GetCurrentPlan()->GetName()); + return GetCurrentPlan()->ShouldReportRun (event_ptr); + } } bool diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp index eceb383b380..b83306cb62a 100644 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -90,7 +90,8 @@ ThreadPlanBase::ShouldStop (Event *event_ptr) { case eStopReasonInvalid: case eStopReasonNone: - m_run_vote = eVoteNo; + // This + m_run_vote = eVoteNoOpinion; m_stop_vote = eVoteNo; return false; @@ -153,7 +154,7 @@ ThreadPlanBase::ShouldStop (Event *event_ptr) } else { - m_run_vote = eVoteNo; + m_run_vote = eVoteNoOpinion; m_stop_vote = eVoteNo; } @@ -179,6 +180,17 @@ ThreadPlanBase::WillStop () return true; } +bool +ThreadPlanBase::WillResume (lldb::StateType resume_state, bool current_plan) +{ + // Reset these to the default values so we don't set them wrong, then not get asked + // for a while, then return the wrong answer. + m_run_vote = eVoteNoOpinion; + m_stop_vote = eVoteNo; + return true; +} + + // The base plan is never done. bool ThreadPlanBase::MischiefManaged () diff --git a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj index 48ec502a0cf..d967f16b025 100644 --- a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj +++ b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj @@ -372,7 +372,6 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, |

