private static AssumeCmd DetermineConflictingAction(CallCounterexample CallCex, string RaceyState, string AccessHasOccurred, string AccessOffset) { AssumeCmd LastLogAssume = null; string LastOffsetValue = null; foreach (var b in CallCex.Trace) { bool finished = false; foreach (var c in b.Cmds.OfType <AssumeCmd>()) { string StateName = QKeyValue.FindStringAttribute(c.Attributes, "captureState"); if (StateName == null) { continue; } Model.CapturedState state = GetStateFromModel(StateName, CallCex.Model); if (state == null || state.TryGet(AccessHasOccurred) is Model.Uninterpreted) { // Either the state was not recorded, or the state has nothing to do with the reported error, so do not // analyse it further. continue; } Model.Boolean AHO_value = state.TryGet(AccessHasOccurred) as Model.Boolean; Model.BitVector AO_value = (RaceInstrumentationUtil.RaceCheckingMethod == RaceCheckingMethod.ORIGINAL ? state.TryGet(AccessOffset) : CallCex.Model.TryGetFunc(AccessOffset).GetConstant()) as Model.BitVector; if (!AHO_value.Value) { LastLogAssume = null; LastOffsetValue = null; } else if (LastLogAssume == null || !AO_value.Numeral.Equals(LastOffsetValue)) { LastLogAssume = c; LastOffsetValue = AO_value.Numeral; } if (StateName.Equals(RaceyState)) { finished = true; } break; } if (finished) { break; } } Debug.Assert(LastLogAssume != null); return(LastLogAssume); }
public BaseState(GenericModel m, Model.CapturedState st) { this.st = st; this.m = m; foreach (var v in st.AllVariables) { var e = st.TryGet(v); m.RegisterLocalValue(v, e); nodes.Add(new ElementNode(this, v, e)); niceName[e] = v; foreach (var r in e.References) { if (r.Args.Length == 1 && r.Args[0] == e) { if (!niceName.ContainsKey(e)) { niceName[e] = r.Func.Name + "(" + v + ")"; } } } } nodes.Add(new ContainerNode <Model.Func>("[Functions]", f => f.Arity == 0 ? null : Function(f), m.model.Functions)); nodes.Add(new ContainerNode <Model.Func>("[Constants]", f => f.Arity != 0 ? null : new AppNode(this, f.Apps.First()), m.model.Functions)); }
public BaseState(GenericModel m, Model.CapturedState st) { this.st = st; this.m = m; foreach (var v in st.AllVariables) { var e = st.TryGet(v); m.RegisterLocalValue(v, e); nodes.Add(new ElementNode(this, v, e)); niceName[e] = v; foreach (var r in e.References) { if (r.Args.Length == 1 && r.Args[0] == e) { if (!niceName.ContainsKey(e)) niceName[e] = r.Func.Name + "(" + v + ")"; } } } nodes.Add(new ContainerNode<Model.Func>("[Functions]", f => f.Arity == 0 ? null : Function(f), m.model.Functions)); nodes.Add(new ContainerNode<Model.Func>("[Constants]", f => f.Arity != 0 ? null : new AppNode(this, f.Apps.First()), m.model.Functions)); }