summaryrefslogtreecommitdiff
path: root/include/backtrace.h
diff options
context:
space:
mode:
authortrimill <trimill@trimillxyz.org>2024-01-30 10:19:33 -0500
committertrimill <trimill@trimillxyz.org>2024-01-30 10:19:33 -0500
commit6b8f33c22d41488b88fcd35331867858d8f67763 (patch)
tree4a62ac9c6136a9e9b94cab0b6838add70accfe31 /include/backtrace.h
parentrefactor, improve exception message (diff)
downloadcorn-6b8f33c22d41488b88fcd35331867858d8f67763.tar.gz
corn-6b8f33c22d41488b88fcd35331867858d8f67763.tar.bz2
corn-6b8f33c22d41488b88fcd35331867858d8f67763.zip
added backtraces
Diffstat (limited to 'include/backtrace.h')
-rw-r--r--include/backtrace.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/backtrace.h b/include/backtrace.h
new file mode 100644
index 0000000..2abece7
--- /dev/null
+++ b/include/backtrace.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <stddef.h>
+
+// Fill dst with a stack trace consisting of return addresses
+// in order from top to bottom. returns the number filled (at most len)
+size_t backtrace(void **dst, size_t len);
+
+
+// same as backtrace but with specified instruction and base pointer
+size_t backtrace_ex(void **dst, size_t len, void* ip, void *bp);
+
+// TODO symbols
+//size_t backtrace_symbols(char *const *dst, size_t len);
+
+// Log a backtrace
+void log_backtrace();
+
+// same as log_backtrace with specified insruction and base pointer
+void log_backtrace_ex(void *ip, void *bp);