Skip to content

Commit c6cb661

Browse files
authored
feat(qemu): add backtrace_full for FullBacktraceCollector (#3468)
1 parent 7931daa commit c6cb661

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

crates/libafl_qemu/src/modules/calls.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,24 @@ impl FullBacktraceCollector {
618618
}
619619
}
620620
}
621+
622+
pub fn backtrace_full() -> Option<Vec<&'static Vec<GuestAddr>>> {
623+
// # Safety
624+
// This accesses the global [`CALLSTACKS`] variable.
625+
// However, the actual variable access is behind a `ThreadLocal` class.
626+
let callstacks_ptr = &raw mut CALLSTACKS;
627+
unsafe {
628+
if let Some(c) = (*callstacks_ptr).as_mut() {
629+
let mut res = Vec::new();
630+
for tls in &mut *c {
631+
res.push(&*tls.get());
632+
}
633+
Some(res)
634+
} else {
635+
None
636+
}
637+
}
638+
}
621639
}
622640

623641
impl CallTraceCollector for FullBacktraceCollector {

0 commit comments

Comments
 (0)