Changeset 8565a42 in mainline for kernel/generic/src/udebug/udebug.c


Ignore:
Timestamp:
2018-03-02T20:34:50Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

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

    r3061bc1 r8565a42  
    7575        waitq_initialize(&ut->go_wq);
    7676        condvar_initialize(&ut->active_cv);
    77        
     77
    7878        ut->go_call = NULL;
    7979        ut->uspace_state = NULL;
     
    9696{
    9797        ipl_t ipl = waitq_sleep_prepare(wq);
    98        
     98
    9999        wq->missed_wakeups = 0;  /* Enforce blocking. */
    100100        bool blocked;
     
    119119        assert(THREAD);
    120120        assert(TASK);
    121        
     121
    122122        mutex_lock(&TASK->udebug.lock);
    123        
     123
    124124        int nsc = --TASK->udebug.not_stoppable_count;
    125        
     125
    126126        /* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
    127127        mutex_lock(&THREAD->udebug.lock);
    128128        assert(THREAD->udebug.stoppable == false);
    129129        THREAD->udebug.stoppable = true;
    130        
     130
    131131        if ((TASK->udebug.dt_state == UDEBUG_TS_BEGINNING) && (nsc == 0)) {
    132132                /*
     
    135135                 *
    136136                 */
    137                
     137
    138138                call_t *db_call = TASK->udebug.begin_call;
    139139                assert(db_call);
    140                
     140
    141141                TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
    142142                TASK->udebug.begin_call = NULL;
    143                
     143
    144144                IPC_SET_RETVAL(db_call->data, 0);
    145145                ipc_answer(&TASK->answerbox, db_call);
     
    148148                 * Active debugging session
    149149                 */
    150                
     150
    151151                if (THREAD->udebug.active == true &&
    152152                    THREAD->udebug.go == false) {
     
    155155                         *
    156156                         */
    157                        
     157
    158158                        /* Make sure nobody takes this call away from us */
    159159                        call_t *go_call = THREAD->udebug.go_call;
    160160                        THREAD->udebug.go_call = NULL;
    161161                        assert(go_call);
    162                        
     162
    163163                        IPC_SET_RETVAL(go_call->data, 0);
    164164                        IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP);
    165                        
     165
    166166                        THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
    167167                        ipc_answer(&TASK->answerbox, go_call);
    168168                }
    169169        }
    170        
     170
    171171        mutex_unlock(&THREAD->udebug.lock);
    172172        mutex_unlock(&TASK->udebug.lock);
     
    185185        mutex_lock(&TASK->udebug.lock);
    186186        mutex_lock(&THREAD->udebug.lock);
    187        
     187
    188188        if ((THREAD->udebug.active) && (THREAD->udebug.go == false)) {
    189189                mutex_unlock(&THREAD->udebug.lock);
    190190                mutex_unlock(&TASK->udebug.lock);
    191                
     191
    192192                udebug_wait_for_go(&THREAD->udebug.go_wq);
    193                
     193
    194194                goto restart;
    195195                /* Must try again - have to lose stoppability atomically. */
     
    198198                assert(THREAD->udebug.stoppable == true);
    199199                THREAD->udebug.stoppable = false;
    200                
     200
    201201                mutex_unlock(&THREAD->udebug.lock);
    202202                mutex_unlock(&TASK->udebug.lock);
     
    228228        udebug_event_t etype =
    229229            end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B;
    230        
     230
    231231        mutex_lock(&TASK->udebug.lock);
    232232        mutex_lock(&THREAD->udebug.lock);
    233        
     233
    234234        /* Must only generate events when in debugging session and is go. */
    235235        if (THREAD->udebug.active != true || THREAD->udebug.go == false ||
     
    239239                return;
    240240        }
    241        
     241
    242242        /* Fill in the GO response. */
    243243        call_t *call = THREAD->udebug.go_call;
    244244        THREAD->udebug.go_call = NULL;
    245        
     245
    246246        IPC_SET_RETVAL(call->data, 0);
    247247        IPC_SET_ARG1(call->data, etype);
    248248        IPC_SET_ARG2(call->data, id);
    249249        IPC_SET_ARG3(call->data, rc);
    250        
     250
    251251        THREAD->udebug.syscall_args[0] = a1;
    252252        THREAD->udebug.syscall_args[1] = a2;
     
    255255        THREAD->udebug.syscall_args[4] = a5;
    256256        THREAD->udebug.syscall_args[5] = a6;
    257        
     257
    258258        /*
    259259         * Make sure udebug.go is false when going to sleep
     
    264264        THREAD->udebug.go = false;
    265265        THREAD->udebug.cur_event = etype;
    266        
     266
    267267        ipc_answer(&TASK->answerbox, call);
    268        
     268
    269269        mutex_unlock(&THREAD->udebug.lock);
    270270        mutex_unlock(&TASK->udebug.lock);
    271        
     271
    272272        udebug_wait_for_go(&THREAD->udebug.go_wq);
    273273}
     
    294294        mutex_lock(&TASK->udebug.lock);
    295295        mutex_lock(&THREAD->udebug.lock);
    296        
     296
    297297        thread_attach(thread, task);
    298        
     298
    299299        LOG("Check state");
    300        
     300
    301301        /* Must only generate events when in debugging session */
    302302        if (THREAD->udebug.active != true) {
     
    304304                    THREAD->udebug.active ? "Yes(+)" : "No",
    305305                    THREAD->udebug.go ? "Yes(-)" : "No");
    306                
     306
    307307                mutex_unlock(&THREAD->udebug.lock);
    308308                mutex_unlock(&TASK->udebug.lock);
    309309                return;
    310310        }
    311        
     311
    312312        LOG("Trigger event");
    313        
     313
    314314        call_t *call = THREAD->udebug.go_call;
    315        
     315
    316316        THREAD->udebug.go_call = NULL;
    317317        IPC_SET_RETVAL(call->data, 0);
    318318        IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
    319319        IPC_SET_ARG2(call->data, (sysarg_t) thread);
    320        
     320
    321321        /*
    322322         * Make sure udebug.go is false when going to sleep
     
    327327        THREAD->udebug.go = false;
    328328        THREAD->udebug.cur_event = UDEBUG_EVENT_THREAD_B;
    329        
     329
    330330        ipc_answer(&TASK->answerbox, call);
    331        
     331
    332332        mutex_unlock(&THREAD->udebug.lock);
    333333        mutex_unlock(&TASK->udebug.lock);
    334        
     334
    335335        LOG("Wait for Go");
    336336        udebug_wait_for_go(&THREAD->udebug.go_wq);
     
    347347        mutex_lock(&TASK->udebug.lock);
    348348        mutex_lock(&THREAD->udebug.lock);
    349        
     349
    350350        LOG("Check state");
    351        
     351
    352352        /* Must only generate events when in debugging session. */
    353353        if (THREAD->udebug.active != true) {
     
    355355                    THREAD->udebug.active ? "Yes" : "No",
    356356                    THREAD->udebug.go ? "Yes" : "No");
    357                
     357
    358358                mutex_unlock(&THREAD->udebug.lock);
    359359                mutex_unlock(&TASK->udebug.lock);
    360360                return;
    361361        }
    362        
     362
    363363        LOG("Trigger event");
    364        
     364
    365365        call_t *call = THREAD->udebug.go_call;
    366        
     366
    367367        THREAD->udebug.go_call = NULL;
    368368        IPC_SET_RETVAL(call->data, 0);
    369369        IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
    370        
     370
    371371        /* Prevent any further debug activity in thread. */
    372372        THREAD->udebug.active = false;
    373373        THREAD->udebug.cur_event = 0;   /* None */
    374374        THREAD->udebug.go = false;      /* Set to initial value */
    375        
     375
    376376        ipc_answer(&TASK->answerbox, call);
    377        
     377
    378378        mutex_unlock(&THREAD->udebug.lock);
    379379        mutex_unlock(&TASK->udebug.lock);
    380        
     380
    381381        /*
    382382         * This event does not sleep - debugging has finished
     
    405405                return EINVAL;
    406406        }
    407        
     407
    408408        LOG("Task %" PRIu64, task->taskid);
    409        
     409
    410410        /* Finish debugging of all userspace threads */
    411411        list_foreach(task->threads, th_link, thread_t, thread) {
    412412                mutex_lock(&thread->udebug.lock);
    413                
     413
    414414                /* Only process userspace threads. */
    415415                if (thread->uspace) {
     
    417417                        thread->udebug.active = false;
    418418                        thread->udebug.cur_event = 0;   /* None */
    419                        
     419
    420420                        /* Is the thread still go? */
    421421                        if (thread->udebug.go == true) {
     
    426426                                 */
    427427                                thread->udebug.go = false;
    428                                
     428
    429429                                /* Answer GO call */
    430430                                LOG("Answer GO call with EVENT_FINISHED.");
    431                                
     431
    432432                                IPC_SET_RETVAL(thread->udebug.go_call->data, 0);
    433433                                IPC_SET_ARG1(thread->udebug.go_call->data,
    434434                                    UDEBUG_EVENT_FINISHED);
    435                                
     435
    436436                                ipc_answer(&task->answerbox, thread->udebug.go_call);
    437437                                thread->udebug.go_call = NULL;
     
    442442                                 *
    443443                                 */
    444                                
     444
    445445                                /*
    446446                                 * thread's lock must not be held when calling
     
    450450                                waitq_wakeup(&thread->udebug.go_wq, WAKEUP_FIRST);
    451451                        }
    452                        
     452
    453453                        mutex_unlock(&thread->udebug.lock);
    454454                        condvar_broadcast(&thread->udebug.active_cv);
     
    456456                        mutex_unlock(&thread->udebug.lock);
    457457        }
    458        
     458
    459459        task->udebug.dt_state = UDEBUG_TS_INACTIVE;
    460460        task->udebug.debugger = NULL;
    461        
     461
    462462        return 0;
    463463}
     
    474474{
    475475        udebug_stoppable_begin();
    476        
     476
    477477        /* Wait until a debugger attends to us. */
    478478        mutex_lock(&THREAD->udebug.lock);
     
    480480                condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock);
    481481        mutex_unlock(&THREAD->udebug.lock);
    482        
     482
    483483        /* Make sure the debugging session is over before proceeding. */
    484484        mutex_lock(&THREAD->udebug.lock);
     
    486486                condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock);
    487487        mutex_unlock(&THREAD->udebug.lock);
    488        
     488
    489489        udebug_stoppable_end();
    490490}
Note: See TracChangeset for help on using the changeset viewer.