linux-initrd: Display a backtrace when the initial program fails.

* guix/build/linux-initrd.scm (boot-system): Add pre-unwind handler in
  'catch' form around 'primitive-load', and call 'format' and
  'display-backtrace' from there.
This commit is contained in:
Ludovic Courtès 2014-05-20 21:56:20 +02:00
parent 9bea3b42b4
commit eb7ccb1afa
1 changed files with 3 additions and 1 deletions

View File

@ -482,10 +482,12 @@ to it are lost."
(catch #t
(lambda ()
(primitive-load to-load))
(lambda args
(start-repl))
(lambda args
(format (current-error-port) "'~a' raised an exception: ~s~%"
to-load args)
(start-repl)))
(display-backtrace (make-stack #t) (current-error-port))))
(format (current-error-port)
"boot program '~a' terminated, rebooting~%"
to-load)