summaryrefslogtreecommitdiff
path: root/core/abort.c
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-09-15 14:49:26 -0500
committerDanny Holman <dholman@gymli.org>2024-09-15 14:49:26 -0500
commit5b2c84c0b6880c66657e6fdd0f802a2187c25d05 (patch)
treef2e46a1dbb8ca1496245449893c6a08e980867c5 /core/abort.c
parent1064864b5112653e0038adeca05ae6db090bf587 (diff)
build: break the engine into its subsystemsv0.60
Break the source code into various subsystem directories. This allows certain subsystems to be disabled at compile time, if needed. Move the build system from raw Makefiles to a CMake generator. This drastically simplifies the build and requires only editing a single file, rather than the several make.config files in subsystem directories. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'core/abort.c')
-rw-r--r--core/abort.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/abort.c b/core/abort.c
new file mode 100644
index 0000000..3b8e536
--- /dev/null
+++ b/core/abort.c
@@ -0,0 +1,24 @@
+#include <rune/core/abort.h>
+#include <rune/core/init.h>
+#include <rune/core/logging.h>
+#include <execinfo.h>
+#include <stdlib.h>
+
+#define MAX_TRACE_ITEMS 30
+
+void _stack_trace(void) {
+ void* buffer[MAX_TRACE_ITEMS];
+ int num_links = backtrace(buffer, MAX_TRACE_ITEMS);
+ char** symbuf = backtrace_symbols(buffer, num_links);
+
+ for (int i = 0; i < num_links; i++)
+ log_output(LOG_INFO, "#%d: %s", i, symbuf[i]);
+
+ free(symbuf);
+}
+
+void rune_abort(void) {
+ log_output(LOG_INFO, "Abort called, printing stack trace");
+ _stack_trace();
+ rune_exit();
+}