Skip to content

Commit

Permalink
don't dump instr bytes if diag is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcolombo committed Oct 17, 2024
1 parent da77d26 commit e498df8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/propolis/src/exits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,27 @@ impl From<&bhyve_api::vm_exit_vmx> for VmxDetail {
}
}

#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone)]
pub struct InstEmul {
pub inst_data: [u8; 15],
pub len: u8,
}

impl std::fmt::Debug for InstEmul {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
#[cfg(feature = "omicron-build")]
let inst_data = "<redacted>";

#[cfg(not(feature = "omicron-build"))]
let inst_data = &self.inst_data;

f.debug_struct("InstEmul")
.field("inst_data", &inst_data)
.field("len", &self.len)
.finish()
}
}

impl InstEmul {
pub fn bytes(&self) -> &[u8] {
&self.inst_data[..usize::min(self.inst_data.len(), self.len as usize)]
Expand Down

0 comments on commit e498df8

Please sign in to comment.