Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pointer tag tracking: also show when tag is being created #1601

Merged
merged 2 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion miri
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
USAGE=$(cat <<"EOF"
COMMANDS
Expand Down
4 changes: 4 additions & 0 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cell::RefCell;
use std::fmt;
use std::num::NonZeroU64;

use log::trace;

Expand Down Expand Up @@ -41,6 +42,7 @@ impl MachineStopType for TerminationInfo {}

/// Miri specific diagnostics
pub enum NonHaltingDiagnostic {
CreatedPointerTag(NonZeroU64),
PoppedPointerTag(Item),
CreatedCallId(CallId),
CreatedAlloc(AllocId),
Expand Down Expand Up @@ -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) =>
Expand Down
3 changes: 3 additions & 0 deletions src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down