X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fvirt_mem_capture.ml;h=5e51fc142be51273a2db63f48175441a6f710cff;hb=14c916e5692f6d1986a10b88d03b41349dcb729a;hp=413af56393b1ff901bf16f79ae0338bf6dff3367;hpb=97131d94f5513b732f8f8d310984e71d8201cadf;p=virt-mem.git diff --git a/lib/virt_mem_capture.ml b/lib/virt_mem_capture.ml index 413af56..5e51fc1 100644 --- a/lib/virt_mem_capture.ml +++ b/lib/virt_mem_capture.ml @@ -22,6 +22,9 @@ 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. *) @@ -36,10 +39,9 @@ let argcheck debug = 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 image kdata = () +(* | [] -> prerr_endline (s_"virt-mem capture: warning: no kernel images were captured") @@ -51,11 +53,11 @@ let rec beforeksyms debug = function * 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 @@ -65,11 +67,16 @@ let rec beforeksyms debug = function save_image image filename ) images -and save_image (_, domname, arch, mmap) filename = - printf (f_"virt-mem capture: saving kernel image from %s to filename %s\n") - domname filename; +and save_image { domname = domname } filename = + assert false; + + let chan = open_out filename in + + close_out chan; - assert false + 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 @@ -85,6 +92,6 @@ let extra_args = [ let () = Virt_mem.register - ~external_cmd:false ~extra_args - ~argcheck ~beforeksyms + ~needs_everything:true ~run + ~external_cmd:false ~extra_args ~argcheck "capture" summary description