git.annexia.org
/
virt-mem.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Integrated image/kdata into kimage structure. Removed dead-code.
[virt-mem.git]
/
lib
/
virt_mem_kallsyms.ml
diff --git
a/lib/virt_mem_kallsyms.ml
b/lib/virt_mem_kallsyms.ml
index
631bf61
..
9e6eccb
100644
(file)
--- a/
lib/virt_mem_kallsyms.ml
+++ b/
lib/virt_mem_kallsyms.ml
@@
-36,7
+36,8
@@
type kallsyms_compr =
| Compressed of (string * Virt_mem_mmap.addr) list * Virt_mem_mmap.addr
| Uncompressed of (string * Virt_mem_mmap.addr) list
| Compressed of (string * Virt_mem_mmap.addr) list * Virt_mem_mmap.addr
| Uncompressed of (string * Virt_mem_mmap.addr) list
-let find_kallsyms debug ({ domname = domname; mem = mem } as image) ksymmap =
+let find_kallsyms debug ({ domname = domname; mem = mem; ksyms = ksyms }
+ as kimage) =
let start_t = gettimeofday () in
(* Now try to find the /proc/kallsyms table. This is in an odd
let start_t = gettimeofday () in
(* Now try to find the /proc/kallsyms table. This is in an odd
@@
-50,7
+51,7
@@
let find_kallsyms debug ({ domname = domname; mem = mem } as image) ksymmap =
* more useful than the basic list of exports.
*)
let ksym_addrs = List.filter_map (
* more useful than the basic list of exports.
*)
let ksym_addrs = List.filter_map (
- fun ksym -> try Some (Ksymmap.find ksym ksym
map
) with Not_found -> None
+ fun ksym -> try Some (Ksymmap.find ksym ksym
s
) with Not_found -> None
) Virt_mem_ksyms.common_ksyms in
(* Search for those kernel addresses in the image. We're looking
) Virt_mem_ksyms.common_ksyms in
(* Search for those kernel addresses in the image. We're looking
@@
-196,20
+197,20
@@
let find_kallsyms debug ({ domname = domname; mem = mem } as image) ksymmap =
(* Vote for the most popular symbol table candidate and
* enhance the function for looking up ksyms.
*)
(* Vote for the most popular symbol table candidate and
* enhance the function for looking up ksyms.
*)
- let ksym
map
=
+ let ksym
s, have_kallsyms
=
let freqs = frequency kallsymtabs in
match freqs with
| [] ->
(* Can't find any kallsymtabs. *)
let freqs = frequency kallsymtabs in
match freqs with
| [] ->
(* Can't find any kallsymtabs. *)
-
Non
e
+
ksyms, fals
e
| (_, (_, _, _, Uncompressed names)) :: _ ->
| (_, (_, _, _, Uncompressed names)) :: _ ->
- let rec loop ksym
map
= function
+ let rec loop ksym
s
= function
| (name, value) :: names ->
| (name, value) :: names ->
- loop (Ksymmap.add name value ksym
map
) names
- | [] -> ksym
map
+ loop (Ksymmap.add name value ksym
s
) names
+ | [] -> ksym
s
in
in
- Some (loop ksymmap names)
+ loop ksyms names, true
| (_, (start_addr, num_entries, names_addr,
Compressed (compressed_names, markers_addr))) :: _ ->
| (_, (start_addr, num_entries, names_addr,
Compressed (compressed_names, markers_addr))) :: _ ->
@@
-255,12
+256,12
@@
let find_kallsyms debug ({ domname = domname; mem = mem } as image) ksymmap =
Some (name, sym_value)
) compressed_names in
Some (name, sym_value)
) compressed_names in
- let rec loop ksym
map
= function
+ let rec loop ksym
s
= function
| (name, value) :: names ->
| (name, value) :: names ->
- loop (Ksymmap.add name value ksym
map
) names
- | [] -> ksym
map
+ loop (Ksymmap.add name value ksym
s
) names
+ | [] -> ksym
s
in
in
-
Some (loop ksymmap names)
in
+
loop ksyms names, true
in
if debug then (
let end_t = gettimeofday () in
if debug then (
let end_t = gettimeofday () in
@@
-268,4
+269,4
@@
let find_kallsyms debug ({ domname = domname; mem = mem } as image) ksymmap =
(end_t -. start_t)
);
(end_t -. start_t)
);
- (image, ksymmap)
+ { kimage with ksyms = ksyms; have_kallsyms = have_kallsyms }