Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/hyperlight_host/src/hypervisor/crashdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ pub(crate) fn generate_crashdump(
if let Ok(nbytes) = checked_core_dump(ctx, create_dump_file) {
if nbytes > 0 {
println!("Core dump created successfully: {}", file_path);
log::error!("Core dump file: {}", file_path);
tracing::error!("Core dump file: {}", file_path);
}
} else {
log::error!("Failed to create core dump file");
tracing::error!("Failed to create core dump file");
}

Ok(())
Expand Down Expand Up @@ -331,7 +331,7 @@ fn core_dump_file_path(dump_dir: Option<String>) -> String {
if std::path::Path::new(&dump_dir).exists() {
std::path::PathBuf::from(dump_dir)
} else {
log::warn!(
tracing::warn!(
"Directory \"{}\" does not exist, falling back to temp directory",
dump_dir
);
Expand Down Expand Up @@ -366,7 +366,7 @@ fn checked_core_dump(
// If the HV returned a context it means we can create a core dump
// This is the case when the sandbox has been configured at runtime to allow core dumps
if let Some(ctx) = ctx {
log::info!("Creating core dump file...");
tracing::info!("Creating core dump file...");

// Set up data sources for the core dump
let guest_view = GuestView::new(&ctx);
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/hypervisor/gdb/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub(crate) fn vcpu_stop_reason(
}

// Log an error and provide internal debugging info
log::error!(
tracing::error!(
r"The vCPU exited because of an unknown reason:
rip: {:?}
dr6: {:?}
Expand Down
22 changes: 11 additions & 11 deletions src/hyperlight_host/src/hypervisor/gdb/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl run_blocking::BlockingEventLoop for GdbBlockingEventLoop {
loop {
match target.try_recv() {
Ok(DebugResponse::VcpuStopped(stop_reason)) => {
log::debug!("VcpuStopped with reason {:?}", stop_reason);
tracing::debug!("VcpuStopped with reason {:?}", stop_reason);

// Resume execution if unknown reason for stop
let stop_response = match stop_reason {
Expand All @@ -73,7 +73,7 @@ impl run_blocking::BlockingEventLoop for GdbBlockingEventLoop {
signal: Signal(signals::SIGSEGV as u8),
},
VcpuStopReason::Unknown => {
log::warn!("Unknown stop reason received");
tracing::warn!("Unknown stop reason received");

// Marking as a SwBreak so the gdb inspect where/why it stopped
BaseStopReason::SwBreak(())
Expand All @@ -83,7 +83,7 @@ impl run_blocking::BlockingEventLoop for GdbBlockingEventLoop {
return Ok(run_blocking::Event::TargetStopped(stop_response));
}
Ok(msg) => {
log::error!("Unexpected message received {:?}", msg);
tracing::error!("Unexpected message received {:?}", msg);
}
Err(crossbeam_channel::TryRecvError::Empty) => (),
Err(crossbeam_channel::TryRecvError::Disconnected) => {
Expand Down Expand Up @@ -112,13 +112,13 @@ impl run_blocking::BlockingEventLoop for GdbBlockingEventLoop {
fn on_interrupt(
target: &mut Self::Target,
) -> Result<Option<Self::StopReason>, <Self::Target as gdbstub::target::Target>::Error> {
log::info!("Received interrupt from GDB client - sending signal to target thread");
tracing::info!("Received interrupt from GDB client - sending signal to target thread");

// Send a signal to the target thread to interrupt it
let res = target.interrupt_vcpu();

if !res {
log::error!("Failed to send signal to target thread");
tracing::error!("Failed to send signal to target thread");
return Err(GdbTargetError::SendSignalError);
}

Expand All @@ -133,21 +133,21 @@ pub(crate) fn event_loop_thread(
match debugger.run_blocking::<GdbBlockingEventLoop>(target) {
Ok(disconnect_reason) => match disconnect_reason {
DisconnectReason::Disconnect => {
log::info!("Gdb client disconnected");
tracing::info!("Gdb client disconnected");
if let Err(e) = target.disable_debug() {
log::error!("Cannot disable debugging: {:?}", e);
tracing::error!("Cannot disable debugging: {:?}", e);
}
}
DisconnectReason::TargetExited(_) => {
log::info!("Guest finalized execution and disconnected");
tracing::info!("Guest finalized execution and disconnected");
}
DisconnectReason::TargetTerminated(sig) => {
log::info!("Gdb target terminated with signal {}", sig)
tracing::info!("Gdb target terminated with signal {}", sig)
}
DisconnectReason::Kill => log::info!("Gdb sent a kill command"),
DisconnectReason::Kill => tracing::info!("Gdb sent a kill command"),
},
Err(e) => {
log::error!("fatal error encountered: {e:?}");
tracing::error!("fatal error encountered: {e:?}");
}
}
}
24 changes: 12 additions & 12 deletions src/hyperlight_host/src/hypervisor/gdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl DebugMemoryAccess {
let mem_offset = (gpa as usize)
.checked_sub(SandboxMemoryLayout::BASE_ADDRESS)
.ok_or_else(|| {
log::warn!(
tracing::warn!(
"gpa={:#X} causes subtract with underflow: \"gpa - BASE_ADDRESS={:#X}-{:#X}\"",
gpa,
gpa,
Expand All @@ -138,11 +138,11 @@ impl DebugMemoryAccess {
let mut region_found = false;
for reg in self.guest_mmap_regions.iter() {
if reg.guest_region.contains(&mem_offset) {
log::debug!("Found mapped region containing {:X}: {:#?}", gpa, reg);
tracing::debug!("Found mapped region containing {:X}: {:#?}", gpa, reg);

// Region found - calculate the offset within the region
let region_offset = mem_offset.checked_sub(reg.guest_region.start).ok_or_else(|| {
log::warn!(
tracing::warn!(
"Cannot calculate offset in memory region: mem_offset={:#X}, base={:#X}",
mem_offset,
reg.guest_region.start,
Expand Down Expand Up @@ -177,7 +177,7 @@ impl DebugMemoryAccess {
} else {
(&mut mgr.shared_mem, mem_offset, "snapshot")
};
log::debug!(
tracing::debug!(
"No mapped region found containing {:X}. Trying {} memory at offset {:X} ...",
gpa,
name,
Expand Down Expand Up @@ -208,7 +208,7 @@ impl DebugMemoryAccess {
let mem_offset = (gpa as usize)
.checked_sub(SandboxMemoryLayout::BASE_ADDRESS)
.ok_or_else(|| {
log::warn!(
tracing::warn!(
"gpa={:#X} causes subtract with underflow: \"gpa - BASE_ADDRESS={:#X}-{:#X}\"",
gpa,
gpa,
Expand All @@ -221,11 +221,11 @@ impl DebugMemoryAccess {
let mut region_found = false;
for reg in self.guest_mmap_regions.iter() {
if reg.guest_region.contains(&mem_offset) {
log::debug!("Found mapped region containing {:X}: {:#?}", gpa, reg);
tracing::debug!("Found mapped region containing {:X}: {:#?}", gpa, reg);

// Region found - calculate the offset within the region
let region_offset = mem_offset.checked_sub(reg.guest_region.start).ok_or_else(|| {
log::warn!(
tracing::warn!(
"Cannot calculate offset in memory region: mem_offset={:#X}, base={:#X}",
mem_offset,
reg.guest_region.start,
Expand Down Expand Up @@ -260,7 +260,7 @@ impl DebugMemoryAccess {
} else {
(&mut mgr.shared_mem, mem_offset, "snapshot")
};
log::debug!(
tracing::debug!(
"No mapped region found containing {:X}. Trying {} memory at offset {:X} ...",
gpa,
name,
Expand Down Expand Up @@ -415,14 +415,14 @@ pub(crate) fn create_gdb_thread(
let (gdb_conn, hyp_conn) = DebugCommChannel::unbounded();
let socket = format!("localhost:{}", port);

log::info!("Listening on {:?}", socket);
tracing::info!("Listening on {:?}", socket);
let listener = TcpListener::bind(socket)?;

log::info!("Starting GDB thread");
tracing::info!("Starting GDB thread");
let _handle = thread::Builder::new()
.name("GDB handler".to_string())
.spawn(move || -> Result<(), GdbTargetError> {
log::info!("Waiting for GDB connection ... ");
tracing::info!("Waiting for GDB connection ... ");
let (conn, _) = listener.accept()?;

let conn: Box<dyn ConnectionExt<Error = io::Error>> = Box::new(conn);
Expand All @@ -433,7 +433,7 @@ pub(crate) fn create_gdb_thread(
// Waits for vCPU to stop at entrypoint breakpoint
let msg = target.recv()?;
if let DebugResponse::InterruptHandle(handle) = msg {
log::info!("Received interrupt handle: {:?}", handle);
tracing::info!("Received interrupt handle: {:?}", handle);
target.set_interrupt_handle(handle);
} else {
return Err(GdbTargetError::UnexpectedMessage);
Expand Down
Loading
Loading