mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: save elf header for coredump
The vmcore file of guest is an elf format, so the first step of coredump is to save the elf header. Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
This commit is contained in:
@@ -19,6 +19,8 @@ use crate::config::{
|
||||
#[cfg(feature = "guest_debug")]
|
||||
use crate::coredump::DumpState;
|
||||
#[cfg(feature = "guest_debug")]
|
||||
use crate::coredump::{Elf64Writable, NoteDescType};
|
||||
#[cfg(feature = "guest_debug")]
|
||||
use crate::coredump::{GuestDebuggable, GuestDebuggableError};
|
||||
use crate::cpu;
|
||||
use crate::device_manager::{Console, DeviceManager, DeviceManagerError, PtyPair};
|
||||
@@ -3020,6 +3022,9 @@ impl Debuggable for Vm {
|
||||
#[cfg(feature = "guest_debug")]
|
||||
pub const UINT16_MAX: u32 = 65535;
|
||||
|
||||
#[cfg(feature = "guest_debug")]
|
||||
impl Elf64Writable for Vm {}
|
||||
|
||||
#[cfg(feature = "guest_debug")]
|
||||
impl GuestDebuggable for Vm {
|
||||
fn coredump(&mut self, destination_url: &str) -> std::result::Result<(), GuestDebuggableError> {
|
||||
@@ -3043,6 +3048,10 @@ impl GuestDebuggable for Vm {
|
||||
|
||||
let coredump_state = self.get_dump_state(destination_url)?;
|
||||
|
||||
self.write_header(&coredump_state)?;
|
||||
self.write_note(&coredump_state)?;
|
||||
self.write_loads(&coredump_state)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user