Changeset 2fbb42f in mainline
- Timestamp:
- 2023-10-26T19:20:09Z (13 months ago)
- Branches:
- master, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 001957b6
- Parents:
- da13982
- Files:
-
- 25 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/stacktrace.h
rda13982 r2fbb42f 52 52 bool (*frame_pointer_prev)(stack_trace_context_t *, uintptr_t *); 53 53 bool (*return_address_get)(stack_trace_context_t *, uintptr_t *); 54 bool (*symbol_resolve)(uintptr_t, const char **, uintptr_t *);54 bool (*symbol_resolve)(uintptr_t, int, const char **, uintptr_t *, const char **, const char **, int *, int *); 55 55 } stack_trace_ops_t; 56 56 -
kernel/generic/meson.build
rda13982 r2fbb42f 46 46 'src/cpu/cpu_mask.c', 47 47 'src/ddi/irq.c', 48 'src/debug/line.c', 49 'src/debug/names.c', 48 50 'src/debug/panic.c', 49 51 'src/debug/profile.c', … … 51 53 'src/debug/stacktrace.c', 52 54 'src/debug/symtab.c', 55 'src/debug/util.c', 53 56 'src/ipc/event.c', 54 57 'src/ipc/ipc.c', -
kernel/generic/src/debug/stacktrace.c
rda13982 r2fbb42f 39 39 #include <stdio.h> 40 40 41 #include <debug/line.h> 42 41 43 #define STACK_FRAMES_MAX 20 42 44 … … 44 46 { 45 47 int cnt = 0; 46 const char *symbol; 47 uintptr_t offset; 48 48 49 uintptr_t fp; 49 50 uintptr_t pc; … … 51 52 while ((cnt++ < STACK_FRAMES_MAX) && 52 53 (ops->stack_trace_context_validate(ctx))) { 54 55 const char *symbol = NULL; 56 uintptr_t symbol_addr = 0; 57 const char *file_name = NULL; 58 const char *dir_name = NULL; 59 int line = 0; 60 int column = 0; 61 53 62 if (ops->symbol_resolve && 54 ops->symbol_resolve(ctx->pc, &symbol, &offset)) { 55 if (offset) 56 printf("%p: %s()+%p\n", (void *) ctx->fp, 57 symbol, (void *) offset); 58 else 59 printf("%p: %s()\n", (void *) ctx->fp, symbol); 63 ops->symbol_resolve(ctx->pc, 0, &symbol, &symbol_addr, &file_name, &dir_name, &line, &column)) { 64 65 if (symbol == NULL) 66 symbol = "<unknown>"; 67 68 if (file_name == NULL && line == 0) { 69 printf("%p: %24s()+%zu\n", (void *) ctx->fp, symbol, ctx->pc - symbol_addr); 70 } else { 71 if (file_name == NULL) 72 file_name = "<unknown>"; 73 if (dir_name == NULL) 74 dir_name = "<unknown>"; 75 76 printf("%p: %20s()+%zu\t %s/%s:%d:%d\n", 77 (void *) ctx->fp, symbol, ctx->pc - symbol_addr, 78 dir_name, file_name, line, column); 79 } 60 80 } else 61 81 printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc); … … 104 124 105 125 static bool 106 kernel_symbol_resolve(uintptr_t addr, const char **sp, uintptr_t *op) 126 resolve_kernel_address(uintptr_t addr, int op_index, 127 const char **symbol, uintptr_t *symbol_addr, 128 const char **filename, const char **dirname, 129 int *line, int *column) 107 130 { 108 uintptr_tsymbol_addr = 0;109 *s p = symtab_name_lookup(addr, &symbol_addr);110 *op = addr - symbol_addr; 111 return symbol_addr != 0;131 *symbol_addr = 0; 132 *symbol = symtab_name_lookup(addr, symbol_addr); 133 134 return debug_line_get_address_info(addr, op_index, filename, dirname, line, column) || *symbol_addr != 0; 112 135 } 113 136 … … 116 139 .frame_pointer_prev = kernel_frame_pointer_prev, 117 140 .return_address_get = kernel_return_address_get, 118 .symbol_resolve = kernel_symbol_resolve141 .symbol_resolve = resolve_kernel_address, 119 142 }; 120 143 -
kernel/meson.build
rda13982 r2fbb42f 95 95 kernel_c_args = arch_kernel_c_args + kernel_defs + [ 96 96 '-ffreestanding', 97 '-fdebug-prefix-map=../../kernel/=', 98 '-fdebug-prefix-map=../../../kernel/=', 97 99 98 100 cc.get_supported_arguments([ … … 112 114 ] 113 115 116 if not CONFIG_LINE_DEBUG 117 # Keep the debug info needed to get file names for kernel stack traces. 118 kernel_c_args += [ '-gdwarf-5', '-g1', '-gno-statement-frontiers' ] 119 endif 120 114 121 if CONFIG_LTO 115 122 kernel_c_args += [ '-flto' ] -
meson/part/compiler_args/meson.build
rda13982 r2fbb42f 69 69 '-ffunction-sections', 70 70 '-fno-common', 71 '-fdebug-prefix-map=' + meson.source_root() + '=.', 71 '-fdebug-prefix-map=' + meson.source_root() + '/=', 72 '-fdebug-prefix-map=../../=', 72 73 ] 73 74 … … 86 87 87 88 if CONFIG_LINE_DEBUG 88 extra_common_flags += [ '-gdwarf- 4', '-g3' ]89 extra_common_flags += [ '-gdwarf-5', '-g3' ] 89 90 endif 90 91
Note:
See TracChangeset
for help on using the changeset viewer.