Skip to content

Commit 7a26621

Browse files
authored
Add support for mmaped memory in crashdumps and guest debugging (#943)
* [dbg] Add debug support for memory mapped regions in Hypervisors Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [crashdump] Fix mmaped memory not included in dump Signed-off-by: Doru Blânzeanu <dblnz@pm.me> --------- Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
1 parent ff7aecc commit 7a26621

File tree

9 files changed

+418
-121
lines changed

9 files changed

+418
-121
lines changed

src/hyperlight_host/src/hypervisor/crashdump.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ const CORE_DUMP_PAGE_SIZE: usize = 0x1000;
4343
/// Structure to hold the crash dump context
4444
/// This structure contains the information needed to create a core dump
4545
#[derive(Debug)]
46-
pub(crate) struct CrashDumpContext<'a> {
47-
regions: &'a [MemoryRegion],
46+
pub(crate) struct CrashDumpContext {
47+
regions: Vec<MemoryRegion>,
4848
regs: [u64; 27],
4949
xsave: Vec<u8>,
5050
entry: u64,
5151
binary: Option<String>,
5252
filename: Option<String>,
5353
}
5454

55-
impl<'a> CrashDumpContext<'a> {
55+
impl CrashDumpContext {
5656
pub(crate) fn new(
57-
regions: &'a [MemoryRegion],
57+
regions: Vec<MemoryRegion>,
5858
regs: [u64; 27],
5959
xsave: Vec<u8>,
6060
entry: u64,
@@ -208,7 +208,7 @@ struct GuestMemReader {
208208
impl GuestMemReader {
209209
fn new(ctx: &CrashDumpContext) -> Self {
210210
Self {
211-
regions: ctx.regions.to_vec(),
211+
regions: ctx.regions.clone(),
212212
}
213213
}
214214
}
@@ -440,7 +440,7 @@ mod test {
440440
fn test_crashdump_write_fails_when_no_regions() {
441441
// Create a dummy context
442442
let ctx = CrashDumpContext::new(
443-
&[],
443+
vec![],
444444
[0; 27],
445445
vec![],
446446
0,
@@ -471,7 +471,7 @@ mod test {
471471
}];
472472
// Create a dummy context
473473
let ctx = CrashDumpContext::new(
474-
&regions,
474+
regions,
475475
[0; 27],
476476
vec![],
477477
0x1000,

0 commit comments

Comments
 (0)