Changeset a35b458 in mainline for kernel/arch/mips32/src/debugger.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/debugger.c

    r3061bc1 ra35b458  
    138138{
    139139        unsigned int i;
    140        
     140
    141141        for (i = 0; jmpinstr[i].andmask; i++) {
    142142                if ((instr & jmpinstr[i].andmask) == jmpinstr[i].value)
    143143                        return true;
    144144        }
    145        
     145
    146146        return false;
    147147}
     
    158158                return 1;
    159159        }
    160        
     160
    161161        irq_spinlock_lock(&bkpoint_lock, true);
    162        
     162
    163163        /* Check, that the breakpoints do not conflict */
    164164        unsigned int i;
     
    176176                        return 0;
    177177                }
    178                
    179         }
    180        
     178
     179        }
     180
    181181        bpinfo_t *cur = NULL;
    182        
     182
    183183        for (i = 0; i < BKPOINTS_MAX; i++) {
    184184                if (!breakpoints[i].address) {
     
    187187                }
    188188        }
    189        
     189
    190190        if (!cur) {
    191191                printf("Too many breakpoints.\n");
     
    193193                return 0;
    194194        }
    195        
     195
    196196        printf("Adding breakpoint on address %p\n", (void *) argv->intval);
    197        
     197
    198198        cur->address = (uintptr_t) argv->intval;
    199199        cur->instruction = ((sysarg_t *) cur->address)[0];
     
    205205                cur->bkfunc = (void (*)(void *, istate_t *)) argv[1].intval;
    206206        }
    207        
     207
    208208        if (is_jump(cur->instruction))
    209209                cur->flags |= BKPOINT_ONESHOT;
    210        
     210
    211211        cur->counter = 0;
    212        
     212
    213213        /* Set breakpoint */
    214214        *((sysarg_t *) cur->address) = 0x0d;
    215215        smc_coherence(cur->address);
    216        
     216
    217217        irq_spinlock_unlock(&bkpoint_lock, true);
    218        
     218
    219219        return 1;
    220220}
     
    229229                return 0;
    230230        }
    231        
     231
    232232        irq_spinlock_lock(&bkpoint_lock, true);
    233        
     233
    234234        bpinfo_t *cur = &breakpoints[argv->intval];
    235235        if (!cur->address) {
     
    238238                return 0;
    239239        }
    240        
     240
    241241        if ((cur->flags & BKPOINT_INPROG) && (cur->flags & BKPOINT_ONESHOT)) {
    242242                printf("Cannot remove one-shot breakpoint in-progress\n");
     
    244244                return 0;
    245245        }
    246        
     246
    247247        ((uint32_t *) cur->address)[0] = cur->instruction;
    248248        smc_coherence(((uint32_t *) cur->address)[0]);
    249249        ((uint32_t *) cur->address)[1] = cur->nextinstruction;
    250250        smc_coherence(((uint32_t *) cur->address)[1]);
    251        
     251
    252252        cur->address = (uintptr_t) NULL;
    253        
     253
    254254        irq_spinlock_unlock(&bkpoint_lock, true);
    255255        return 1;
     
    262262{
    263263        unsigned int i;
    264        
     264
    265265        printf("[nr] [count] [address ] [inprog] [oneshot] [funccall] [in symbol\n");
    266        
     266
    267267        for (i = 0; i < BKPOINTS_MAX; i++) {
    268268                if (breakpoints[i].address) {
    269269                        const char *symbol = symtab_fmt_name_lookup(
    270270                            breakpoints[i].address);
    271                        
     271
    272272                        printf("%-4u %7zu %p %-8s %-9s %-10s %s\n", i,
    273273                            breakpoints[i].counter, (void *) breakpoints[i].address,
     
    278278                }
    279279        }
    280        
     280
    281281        return 1;
    282282}
     
    290290{
    291291        unsigned int i;
    292        
     292
    293293        for (i = 0; i < BKPOINTS_MAX; i++)
    294294                breakpoints[i].address = (uintptr_t) NULL;
    295        
     295
    296296#ifdef CONFIG_KCONSOLE
    297297        cmd_initialize(&bkpts_info);
     
    299299                log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    300300                    bkpts_info.name);
    301        
     301
    302302        cmd_initialize(&delbkpt_info);
    303303        if (!cmd_register(&delbkpt_info))
    304304                log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    305305                    delbkpt_info.name);
    306        
     306
    307307        cmd_initialize(&addbkpt_info);
    308308        if (!cmd_register(&addbkpt_info))
    309309                log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    310310                    addbkpt_info.name);
    311        
     311
    312312        cmd_initialize(&addbkpte_info);
    313313        if (!cmd_register(&addbkpte_info))
     
    331331        if (cp0_cause_read() & 0x80000000)
    332332                panic("Breakpoint in branch delay slot not supported.");
    333        
     333
    334334        irq_spinlock_lock(&bkpoint_lock, false);
    335        
     335
    336336        bpinfo_t *cur = NULL;
    337337        uintptr_t fireaddr = istate->epc;
    338338        unsigned int i;
    339        
     339
    340340        for (i = 0; i < BKPOINTS_MAX; i++) {
    341341                /* Normal breakpoint */
     
    345345                        break;
    346346                }
    347                
     347
    348348                /* Reinst only breakpoint */
    349349                if ((breakpoints[i].flags & BKPOINT_REINST) &&
     
    353353                }
    354354        }
    355        
     355
    356356        if (cur) {
    357357                if (cur->flags & BKPOINT_REINST) {
     
    359359                        ((uint32_t *) cur->address)[0] = 0x0d;
    360360                        smc_coherence(((uint32_t *)cur->address)[0]);
    361                        
     361
    362362                        /* Return back the second */
    363363                        ((uint32_t *) cur->address)[1] = cur->nextinstruction;
    364364                        smc_coherence(((uint32_t *) cur->address)[1]);
    365                        
     365
    366366                        cur->flags &= ~BKPOINT_REINST;
    367367                        irq_spinlock_unlock(&bkpoint_lock, false);
    368368                        return;
    369369                }
    370                
     370
    371371                if (cur->flags & BKPOINT_INPROG)
    372372                        printf("Warning: breakpoint recursion\n");
    373                
     373
    374374                if (!(cur->flags & BKPOINT_FUNCCALL)) {
    375375                        printf("***Breakpoint %u: %p in %s.\n", i,
     
    377377                            symtab_fmt_name_lookup(fireaddr));
    378378                }
    379                
     379
    380380                /* Return first instruction back */
    381381                ((uint32_t *)cur->address)[0] = cur->instruction;
     
    392392                    (void *) fireaddr,
    393393                    symtab_fmt_name_lookup(fireaddr));
    394                
     394
    395395                /* Move on to next instruction */
    396396                istate->epc += 4;
    397397        }
    398        
     398
    399399        if (cur)
    400400                cur->counter++;
    401        
     401
    402402        if (cur && (cur->flags & BKPOINT_FUNCCALL)) {
    403403                /* Allow zero bkfunc, just for counting */
     
    414414                atomic_set(&haltstate, 1);
    415415                irq_spinlock_unlock(&bkpoint_lock, false);
    416                
     416
    417417                kconsole("debug", "Debug console ready.\n", false);
    418                
     418
    419419                irq_spinlock_lock(&bkpoint_lock, false);
    420420                atomic_set(&haltstate, 0);
    421421#endif
    422422        }
    423        
     423
    424424        if ((cur) && (cur->address == fireaddr)
    425425            && ((cur->flags & BKPOINT_INPROG))) {
     
    427427                if ((cur->flags & BKPOINT_ONESHOT))
    428428                        cur->address = (uintptr_t) NULL;
    429                
     429
    430430                /* Remove in-progress flag */
    431431                cur->flags &= ~BKPOINT_INPROG;
    432432        }
    433        
     433
    434434        irq_spinlock_unlock(&bkpoint_lock, false);
    435435}
Note: See TracChangeset for help on using the changeset viewer.