From d1b7249803ba5d316fa7b6cde4cf8d29a5fe0306 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 12 Apr 2023 01:32:41 +0300 Subject: [PATCH] Kernel: Debug::dump_stack_trace now 'detects' repeating function --- kernel/kernel/Debug.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/kernel/Debug.cpp b/kernel/kernel/Debug.cpp index d8f1d6a4..7c381280 100644 --- a/kernel/kernel/Debug.cpp +++ b/kernel/kernel/Debug.cpp @@ -20,6 +20,7 @@ namespace Debug return; } uintptr_t first_rip = frame->rip; + uintptr_t last_rip = 0; BAN::Formatter::print(Debug::putchar, "\e[36mStack trace:\r\n"); while (frame) @@ -30,8 +31,16 @@ namespace Debug if (frame && frame->rip == first_rip) { derrorln("looping kernel panic :("); - return; + break; } + + if (frame && frame->rip == last_rip) + { + derrorln("repeating stack strace"); + break; + } + + last_rip = frame->rip; } BAN::Formatter::print(Debug::putchar, "\e[m"); }