From 4e4496e993942fc5361f2e4ab23798ea6a4d78b9 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 25 Jul 2022 21:19:57 +0200 Subject: kernel: cleaner and more compact stacktraces --- src/kernel/arch/amd64/debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/kernel/arch/amd64/debug.c') diff --git a/src/kernel/arch/amd64/debug.c b/src/kernel/arch/amd64/debug.c index c17c906..c273c39 100644 --- a/src/kernel/arch/amd64/debug.c +++ b/src/kernel/arch/amd64/debug.c @@ -13,6 +13,9 @@ void *debug_caller(size_t depth) { void debug_stacktrace(void) { for (size_t i = 0; i < 16; i++) { - kprintf(" k/%08x\n", (uintptr_t)debug_caller(i)); + void *ptr = debug_caller(i); + if (!ptr) break; + kprintf(" k/%08x", (uintptr_t)ptr); } + kprintf("\n"); } -- cgit v1.2.3