Handle missing allocations in Memory::dump.
This commit is contained in:
parent
1f6583fe06
commit
6be14eab15
@ -176,11 +176,18 @@ impl Memory {
|
||||
|
||||
while let Some(id) = allocs_to_print.pop_front() {
|
||||
allocs_seen.insert(id.0);
|
||||
let alloc = self.get(id).unwrap();
|
||||
let prefix = format!("Alloc {:<5} ", format!("{}:", id.0));
|
||||
print!("{}", prefix);
|
||||
let mut relocations = vec![];
|
||||
|
||||
let alloc = match self.alloc_map.get(&id.0) {
|
||||
Some(a) => a,
|
||||
None => {
|
||||
println!("(deallocated)");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
for i in 0..alloc.bytes.len() {
|
||||
if let Some(&target_id) = alloc.relocations.get(&i) {
|
||||
if !allocs_seen.contains(&target_id.0) {
|
||||
|
@ -51,3 +51,9 @@ fn match_ref_mut() -> i8 {
|
||||
}
|
||||
t.0
|
||||
}
|
||||
|
||||
#[miri_run]
|
||||
fn dangling_pointer() -> *const i32 {
|
||||
let b = Box::new(42);
|
||||
&*b as *const i32
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user