pub fn discover_without_debug_info(image: &Image) -> FunctionsExpand description
Like discover, but ignoring the function lists that debug builds
carry, so the result is what would be found in a release build of the
same program. Comparing the two measures how complete discovery is.
Examples found in repository?
examples/coverage.rs (line 15)
9fn main() {
10 for path in std::env::args().skip(1) {
11 let data = std::fs::read(&path).expect("cannot read image");
12 let image = Image::parse(&data).expect("cannot parse image");
13 let listed: BTreeSet<u32> = image.debug.method_headers.iter().copied().collect();
14 let with: BTreeSet<u32> = discover(&image).by_address.keys().copied().collect();
15 let found = discover_without_debug_info(&image);
16 let without: BTreeSet<u32> = found.by_address.keys().copied().collect();
17 let missed: Vec<u32> = listed.difference(&without).copied().collect();
18 let extra: Vec<u32> = without.difference(&listed).copied().collect();
19 println!(
20 "{path}: listed {}, with debug info {}, without {}, missed {}, not listed {}, failures {}",
21 listed.len(),
22 with.len(),
23 without.len(),
24 missed.len(),
25 extra.len(),
26 found.errors().count()
27 );
28 println!(" missed: {:x?}", &missed[..missed.len().min(12)]);
29 println!(" not listed: {:x?}", &extra[..extra.len().min(12)]);
30 }
31}