Changes in kernel/generic/src/udebug/udebug_ops.c [dfa4be62:d1582b50] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/udebug/udebug_ops.c
rdfa4be62 rd1582b50 51 51 #include <udebug/udebug.h> 52 52 #include <udebug/udebug_ops.h> 53 #include <mem w.h>53 #include <mem.h> 54 54 #include <stdlib.h> 55 55 … … 83 83 mutex_lock(&TASK->udebug.lock); 84 84 85 thread = thread_try_get(thread); 86 87 if (!thread) { 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); 88 90 mutex_unlock(&TASK->udebug.lock); 89 91 return ENOENT; 90 92 } 93 94 /* thread->lock is enough to ensure the thread's existence */ 95 irq_spinlock_exchange(&threads_lock, &thread->lock); 91 96 92 97 /* Verify that 'thread' is a userspace thread. */ 93 98 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.lock 115 * is enough to ensure its existence and that active remains 116 * 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 */ 94 126 mutex_unlock(&TASK->udebug.lock); 95 127 return ENOENT; … … 103 135 mutex_lock(&thread->udebug.lock); 104 136 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 121 137 /* The big task mutex is no longer needed. */ 122 138 mutex_unlock(&TASK->udebug.lock); … … 137 153 { 138 154 mutex_unlock(&thread->udebug.lock); 139 140 /* Drop reference from _thread_op_begin() */141 thread_put(thread);142 155 } 143 156 … … 268 281 * 269 282 */ 270 waitq_wake _all(&thread->udebug.go_wq);283 waitq_wakeup(&thread->udebug.go_wq, WAKEUP_FIRST); 271 284 272 285 _thread_op_end(thread); … … 380 393 /* FIXME: make sure the thread isn't past debug shutdown... */ 381 394 list_foreach(TASK->threads, th_link, thread_t, thread) { 395 irq_spinlock_lock(&thread->lock, false); 382 396 bool uspace = thread->uspace; 397 irq_spinlock_unlock(&thread->lock, false); 383 398 384 399 /* Not interested in kernel threads. */
Note:
See TracChangeset
for help on using the changeset viewer.