Add option to create qemu debug logs

This commit is contained in:
David Venhoff 2025-08-06 15:29:01 +02:00
parent 96f0e4512b
commit 27d379486b
2 changed files with 18 additions and 0 deletions

View File

@ -247,6 +247,9 @@ pub struct RuntimeConfig {
/* aux_buffer size */ /* aux_buffer size */
aux_buffer_size: usize, aux_buffer_size: usize,
/* The path to which nyx logs will be written to from QEMU-Nyx (requires debug mode in QEMU-Nyx) */
nyx_debug_log_path: Option<String>
} }
impl RuntimeConfig{ impl RuntimeConfig{
@ -258,6 +261,7 @@ impl RuntimeConfig{
debug_mode: false, debug_mode: false,
worker_id: 0, worker_id: 0,
aux_buffer_size: DEFAULT_AUX_BUFFER_SIZE, aux_buffer_size: DEFAULT_AUX_BUFFER_SIZE,
nyx_debug_log_path: None
} }
} }
@ -321,6 +325,14 @@ impl RuntimeConfig{
pub fn aux_buffer_size(&self) -> usize { pub fn aux_buffer_size(&self) -> usize {
self.aux_buffer_size self.aux_buffer_size
} }
pub fn set_nyx_debug_log_path(&mut self, path: String) {
self.nyx_debug_log_path = Some(path);
}
pub fn nyx_debug_log_path(&self) -> Option<&str> {
self.nyx_debug_log_path.as_deref()
}
} }

View File

@ -122,6 +122,12 @@ impl QemuParams {
cmd.push("-cpu".to_string()); cmd.push("-cpu".to_string());
cmd.push("kAFL64-Hypervisor-v1".to_string()); cmd.push("kAFL64-Hypervisor-v1".to_string());
if let Some(nyx_debug_log_path) = fuzzer_config.runtime.nyx_debug_log_path() {
cmd.push("-D".to_string());
cmd.push(nyx_debug_log_path.to_string());
cmd.push("-d".to_string());
cmd.push("nyx".to_string());
}
if fuzzer_config.runtime.reuse_root_snapshot_path().is_some() { if fuzzer_config.runtime.reuse_root_snapshot_path().is_some() {
cmd.push("-fast_vm_reload".to_string()); cmd.push("-fast_vm_reload".to_string());