Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/udebug/udebug_ops.c

    rdfa4be62 rb169619  
    9090        }
    9191
     92        irq_spinlock_lock(&thread->lock, true);
     93
    9294        /* Verify that 'thread' is a userspace thread. */
    9395        if (!thread->uspace) {
     96                /* It's not, deny its existence */
     97                irq_spinlock_unlock(&thread->lock, true);
    9498                mutex_unlock(&TASK->udebug.lock);
    9599                return ENOENT;
    96100        }
     101
     102        /* Verify debugging state. */
     103        if (thread->udebug.active != true) {
     104                /* Not in debugging session or undesired GO state */
     105                irq_spinlock_unlock(&thread->lock, true);
     106                mutex_unlock(&TASK->udebug.lock);
     107                return ENOENT;
     108        }
     109
     110        /* Now verify that the thread belongs to the current task. */
     111        if (thread->task != TASK) {
     112                /* No such thread belonging this task */
     113                irq_spinlock_unlock(&thread->lock, true);
     114                mutex_unlock(&TASK->udebug.lock);
     115                return ENOENT;
     116        }
     117
     118        irq_spinlock_unlock(&thread->lock, true);
     119
     120        /* Only mutex TASK->udebug.lock left. */
    97121
    98122        /*
     
    102126         */
    103127        mutex_lock(&thread->udebug.lock);
    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         }
    120128
    121129        /* The big task mutex is no longer needed. */
     
    380388        /* FIXME: make sure the thread isn't past debug shutdown... */
    381389        list_foreach(TASK->threads, th_link, thread_t, thread) {
     390                irq_spinlock_lock(&thread->lock, false);
    382391                bool uspace = thread->uspace;
     392                irq_spinlock_unlock(&thread->lock, false);
    383393
    384394                /* Not interested in kernel threads. */
Note: See TracChangeset for help on using the changeset viewer.