summaryrefslogtreecommitdiffstats
path: root/virt-top
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-01-06 12:40:29 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-01-06 12:43:48 +0000
commitd3def2ccdd0e1f25f4966eee8cfc4396861e4fb4 (patch)
tree05640894ed5afb32ea7f5e02c758c53d0c4fb585 /virt-top
parent0b94aeb460d42eea16bf942dd0892b8ebf63877b (diff)
downloadvirt-top-d3def2ccdd0e1f25f4966eee8cfc4396861e4fb4.tar.gz
virt-top-d3def2ccdd0e1f25f4966eee8cfc4396861e4fb4.tar.xz
virt-top-d3def2ccdd0e1f25f4966eee8cfc4396861e4fb4.zip
main: Record and print full exception stack traces.
This turns on stack trace recording unconditionally (the same effect as if OCAMLRUNPARAM=b was always supplied), and also prints stack traces to the log file if there is an exception. See also: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printexc.html Note that this requires OCaml >= 3.11.0.
Diffstat (limited to 'virt-top')
-rw-r--r--virt-top/virt_top_main.ml3
1 files changed, 3 insertions, 0 deletions
diff --git a/virt-top/virt_top_main.ml b/virt-top/virt_top_main.ml
index 4e1c5b7..4e5c07b 100644
--- a/virt-top/virt_top_main.ml
+++ b/virt-top/virt_top_main.ml
@@ -34,6 +34,7 @@ let error =
let ((_, _, script_mode, _, _, _, _) as setup) = start_up () in
try
+ Printexc.record_backtrace true;
main_loop setup;
if not script_mode then endwin ();
false
@@ -41,10 +42,12 @@ let error =
| Libvirt.Virterror err ->
if not script_mode then endwin ();
prerr_endline (Libvirt.Virterror.to_string err);
+ Printexc.print_backtrace stderr;
true
| exn ->
if not script_mode then endwin ();
prerr_endline (s_ "Error" ^ ": " ^ Printexc.to_string exn);
+ Printexc.print_backtrace stderr;
true
let () =