Xyris  0.5
Stack Namespace Reference

Functions

void printTrace (size_t max)
 

Function Documentation

◆ printTrace()

void Stack::printTrace ( size_t  max)

Definition at line 24 of file Stacktrace.cpp.

25 {
26  // Define our stack
27  struct Arch::stackframe* frame;
28  asm volatile(
29  "movl %%ebp, %0"
30  : "=r"(frame));
31  Console::printf("\033[31mStack trace:\033[0m\n");
32  Logger::Print("\033[31mStack trace:\033[0m\n");
33 
34  for (size_t i = 0; frame != NULL && i < max; ++i) {
35  Console::printf("0x%08zX\n", frame->eip);
36  Logger::Print("0x%08zX\n", frame->eip);
37  if ((uintptr_t)frame->ebp == 0x00000000) {
38  break;
39  }
40  frame = frame->ebp;
41  }
42 }
+ Here is the call graph for this function:
Arch::stackframe::ebp
struct stackframe * ebp
Definition: Arch.i686.hpp:19
Arch::stackframe::eip
size_t eip
Definition: Arch.i686.hpp:20
Arch::stackframe
Definition: Arch.i686.hpp:18
Console::printf
int printf(const char *fmt,...)
Definition: console.cpp:273
Logger::Print
static void Print(const char *fmt,...)
Definition: Logger.cpp:111