Kernel: Move dump_backtrace() out of arch.

I discovered __builtin_frame_address()
This commit is contained in:
Bananymous
2023-01-22 03:00:13 +02:00
parent fbfb3d6b70
commit 6ec4ba3dc9
3 changed files with 3 additions and 4 deletions

23
kernel/kernel/Panic.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <kernel/Panic.h>
namespace Kernel
{
void dump_stacktrace()
{
struct stackframe
{
stackframe* ebp;
uint64_t eip;
};
stackframe* frame = (stackframe*)__builtin_frame_address(0);
BAN::Formatter::print(Serial::serial_putc, "\e[36mStack trace:\r\n");
while (frame)
{
BAN::Formatter::print(Serial::serial_putc, " {}\r\n", (void*)frame->eip);
frame = frame->ebp;
}
}
}