]> git.lizzy.rs Git - rust.git/commitdiff
Print hex dump of alloc on reading undef bytes
authorDavid Cook <divergentdave@gmail.com>
Wed, 22 Apr 2020 02:28:22 +0000 (21:28 -0500)
committerDavid Cook <divergentdave@gmail.com>
Wed, 22 Apr 2020 02:28:22 +0000 (21:28 -0500)
src/diagnostics.rs

index 5189982b1361a14f01235ce129ed62cfa84d45d5..77aaacea02400cc5b25602df1ad4ad7360ac8f9b 100644 (file)
@@ -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)
 }