From e37d0e312596c06659b881c240a5afdd58395665 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 21 Apr 2020 21:28:22 -0500 Subject: [PATCH] Print hex dump of alloc on reading undef bytes --- src/diagnostics.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 5189982b136..77aaacea024 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -114,6 +114,9 @@ pub fn report_error<'tcx, 'mir>( }; e.print_backtrace(); + if let UndefinedBehavior(UndefinedBehaviorInfo::InvalidUndefBytes(Some(ptr))) = e.kind { + ecx.memory.dump_alloc(ptr.alloc_id); + } let msg = e.to_string(); report_msg(ecx, &format!("{}: {}", title, msg), msg, helps, true) }