open Printf
open ExtString
+module D = Libvirt.Domain
+
+open Virt_mem_types
open Virt_mem_gettext.Gettext
(* This will contain what is passed by the user as '-o' option. *)
exit 1
)
-(* Capture the images before kernel symbol analysis is attempted.
- * Just save them to the output file(s).
- *)
-let rec beforeksyms debug = function
+(* Capture the image. *)
+let rec run debug kimage = ()
+(*
| [] ->
prerr_endline
(s_"virt-mem capture: warning: no kernel images were captured")
* is the domain ID (if known) or a mangled domain name.
*)
List.iter (
- fun ((domid, domname, _, _) as image) ->
+ fun ({ dom = dom; domname = domname } as image) ->
let filename =
!output_filename ^ "." ^
- match domid with
- | Some id -> string_of_int id
+ match dom with
+ | Some dom -> string_of_int (D.get_id dom)
| None ->
let f = function
| ('a'..'z'|'A'..'Z'|'0'..'9'|'_' as c) -> String.make 1 c
save_image image filename
) images
-and save_image (_, domname, arch, mem) filename =
- let chan = open_out filename in
+and save_image { domname = domname } filename =
+ assert false;
- (* XXX At the moment, CONTRARY to what it says in the manual, we
- * are only able to dump out raw data. We don't save the header,
- * start address, etc. (which we should do). XXX
- *)
- assert (Virt_mem_mmap.nr_mappings mem = 1);
-
- Virt_mem_mmap.iter mem (
- fun start size ->
- let bytes = Virt_mem_mmap.get_bytes mem start (Int64.to_int size) in
- output_string chan bytes
- );
+ let chan = open_out filename in
close_out chan;
printf (f_"virt-mem capture: wrote kernel image from %s to filename %s\n")
domname filename
+*)
let summary = s_"capture memory image for post-mortem analysis"
let description = s_"Capture a memory image to a file for later post-mortem
let () =
Virt_mem.register
- ~external_cmd:false ~extra_args
- ~argcheck ~beforeksyms
+ ~needs_everything:true ~run
+ ~external_cmd:false ~extra_args ~argcheck
"capture" summary description