[Lldb-commits] [lldb] r116674 - /lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp

Greg Clayton gclayton at apple.com
Sat Oct 16 11:11:41 PDT 2010


Author: gclayton
Date: Sat Oct 16 13:11:41 2010
New Revision: 116674

URL: http://llvm.org/viewvc/llvm-project?rev=116674&view=rev
Log:
Fixed an issue with MachTask::TaskResume () where if the task was already
suspended, we would call "int ::task_resume (task_t task);" as many times as
it took to resume the task which isn't what we want to do.


Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp?rev=116674&r1=116673&r2=116674&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp Sat Oct 16 13:11:41 2010
@@ -86,14 +86,18 @@
 {
     struct task_basic_info task_info;
     task_t task = TaskPort();
+	if (task == TASK_NULL)
+		return KERN_INVALID_ARGUMENT;
 
     DNBError err;
     err = BasicInfo(task, &task_info);
 
     if (err.Success())
     {
-        integer_t i;
-        for (i=0; i<task_info.suspend_count; i++)
+		// task_resume isn't counted like task_suspend calls are, are, so if the 
+		// task is not suspended, don't try and resume it since it is already 
+		// running
+		if (task_info.suspend_count > 0)
         {
             err = ::task_resume (task);
             if (DNBLogCheckLogBit(LOG_TASK) || err.Fail())





More information about the lldb-commits mailing list