AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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
11
int
__printing_trace
= 0;
12
13
/* Prints the current stack trace, the return address of each frame. */
14
void
arch_stack_trace
(
void
)
15
{
16
__printing_trace
= 1;
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
26
__printing_trace
= 0;
27
}
__printing_trace
int __printing_trace
Definition
trace.c:11
arch_stack_trace
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
ARCH_DMAP_BASE
#define ARCH_DMAP_BASE
Definition
mm.h:14
system.h
mm.h
printk
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
Definition
printk.c:249
uintptr_t
__SIZE_TYPE__ uintptr_t
Definition
stddef.h:12
kernel
arch
aarch64
cpu
trace.c
Generated by
1.18.0