2023-01-21 22:16:31 +02:00
|
|
|
#include <kernel/Panic.h>
|
|
|
|
|
|
|
|
namespace Kernel
|
|
|
|
{
|
|
|
|
|
|
|
|
void dump_stacktrace()
|
|
|
|
{
|
|
|
|
struct stackframe
|
|
|
|
{
|
|
|
|
stackframe* ebp;
|
|
|
|
uint32_t eip;
|
|
|
|
};
|
|
|
|
|
|
|
|
stackframe* frame;
|
|
|
|
asm volatile("movl %%ebp, %0" : "=r"(frame));
|
2023-01-21 22:21:38 +02:00
|
|
|
BAN::Formatter::print(Serial::serial_putc, "\e[36mStack trace:\r\n");
|
2023-01-21 22:16:31 +02:00
|
|
|
while (frame)
|
|
|
|
{
|
2023-01-21 22:21:38 +02:00
|
|
|
BAN::Formatter::print(Serial::serial_putc, " {}\r\n", (void*)frame->eip);
|
2023-01-21 22:16:31 +02:00
|
|
|
frame = frame->ebp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|