summaryrefslogtreecommitdiff
path: root/targets/fib.c
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 11:08:49 -0300
committerGabriel Schneider <[email protected]>2026-11-10 11:08:49 -0300
commit0b29354e1ddf6cf75ac4c426a00dd3435ace5069 (patch)
tree918e6f6810a9b8b5a8ed17e698085e92018333b9 /targets/fib.c
downloadcomputeranim-0b29354e1ddf6cf75ac4c426a00dd3435ace5069.tar.gz
computeranim-0b29354e1ddf6cf75ac4c426a00dd3435ace5069.zip
ztrace: the event, the ring, the recording, a ptrace loop
One 64-byte Event for every backend; a shared-memory ring from target to tracer with stop/resume; a Recorder that folds events into xitdb moments (registers, memory in 64-byte chunks with known-byte masks, strings) and a Trace that reads any moment back; a minimal ptrace Process; ztrace record, run and dump. Per-area build files so the areas grow apart.
Diffstat (limited to 'targets/fib.c')
-rw-r--r--targets/fib.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/targets/fib.c b/targets/fib.c
new file mode 100644
index 0000000..5be9998
--- /dev/null
+++ b/targets/fib.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+static unsigned long fib(unsigned n) {
+ return n < 2 ? n : fib(n - 1) + fib(n - 2);
+}
+
+int main(int argc, char **argv) {
+ unsigned n = argc > 1 ? (unsigned)atoi(argv[1]) : 10;
+ printf("fib(%u) = %lu\n", n, fib(n));
+ return 0;
+}