From 16491aef42d386a9e721b913b9b4d8361a127a5a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 27 Oct 2020 14:21:59 +0100 Subject: [PATCH 1/2] Use bash to make sure &> works --- miri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miri b/miri index 161276c52b..337b2a496d 100755 --- a/miri +++ b/miri @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e USAGE=$(cat <<"EOF" COMMANDS From 086e9c49a95ab30380954cc3bca632145786cee2 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 27 Oct 2020 14:22:29 +0100 Subject: [PATCH 2/2] pointer tag tracking: also show when tag is being created --- src/diagnostics.rs | 4 ++++ src/stacked_borrows.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 81cd049217..12ad93a528 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -1,5 +1,6 @@ use std::cell::RefCell; use std::fmt; +use std::num::NonZeroU64; use log::trace; @@ -41,6 +42,7 @@ impl MachineStopType for TerminationInfo {} /// Miri specific diagnostics pub enum NonHaltingDiagnostic { + CreatedPointerTag(NonZeroU64), PoppedPointerTag(Item), CreatedCallId(CallId), CreatedAlloc(AllocId), @@ -266,6 +268,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx for e in diagnostics.drain(..) { use NonHaltingDiagnostic::*; let msg = match e { + CreatedPointerTag(tag) => + format!("created tag {:?}", tag), PoppedPointerTag(item) => format!("popped tracked tag for item {:?}", item), CreatedCallId(id) => diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 817ed99d2b..257208056d 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -168,6 +168,9 @@ impl GlobalState { fn new_ptr(&mut self) -> PtrId { let id = self.next_ptr_id; + if Some(id) == self.tracked_pointer_tag { + register_diagnostic(NonHaltingDiagnostic::CreatedPointerTag(id)); + } self.next_ptr_id = NonZeroU64::new(id.get() + 1).unwrap(); id }