Changeset 8565a42 in mainline for kernel/generic/src/debug
- Timestamp:
- 2018-03-02T20:34:50Z (7 years ago)
- 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)
- Location:
- kernel/generic/src/debug
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/debug.c
r3061bc1 r8565a42 46 46 { 47 47 const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn); 48 48 49 49 const char *call_site_sym; 50 50 uintptr_t call_site_off; 51 51 52 52 if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym, 53 53 &call_site_off) == EOK) … … 61 61 { 62 62 const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn); 63 63 64 64 const char *call_site_sym; 65 65 uintptr_t call_site_off; 66 66 67 67 if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym, 68 68 &call_site_off) == EOK) -
kernel/generic/src/debug/panic.c
r3061bc1 r8565a42 49 49 { 50 50 console_override = true; 51 51 52 52 printf("\n%s Kernel panic ", BANNER_LEFT); 53 53 if (CPU) 54 54 printf("on cpu%u ", CPU->id); 55 55 printf("due to "); 56 56 57 57 va_list args; 58 58 va_start(args, fmt); … … 91 91 } 92 92 va_end(args); 93 93 94 94 printf("\n"); 95 95 96 96 printf("THE=%p: ", THE); 97 97 if (THE != NULL) { … … 99 99 " magic=%#" PRIx32 "\n", THE->preemption, 100 100 THE->thread, THE->task, THE->cpu, THE->as, THE->magic); 101 101 102 102 if (THE->thread != NULL) 103 103 printf("thread=\"%s\"\n", THE->thread->name); 104 104 105 105 if (THE->task != NULL) 106 106 printf("task=\"%s\"\n", THE->task->name); 107 107 } else 108 108 printf("invalid\n"); 109 109 110 110 if (istate) { 111 111 istate_decode(istate); 112 112 printf("\n"); 113 113 } 114 114 115 115 stack_trace(); 116 116 halt(); -
kernel/generic/src/debug/stacktrace.c
r3061bc1 r8565a42 48 48 uintptr_t fp; 49 49 uintptr_t pc; 50 50 51 51 while ((cnt++ < STACK_FRAMES_MAX) && 52 52 (ops->stack_trace_context_validate(ctx))) { … … 60 60 } else 61 61 printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc); 62 62 63 63 if (!ops->return_address_get(ctx, &pc)) 64 64 break; 65 65 66 66 if (!ops->frame_pointer_prev(ctx, &fp)) 67 67 break; 68 68 69 69 ctx->fp = fp; 70 70 ctx->pc = pc; … … 96 96 .istate = istate 97 97 }; 98 98 99 99 if (istate_from_uspace(istate)) 100 100 stack_trace_ctx(&ust_ops, &ctx); -
kernel/generic/src/debug/symtab.c
r3061bc1 r8565a42 58 58 #ifdef CONFIG_SYMTAB 59 59 size_t i; 60 60 61 61 for (i = 1; symbol_table[i].address_le; i++) { 62 62 if (addr < uint64_t_le2host(symbol_table[i].address_le)) 63 63 break; 64 64 } 65 65 66 66 if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) { 67 67 *name = symbol_table[i - 1].symbol_name; … … 71 71 return EOK; 72 72 } 73 73 74 74 *name = NULL; 75 75 return ENOENT; 76 76 77 77 #else 78 78 *name = NULL; … … 97 97 const char *name; 98 98 errno_t rc = symtab_name_lookup(addr, &name, NULL); 99 99 100 100 switch (rc) { 101 101 case EOK: … … 121 121 { 122 122 size_t namelen = str_length(name); 123 123 124 124 size_t pos; 125 125 for (pos = *startpos; symbol_table[pos].address_le; pos++) { 126 126 const char *curname = symbol_table[pos].symbol_name; 127 127 128 128 /* Find a ':' in curname */ 129 129 const char *colon = str_chr(curname, ':'); 130 130 if (colon == NULL) 131 131 continue; 132 132 133 133 if (str_length(curname) < namelen) 134 134 continue; 135 135 136 136 if (str_lcmp(name, curname, namelen) == 0) { 137 137 *startpos = pos; … … 139 139 } 140 140 } 141 141 142 142 return NULL; 143 143 } … … 162 162 size_t pos = 0; 163 163 const char *hint; 164 164 165 165 while ((hint = symtab_search_one(name, &pos))) { 166 166 if (str_length(hint) == 0) { … … 170 170 pos++; 171 171 } 172 172 173 173 if (found > 1) 174 174 return EOVERFLOW; 175 175 176 176 if (found < 1) 177 177 return ENOENT; 178 178 179 179 return EOK; 180 180 181 181 #else 182 182 return ENOTSUP; … … 195 195 pos++; 196 196 } 197 197 198 198 #else 199 199 printf("No symbol information available.\n"); … … 208 208 size_t len = str_length(input); 209 209 struct symtab_entry **entry = (struct symtab_entry**)ctx; 210 210 211 211 if (*entry == NULL) 212 212 *entry = symbol_table; 213 213 214 214 for (; (*entry)->address_le; (*entry)++) { 215 215 const char *curname = (*entry)->symbol_name; 216 216 217 217 /* Find a ':' in curname */ 218 218 const char *colon = str_chr(curname, ':'); 219 219 if (colon == NULL) 220 220 continue; 221 221 222 222 if (str_length(curname) < len) 223 223 continue; 224 224 225 225 if (str_lcmp(input, curname, len) == 0) { 226 226 (*entry)++; … … 230 230 } 231 231 } 232 232 233 233 return NULL; 234 234 235 235 #else 236 236 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.