AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
trace.c
Go to the documentation of this file.
1
7
8#include <core/system.h>
9#include <mm/mm.h>
10
12
13/* Prints the current stack trace, the return address of each frame. */
15{
17 printk("stack trace:\n");
18
19 uintptr_t *fp = __builtin_frame_address(0);
20
21 for (int i = 0; i < 32 && fp && (uintptr_t) fp >= ARCH_DMAP_BASE; ++i) {
22 printk(" [%p]\n", (void *) fp[1]);
23 fp = (uintptr_t *) fp[0];
24 }
25
27}
int __printing_trace
Definition trace.c:11
void arch_stack_trace(void)
Prints the stack trace of the running code, for a panic: the return address of each frame.
Definition trace.c:14
#define ARCH_DMAP_BASE
Definition mm.h:14
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
Definition printk.c:249
__SIZE_TYPE__ uintptr_t
Definition stddef.h:12