sbpf-coverage 0.2.8

Maps SBPF execution traces to source code for test coverage and trace disassembly of Solana programs
Documentation
diff --git a/src/lib.rs b/src/lib.rs
index 8d1d430..c4084b0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -426,6 +426,13 @@ end_of_record
                         }
                     };
 
+                    // // Skip Rust closures
+                    // if let Some(demangled_fn_name) = &outer_frame_details.demangled_function_name {
+                    //     if demangled_fn_name.contains(r#"{{closure}}"#) {
+                    //         continue;
+                    //     }
+                    // }
+
                     // There's a branch at this vaddr.
                     let branch = branches.entry(*vaddr).or_insert(Branch::new(
                         outer_frame_details.file_name, // TODO: if these are None? Update them later?
@@ -448,26 +455,29 @@ end_of_record
         }
     }
 
-    for (_vaddr, branch) in &branches {
-        if branch.goto_taken != 0 && branch.next_taken != 0 {
-            // Skip these ones - everything seems covered here.
-            continue;
-        }
+    branches.iter().for_each(|(_vaddr, branch)| {
         match (&branch.file, branch.line) {
             (Some(file), Some(line)) => {
-                write_branch_lcov(
-                    &file,
-                    line,
-                    if branch.next_taken == 0 {
-                        LcovBranch::GotoNotTaken
-                    } else {
-                        LcovBranch::NextNotTaken
-                    },
-                );
+                if branch.goto_taken != 0 && branch.next_taken != 0 {
+                    // Both hit. So add them.
+                    write_branch_lcov(&file, line, LcovBranch::NextNotTaken);
+                    write_branch_lcov(&file, line, LcovBranch::GotoNotTaken);
+                } else {
+                    // Only one branch hit, act accordingly.
+                    write_branch_lcov(
+                        &file,
+                        line,
+                        if branch.next_taken == 0 {
+                            LcovBranch::GotoNotTaken
+                        } else {
+                            LcovBranch::NextNotTaken
+                        },
+                    );
+                }
             }
             _ => {}
         }
-    }
+    });
 
     // smoelius: A `vaddr` could not have an entry because its file does not exist. Keep only those
     // `vaddr`s that have entries.