diff --git a/src/lib.rs b/src/lib.rs
index b35c557..c10b73e 100644
@@ -1,4 +1,4 @@
-use addr2line::{fallible_iterator::IntoFallibleIterator, Loader};
+use addr2line::{fallible_iterator::{FallibleIterator, IntoFallibleIterator}, Loader};
use anyhow::{anyhow, Result};
use byteorder::{LittleEndian, ReadBytesExt};
use cargo_metadata::MetadataCommand;
@@ -23,6 +23,11 @@ pub use anchor_cli_lib::{
__get_keypair as get_keypair, __is_hidden as is_hidden, __keys_sync as keys_sync,
};
+pub enum Branch {
+ UncoveredNext(u64),
+ UncoveredGoto(u64),
+}
+
#[cfg(feature = "__anchor_cli")]
mod anchor_cli_config;
#[cfg(feature = "__anchor_cli")]
@@ -223,6 +228,8 @@ fn process_pcs_path(dwarfs: &[Dwarf], pcs_path: &Path) -> Result<Outcome> {
let frames = dwarf.loader.find_frames(*vaddr);
if let Ok(mut frames) = frames {
let mut found = false;
+ let mut uncovered_next = None;
+ let mut uncovered_goto = None;
while let Some(frame) = frames.next().ok() {
if let Some(frame) = frame {
// eprintln!("frame: {:08x?}", frame.dw_die_offset);
@@ -232,6 +239,13 @@ fn process_pcs_path(dwarfs: &[Dwarf], pcs_path: &Path) -> Result<Outcome> {
continue;
};
let Some(func) = frame.function else { continue };
+ if indent == 1 { // only the first is interesting
+ if let Some(uncovered_next) = uncovered_next.take() {
+
+ }
+
+ if let Some(uncovered_goto) = uncovered_goto.take() {}
+
eprintln!(
"{}0x{:08x}({}) [{:016x}]=> frame 0x{:08x}#{}@{:?}:{:?}:{:?}\n {:08x?}\n",
get_indent(indent),
@@ -263,12 +277,16 @@ fn process_pcs_path(dwarfs: &[Dwarf], pcs_path: &Path) -> Result<Outcome> {
let goto_taken = vaddrs.iter().find(|e| **e == goto_pc).is_some();
if next_taken == false {
eprintln!("\t next branch {:x} + 8 not taken!", next_pc);
+ uncovered_next = Some(Branch::UncoveredNext(next_pc));
+ let frame = frames.peekable().next();
}
if goto_taken == false {
eprintln!(
"\t goto branch 0x{:x} + 0x{:x} not taken!",
vaddr, ins_offset
);
+ uncovered_goto =
+ Some(Branch::UncoveredGoto(*vaddr + ins_offset));
}
}
}