Changeset 8751cf3 in mainline
- Timestamp:
- 2018-06-19T20:04:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 826a0a97
- Parents:
- 3bd1d7d4
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-04 20:01:22)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-19 20:04:17)
- Location:
- uspace/lib/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/assert.c
r3bd1d7d4 r8751cf3 49 49 cond, file, line); 50 50 51 stacktrace_kio_print(); 52 51 53 /* Sometimes we know in advance that regular printf() would likely fail. */ 52 54 abort(); … … 60 62 kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 61 63 cond, file, line); 64 65 stacktrace_kio_print(); 62 66 63 67 /* -
uspace/lib/c/generic/stacktrace.c
r3bd1d7d4 r8751cf3 39 39 #include <stdint.h> 40 40 #include <errno.h> 41 #include <io/kio.h> 41 42 42 43 static errno_t stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data); 43 44 44 45 static stacktrace_ops_t basic_ops = { 45 .read_uintptr = stacktrace_read_uintptr 46 .read_uintptr = stacktrace_read_uintptr, 47 .printf = printf, 48 }; 49 50 static stacktrace_ops_t kio_ops = { 51 .read_uintptr = stacktrace_read_uintptr, 52 .printf = kio_printf, 46 53 }; 47 54 … … 57 64 58 65 while (stacktrace_fp_valid(&st, fp)) { 59 printf("%p: %p()\n", (void *) fp, (void *) pc);66 ops->printf("%p: %p()\n", (void *) fp, (void *) pc); 60 67 rc = stacktrace_ra_get(&st, fp, &pc); 61 68 if (rc != EOK) … … 71 78 { 72 79 stacktrace_print_generic(&basic_ops, NULL, fp, pc); 80 } 81 82 void stacktrace_kio_print(void) 83 { 84 stacktrace_prepare(); 85 stacktrace_print_generic(&kio_ops, NULL, stacktrace_fp_get(), stacktrace_pc_get()); 86 87 /* 88 * Prevent the tail call optimization of the previous call by 89 * making it a non-tail call. 90 */ 91 92 kio_printf("-- end of stack trace --\n"); 73 93 } 74 94 -
uspace/lib/c/include/stacktrace.h
r3bd1d7d4 r8751cf3 43 43 typedef struct { 44 44 errno_t (*read_uintptr)(void *, uintptr_t, uintptr_t *); 45 int (*printf)(const char *, ...); 45 46 } stacktrace_ops_t; 46 47 … … 51 52 52 53 extern void stacktrace_print(void); 54 extern void stacktrace_kio_print(void); 53 55 extern void stacktrace_print_fp_pc(uintptr_t, uintptr_t); 54 56 extern void stacktrace_print_generic(stacktrace_ops_t *, void *, uintptr_t,
Note:
See TracChangeset
for help on using the changeset viewer.