protected override BreakEventInfo OnInsertBreakEvent(BreakEvent be) { Breakpoint bp = be as Breakpoint; if (bp == null) { throw new NotSupportedException(); } BreakEventInfo breakEventInfo = new BreakEventInfo(); //bool dres = InternalStop (); try { string extraCmd = string.Empty; if (bp.HitCount > 0) { extraCmd += "-i " + bp.HitCount; breakpointsWithHitCount.Add(breakEventInfo); } if (!string.IsNullOrEmpty(bp.ConditionExpression)) { if (!bp.BreakIfConditionChanges) { extraCmd += " -c " + bp.ConditionExpression; } } ulong bh = 0; DebugEngineWrapper.BreakPoint engineBreakPoint = null; ulong off = 0; if (Engine.Symbols.GetOffsetByLine(bp.FileName, (uint)bp.Line, out off)) { engineBreakPoint = Engine.AddBreakPoint(BreakPointOptions.Enabled); engineBreakPoint.Offset = off; bh = engineBreakPoint.Offset; breakpoints[bh] = new BreakPointWrapper(breakEventInfo, engineBreakPoint); breakEventInfo.Handle = bh; breakEventInfo.SetStatus(BreakEventStatus.Bound, null); //if (!be.Enabled) //ToDo: tell debugger engine that breakpoint is disabled } else { breakEventInfo.SetStatus(BreakEventStatus.BindError, null); } return(breakEventInfo); } finally { //InternalResume (dres); } }
protected override void OnRemoveBreakEvent(BreakEventInfo binfo) { if (binfo == null) { return; } breakpointsWithHitCount.Remove(binfo); DebugEngineWrapper.BreakPoint breakpoint = breakpoints[(ulong)binfo.Handle].Breakpoint; if (IsDebugging /*&& bpw.IsExisting*/) { Engine.RemoveBreakPoint(breakpoint); } breakpointsWithHitCount.Remove(binfo); breakpoints.Remove((ulong)binfo.Handle); }
public BreakPointWrapper(BreakEventInfo eventInfo, DebugEngineWrapper.BreakPoint breakpoint) { EventInfo = eventInfo; Breakpoint = breakpoint; }