[Lldb-commits] [lldb] r124113 - in /lldb/trunk: include/lldb/Target/ThreadPlanBase.h source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Target/Process.cpp source/Target/Thread.cpp source/Target/ThreadPlanBase.cpp tools/debugserver/debugserver.xcodeproj/project.pbxproj

Jim Ingham jingham at apple.com
Sun Jan 23 22:34:17 PST 2011


Author: jingham
Date: Mon Jan 24 00:34:17 2011
New Revision: 124113

URL: http://llvm.org/viewvc/llvm-project?rev=124113&view=rev
Log:
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.

Modified:
    lldb/trunk/include/lldb/Target/ThreadPlanBase.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanBase.cpp
    lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj

Modified: lldb/trunk/include/lldb/Target/ThreadPlanBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanBase.h?rev=124113&r1=124112&r2=124113&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanBase.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanBase.h Mon Jan 24 00:34:17 2011
@@ -39,6 +39,7 @@
     virtual lldb::StateType GetPlanRunState ();
     virtual bool WillStop ();
     virtual bool MischiefManaged ();
+    virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
 
     virtual bool IsMasterPlan()
     {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=124113&r1=124112&r2=124113&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Jan 24 00:34:17 2011
@@ -1968,8 +1968,8 @@
                 ::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)

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124113&r1=124112&r2=124113&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Jan 24 00:34:17 2011
@@ -1716,7 +1716,10 @@
 {
     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 @@
             {
                 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 @@
         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 @@
     
     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 @@
                 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)
                 {

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=124113&r1=124112&r2=124113&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Mon Jan 24 00:34:17 2011
@@ -351,17 +351,35 @@
 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

Modified: lldb/trunk/source/Target/ThreadPlanBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanBase.cpp?rev=124113&r1=124112&r2=124113&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanBase.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanBase.cpp Mon Jan 24 00:34:17 2011
@@ -90,7 +90,8 @@
         {
         case eStopReasonInvalid:
         case eStopReasonNone:
-            m_run_vote = eVoteNo;
+            // This 
+            m_run_vote = eVoteNoOpinion;
             m_stop_vote = eVoteNo;
             return false;
 
@@ -153,7 +154,7 @@
     }
     else
     {
-        m_run_vote = eVoteNo;
+        m_run_vote = eVoteNoOpinion;
         m_stop_vote = eVoteNo;
     }
 
@@ -179,6 +180,17 @@
     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 ()

Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=124113&r1=124112&r2=124113&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Jan 24 00:34:17 2011
@@ -372,7 +372,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */;
 			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,





More information about the lldb-commits mailing list