aboutsummaryrefslogtreecommitdiff
path: root/debug/programs/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/programs/init.c')
-rw-r--r--debug/programs/init.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/debug/programs/init.c b/debug/programs/init.c
new file mode 100644
index 0000000..a2b41b0
--- /dev/null
+++ b/debug/programs/init.c
@@ -0,0 +1,24 @@
+int main(void);
+
+void handle_trap(unsigned int mcause, unsigned int mepc, unsigned int sp)
+{
+ while (1)
+ ;
+}
+
+void _exit(int status)
+{
+ // Make sure gcc doesn't inline _exit, so we can actually set a breakpoint
+ // on it.
+ volatile int i = 42;
+ while (i)
+ ;
+ // _exit isn't supposed to return.
+ while (1)
+ ;
+}
+
+void _init()
+{
+ _exit(main());
+}