Dump all modules, even if not enqueued

This commit is contained in:
Andrzej Janik 2021-04-12 00:42:35 +02:00
parent 96f95d59ce
commit fedf88180a

View file

@ -184,6 +184,17 @@ unsafe fn record_module_image(module: CUmodule, image: &str) {
},
);
}
if let Err(e) = try_dump_module_image(image) {
os_log!("Errors when saving module: {:?}, {}", module, e);
}
}
unsafe fn try_dump_module_image(image: &str) -> Result<(), Box<dyn Error>> {
let mut dump_path = get_dump_dir()?;
dump_path.push(format!("module_{:04}.ptx", MODULES.as_ref().unwrap().len()));
let mut file = File::create(dump_path)?;
file.write_all(image.as_bytes())?;
Ok(())
}
unsafe fn to_str<T>(image: *const T) -> Option<&'static str> {