Kernel: Move dump_stacktrace from panic -> debug

This commit is contained in:
Bananymous
2023-01-25 22:28:18 +02:00
parent e87026f01d
commit aa0757e135
5 changed files with 20 additions and 28 deletions

View File

@@ -5,6 +5,23 @@
namespace Debug
{
void DumpStackTrace()
{
struct stackframe
{
stackframe* ebp;
uintptr_t eip;
};
stackframe* frame = (stackframe*)__builtin_frame_address(0);
BAN::Formatter::print(Debug::putchar, "\e[36mStack trace:\r\n");
while (frame)
{
BAN::Formatter::print(Debug::putchar, " {}\r\n", (void*)frame->eip);
frame = frame->ebp;
}
}
void putchar(char ch)
{
if (Serial::IsInitialized())

View File

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