Changeset 7e752b2 in mainline for kernel/generic/src/debug


Ignore:
Timestamp:
2010-11-26T01:33:20Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf61d3a
Parents:
202f57b
Message:
  • correct printf() formatting strings and corresponding arguments
  • minor cstyle changes and other small fixes
Location:
kernel/generic/src/debug
Files:
4 edited

Legend:

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

    r202f57b r7e752b2  
    5252        if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
    5353            &call_site_off) == EOK)
    54                 printf("%s+%" PRIp "->%s\n", call_site_sym, call_site_off,
    55                     fn_sym);
     54                printf("%s()+%p->%s()\n", call_site_sym,
     55                    (void *) call_site_off, fn_sym);
    5656        else
    57                 printf("->%s\n", fn_sym);
     57                printf("->%s()\n", fn_sym);
    5858}
    5959
     
    6767        if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
    6868            &call_site_off) == EOK)
    69                 printf("%s+%" PRIp "<-%s\n", call_site_sym, call_site_off,
    70                     fn_sym);
     69                printf("%s()+%p<-%s()\n", call_site_sym,
     70                    (void *) call_site_off, fn_sym);
    7171        else
    72                 printf("<-%s\n", fn_sym);
     72                printf("<-%s()\n", fn_sym);
    7373}
    7474
  • kernel/generic/src/debug/panic.c

    r202f57b r7e752b2  
    4242#include <interrupt.h>
    4343
     44#define BANNER_LEFT   "######>"
     45#define BANNER_RIGHT  "<######"
     46
    4447void panic_common(panic_category_t cat, istate_t *istate, int access,
    4548    uintptr_t address, const char *fmt, ...)
    4649{
    4750        va_list args;
    48 
     51       
    4952        silent = false;
    50 
    51         printf("\nKERNEL PANIC ");
     53       
     54        printf("\n%s Kernel panic ", BANNER_LEFT);
    5255        if (CPU)
    53                 printf("ON cpu%d ", CPU->id);
    54         printf("DUE TO ");
    55 
     56                printf("on cpu%u ", CPU->id);
     57        printf("due to ");
     58       
    5659        va_start(args, fmt);
    5760        if (cat == PANIC_ASSERT) {
    58                 printf("A FAILED ASSERTION:\n");
     61                printf("a failed assertion: %s\n", BANNER_RIGHT);
    5962                vprintf(fmt, args);
    6063                printf("\n");
    6164        } else if (cat == PANIC_BADTRAP) {
    62                 printf("BAD TRAP %ld.\n", address);
     65                printf("bad trap %" PRIun ". %s\n", address,
     66                    BANNER_RIGHT);
    6367                if (fmt) {
    6468                        vprintf(fmt, args);
     
    6670                }
    6771        } else if (cat == PANIC_MEMTRAP) {
    68                 printf("A BAD MEMORY ACCESS WHILE ");
     72                printf("a bad memory access while ");
    6973                if (access == PF_ACCESS_READ)
    70                         printf("LOADING FROM");
     74                        printf("loading from");
    7175                else if (access == PF_ACCESS_WRITE)
    72                         printf("STORING TO");
     76                        printf("storing to");
    7377                else if (access == PF_ACCESS_EXEC)
    74                         printf("BRANCHING TO");
     78                        printf("branching to");
    7579                else
    76                         printf("REFERENCING");
    77                 printf(" ADDRESS %p.\n", address);
     80                        printf("referencing");
     81                printf(" address %p. %s\n", (void *) address,
     82                    BANNER_RIGHT);
    7883                if (fmt) {
    7984                        vprintf(fmt, args);
     
    8186                }
    8287        } else {
    83                 printf("THE FOLLOWING REASON:\n");
     88                printf("the following reason: %s\n",
     89                    BANNER_RIGHT);
    8490                vprintf(fmt, args);
    8591                printf("\n");
    8692        }
    8793        va_end(args);
    88 
     94       
    8995        printf("\n");
    90 
     96       
    9197        if (istate) {
    9298                istate_decode(istate);
    9399                printf("\n");
    94100        }
    95 
     101       
    96102        stack_trace();
    97103        halt();
  • kernel/generic/src/debug/stacktrace.c

    r202f57b r7e752b2  
    4141#define STACK_FRAMES_MAX        20
    4242
    43 void
    44 stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
     43void stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
    4544{
    4645        int cnt = 0;
     
    5453                if (ops->symbol_resolve &&
    5554                    ops->symbol_resolve(ctx->pc, &symbol, &offset)) {
    56                         if (offset)
    57                                 printf("%p: %s+%" PRIp "()\n",
    58                                     ctx->fp, symbol, offset);
     55                        if (offset)
     56                                printf("%p: %s()+%p\n", (void *) ctx->fp,
     57                                    symbol, (void *) offset);
    5958                        else
    60                                 printf("%p: %s()\n",
    61                                     ctx->fp, symbol);
    62                 } else {
    63                         printf("%p: %p()\n", ctx->fp, ctx->pc);
    64                 }
     59                                printf("%p: %s()\n", (void *) ctx->fp, symbol);
     60                } else
     61                        printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc);
     62               
    6563                if (!ops->return_address_get(ctx, &pc))
    6664                        break;
     65               
    6766                if (!ops->frame_pointer_prev(ctx, &fp))
    6867                        break;
     68               
    6969                ctx->fp = fp;
    7070                ctx->pc = pc;
  • kernel/generic/src/debug/symtab.c

    r202f57b r7e752b2  
    192192                uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
    193193                char *realname = symbol_table[pos].symbol_name;
    194                 printf("%p: %s\n", addr, realname);
     194                printf("%p: %s\n", (void *) addr, realname);
    195195                pos++;
    196196        }
Note: See TracChangeset for help on using the changeset viewer.