Subversion Repositories HelenOS

Rev

Rev 2824 | Rev 2826 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2824 Rev 2825
Line 74... Line 74...
74
 
74
 
75
    ipl = interrupts_disable();
75
    ipl = interrupts_disable();
76
    ta = get_lock_callee_task(phone);
76
    ta = get_lock_callee_task(phone);
77
    klog_printf("debugging task %llu", ta->taskid);
77
    klog_printf("debugging task %llu", ta->taskid);
78
 
78
 
79
    if (ta->being_debugged != false) {
79
    if (ta->dt_state != UDEBUG_TS_INACTIVE) {
80
        spinlock_unlock(&ta->lock);
80
        spinlock_unlock(&ta->lock);
81
        interrupts_restore(ipl);
81
        interrupts_restore(ipl);
82
        klog_printf("debug_begin(): busy error");
82
        klog_printf("debug_begin(): busy error");
83
        return EBUSY;
83
        return EBUSY;
84
    }
84
    }
85
 
85
 
86
    ta->being_debugged = true;
-
 
87
    ta->stop_request = true;
86
    ta->dt_state = UDEBUG_TS_BEGINNING;
88
    ta->debug_begin_call = call;
87
    ta->debug_begin_call = call;
89
 
88
 
90
    if (ta->not_stoppable_count == 0) {
89
    if (ta->not_stoppable_count == 0) {
-
 
90
        ta->dt_state = UDEBUG_TS_ACTIVE;
91
        ta->debug_begin_call = NULL;
91
        ta->debug_begin_call = NULL;
92
        ta->stop_request = false;
-
 
93
        spinlock_unlock(&ta->lock);
92
        spinlock_unlock(&ta->lock);
94
        interrupts_restore(ipl);
93
        interrupts_restore(ipl);
95
        klog_printf("debug_begin(): immediate backsend");
94
        klog_printf("debug_begin(): immediate backsend");
96
        return 1; /* actually we need backsend with 0 retval */
95
        return 1; /* actually we need backsend with 0 retval */
97
    }
96
    }
Line 118... Line 117...
118
 
117
 
119
    t = (thread_t *) IPC_GET_ARG2(call->data);
118
    t = (thread_t *) IPC_GET_ARG2(call->data);
120
 
119
 
121
    ipl = interrupts_disable();
120
    ipl = interrupts_disable();
122
    spinlock_lock(&threads_lock);
121
    spinlock_lock(&threads_lock);
-
 
122
 
123
    if (!thread_exists(t)) {
123
    if (!thread_exists(t)) {
124
        spinlock_unlock(&threads_lock);
124
        spinlock_unlock(&threads_lock);
125
        interrupts_restore(ipl);
125
        interrupts_restore(ipl);
126
        return ENOENT;
126
        return ENOENT;
127
    }
127
    }
128
 
128
 
-
 
129
    t->debug_stop = false;
129
    waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
130
    waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
-
 
131
 
130
    spinlock_unlock(&threads_lock);
132
    spinlock_unlock(&threads_lock);
131
    interrupts_restore(ipl);
133
    interrupts_restore(ipl);
132
 
134
 
133
    return 0; /* no backsend */
135
    return 0; /* no backsend */
134
}
136
}