iptr_edge_analyzer/
diagnose.rs1use crate::{EdgeAnalyzer, HandleControlFlow, ReadMemory};
4
5pub struct DiagnosticInformation {
9 pub cfg_size: usize,
11 #[cfg(feature = "cache")]
13 pub cache_trailing_bits_size: usize,
14 #[cfg(feature = "cache")]
16 pub cache8_size: usize,
17 #[cfg(feature = "cache")]
19 pub cache32_size: usize,
20 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
22 pub cache_trailing_bits_hit_count: usize,
23 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
25 pub cache_8bit_hit_count: usize,
26 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
28 pub cache_32bit_hit_count: usize,
29 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
31 pub cache_missed_bit_count: usize,
32}
33
34impl<H: HandleControlFlow, R: ReadMemory> EdgeAnalyzer<H, R> {
35 #[must_use]
37 pub fn diagnose(&self) -> DiagnosticInformation {
38 let cfg_size = self.static_analyzer.cfg_size();
39 #[cfg(feature = "cache")]
40 let (cache_trailing_bits_size, cache8_size, cache32_size) = self.cache_manager.cache_size();
41
42 DiagnosticInformation {
43 cfg_size,
44 #[cfg(feature = "cache")]
45 cache_trailing_bits_size,
46 #[cfg(feature = "cache")]
47 cache8_size,
48 #[cfg(feature = "cache")]
49 cache32_size,
50 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
51 cache_32bit_hit_count: self.cache_32bit_hit_count,
52 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
53 cache_8bit_hit_count: self.cache_8bit_hit_count,
54 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
55 cache_trailing_bits_hit_count: self.cache_trailing_bits_hit_count,
56 #[cfg(all(feature = "cache", feature = "more_diagnose"))]
57 cache_missed_bit_count: self.cache_missed_bit_count,
58 }
59 }
60}