Obey virt-top --end-time down to near millisecond accuracy (RHBZ#637964).
[virt-top.git] / virt-top / virt_top_main.ml
index 4ab60ad..4e5c07b 100644 (file)
@@ -1,5 +1,5 @@
 (* 'top'-like tool for libvirt domains.
-   (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc.
+   (C) Copyright 2007-2009 Richard W.M. Jones, Red Hat Inc.
    http://libvirt.org/
 
    This program is free software; you can redistribute it and/or modify
@@ -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 () =