summaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-08 17:55:13 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-08 17:55:13 -0400
commit331a2a442b2c8595002d342372d4d08f104b382d (patch)
tree7f46cf1a774d9135383125211b268b28df34d232 /kernel/include
parentremove boot dir (diff)
downloadcomus-331a2a442b2c8595002d342372d4d08f104b382d.tar.gz
comus-331a2a442b2c8595002d342372d4d08f104b382d.tar.bz2
comus-331a2a442b2c8595002d342372d4d08f104b382d.zip
backtrace
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/lib/klib.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/include/lib/klib.h b/kernel/include/lib/klib.h
index c67e57d..3afe925 100644
--- a/kernel/include/lib/klib.h
+++ b/kernel/include/lib/klib.h
@@ -193,4 +193,30 @@ unsigned int bound(unsigned int min, unsigned int value, unsigned int max);
*/
__attribute__((noreturn)) void panic(const char *format, ...);
+/**
+ * Fill dst with a stack trace consisting of return addresses in order
+ * from top to bottom
+ *
+ * @returns number of backtraces (at most len)
+ */
+size_t backtrace(void **dst, size_t len);
+
+/**
+ * Fill dst with a stack trace consisting of return addresses in order
+ * from top to bottom, starting at a provided ip/bp
+ *
+ * @returns number of backtraces (at most len)
+ */
+size_t backtrace_ex(void **dst, size_t len, void *ip, void *bp);
+
+/**
+ * Log a backtrace to output
+ */
+void log_backtrace(void);
+
+/**
+ * Log a backtrace to output starting at a provided ip/bp
+ */
+void log_backtrace_ex(void *ip, void *bp);
+
#endif /* klib.h */