Changes in kernel/generic/src/udebug/udebug_ops.c [d1582b50:dfa4be62] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/udebug/udebug_ops.c
rd1582b50 rdfa4be62 51 51 #include <udebug/udebug.h> 52 52 #include <udebug/udebug_ops.h> 53 #include <mem .h>53 #include <memw.h> 54 54 #include <stdlib.h> 55 55 … … 83 83 mutex_lock(&TASK->udebug.lock); 84 84 85 /* thread_exists() must be called with threads_lock held */ 86 irq_spinlock_lock(&threads_lock, true); 87 88 if (!thread_exists(thread)) { 89 irq_spinlock_unlock(&threads_lock, true); 85 thread = thread_try_get(thread); 86 87 if (!thread) { 90 88 mutex_unlock(&TASK->udebug.lock); 91 89 return ENOENT; 92 90 } 93 94 /* thread->lock is enough to ensure the thread's existence */95 irq_spinlock_exchange(&threads_lock, &thread->lock);96 91 97 92 /* Verify that 'thread' is a userspace thread. */ 98 93 if (!thread->uspace) { 99 /* It's not, deny its existence */100 irq_spinlock_unlock(&thread->lock, true);101 mutex_unlock(&TASK->udebug.lock);102 return ENOENT;103 }104 105 /* Verify debugging state. */106 if (thread->udebug.active != true) {107 /* Not in debugging session or undesired GO state */108 irq_spinlock_unlock(&thread->lock, true);109 mutex_unlock(&TASK->udebug.lock);110 return ENOENT;111 }112 113 /*114 * Since the thread has active == true, TASK->udebug.lock115 * is enough to ensure its existence and that active remains116 * true.117 *118 */119 irq_spinlock_unlock(&thread->lock, true);120 121 /* Only mutex TASK->udebug.lock left. */122 123 /* Now verify that the thread belongs to the current task. */124 if (thread->task != TASK) {125 /* No such thread belonging this task */126 94 mutex_unlock(&TASK->udebug.lock); 127 95 return ENOENT; … … 135 103 mutex_lock(&thread->udebug.lock); 136 104 105 /* Verify debugging state. */ 106 if (thread->udebug.active != true) { 107 /* Not in debugging session or undesired GO state */ 108 mutex_unlock(&thread->udebug.lock); 109 mutex_unlock(&TASK->udebug.lock); 110 return ENOENT; 111 } 112 113 /* Now verify that the thread belongs to the current task. */ 114 if (thread->task != TASK) { 115 /* No such thread belonging this task */ 116 mutex_unlock(&thread->udebug.lock); 117 mutex_unlock(&TASK->udebug.lock); 118 return ENOENT; 119 } 120 137 121 /* The big task mutex is no longer needed. */ 138 122 mutex_unlock(&TASK->udebug.lock); … … 153 137 { 154 138 mutex_unlock(&thread->udebug.lock); 139 140 /* Drop reference from _thread_op_begin() */ 141 thread_put(thread); 155 142 } 156 143 … … 281 268 * 282 269 */ 283 waitq_wake up(&thread->udebug.go_wq, WAKEUP_FIRST);270 waitq_wake_all(&thread->udebug.go_wq); 284 271 285 272 _thread_op_end(thread); … … 393 380 /* FIXME: make sure the thread isn't past debug shutdown... */ 394 381 list_foreach(TASK->threads, th_link, thread_t, thread) { 395 irq_spinlock_lock(&thread->lock, false);396 382 bool uspace = thread->uspace; 397 irq_spinlock_unlock(&thread->lock, false);398 383 399 384 /* Not interested in kernel threads. */
Note:
See TracChangeset
for help on using the changeset viewer.