Changeset 7e752b2 in mainline for kernel/generic/src/debug
- Timestamp:
- 2010-11-26T01:33:20Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bf61d3a
- Parents:
- 202f57b
- Location:
- kernel/generic/src/debug
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/debug.c
r202f57b r7e752b2 52 52 if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym, 53 53 &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); 56 56 else 57 printf("->%s \n", fn_sym);57 printf("->%s()\n", fn_sym); 58 58 } 59 59 … … 67 67 if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym, 68 68 &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); 71 71 else 72 printf("<-%s \n", fn_sym);72 printf("<-%s()\n", fn_sym); 73 73 } 74 74 -
kernel/generic/src/debug/panic.c
r202f57b r7e752b2 42 42 #include <interrupt.h> 43 43 44 #define BANNER_LEFT "######>" 45 #define BANNER_RIGHT "<######" 46 44 47 void panic_common(panic_category_t cat, istate_t *istate, int access, 45 48 uintptr_t address, const char *fmt, ...) 46 49 { 47 50 va_list args; 48 51 49 52 silent = false; 50 51 printf("\n KERNEL PANIC ");53 54 printf("\n%s Kernel panic ", BANNER_LEFT); 52 55 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 56 59 va_start(args, fmt); 57 60 if (cat == PANIC_ASSERT) { 58 printf(" A FAILED ASSERTION:\n");61 printf("a failed assertion: %s\n", BANNER_RIGHT); 59 62 vprintf(fmt, args); 60 63 printf("\n"); 61 64 } else if (cat == PANIC_BADTRAP) { 62 printf("BAD TRAP %ld.\n", address); 65 printf("bad trap %" PRIun ". %s\n", address, 66 BANNER_RIGHT); 63 67 if (fmt) { 64 68 vprintf(fmt, args); … … 66 70 } 67 71 } else if (cat == PANIC_MEMTRAP) { 68 printf(" A BAD MEMORY ACCESS WHILE");72 printf("a bad memory access while "); 69 73 if (access == PF_ACCESS_READ) 70 printf(" LOADING FROM");74 printf("loading from"); 71 75 else if (access == PF_ACCESS_WRITE) 72 printf(" STORING TO");76 printf("storing to"); 73 77 else if (access == PF_ACCESS_EXEC) 74 printf(" BRANCHING TO");78 printf("branching to"); 75 79 else 76 printf("REFERENCING"); 77 printf(" ADDRESS %p.\n", address); 80 printf("referencing"); 81 printf(" address %p. %s\n", (void *) address, 82 BANNER_RIGHT); 78 83 if (fmt) { 79 84 vprintf(fmt, args); … … 81 86 } 82 87 } else { 83 printf("THE FOLLOWING REASON:\n"); 88 printf("the following reason: %s\n", 89 BANNER_RIGHT); 84 90 vprintf(fmt, args); 85 91 printf("\n"); 86 92 } 87 93 va_end(args); 88 94 89 95 printf("\n"); 90 96 91 97 if (istate) { 92 98 istate_decode(istate); 93 99 printf("\n"); 94 100 } 95 101 96 102 stack_trace(); 97 103 halt(); -
kernel/generic/src/debug/stacktrace.c
r202f57b r7e752b2 41 41 #define STACK_FRAMES_MAX 20 42 42 43 void 44 stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx) 43 void stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx) 45 44 { 46 45 int cnt = 0; … … 54 53 if (ops->symbol_resolve && 55 54 ops->symbol_resolve(ctx->pc, &symbol, &offset)) { 56 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); 59 58 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 65 63 if (!ops->return_address_get(ctx, &pc)) 66 64 break; 65 67 66 if (!ops->frame_pointer_prev(ctx, &fp)) 68 67 break; 68 69 69 ctx->fp = fp; 70 70 ctx->pc = pc; -
kernel/generic/src/debug/symtab.c
r202f57b r7e752b2 192 192 uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le); 193 193 char *realname = symbol_table[pos].symbol_name; 194 printf("%p: %s\n", addr, realname);194 printf("%p: %s\n", (void *) addr, realname); 195 195 pos++; 196 196 }
Note:
See TracChangeset
for help on using the changeset viewer.