Skip to content

Commit 3750fa6

Browse files
committed
Help debug missing assembly
1 parent 2285f74 commit 3750fa6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

assert-instr/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,18 @@ pub fn assert(fnptr: usize, expected: &str) {
234234
};
235235

236236
// Find our function in the list of all disassembled functions
237-
let functions = &DISASSEMBLY.get(&sym)
238-
.expect(&format!("failed to find disassembly of {}", sym));
237+
let functions = match DISASSEMBLY.get(&sym) {
238+
Some(f) => f,
239+
None => {
240+
let parts = sym.split("::").collect::<Vec<_>>();
241+
let part = parts.last().unwrap();
242+
println!("maybe related functions");
243+
for f in DISASSEMBLY.keys().filter(|k| k.contains(part)) {
244+
println!("\t- {}", f);
245+
}
246+
panic!("failed to find disassembly of {}", sym);
247+
}
248+
};
239249
assert_eq!(functions.len(), 1);
240250
let function = &functions[0];
241251

0 commit comments

Comments
 (0)